RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups 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 #include <time.h>
26 
30 enum tr_rtvals {
33 
35  TR_ERROR = -1,
36 
39 
41  TR_INTR = -3,
42 
44  TR_CLOSED = -4
45 };
46 
47 struct tr_socket;
48 
53 typedef void (*tr_close_fp)(void *socket);
54 
59 typedef int (*tr_open_fp)(void *socket);
60 
65 typedef void (*tr_free_fp)(struct tr_socket *tr_sock);
66 
71 typedef int (*tr_recv_fp)(const void *socket, void *pdu, const size_t len, const time_t timeout);
72 
77 typedef int (*tr_send_fp)(const void *socket, const void *pdu, const size_t len, const time_t timeout);
78 
83 typedef const char *(*tr_ident_fp)(void *socket);
84 
95 struct tr_socket {
96  void *socket;
97  tr_open_fp open_fp;
98  tr_close_fp close_fp;
99  tr_free_fp free_fp;
100  tr_send_fp send_fp;
101  tr_recv_fp recv_fp;
102  tr_ident_fp ident_fp;
103 };
104 
105 
106 #endif
107 /* @} */
Definition: transport.h:35
A transport socket datastructure.
Definition: transport.h:95
Definition: transport.h:41
void(* tr_close_fp)(void *socket)
A function pointer to a technology specific close function.
Definition: transport.h:53
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:77
Definition: transport.h:38
int(* tr_open_fp)(void *socket)
A function pointer to a technology specific open function.
Definition: transport.h:59
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:65
Operation was successful.
Definition: transport.h:32
tr_rtvals
The return values for tr_ functions.
Definition: transport.h:30
const char *(* tr_ident_fp)(void *socket)
A function pointer to a technology specific info function.
Definition: transport.h:83
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:71
Definition: transport.h:44