RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
transport.h
1 /*
2  * This file is part of RTRlib.
3  *
4  * This file is subject to the terms and conditions of the MIT license.
5  * See the file LICENSE in the top level directory for more details.
6  *
7  * Website: http://rtrlib.realmv6.org/
8  */
9 
23 #ifndef RTR_TRANSPORT_H
24 #define RTR_TRANSPORT_H
25 
26 #include <time.h>
27 
31 #define RTRLIB_TRANSPORT_CONNECT_TIMEOUT_DEFAULT 30
32 
36 enum tr_rtvals {
39 
41  TR_ERROR = -1,
42 
45 
47  TR_INTR = -3,
48 
50  TR_CLOSED = -4
51 };
52 
53 struct tr_socket;
54 
59 typedef void (*tr_close_fp)(void *socket);
60 
65 typedef int (*tr_open_fp)(void *socket);
66 
72 typedef void (*tr_free_fp)(struct tr_socket *tr_sock);
73 
78 typedef int (*tr_recv_fp)(const void *socket, void *pdu, const size_t len, const time_t timeout);
79 
84 typedef int (*tr_send_fp)(const void *socket, const void *pdu, const size_t len, const time_t timeout);
85 
90 typedef const char *(*tr_ident_fp)(void *socket);
91 
102 struct tr_socket {
103  void *socket;
104  tr_open_fp open_fp;
105  tr_close_fp close_fp;
106  tr_free_fp free_fp;
107  tr_send_fp send_fp;
108  tr_recv_fp recv_fp;
109  tr_ident_fp ident_fp;
110 };
111 
112 #endif
113 
Definition: transport.h:41
A transport socket datastructure.
Definition: transport.h:102
Definition: transport.h:47
void(* tr_close_fp)(void *socket)
A function pointer to a technology specific close function.
Definition: transport.h:59
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
Definition: transport.h:44
int(* tr_open_fp)(void *socket)
A function pointer to a technology specific open function.
Definition: transport.h:65
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
Operation was successful.
Definition: transport.h:38
tr_rtvals
The return values for tr_ functions.
Definition: transport.h:36
const char *(* tr_ident_fp)(void *socket)
A function pointer to a technology specific info function.
Definition: transport.h:90
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
Definition: transport.h:50