RTI Connext DDS Micro  Version 2.4.7
 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 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  */
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  }
278  private:\
280  const struct UDP_InterfaceFactoryProperty& from )
281  {
282  UDP_InterfaceFactoryProperty_initialize(this);
283  UNUSED_ARG(from);
284  }
285  struct UDP_InterfaceFactoryProperty& operator=(
286  const struct UDP_InterfaceFactoryProperty& from )
287  {
288  UNUSED_ARG(from);
289  return *this;
290  }
291  bool operator==(
292  const struct UDP_InterfaceFactoryProperty& other)
293  {
294  UNUSED_ARG(other);
295  return false;
296  }
297  bool operator!=(
298  const struct UDP_InterfaceFactoryProperty& other)
299  {
300  UNUSED_ARG(other);
301  return false;
302  }
303 #endif
304 };
305 
306 #ifdef __cplusplus
307 extern "C"
308 {
309 #endif
310 
311 /*ci
312  * \def UDP_InterfaceFactoryProperty_INITIALIZER
313  * \brief Constant to initialize UDP_InterfaceFactoryProperty
314  */
315 #if (OSAPI_PLATFORM == OSAPI_PLATFORM_VXWORKS) && \
316  (!VXWORKS_VERSION_6_3_OR_BETTER)
317 
318 #define UDP_InterfaceFactoryProperty_INITIALIZER \
319 {\
320  NETIO_InterfaceFactoryProperty_INITIALIZER,\
321  REDA_StringSeq_INITIALIZER,\
322  REDA_StringSeq_INITIALIZER,\
323  (8*1024),\
324  (8*1024),\
325  (8*1024),\
326  1,\
327  UDP_NatEntrySeq_INITIALIZER,\
328  UDP_InterfaceTableEntrySeq_INITIALIZER,\
329  NULL,\
330  RTI_TRUE,\
331  RTI_FALSE, \
332  OSAPI_THREAD_PROPERTY_DEFAULT \
333 }
334 #else /* !VxWorks <6.3 */
335 
336 #ifndef RTI_CERT
337 #define UDP_InterfaceFactoryProperty_INITIALIZER \
338 {\
339  NETIO_InterfaceFactoryProperty_INITIALIZER,\
340  REDA_StringSeq_INITIALIZER,\
341  REDA_StringSeq_INITIALIZER,\
342  (256*1024),\
343  (256*1024),\
344  (8*1024),\
345  1,\
346  UDP_NatEntrySeq_INITIALIZER,\
347  UDP_InterfaceTableEntrySeq_INITIALIZER,\
348  NULL,\
349  RTI_TRUE,\
350  RTI_FALSE, \
351  OSAPI_THREAD_PROPERTY_DEFAULT \
352 }
353 #else
354 #define UDP_InterfaceFactoryProperty_INITIALIZER \
355 {\
356  NETIO_InterfaceFactoryProperty_INITIALIZER,\
357  REDA_StringSeq_INITIALIZER,\
358  REDA_StringSeq_INITIALIZER,\
359  (8*1024),\
360  (8*1024),\
361  (8*1024),\
362  1,\
363  UDP_InterfaceTableEntrySeq_INITIALIZER,\
364  NULL,\
365  RTI_TRUE,\
366  RTI_FALSE, \
367  OSAPI_THREAD_PROPERTY_DEFAULT \
368 }
369 #endif /* !RTI_CERT */
370 #endif
371 
372 #define UDP_INTERFACE_INTERFACE_ID RT_MKINTERFACEID(\
373  RT_COMPONENT_CLASS_NETIO,RT_COMPONENT_INSTANCE_UDP)
374 
375 extern NETIODllVariable struct UDP_InterfaceFactoryProperty UDP_INTERFACE_FACTORY_PROPERTY_DEFAULT;
376 
377 /*ce \dref_UDP_InterfaceFactory_get_interface
378  */
379 MUST_CHECK_RETURN NETIODllExport struct RT_ComponentFactoryI*
381 
382 #ifdef __cplusplus
383 } /* extern "C" */
384 #endif
385 
386 #undef RTI_EXPORT_REDA_SEQUENCE
387 
388 #endif /* netio_udp_h */
389 
390 /*ci @} */
391 

RTI Connext DDS Micro Version 2.4.7 Copyright © Fri Feb 26 2016 Real-Time Innovations, Inc