RTI Connext DDS Micro  Version 2.4.10
 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 #define UDP_NAT_INITIALIZER UDP_NatEntrySeq_INITIALIZER,
93 
94 #else /* !RTI_CERT */
95 #define UDP_NAT_INITIALIZER
96 #endif
97 
98 /*ci
99  * \def UDP_INTERFACE_MAX_IFNAME
100  * \brief Maximum length of a UDP network interface
101  */
102 #define UDP_INTERFACE_MAX_IFNAME 64
103 
104 /*ci
105  * \def UDP_INTERFACE_INTERFACE_UP_FLAG
106  * \brief Generic flag to indicate if a network stack is up
107  */
108 #define UDP_INTERFACE_INTERFACE_UP_FLAG 0x1
109 
110 /*ci
111  * \def UDP_INTERFACE_INTERFACE_MULTICAST_FLAG
112  * \brief Generic flag to indicate if a network stack supports multicast
113  */
114 #define UDP_INTERFACE_INTERFACE_MULTICAST_FLAG 0x2
115 
116 /*ci
117  * \brief The maximum number of bits in a UDP netmask
118  */
119 #define UDP_INTERFACE_MAX_NETMASK_BITS (32)
120 
121 /*ci
122  * \brief Generic structure to describe a network interface
123  */
124 struct DDSCPPDllExport UDP_InterfaceTableEntry
125 {
126  /*ci
127  * \brief Flags to indicate if the interface is up etc.
128  */
129  RTI_UINT32 flags;
130 
131  /*ci
132  * \brief The address of the interface as configured by the OS
133  */
134  RTI_UINT32 address;
135 
136  /*ci
137  * \brief The netmask of the interface as configured by the OS
138  */
139  RTI_UINT32 netmask;
140 
141  /*ci
142  * \brief The name of the interface as configured by the OS
143  */
144  char ifname[UDP_INTERFACE_MAX_IFNAME];
145 };
146 
147 /*ci
148  * \def UDP_InterfaceTableEntry_INITIALIZER
149  * \brief Constant to initialize \ref UDP_InterfaceTableEntry
150  */
151 #define UDP_InterfaceTableEntry_INITIALIZER \
152 {\
153  0,\
154  0,\
155  0,\
156  {0}\
157 }
158 
159 #define T struct UDP_InterfaceTableEntry
160 #define TSeq UDP_InterfaceTableEntrySeq
161 #include <reda/reda_sequence_decl.h>
162 
163 #define UDP_InterfaceTableEntrySeq_INITIALIZER \
164  REDA_DEFINE_SEQUENCE_INITIALIZER(struct UDP_InterfaceTableEntry)
165 
166 /*e \dref_UDP_InterfaceTable_add_entry
167  */
168 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
169 UDP_InterfaceTable_add_entry(struct UDP_InterfaceTableEntrySeq *seq,
170  RTI_UINT32 address,
171  RTI_UINT32 netmask,
172  const char *ifname,
173  RTI_UINT32 flags);
174 
175 #ifdef __cplusplus
176 } /* extern "C" */
177 #endif
178 
179 #ifdef __cplusplus
180 extern "C"
181 {
182 #endif
183 
185 NETIODllExport RTI_BOOL
186 UDP_InterfaceFactoryProperty_initialize(
187  struct UDP_InterfaceFactoryProperty* self);
188 
189 #ifndef RTI_CERT
190 NETIODllExport RTI_BOOL
191 UDP_InterfaceFactoryProperty_finalize(
192  struct UDP_InterfaceFactoryProperty *p);
193 #endif /* !RTI_CERT */
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 /*ce \dref_UDP_InterfaceFactoryProperty
200  * \brief Properties the UDP interface can be registered with.
201  */
202 struct DDSCPPDllExport UDP_InterfaceFactoryProperty
203 {
204  /*ci
205  * \brief Inherited property struct
206  */
207  struct NETIO_InterfaceFactoryProperty _parent;
208 
209  /*ce \dref_UDP_InterfaceFactoryProperty_allow_interface
210  * \brief Sequence of allowed interface names
211  */
212  struct REDA_StringSeq allow_interface;
213 
214  /*ce \dref_UDP_InterfaceFactoryProperty_deny_interface
215  * \brief Sequence of denied interface names. This list is checked
216  * after the allow_interface list.
217  */
218  struct REDA_StringSeq deny_interface;
219 
220  /*ce \dref_UDP_InterfaceFactoryProperty_max_send_buffer_size
221  * \brief The size of the send socket buffer
222  */
224 
225  /*ce \dref_UDP_InterfaceFactoryProperty_max_receive_buffer_size
226  * \brief The size of the receive socket buffer
227  */
229 
230  /*ce \dref_UDP_InterfaceFactoryProperty_max_message_size
231  * \brief The maximum size of the message which can be received
232  */
233  RTI_INT32 max_message_size;
234 
235  /*ce \dref_UDP_InterfaceFactoryProperty_multicast_ttl
236  * \brief The maximum TTL
237  */
238  RTI_INT32 multicast_ttl;
239 
240 #ifndef RTI_CERT
241  /*ce \dref_UDP_InterfaceFactoryProperty_nat
242  */
243  struct UDP_NatEntrySeq nat;
244 #endif /* !RTI_CERT */
245 
246  /*ce \dref_UDP_InterfaceFactoryProperty_if_table
247  * \brief The interface table if interfaces are added manually
248  */
249  struct UDP_InterfaceTableEntrySeq if_table;
250 
251  /*ce \dref_UDP_InterfaceFactoryProperty_multicast_interface
252  * \brief The network interface to use to send to multicast
253  */
254  REDA_String_T multicast_interface;
255 
256  /*ce \dref_UDP_InterfaceFactoryProperty_is_default_interface
257  * \brief If this should be considered the default UDP interfaces if
258  * no other UDP interface is found to handle a route
259  */
261 
262  /*ce \dref_UDP_InterfaceFactoryProperty_disable_auto_interface_config
263  * \brief Disable reading of available network interfaces using system
264  * information and instead rely on the manually configured
265  * interface table
266  */
268 
269  /*ce \dref_UDP_InterfaceFactoryProperty_recv_thread
270  * \brief Thread properties for each receive thread created by this
271  * NETIO interface.
272  */
273  struct OSAPI_ThreadProperty recv_thread;
274 
275 #ifdef RTI_CPP
276  public:
278  {
279  UDP_InterfaceFactoryProperty_initialize(this);
280  }
281 #endif
282 };
283 
284 #ifdef __cplusplus
285 extern "C"
286 {
287 #endif
288 
289 /*ci
290  * \def UDP_InterfaceFactoryProperty_INITIALIZER
291  * \brief Constant to initialize UDP_InterfaceFactoryProperty
292  *
293  * NOTE: Do not add a comma (,) after UDP_NAT_INITIALIZER, it is
294  * part of the definition based on the RTI_CERT definition.
295  */
296 #define UDP_InterfaceFactoryProperty_INITIALIZER \
297 {\
298  NETIO_InterfaceFactoryProperty_INITIALIZER,\
299  REDA_StringSeq_INITIALIZER,\
300  REDA_StringSeq_INITIALIZER,\
301  (256*1024),\
302  (256*1024),\
303  (8*1024),\
304  1,\
305  UDP_NAT_INITIALIZER \
306  UDP_InterfaceTableEntrySeq_INITIALIZER,\
307  NULL,\
308  RTI_TRUE,\
309  RTI_FALSE, \
310  OSAPI_THREAD_PROPERTY_DEFAULT \
311 }
312 
313 #define UDP_INTERFACE_INTERFACE_ID RT_MKINTERFACEID(\
314  RT_COMPONENT_CLASS_NETIO,RT_COMPONENT_INSTANCE_UDP)
315 
316 extern NETIODllVariable struct UDP_InterfaceFactoryProperty UDP_INTERFACE_FACTORY_PROPERTY_DEFAULT;
317 
318 /*ce \dref_UDP_InterfaceFactory_get_interface
319  */
320 MUST_CHECK_RETURN NETIODllExport struct RT_ComponentFactoryI*
322 
323 #ifdef __cplusplus
324 } /* extern "C" */
325 #endif
326 
327 #undef RTI_EXPORT_REDA_SEQUENCE
328 
329 #endif /* netio_udp_h */
330 
331 /*ci @} */
332 

RTI Connext DDS Micro Version 2.4.10 Copyright © Fri Jun 30 2017 Real-Time Innovations, Inc