RTI Connext DDS Micro  Version 2.4.8
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
netio_udp.h
1 /*
2  * FILE: netio_udp.h - UDP API
3  *
4  * Copyright 2008-2015 Real-Time Innovations, Inc.
5  *
6  * No duplications, whole or partial, manual or electronic, may be made
7  * without express written permission. Any such copies, or
8  * revisions thereof, must display this notice unaltered.
9  * This code contains trade secrets of Real-Time Innovations, Inc.
10  *
11  * Modification History
12  * --------------------
13  * 19may2015,as MICRO-1193 Refactoring of Sequence API levels
14  * 13mar2013,eh Fix MICRO-352 (max message/send/receive sizes)
15  * 25apr2012,tk Written
16  *
17  */
18 /*ci
19  * \file
20  * \defgroup NETIO_UDPInterfaceClass UDP Interface
21  * \ingroup NETIOModule
22  * \brief NETIO UDP Interface
23  *
24  * \details
25  *
26  * The UDP interface is implemented as a NETIO interface and NETIO interface
27  * factory.
28  */
29 /*ci \addtogroup NETIO_UDPInterfaceClass
30  * @{
31  */
32 #ifndef netio_udp_h
33 #define netio_udp_h
34 
35 #ifndef RTI_EXPORT_REDA_SEQUENCE
36 #define RTI_EXPORT_REDA_SEQUENCE
37 #endif
38 
39 #ifndef osapi_config_h
40 #include "osapi/osapi_config.h"
41 #endif
42 #ifndef osapi_thread_h
43 #include "osapi/osapi_thread.h"
44 #endif
45 #ifndef rt_rt_h
46 #include "rt/rt_rt.h"
47 #endif
48 #ifndef reda_string_h
49 #include "reda/reda_string.h"
50 #endif
51 #ifndef reda_sequence_h
52 #include "reda/reda_sequence.h"
53 #endif
54 #ifndef netio_dll_h
55 #include "netio/netio_dll.h"
56 #endif
57 #ifndef netio_config_h
58 #include "netio/netio_config.h"
59 #endif
60 #ifndef netio_address_h
61 #include "netio/netio_address.h"
62 #endif
63 #ifndef netio_route_h
64 #include "netio/netio_route.h"
65 #endif
66 
67 #ifdef __cplusplus
68 extern "C"
69 {
70 #endif
71 
72 #ifndef RTI_CERT
73 struct UDP_NatEntry
74 {
75  struct NETIO_Address local_address;
76  struct NETIO_Address public_address;
77 };
78 
79 #define UDP_NatEntry_INITIALIZER \
80 {\
81  NETIO_Address_INITIALIZER,\
82  NETIO_Address_INITIALIZER,\
83 }
84 
85 #define T struct UDP_NatEntry
86 #define TSeq UDP_NatEntrySeq
87 #include <reda/reda_sequence_decl.h>
88 
89 #define UDP_NatEntrySeq_INITIALIZER \
90  REDA_DEFINE_SEQUENCE_INITIALIZER(struct UDP_NatEntry)
91 
92 #endif /* !RTI_CERT */
93 
94 /*ci
95  * \def UDP_INTERFACE_MAX_IFNAME
96  * \brief Maximum length of a UDP network interface
97  */
98 #define UDP_INTERFACE_MAX_IFNAME 64
99 
100 /*ci
101  * \def UDP_INTERFACE_INTERFACE_UP_FLAG
102  * \brief Generic flag to indicate if a network stack is up
103  */
104 #define UDP_INTERFACE_INTERFACE_UP_FLAG 0x1
105 
106 /*ci
107  * \def UDP_INTERFACE_INTERFACE_MULTICAST_FLAG
108  * \brief Generic flag to indicate if a network stack supports multicast
109  */
110 #define UDP_INTERFACE_INTERFACE_MULTICAST_FLAG 0x2
111 
112 /*ci
113  * \brief The maximum number of bits in a UDP netmask
114  */
115 #define UDP_INTERFACE_MAX_NETMASK_BITS (32)
116 
117 /*ci
118  * \brief Generic structure to describe a network interface
119  */
120 struct DDSCPPDllExport UDP_InterfaceTableEntry
121 {
122  /*ci
123  * \brief Flags to indicate if the interface is up etc.
124  */
125  RTI_UINT32 flags;
126 
127  /*ci
128  * \brief The address of the interface as configured by the OS
129  */
130  RTI_UINT32 address;
131 
132  /*ci
133  * \brief The netmask of the interface as configured by the OS
134  */
135  RTI_UINT32 netmask;
136 
137  /*ci
138  * \brief The name of the interface as configured by the OS
139  */
140  char ifname[UDP_INTERFACE_MAX_IFNAME];
141 };
142 
143 /*ci
144  * \def UDP_InterfaceTableEntry_INITIALIZER
145  * \brief Constant to initialize \ref UDP_InterfaceTableEntry
146  */
147 #define UDP_InterfaceTableEntry_INITIALIZER \
148 {\
149  0,\
150  0,\
151  0,\
152  {0}\
153 }
154 
155 #define T struct UDP_InterfaceTableEntry
156 #define TSeq UDP_InterfaceTableEntrySeq
157 #include <reda/reda_sequence_decl.h>
158 
159 #define UDP_InterfaceTableEntrySeq_INITIALIZER \
160  REDA_DEFINE_SEQUENCE_INITIALIZER(struct UDP_InterfaceTableEntry)
161 
162 /*e \dref_UDP_InterfaceTable_add_entry
163  */
164 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
165 UDP_InterfaceTable_add_entry(struct UDP_InterfaceTableEntrySeq *seq,
166  RTI_UINT32 address,
167  RTI_UINT32 netmask,
168  const char *ifname,
169  RTI_UINT32 flags);
170 
171 #ifdef __cplusplus
172 } /* extern "C" */
173 #endif
174 
175 #ifdef __cplusplus
176 extern "C"
177 {
178 #endif
179 
181 NETIODllExport RTI_BOOL
182 UDP_InterfaceFactoryProperty_initialize(
183  struct UDP_InterfaceFactoryProperty* self);
184 
185 #ifndef RTI_CERT
186 NETIODllExport RTI_BOOL
187 UDP_InterfaceFactoryProperty_finalize(
188  struct UDP_InterfaceFactoryProperty *p);
189 #endif /* !RTI_CERT */
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 /*ce \dref_UDP_InterfaceFactoryProperty
196  * \brief Properties the UDP interface can be registered with.
197  */
198 struct DDSCPPDllExport UDP_InterfaceFactoryProperty
199 {
200  /*ci
201  * \brief Inherited property struct
202  */
203  struct NETIO_InterfaceFactoryProperty _parent;
204 
205  /*ce \dref_UDP_InterfaceFactoryProperty_allow_interface
206  * \brief Sequence of allowed interface names
207  */
208  struct REDA_StringSeq allow_interface;
209 
210  /*ce \dref_UDP_InterfaceFactoryProperty_deny_interface
211  * \brief Sequence of denied interface names. This list is checked
212  * after the allow_interface list.
213  */
214  struct REDA_StringSeq deny_interface;
215 
216  /*ce \dref_UDP_InterfaceFactoryProperty_max_send_buffer_size
217  * \brief The size of the send socket buffer
218  */
220 
221  /*ce \dref_UDP_InterfaceFactoryProperty_max_receive_buffer_size
222  * \brief The size of the receive socket buffer
223  */
225 
226  /*ce \dref_UDP_InterfaceFactoryProperty_max_message_size
227  * \brief The maximum size of the message which can be received
228  */
229  RTI_INT32 max_message_size;
230 
231  /*ce \dref_UDP_InterfaceFactoryProperty_multicast_ttl
232  * \brief The maximum TTL
233  */
234  RTI_INT32 multicast_ttl;
235 
236 #ifndef RTI_CERT
237  /*ce \dref_UDP_InterfaceFactoryProperty_nat
238  */
239  struct UDP_NatEntrySeq nat;
240 #endif /* !RTI_CERT */
241 
242  /*ce \dref_UDP_InterfaceFactoryProperty_if_table
243  * \brief The interface table if interfaces are added manually
244  */
245  struct UDP_InterfaceTableEntrySeq if_table;
246 
247  /*ce \dref_UDP_InterfaceFactoryProperty_multicast_interface
248  * \brief The network interface to use to send to multicast
249  */
250  REDA_String_T multicast_interface;
251 
252  /*ce \dref_UDP_InterfaceFactoryProperty_is_default_interface
253  * \brief If this should be considered the default UDP interfaces if
254  * no other UDP interface is found to handle a route
255  */
257 
258  /*ce \dref_UDP_InterfaceFactoryProperty_disable_auto_interface_config
259  * \brief Disable reading of available network interfaces using system
260  * information and instead rely on the manually configured
261  * interface table
262  */
264 
265  /*ce \dref_UDP_InterfaceFactoryProperty_recv_thread
266  * \brief Thread properties for each receive thread created by this
267  * NETIO interface.
268  */
269  struct OSAPI_ThreadProperty recv_thread;
270 
271 #ifdef RTI_CPP
272  public:
274  {
275  UDP_InterfaceFactoryProperty_initialize(this);
276  }
277 #endif
278 };
279 
280 #ifdef __cplusplus
281 extern "C"
282 {
283 #endif
284 
285 /*ci
286  * \def UDP_InterfaceFactoryProperty_INITIALIZER
287  * \brief Constant to initialize UDP_InterfaceFactoryProperty
288  */
289 #if (OSAPI_PLATFORM == OSAPI_PLATFORM_VXWORKS) && \
290  (!VXWORKS_VERSION_6_3_OR_BETTER)
291 
292 #define UDP_InterfaceFactoryProperty_INITIALIZER \
293 {\
294  NETIO_InterfaceFactoryProperty_INITIALIZER,\
295  REDA_StringSeq_INITIALIZER,\
296  REDA_StringSeq_INITIALIZER,\
297  (8*1024),\
298  (8*1024),\
299  (8*1024),\
300  1,\
301  UDP_NatEntrySeq_INITIALIZER,\
302  UDP_InterfaceTableEntrySeq_INITIALIZER,\
303  NULL,\
304  RTI_TRUE,\
305  RTI_FALSE, \
306  OSAPI_THREAD_PROPERTY_DEFAULT \
307 }
308 #else /* !VxWorks <6.3 */
309 
310 #ifndef RTI_CERT
311 #define UDP_InterfaceFactoryProperty_INITIALIZER \
312 {\
313  NETIO_InterfaceFactoryProperty_INITIALIZER,\
314  REDA_StringSeq_INITIALIZER,\
315  REDA_StringSeq_INITIALIZER,\
316  (256*1024),\
317  (256*1024),\
318  (8*1024),\
319  1,\
320  UDP_NatEntrySeq_INITIALIZER,\
321  UDP_InterfaceTableEntrySeq_INITIALIZER,\
322  NULL,\
323  RTI_TRUE,\
324  RTI_FALSE, \
325  OSAPI_THREAD_PROPERTY_DEFAULT \
326 }
327 #else
328 #define UDP_InterfaceFactoryProperty_INITIALIZER \
329 {\
330  NETIO_InterfaceFactoryProperty_INITIALIZER,\
331  REDA_StringSeq_INITIALIZER,\
332  REDA_StringSeq_INITIALIZER,\
333  (8*1024),\
334  (8*1024),\
335  (8*1024),\
336  1,\
337  UDP_InterfaceTableEntrySeq_INITIALIZER,\
338  NULL,\
339  RTI_TRUE,\
340  RTI_FALSE, \
341  OSAPI_THREAD_PROPERTY_DEFAULT \
342 }
343 #endif /* !RTI_CERT */
344 #endif
345 
346 #define UDP_INTERFACE_INTERFACE_ID RT_MKINTERFACEID(\
347  RT_COMPONENT_CLASS_NETIO,RT_COMPONENT_INSTANCE_UDP)
348 
349 extern NETIODllVariable struct UDP_InterfaceFactoryProperty UDP_INTERFACE_FACTORY_PROPERTY_DEFAULT;
350 
351 /*ce \dref_UDP_InterfaceFactory_get_interface
352  */
353 MUST_CHECK_RETURN NETIODllExport struct RT_ComponentFactoryI*
355 
356 #ifdef __cplusplus
357 } /* extern "C" */
358 #endif
359 
360 #undef RTI_EXPORT_REDA_SEQUENCE
361 
362 #endif /* netio_udp_h */
363 
364 /*ci @} */
365 

RTI Connext DDS Micro Version 2.4.8 Copyright © Tue Apr 12 2016 Real-Time Innovations, Inc