Loading...
Searching...
No Matches
transport.h
/*
* This file is part of RTRlib.
*
* This file is subject to the terms and conditions of the MIT license.
* See the file LICENSE in the top level directory for more details.
*
* Website: http://rtrlib.realmv6.org/
*/
#ifndef RTR_TRANSPORT_H
#define RTR_TRANSPORT_H
#include <time.h>
#define RTRLIB_TRANSPORT_CONNECT_TIMEOUT_DEFAULT 30
enum tr_rtvals {
TR_SUCCESS = 0,
TR_ERROR = -1,
TR_WOULDBLOCK = -2,
TR_INTR = -3,
TR_CLOSED = -4
};
struct tr_socket;
typedef void (*tr_close_fp)(void *socket);
typedef int (*tr_open_fp)(void *socket);
typedef void (*tr_free_fp)(struct tr_socket *tr_sock);
typedef int (*tr_recv_fp)(const void *socket, void *pdu, const size_t len, const time_t timeout);
typedef int (*tr_send_fp)(const void *socket, const void *pdu, const size_t len, const time_t timeout);
typedef const char *(*tr_ident_fp)(void *socket);
struct tr_socket {
void *socket;
tr_open_fp open_fp;
tr_close_fp close_fp;
tr_free_fp free_fp;
tr_send_fp send_fp;
tr_recv_fp recv_fp;
tr_ident_fp ident_fp;
};
#endif
tr_ident_fp
const char *(* tr_ident_fp)(void *socket)
A function pointer to a technology specific info function.
Definition transport.h:90
tr_recv_fp
int(* tr_recv_fp)(const void *socket, void *pdu, const size_t len, const time_t timeout)
A function pointer to a technology specific recv function.
Definition transport.h:78
tr_free_fp
void(* tr_free_fp)(struct tr_socket *tr_sock)
A function pointer to a technology specific free function. All memory associated with the tr_socket w...
Definition transport.h:72
tr_rtvals
tr_rtvals
The return values for tr_ functions.
Definition transport.h:36
tr_open_fp
int(* tr_open_fp)(void *socket)
A function pointer to a technology specific open function.
Definition transport.h:65
tr_close_fp
void(* tr_close_fp)(void *socket)
A function pointer to a technology specific close function.
Definition transport.h:59
tr_send_fp
int(* tr_send_fp)(const void *socket, const void *pdu, const size_t len, const time_t timeout)
A function pointer to a technology specific send function.
Definition transport.h:84
TR_ERROR
@ TR_ERROR
Definition transport.h:41
TR_INTR
@ TR_INTR
Definition transport.h:47
TR_CLOSED
@ TR_CLOSED
Definition transport.h:50
TR_WOULDBLOCK
@ TR_WOULDBLOCK
Definition transport.h:44
TR_SUCCESS
@ TR_SUCCESS
Operation was successful.
Definition transport.h:38
tr_socket
A transport socket datastructure.
Definition transport.h:102