RTI Connext Micro  Version 2.4.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
netio_interface.h
Go to the documentation of this file.
1 /*
2  * FILE: netio_interface.h - NETIO API
3  *
4  * Copyright 2012-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  * 03feb2014,eh MICRO-714: change ack to acknack
14  * 27jan2014,eh MICRO-714: add post_event. For reliable reader activity change
15  * 17may2013,eh MICRO-385: remove unused fns/fields of packet
16  * 25apr2012,tk Written
17  */
18 
19 /*ce
20  * \file
21  */
22 #ifndef netio_interface_h
23 #define netio_interface_h
24 
25 #ifndef netio_dll_h
26 #include "netio/netio_dll.h"
27 #endif
28 
29 #ifndef osapi_config_h
30 #include "osapi/osapi_config.h"
31 #endif
32 
33 #ifndef osapi_types_h
34 #include "osapi/osapi_types.h"
35 #endif
36 #ifndef osapi_time_h
37 #include "osapi/osapi_time.h"
38 #endif
39 #ifndef reda_sequenceNumber_h
40 #include "reda/reda_sequenceNumber.h"
41 #endif
42 
43 #ifndef db_api_h
44 #include "db/db_api.h"
45 #endif
46 
47 #ifndef rt_rt_h
48 #include "rt/rt_rt.h"
49 #endif
50 
51 #ifndef netio_address_h
52 #include "netio/netio_address.h"
53 #endif
54 
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59 
60 /*ci
61  * \defgroup NETIO_PacketClass NETIO Packet API
62  * \ingroup NETIOCommon
63  * \brief NETIO_Packet implementation
64  */
65 
66 /*ci
67  * \addtogroup NETIO_PacketClass
68  * @{
69  */
70 /*
71  * The following constants are passed as part of a NETIO_Packet to
72  * indicate what protocol it originated from. It may be used the receiver
73  */
74 /*ci
75  * \def NETIO_PROTOCOL_INTRA
76  * \brief The packet originates from the INTRA protocol
77  */
78 #define NETIO_PROTOCOL_INTRA (1)
79 
80 /*ci
81  * \def NETIO_PROTOCOL_RTPS
82  * \brief The packet originates from the RTPS protocol
83  */
84 #define NETIO_PROTOCOL_RTPS (2)
85 
86 /*ci
87  * \def NETIO_PROTOCOL_RTPS
88  * \brief The packet originates from the UDP protocol
89  */
90 #define NETIO_PROTOCOL_UDP (3)
91 
92 /*
93  * The following constants are passed as part of a NETIO_Packet to
94  * provide meta information about the content (if any).
95  */
96 /*ci
97  * \def NETIO_RTPS_FLAGS_DISPOSE
98  * \brief The packet is a RTPS dispose message, a key is disposed
99  */
100 #define NETIO_RTPS_FLAGS_DISPOSE (0x1)
101 
102 /*ci
103  * \def NETIO_RTPS_FLAGS_UNREGISTER
104  * \brief The packet is a RTPS unregister message, a key has been unregistered
105  * by a writer
106  */
107 #define NETIO_RTPS_FLAGS_UNREGISTER (0x2)
108 
109 /*ci
110  * \def NETIO_RTPS_FLAGS_LIVELINESS
111  * \brief The packet is counts as liveliness, even it does not contain any data
112  */
113 #define NETIO_RTPS_FLAGS_LIVELINESS (0x4)
114 
115 /*ci
116  * \def NETIO_RTPS_FLAGS_INLINEQOS
117  * \brief The packet contains inline Qos as defined by RTPS
118  */
119 #define NETIO_RTPS_FLAGS_INLINEQOS (0x8)
120 
121 /*ci
122  * \def NETIO_RTPS_FLAGS_INLINEQOS
123  * \brief The packet indicates that some packets has been permanently lost
124  * and any attempt to wait for them should be aborted
125  */
126 #define NETIO_RTPS_FLAGS_LOST_DATA (0x10)
127 
128 /*ci
129  * \def NETIO_RTPS_FLAGS_COMMIT_DATA
130  * \brief The packet indicates that some even if the packet does not contain
131  * data, it does contain information about which packets can be considered
132  * to be received in order.
133  */
134 #define NETIO_RTPS_FLAGS_COMMIT_DATA (0x20)
135 
136 /*ci
137  * \def NETIO_RTPS_FLAGS_COMMIT_DATA
138  * \brief The packet indicates that some even if the packet does not contain
139  * data, it does contain information about which packets can be considered
140  * to be received in order.
141  */
142 #define NETIO_RTPS_FLAGS_DATA (0x40)
143 
144 /*ci
145  * \def NETIO_RTPS_FLAGS_LAST_WRITE_FOR_SN
146  * \brief
147  */
148 #define NETIO_RTPS_FLAGS_LAST_WRITE_FOR_SN (0x80)
149 
150 /*ci
151  * \def NETIO_RTPS_FLAGS_LITTLE_ENDIAN
152  * \brief The packet payload is in little endian format
153  */
154 #define NETIO_RTPS_FLAGS_LITTLE_ENDIAN (0x100)
155 
156 /*ci
157  * \brief RTPS protocol specific data
158  */
159 struct NETIO_RtpsInfo
160 {
161  /*ci
162  * \brief Pointer to beginning of data-payload
163  */
164  struct REDA_Buffer *inline_data;
165 
166  /*ci
167  * \brief The GUID prefix of the peer
168  */
169  struct NETIO_GuidPrefix guid_prefix;
170 };
171 
172 /*ci
173  * \brief INTRA protocol specific data
174  */
175 struct NETIO_IntraInfo
176 {
177  /*ci
178  * \brief opaque pointer to in-memory representation of data
179  */
180  const void *user_data;
181 
182  /*ci
183  * \brief Pointer to beginning of intra data-payload. Intra data-paylod
184  * only contains inline Qos
185  */
186  struct REDA_Buffer *inline_data;
187 };
188 
189 /*ci
190  *\brief NETIO_IntraInfo initializer constant
191  */
192 #define NETIO_IntraInfo_INITIALIZER \
193 { \
194  NULL, /* user_data */ \
195  NULL, /* inline_data */ \
196 }
197 
198 /*ci
199  *\brief Structure containing meta-data about a \ref NETIO_Packet payload
200  */
201 struct NETIO_PacketInfo
202 {
203  /*ci
204  * \brief The SN of the packet. The SN and PacketId is synonymous
205  */
206  struct REDA_SequenceNumber sn;
207 
208  /*ci
209  * \brief The reception time-stamp of the packet
210  */
211  struct OSAPI_NtpTime timestamp;
212 
213  RTI_INT8 priority;
214 
215  /*ci
216  * \brief Whether the data-payload is valid or not
217  */
218  RTI_UINT8 valid_data;
219 
220  /*ci
221  * \brief Whether key for the sample
222  */
223  struct NETIO_Guid instance;
224 
225  /*ci
226  * \brief Flags describing the contents of the payload
227  */
228  RTI_UINT32 rtps_flags;
229 
230  /*ci
231  * \brief The committable_sn means that all SNs upto, but not including
232  * this SN can be committed (made available to the user)
233  */
234  struct REDA_SequenceNumber committable_sn;
235 
236  /*ci
237  * \brief The first_available_sn indicates the first available SN which is
238  * available. It is typically used downstream to boot-strap the
239  * reliability protocol
240  */
241  struct REDA_SequenceNumber first_available_sn;
242 
243  /*ci
244  * \brief If NETIO_RTPS_FLAGS_LOST_DATA is set, this is the highest sequence
245  * number which has been lost.
246  */
247  struct REDA_SequenceNumber lost_sample_sn;
248 
249  /*ci
250  * \brief If NETIO_RTPS_FLAGS_LOST_DATA is set, this is the total number
251  * of samples that have been lost upto and including lost_sample_sn
252  */
253  RTI_UINT32 lost_sample_count;
254 
255  /*ci
256  * \brief The protocol which produced this packet, it may change as the
257  * packet traverses a NETIO stack
258  */
259  RTI_INT32 protocol_id;
260 
261  /*ci
262  * \brief Protocol specific data based, protocol_id identifies which one
263  * is valid.
264  */
265  struct
266  {
267  struct NETIO_IntraInfo intra_info;
268  struct NETIO_RtpsInfo rtps_data;
269  } protocol_data;
270 };
271 
272 /*ci
273  * \def NETIO_PacketInfo_INITIALIZER
274  * \brief Constant to initialize NETIO_PacketInfo
275  */
276 #define NETIO_PacketInfo_INITIALIZER \
277 { \
278  REDA_SEQUENCE_NUMBER_ZERO, /* sn */\
279  OSAPI_NTP_TIME_ZERO, /* timestamp */ \
280  0, /* priority */ \
281  0, /* valid_data */ \
282  NETIO_ADDRESS_GUID_UNKNOWN, /* instance */ \
283  0, /* flags */ \
284  REDA_SEQUENCE_NUMBER_ZERO, /* committable_sn */ \
285  REDA_SEQUENCE_NUMBER_ZERO, /* first_available_sn */ \
286  REDA_SEQUENCE_NUMBER_ZERO, /* lost_sample_sn */ \
287  0, /* lost sample count */ \
288  0, /* protocol_id */\
289  {{NULL,NULL},{NULL,{{0,0,0,0,0,0,0,0,0,0,0,0}}}}\
290 }
291 
292 /*ci
293  * \brief Implementation of the abstract NETIO_Packet type.
294  *
295  * \details
296  * The NETIO layers passed \ref NETIO_Packet structures upstream/downstream.
297  * Any meta-data about the packet must be encapsulated either in the packet
298  * payload or the packet info field.
299  */
300 struct NETIO_Packet
301 {
302  /*ci
303  * \brief The source of the packet
304  */
305  struct NETIO_Address source;
306 
307  /*ci
308  * \brief Buffer holding a NETIO_Packet. The buffer must be allocated
309  * and managed outside of this structure. That, is NETIO_Packet
310  * only manages payloads by reference.
311  */
312  char *buffer;
313 
314  /*ci
315  * \brief The maximum number of bytes buffer can hold
316  */
317  RTI_SIZE_T max_length;
318 
319  /*ci
320  * \brief The current position of head cursor
321  */
322  RTI_SIZE_T head_pos;
323 
324  /*ci
325  * \brief The current position of tail cursor
326  */
327  RTI_SIZE_T tail_pos;
328 
329  /*ci
330  * \brief Temporary storage for the current head position so it can later
331  * be restored if a packet payload is traversed multiple times
332  */
333  RTI_SIZE_T saved_head_pos;
334 
335  /*ci
336  * \brief Temporary storage for the current tail position so it can later
337  * be restored if a packet payload is traversed multiple times
338  */
339  RTI_SIZE_T saved_tail_pos;
340 
341  /*ci
342  * \brief Meta data about the packet, refer to \ref NETIO_PacketInfo for
343  * details
344  */
345  struct NETIO_PacketInfo info;
346 
347  /*ci
348  * \brief Sequence of destinations for single packet. Memory owned by sender.
349  */
350  struct NETIO_AddressSeq *dests;
351 };
352 
353 /*ci
354  * \brief Abstract NETIO_Packet type
355  */
356 typedef struct NETIO_Packet NETIO_Packet_T;
357 
358 /*ci
359  * \brief Every packet must have a unique ID. Since RTPS SN does not wrap around,
360  * it is safe to use as a unique ID per data-writer. It also avoids having
361  * to map a between packet id to a RTPS SN.
362  */
363 typedef struct REDA_SequenceNumber NETIO_PacketId_T;
364 
365 /*ci
366  * \def NETIO_Packet_INITIALIZER
367  * \brief Constant to initialize a \ref NETIO_Packet
368  */
369 #define NETIO_Packet_INITIALIZER \
370 {\
371  NETIO_Address_INITIALIZER,\
372  NULL, /* buffer */\
373  0, /* max_length */\
374  0, /* head_pos */\
375  0, /* tail_pos */\
376  0, /* saved_head_pos */\
377  0, /* saved_tail_pos */\
378  NETIO_PacketInfo_INITIALIZER,\
379  NULL /* dests */\
380 }
381 
382 /*ci
383  * \brief Adjust the head cursor in the packet payload
384  *
385  * \details
386  *
387  * Adjust the head cursor in the packet payload. A positive value moves the
388  * cursor forward, a negative value backwards.
389  *
390  * \param[in] packet Packet to adjust head cursor in
391  * \param[in] delta Adjustment to make
392  *
393  * \return RTI_TRUE on success, RTI_FALSE on failure
394  */
395 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
396 NETIO_Packet_set_head(NETIO_Packet_T *packet,RTI_INT32 delta);
397 
398 /*ci
399  * \brief Adjust the tail cursor in the packet payload
400  *
401  * \details
402  *
403  * Adjust the tail cursor in the packet payload. A positive value moves the
404  * cursor forward, a negative value backwards.
405  *
406  * \param[in] packet Packet to adjust tail cursor in
407  * \param[in] delta Adjustment to make
408  *
409  * \return RTI_TRUE on success, RTI_FALSE on failure
410  */
411 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
412 NETIO_Packet_set_tail(NETIO_Packet_T *packet,RTI_INT32 delta);
413 
414 /*ci
415  * \brief Get a pointer to the current head
416  *
417  * \details
418  *
419  * Get a pointer to the current head. Note that it can be assumed that the
420  * payload buffer is contiguous.
421  *
422  * \param[in] packet Packet to get the head pointer for
423  *
424  * \return pointer to packet head
425  *
426  * \sa \ref NETIO_Packet_set_head
427  */
428 MUST_CHECK_RETURN NETIODllExport void*
429 NETIO_Packet_get_head(NETIO_Packet_T *packet);
430 
431 /*ci
432  * \brief Get a pointer to the tail head
433  *
434  * \details
435  *
436  * Get a pointer to the current tail. Note that it can be assumed that the
437  * payload buffer is contiguous.
438  *
439  * \param[in] packet Packet to get the tail pointer for
440  *
441  * \return pointer to packet tail
442  *
443  * \sa \ref NETIO_Packet_set_tail
444  */
445 MUST_CHECK_RETURN NETIODllExport void*
446 NETIO_Packet_get_tail(NETIO_Packet_T *packet);
447 
448 /*ci
449  * \brief Initialize a packet with a payload buffer of the given length
450  *
451  * \details
452  *
453  * NETIO_Packet only manipulates payloads by reference. The actual buffer
454  * holding a payload must be managed outside of the packet structure. A
455  * payload buffer is assigned to the packet with the length and an initialized
456  * destination sequence.
457  *
458  * \param[in] packet Packet structure to initialize
459  * \param[in] init_buffer Payload buffer
460  * \param[in] init_length Initial length in bytes of the buffer
461  * \param[in] trailer_length The initial trail position in the payload
462  * \param[in] dest_seq Initialized sequence of destination address for
463  * the packet
464  *
465  * \return RTI_TRUE on successful initialization, RTI_FALSE on failure
466  */
467 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
468 NETIO_Packet_initialize(NETIO_Packet_T *packet,
469  void *init_buffer,
470  RTI_SIZE_T init_length,
471  RTI_SIZE_T trailer_length,
472  struct NETIO_AddressSeq *dest_seq);
473 
474 #ifndef RTI_CERT
475 /*ci
476  * \brief Finalize a packet structure
477  *
478  * \details
479  *
480  * Finalize a packet structure
481  *
482  * \param[in] packet Packet structure to finalize
483  *
484  * \return RTI_TRUE on successful initialization, RTI_FALSE on failure
485  */
486 SHOULD_CHECK_RETURN NETIODllExport RTI_BOOL
487 NETIO_Packet_finalize(NETIO_Packet_T *packet);
488 #endif /* !RTI_CERT */
489 
490 /*ci
491  * \brief Get pointer to the packet payload data
492  *
493  * \details
494  *
495  * Finalize a packet structure
496  *
497  * \param[in] packet Packet structure to finalize
498  *
499  * \return RTI_TRUE on successful initialization, RTI_FALSE on failure
500  */
501 MUST_CHECK_RETURN NETIODllExport struct NETIO_PacketInfo*
502 NETIO_Packet_get_info(NETIO_Packet_T *packet);
503 
504 NETIODllExport void
505 NETIO_Packet_set_source(NETIO_Packet_T *packet,struct NETIO_Address *src);
506 
507 /*ci
508  * \brief Get the length the packet payload
509  *
510  * \details
511  *
512  * Get the length the packet payload
513  *
514  * \param[in] packet Packet to return the payload lenght for
515  *
516  * \return Length of payload
517  */
518 SHOULD_CHECK_RETURN NETIODllExport RTI_SIZE_T
519 NETIO_Packet_get_payload_length(NETIO_Packet_T *packet);
520 
521 /*ci
522  * \brief Save the current head and tail positions
523  *
524  * \details
525  *
526  * Save the current head and tail positions
527  *
528  * \param[in] packet Packet to save the head and tail positions for
529  *
530  *\sa \ref NETIO_Packet_restore_positions
531  *
532  */
533 NETIODllExport void
534 NETIO_Packet_save_positions(NETIO_Packet_T *packet);
535 
536 /*ci
537  * \brief Restore the saved head and tail positions
538  *
539  * \details
540  *
541  * Restore the saved head and tail positions
542  *
543  * \param[in] packet Packet to restore the head and tail positions for
544  *
545  * \sa \ref NETIO_Packet_save_positions
546  */
547 NETIODllExport void
548 NETIO_Packet_restore_positions(NETIO_Packet_T *packet);
549 
550 /*ci
551  * \brief Save the saved head and tail positions to external variables
552  *
553  * \details
554  *
555  * Save the saved head and tail positions to external variables
556  *
557  * \param[in] packet Packet to save the head and tail positions for
558  * \param[out] head Contains current head position for packet on return
559  * \param[out] tail Contains current tail position for packet on return
560  *
561  * \sa \ref NETIO_Packet_restore_positions_from
562  */
563 NETIODllExport void
564 NETIO_Packet_save_positions_to(NETIO_Packet_T *packet,
565  RTI_SIZE_T *head,
566  RTI_SIZE_T *tail);
567 
568 /*ci
569  * \brief Save the saved head and tail positions to external variables
570  *
571  * \details
572  *
573  * Restore the saved head and tail positions from external variables
574  *
575  * \param[in] packet Packet to restore the head and tail positions for
576  * \param[in] head Set head position for packet
577  * \param[in] tail Set tail position for packet
578  *
579  * \sa \ref NETIO_Packet_save_positions_to
580  */
581 NETIODllExport void
582 NETIO_Packet_restore_positions_from(NETIO_Packet_T *packet,
583  RTI_SIZE_T head,
584  RTI_SIZE_T tail);
585 
586 /*ci @} */
587 
588 /*ci
589  * \defgroup NETIO_InterfaceClass NETIO Interface API
590  * \ingroup NETIOModule
591  */
592 /*ci \addtogroup NETIO_InterfaceClass
593  * @{
594  */
595 
596 /*ci
597  * \brief The required number of bytes to convert an component id and
598  * counter to a table name
599  */
600 #define NETIO_TABLE_NAME_SIZE (16)
601 
602 /*ci
603  * \brief NETIO base-class property
604  */
605 struct NETIO_InterfaceProperty
606 {
607  struct RT_ComponentProperty _parent;
608  RTI_INT32 max_routes;
609  RTI_INT32 max_binds;
610 };
611 
612 
613 /*ci
614  * \brief Constant to initialize \ref NETIO_InterfaceProperty
615  */
616 #define NETIO_InterfaceProperty_INITIALIZER \
617 {\
618  RT_ComponentProperty_INITIALIZER,\
619  0,\
620  0\
621 }
622 
623 /*ci
624  * \brief NETIO listener structure
625  *
626  * \details
627  *
628  * All NETIO interface are RT Components, and all NETIO layers derives
629  * the listener class from the RT_ComponentListener.
630  */
631 struct NETIO_InterfaceListener
632 {
633  /*ci
634  * \brief Derived from member
635  */
636  struct RT_ComponentListener _parent;
637 };
638 
639 /*ci
640  * \def NETIO_InterfaceListener_INITIALIZE
641  * \brief Constant to initialize \ref NETIO_InterfaceListener
642  */
643 #define NETIO_InterfaceListener_INITIALIZE \
644 {\
645  RT_ComponentListener_INITIALIZER \
646 }
647 
648 /*ci
649  * \brief Common NETIO Interface factory properties
650  *
651  * \details
652  *
653  * All NETIO layers are implemented as RT components. All NETIO layers
654  * are created from NETIO factories, and all NETIO factories are RT
655  * component factories that share common properties inherited from
656  * this structure.
657  */
658 struct NETIO_InterfaceFactoryProperty
659 {
660  /*ci
661  * \brief derived from member
662  */
663  struct RT_ComponentFactoryProperty _parent;
664 };
665 
666 /*ci
667  * \def NETIO_InterfaceFactoryProperty_INITIALIZER
668  * \brief Constant to initialize a \ref NETIO_InterfaceFactoryProperty
669  */
670 #define NETIO_InterfaceFactoryProperty_INITIALIZER \
671 {\
672  RT_ComponentFactoryProperty_INITIALIZER \
673 }
674 
675 /*ci
676  * \brief Definitions of valid NETIO interface states
677  */
678 typedef enum
679 {
680  /*ci
681  * \brief The interface has been created, but will not send/receive
682  */
683  NETIO_INTERFACESTATE_CREATED,
684 
685  /*ci
686  * \brief The interface is enabled, can send/receive
687  */
688  NETIO_INTERFACESTATE_ENABLED
689 } NETIO_InterfaceState_T;
690 
691 /*ci
692  * \brief Base-class definition for all NETIO interfaces
693  *
694  * \details
695  *
696  * All NETIO layers are RT components and are derived from RT components.
697  * All NETIO layers also share a common base class, \ref NETIO_Interface
698  * and share common properties.
699  */
700 struct NETIO_Interface
701 {
702  /*ci
703  * \brief Derived member
704  */
705  struct RT_Component _parent;
706 
707  /*ci
708  * \brief A route table with addresses to send to
709  */
710  DB_Table_T _rtable;
711 
712  /*ci
713  * \brief A bind table with addresses to listen to
714  */
715  DB_Table_T _btable;
716 
717  /*ci
718  * \brief Common interface listener to signal changed in NETIO
719  * layers
720  */
721  struct NETIO_InterfaceListener _listener;
722 
723  /*ci
724  * \brief The local address of the NETIO layer. The use is NETIO
725  * specific. It is not guarenteed to be unique outside of the
726  * stack the layer belongs to.
727  */
728  struct NETIO_Address local_address;
729 
730  /*ci
731  * \brief The current NETIO interface state
732  */
733  NETIO_InterfaceState_T state;
734 };
735 
736 /*ci
737  * \brief Abstract NETIO_Interface type
738  */
739 typedef struct NETIO_Interface NETIO_Interface_T;
740 
741 /*ci
742  * \brief Common bind properties
743  */
744 struct NETIOBindProperty
745 {
746  /*ci
747  * \brief The strength of the bind. Strength is a DDS concept and used to
748  * determine ownerships for instances.
749  */
750  RTI_UINT32 strength;
751 };
752 
753 /*ci
754  * \def NETIOBindProperty_INITIALIZER
755  * \brief Constant to initialize \ref NETIOBindProperty
756  */
757 #define NETIOBindProperty_INITIALIZER \
758 {\
759  0\
760 }
761 
762 /*ci
763  * \brief Common route properties
764  */
765 struct NETIORouteProperty
766 {
767  RTI_INT32 _dummy;
768 };
769 
770 /*ci
771  * \def NETIORouteProperty_INITIALIZER
772  * \brief Constant to initialize \ref NETIORouteProperty
773  */
774 #define NETIORouteProperty_INITIALIZER \
775 {\
776  0 \
777 }
778 
779 /*ci
780  * \brief Generic bind key to listen to a source
781  */
782 struct NETIOBindEntryKey
783 {
784  /*ci
785  * \brief The source address to listen too
786  */
787  struct NETIO_Address source;
788 
789  /*ci
790  * \brief The destination address listening to the source
791  */
792  struct NETIO_Address destination;
793 };
794 
795 /*ci
796  * \brief Generic bind entry
797  */
798 struct NETIOBindEntry
799 {
800  /*ci
801  * \brief The source address to listen too
802  */
803  struct NETIO_Address source;
804 
805  /*ci
806  * \brief The destination address listening to the source
807  */
808  struct NETIO_Address destination;
809 
810  /*ci
811  * \brief The interface to use to listen too source
812  */
813  NETIO_Interface_T *intf;
814 };
815 
816 /*ci
817  * \brief The state of a route as determined by the protocol layer
818  */
819 typedef enum
820 {
821  /*ci
822  * \brief The route is active, it can send data
823  */
824  NETIO_ROUTESTATE_ACTIVE,
825 
826  /*ci
827  * \brief The route is inactive, it cannot send data
828  */
829  NETIO_ROUTESTATE_INACTIVE
830 } NETIO_RouteState_T;
831 
832 /*ci
833  * \brief Definition of generic route entry key. Typically all route entries
834  * inherit from this key
835  */
836 struct NETIORouteEntryKey
837 {
838  /*ci
839  * \brief The address which an be reached on this route
840  */
841  struct NETIO_Address destination;
842 
843  /*ci
844  * \brief The interface which can reach the destination
845  */
846  NETIO_Interface_T *intf;
847 
848  /*ci
849  * \brief The address of the interface itself (source)
850  */
851  struct NETIO_Address intf_address;
852 };
853 
854 /*ci
855  * \brief Generic route entry, typically all routes inherit from this type
856  */
857 struct NETIORouteEntry
858 {
859  /*ci
860  * \brief The destinationa address which can be reached
861  */
862  struct NETIO_Address destination;
863 
864  /*ci
865  * \brief The interface which can reach the address
866  */
867  NETIO_Interface_T *intf;
868 
869  /*ci
870  * \brief The address of the interface
871  */
872  struct NETIO_Address intf_address;
873 
874  /*ci
875  * \brief State of the route entry
876  */
877  NETIO_RouteState_T state;
878 };
879 
880 /*ci
881  * \brief Discriminator for status changes detected at a protocol level
882  */
883 typedef enum
884 {
885  /*ci
886  * \brief A NETIO layer has determined that the peer is inactive
887  */
888  NETIO_EVENTKIND_INACTIVE_PEER,
889 
890  /*ci
891  * \brief A NETIO layer has determined that the peer is active
892  */
893  NETIO_EVENTKIND_ACTIVE_PEER
894 } NETIO_EventKind_T;
895 
896 /*ci
897  * \brief Structure to signal protocol level status changes upstream/downstream
898  */
899 struct NETIO_Event_PeerActivity
900 {
901  /*ci
902  * \brief Address of peer layer with the activity change
903  */
904  struct NETIO_Address peer_addr;
905 
906  /*ci
907  * \brief Total number of times the peer has become inactive
908  */
909  RTI_INT32 inactive_total;
910 
911  /*ci
912  * \brief Change in inactivity since last time signalled
913  */
914  RTI_INT32 inactive_change;
915 
916  /*ci
917  * \brief Total number of times the peer has become active
918  */
919  RTI_INT32 active_total;
920 
921  /*ci
922  * \brief Change in activity since last time signalled
923  */
924  RTI_INT32 active_change;
925 };
926 
927 /*ci
928  * \brief Generic event structure to signal status changes detected at the
929  * protocol level
930  */
931 struct NETIO_Event
932 {
933  /*ci
934  * \brief Event discrimniator
935  */
936  NETIO_EventKind_T kind;
937 
938  /*ci
939  * \brief Additional event information
940  */
941  union {
942  struct NETIO_Event_PeerActivity peer_activity;
943  } value;
944 };
945 
946 struct NETIO_InterfaceI;
947 
948 /*ci
949  * \brief Create a table name with a consistent format for NETIO route
950  * and bind tables
951  *
952  * \param[out] tbl_name The resulting table name is placed here. It is assumed
953  * that the buffer is long enough and is should be at least
954  * NETIO_TABLE_NAME_SIZE bytes large.
955  * \param[in] id The name of the factory owning the table
956  * \param[in] suffix Single character identifying the type of table
957  * \param[in] instance The instance the table is created from
958  *
959  */
960 NETIODllExport void
961 NETIO_Interface_Table_name_from_id(char *tbl_name,
962  union RT_ComponentFactoryId *id,
963  char suffix,
964  RTI_INT32 instance);
965 
966 /*ci
967  * \brief Initialize a NETIO_Interface base-class
968  *
969  * \param[in] netio The netio interface to initialize
970  * \param[in] netio_intf Pointer to the NETIO interface implementation
971  * \param[in] property The NETIO properties
972  * \param[in] listener The NETIO listener
973  *
974  * \return RTI_TRUE on success, RTI_FALSE on failure
975  *
976  * \sa \ref NETIO_Interface_finalize
977  */
978 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
979 NETIO_Interface_initialize(struct NETIO_Interface *netio,
980  struct NETIO_InterfaceI *netio_intf,
981  const struct NETIO_InterfaceProperty *const property,
982  const struct NETIO_InterfaceListener *const listener);
983 
984 #ifndef RTI_CERT
985 /*ci
986  * \brief Finalaize a NETIO_Interface base-class
987  *
988  * \param[in] netio The netio interface to finalize
989  *
990  * \return RTI_TRUE on success, RTI_FALSE on failure
991  *
992  * \sa \ref NETIO_Interface_initialize
993  */
994 SHOULD_CHECK_RETURN NETIODllExport RTI_BOOL
995 NETIO_Interface_finalize(struct NETIO_Interface *netio);
996 #endif /* !RTI_CERT */
997 
998 /*ci
999  * \brief Implementation of required database function to compare
1000  * NETIO route records stored in a database
1001  *
1002  * \details
1003  *
1004  * This function is installed as the compare function for the
1005  * tables holding NETIO_Route records
1006  *
1007  * \param[in] flags Passed in from the database
1008  * \param[in] op1 Existing database record
1009  * \param[in] op2 New database record or key depending on flags
1010  *
1011  * \return 0 if op1 = op2, < 0 if op1 < op2, > 0 if op1 > op2
1012  */
1013 MUST_CHECK_RETURN NETIODllExport RTI_INT32
1014 NETIO_Interface_compare_route(RTI_INT32 flags,
1015  const DB_Record_T op1, void *op2);
1016 
1017 /*ci
1018  * \brief Implementation of required database function to compare
1019  * NETIO route records stored in a database
1020  *
1021  * \details
1022  *
1023  * This function is installed as the compare function for the
1024  * tables holding NETIO_Bind records
1025  *
1026  * \param[in] flags Passed in from the database
1027  * \param[in] op1 Existing database record
1028  * \param[in] op2 New database record or key depending on flags
1029  *
1030  * \return 0 if op1 = op2, < 0 if op1 < op2, > 0 if op1 > op2
1031  */
1032 MUST_CHECK_RETURN NETIODllExport RTI_INT32
1033 NETIO_Interface_compare_bind(RTI_INT32 flags,
1034  const DB_Record_T op1, void *op2);
1035 
1036 /*ci
1037  * \brief Lookup if route exists to a destination via an interface
1038  *
1039  * \param[in] netio_intf The source interface
1040  * \param[in] dst_reader The destination address
1041  * \param[in] via_intf The downstream interface
1042  * \param[in] via_address The address to pass to the downstream interface
1043  * \param[out] route_entry If a route exists, pointer to the entry otherwise
1044  * NULL
1045  *
1046  * \return RTI_TRUE on success, RTI_FALSE on failure
1047  */
1048 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
1049 NETIO_Interface_lookup_route(struct NETIO_Interface *netio_intf,
1050  struct NETIO_Address *dst_reader,
1051  struct NETIO_Interface *via_intf,
1052  struct NETIO_Address *via_address,
1053  struct NETIORouteEntry **route_entry);
1054 
1055 /*ci
1056  * \brief Definition of the \ref NETIO_InterfaceI send method
1057  *
1058  * \param[in] self NETIO interface to send from
1059  * \param[in] source The source interface for the packet
1060  * \param[in] destination The destination address for the packet
1061  * \param[in] packet The packet to send
1062  *
1063  * \return RTI_TRUE on success, RTI_FALSE on failure
1064  *
1065  * \sa \ref NETIO_Interface_send, \ref NETIO_InterfaceI
1066  */
1067 FUNCTION_MUST_TYPEDEF(
1068 RTI_BOOL
1069 (*NETIO_Interface_sendFunc)(
1070  NETIO_Interface_T *self,
1071  struct NETIO_Interface *source,
1072  struct NETIO_Address *destination,
1073  NETIO_Packet_T *packet)
1074 )
1075 
1076 /*ci
1077  * \brief Definition of the \ref NETIO_InterfaceI receive method
1078  *
1079  * \param[in] self NETIO interface to receive in
1080  * \param[in] src_addr The source address of the packet
1081  * \param[in] dst_addr The destination address for the packet
1082  * \param[in] packet The forwarded packet from downstream
1083  *
1084  * \return RTI_TRUE on success, RTI_FALSE on failure
1085  *
1086  * \sa \ref NETIO_Interface_receive, \ref NETIO_InterfaceI
1087  */
1088 FUNCTION_MUST_TYPEDEF(
1089 RTI_BOOL
1090 (*NETIO_Interface_receiveFunc)(
1091  NETIO_Interface_T *netio_intf,
1092  struct NETIO_Address *src_addr,
1093  struct NETIO_Address *dst_addr,
1094  NETIO_Packet_T *packet)
1095 )
1096 
1097 /*ci
1098  * \brief Definition of the \ref NETIO_InterfaceI acknack method
1099  *
1100  * \param[in] self The NETIO interface receiving the acknack
1101  * \param[in] source The peer source address of the acknack
1102  * \param[in] packet_id The packet_id/SN of the NETIO_Packet being acked/nacked
1103  * \param[in] nack RTI_TRUE if this is a negative acknowledgment
1104  *
1105  * \return RTI_TRUE on success, RTI_FALSE on failure
1106  *
1107  * \sa \ref NETIO_Interface_acknack, \ref NETIO_InterfaceI
1108  */
1109 FUNCTION_MUST_TYPEDEF(
1110 RTI_BOOL
1111 (*NETIO_Interface_acknackFunc)(
1112  NETIO_Interface_T *self,
1113  struct NETIO_Address *source,
1114  NETIO_PacketId_T *packet_id,
1115  RTI_BOOL nack)
1116 )
1117 
1118 /*ci
1119  * \brief Definition of the \ref NETIO_InterfaceI request method
1120  *
1121  * \param[in] self The NETIO interface receiving the request
1122  * \param[in] source The peer source address of the request
1123  * \param[in] dest The peer destination address of the request
1124  * \param[in] packet The requested packet if it existed, NULL
1125  * otherwise
1126  * \param[in] packet_id The packet_id/SN of the NETIO_Packet being
1127  * requested
1128  * \param[in] actual_packet_id The if packet_id is not available, the next
1129  * available SN/packet_id
1130  *
1131  * \return RTI_TRUE on success, RTI_FALSE on failure
1132  *
1133  * \sa \ref NETIO_Interface_request, \ref NETIO_InterfaceI
1134  */
1135 FUNCTION_MUST_TYPEDEF(
1136 RTI_BOOL
1137 (*NETIO_Interface_requestFunc)(
1138  NETIO_Interface_T *self,
1139  struct NETIO_Address *source,
1140  struct NETIO_Address *dest,
1141  NETIO_Packet_T **packet,
1142  NETIO_PacketId_T *packet_id,
1143  NETIO_PacketId_T *actual_packet_id)
1144 )
1145 
1146 
1147 FUNCTION_MUST_TYPEDEF(
1148 RTI_BOOL
1149 (*NETIO_Interface_return_loanFunc)(
1150  NETIO_Interface_T *self,
1151  struct NETIO_Address *source,
1152  NETIO_Packet_T *packet,
1153  NETIO_PacketId_T *packet_id)
1154 )
1155 
1156 /*ci
1157  * \brief Definition of the \ref NETIO_InterfaceI xmit_remove method
1158  *
1159  * \param[in] self NETIO interface to cancel a transmit on
1160  * \param[in] destination The destination address of the packet
1161  * \param[in] packet_id The packet_id/SN of the NETIO_Packet to cancel
1162  *
1163  * \return RTI_TRUE on success, RTI_FALSE on failure
1164  *
1165  * \sa \ref NETIO_Interface_xmit_remove, \ref NETIO_InterfaceI
1166  */
1167 FUNCTION_MUST_TYPEDEF(
1168 RTI_BOOL
1169 (*NETIO_Interface_xmit_removeFunc)(
1170  NETIO_Interface_T *self,
1171  struct NETIO_Address *destination,
1172  NETIO_PacketId_T *packet_id)
1173 )
1174 
1175 /*ci
1176  * \brief Definition of the \ref NETIO_InterfaceI add_route method
1177  *
1178  * \param[in] self NETIO interface to add the route too
1179  * \param[in] dst_addr The destination address for the route
1180  * \param[in] via_intf The downstream interface
1181  * \param[in] via_addr The address to pass to the downstream interface
1182  * \param[in] property The route property
1183  * \param[in] existed Whether the route already existed
1184  *
1185  * \sa \ref NETIO_Interface_add_route, \ref NETIO_InterfaceI
1186  */
1187 FUNCTION_MUST_TYPEDEF(
1188 RTI_BOOL
1189 (*NETIO_Interface_add_routeFunc)(
1190  NETIO_Interface_T *self,
1191  struct NETIO_Address *dst_addr,
1192  NETIO_Interface_T *via_intf,
1193  struct NETIO_Address *via_addr,
1194  struct NETIORouteProperty *property,
1195  RTI_BOOL *existed)
1196 )
1197 
1198 /*ci
1199  * \brief Definition of the \ref NETIO_InterfaceI delete_route method
1200  *
1201  * \param[in] self NETIO interface to add the route too
1202  * \param[in] dst_addr The destination address for the route
1203  * \param[in] via_intf The downstream interface
1204  * \param[in] via_addr The address to pass to the downstream interface
1205  * \param[out] existed Whether the route existed
1206  *
1207  * \return RTI_TRUE on success, RTI_FALSE on failure. Note that is it not
1208  * considered a failure if the interface didn't exist.
1209  *
1210  * \sa \ref NETIO_Interface_delete_route, \ref NETIO_InterfaceI
1211  */
1212 FUNCTION_MUST_TYPEDEF(
1213 RTI_BOOL
1214 (*NETIO_Interface_delete_routeFunc)(
1215  NETIO_Interface_T *self,
1216  struct NETIO_Address *dst_addr,
1217  NETIO_Interface_T *via_intf,
1218  struct NETIO_Address *via_addr,
1219  RTI_BOOL *existed)
1220 )
1221 
1222 /*ci
1223  * \brief Definition of the \ref NETIO_InterfaceI bind method
1224  *
1225  * \param[in] netio_intf NETIO interface to bind
1226  * \param[in] src_addr The address to bind to
1227  * \param[in] property The property to use for the bind
1228  * \param[out] existed Whether a previous bind existed or not
1229  *
1230  * \return RTI_TRUE on success, RTI_FALSE on failure.
1231  *
1232  * \sa \ref NETIO_Interface_bind, \ref NETIO_InterfaceI
1233  */
1234 FUNCTION_MUST_TYPEDEF(
1235 RTI_BOOL
1236 (*NETIO_Interface_bindFunc)(NETIO_Interface_T *netio_intf,
1237  struct NETIO_Address *src_addr,
1238  struct NETIOBindProperty *property,
1239  RTI_BOOL *existed)
1240 )
1241 
1242 /*ci
1243  * \brief Definition of the \ref NETIO_InterfaceI unbind method
1244  *
1245  * \param[in] netio_intf NETIO interface to bind
1246  * \param[in] src_addr The address to unbind from
1247  * \param[in] dst_intf Interface to unbind from
1248  * \param[out] existed Whether a bind existed or not
1249  *
1250  * \return RTI_TRUE on success, RTI_FALSE on failure.
1251  *
1252  * \sa \ref NETIO_Interface_unbind, \ref NETIO_InterfaceI
1253  */
1254 FUNCTION_MUST_TYPEDEF(
1255 RTI_BOOL
1256 (*NETIO_Interface_unbindFunc)(NETIO_Interface_T *netio_intf,
1257  struct NETIO_Address *src_addr,
1258  NETIO_Interface_T *dst_intf,
1259  RTI_BOOL *existed)
1260 )
1261 
1262 /*ci
1263  * \brief Definition of the \ref NETIO_InterfaceI bind_external method
1264  *
1265  * \param[in] src_intf NETIO interface to bind to upstream interface
1266  * \param[in] src_addr The address to bind to
1267  * \param[in] dst_intf The upstream interface
1268  * \param[in] dst_addr The address to pass to the upstream interface
1269  * \param[in] property The properties for the bind
1270  * \param[out] existed Whether a previous bind already existed for this entry
1271  *
1272  * \return RTI_TRUE on success, RTI_FALSE on failure.
1273  *
1274  * \sa \ref NETIO_Interface_bind_external, \ref NETIO_InterfaceI
1275  */
1276 FUNCTION_MUST_TYPEDEF(
1277 RTI_BOOL
1278 (*NETIO_Interface_bind_externalFunc)(NETIO_Interface_T *src_intf,
1279  struct NETIO_Address *src_addr,
1280  NETIO_Interface_T *dst_intf,
1281  struct NETIO_Address *dst_addr,
1282  struct NETIOBindProperty *property,
1283  RTI_BOOL *existed)
1284 )
1285 
1286 /*ci
1287  * \brief Definition of the \ref NETIO_InterfaceI unbind_external method
1288  *
1289  * \param[in] src_intf NETIO interface to unbind from upstream interface
1290  * \param[in] src_addr The address to unbind from
1291  * \param[in] dst_intf The upstream interface
1292  * \param[in] dst_addr The address to passed to the upstream interface
1293  * \param[out] existed Whether a previous bind already existed for this entry
1294  *
1295  * \return RTI_TRUE on success, RTI_FALSE on failure.
1296  *
1297  * \sa \ref NETIO_Interface_unbind_external, \ref NETIO_InterfaceI
1298  */
1299 FUNCTION_MUST_TYPEDEF(
1300 RTI_BOOL
1301 (*NETIO_Interface_unbind_externalFunc)(NETIO_Interface_T *src_intf,
1302  struct NETIO_Address *src_addr,
1303  NETIO_Interface_T *dst_intf,
1304  struct NETIO_Address *dst_addr,
1305  RTI_BOOL *existed)
1306 )
1307 
1308 /*ci
1309  * \brief Definition of the \ref NETIO_InterfaceI get_external_interface method
1310  *
1311  * \param[in] netio_intf NETIO interface to get the external interface for
1312  * \param[in] src_addr The address to send to
1313  * \param[out] dst_intf The interface to use when sending to the address
1314  * \param[out] dst_addr The destination address to use when forwarding
1315  * packets to the destination interface
1316  *
1317  * \return RTI_TRUE on success, RTI_FALSE on failure.
1318  *
1319  * \sa \ref NETIO_Interface_get_external_interface, \ref NETIO_InterfaceI
1320  */
1321 FUNCTION_MUST_TYPEDEF(
1322 RTI_BOOL
1323 (*NETIO_Interface_get_external_interfaceFunc)(NETIO_Interface_T *netio_intf,
1324  struct NETIO_Address *src_addr,
1325  NETIO_Interface_T **dst_intf,
1326  struct NETIO_Address *dst_addr)
1327 )
1328 
1329 /*ci
1330  * \brief Definition of the \ref NETIO_InterfaceI reserve_address method
1331  *
1332  * \param[in] self NETIO interface to reserve addresses on
1333  * \param[in] req_address List of requested addresses
1334  * \param[inout] rsvd_address The downstream interface
1335  * \param[in] property Properties to use to listen on the reserved addresses
1336  *
1337  * \return RTI_TRUE on success, RTI_FALSE on failure.
1338  *
1339  * \sa \ref NETIO_Interface_reserve_address, \ref NETIO_InterfaceI
1340  */
1341 FUNCTION_MUST_TYPEDEF(
1342 RTI_BOOL
1343 (*NETIO_Interface_reserve_addressFunc)(NETIO_Interface_T *self,
1344  struct NETIO_AddressSeq *req_address,
1345  struct NETIO_AddressSeq *rsvd_address,
1346  struct NETIOBindProperty *property)
1347 )
1348 
1349 /*ci
1350  * \brief Definition of the \ref NETIO_InterfaceI release_address method
1351  *
1352  * \param[in] self NETIO interface to release addresses on
1353  * \param[in] address Address to release
1354  *
1355  * \return RTI_TRUE on success, RTI_FALSE on failure.
1356  *
1357  * \sa \ref NETIO_Interface_release_address, \ref NETIO_InterfaceI
1358  */
1359 FUNCTION_MUST_TYPEDEF(
1360 RTI_BOOL
1361 (*NETIO_Interface_release_addressFunc)(NETIO_Interface_T *self,
1362  struct NETIO_Address *src_addr)
1363 )
1364 
1365 /*ci
1366  * \brief Definition of the \ref NETIO_InterfaceI set_state method
1367  *
1368  * \param[in] netio_intf NETIO interface to set state on
1369  * \param[in] state New state
1370  *
1371  * \return RTI_TRUE on success, RTI_FALSE on failure.
1372  *
1373  * \sa \ref NETIO_Interface_set_state, \ref NETIO_InterfaceI
1374  */
1375 FUNCTION_MUST_TYPEDEF(
1376 RTI_BOOL
1377 (*NETIO_Interface_set_stateFunc)(NETIO_Interface_T *netio_intf,
1378  NETIO_InterfaceState_T state)
1379 )
1380 
1381 /*ci
1382  * \brief Definition of the \ref NETIO_InterfaceI resolve_adddress method
1383  *
1384  * \param[out] netio_intf Interface
1385  * \param[in] address_string Address to convert
1386  * \param[out] address_value Converted address on success
1387  * \param[out] is_invalid Whether the address is valid or not
1388  *
1389  * \return RTI_TRUE on success, RTI_FALSE on failure.
1390  *
1391  * \sa \ref NETIO_Interface_resolve_adddress, \ref NETIO_InterfaceI
1392  */
1393 FUNCTION_MUST_TYPEDEF(
1394 RTI_BOOL
1395 (*NETIO_Interface_resolve_adddressFunc)(NETIO_Interface_T *netio_intf,
1396  const char *address_string,
1397  struct NETIO_Address *address_value,
1398  RTI_BOOL *invalid)
1399 )
1400 
1401 /*ci
1402  * \brief Definition of the \ref NETIO_InterfaceI get_route_table method
1403  *
1404  * \param[in] netio_intf The NETIO interface
1405  * \param[inout] address Sequence of NETIO addresses this interface understands
1406  * \param[inout] netmask Sequence of the corresponding netmasks
1407  *
1408  * \return RTI_TRUE on success, RTI_FALSE on failure.
1409  *
1410  * \sa \ref NETIO_Interface_get_route_table, \ref NETIO_InterfaceI
1411  */
1412 FUNCTION_MUST_TYPEDEF(
1413 RTI_BOOL
1414 (*NETIO_Interface_get_route_tableFunc)(NETIO_Interface_T *netio_intf,
1415  struct NETIO_AddressSeq *address,
1416  struct NETIO_NetmaskSeq *netmask)
1417 )
1418 
1419 /*ci
1420  * \brief Definition of the \ref NETIO_InterfaceI post_event method
1421  *
1422  * \param[in] self The datawriter interface the event occurred on
1423  * \param[in] src_intf The source of the event
1424  * \param[in] event The NETIO event
1425  *
1426  * \return RTI_TRUE if the event was handled successfully, RTI_FALSE if not
1427  *
1428  * \sa \ref NETIO_Interface_post_event, \ref NETIO_InterfaceI
1429  */
1430 FUNCTION_MUST_TYPEDEF(
1431 RTI_BOOL
1432 (*NETIO_Interface_post_eventFunc)(NETIO_Interface_T *self,
1433  NETIO_Interface_T *src_intf,
1434  struct NETIO_Event *event)
1435 )
1436 
1437 /*ci
1438  * \brief NETIO_InterfaceI interface required to be implemented by all NETIO
1439  * layers.
1440  */
1441 struct NETIO_InterfaceI
1442 {
1443  /*ci
1444  * \brief Base-class interface
1445  */
1446  struct RT_ComponentI _parent;
1447 
1448  /*ci
1449  * \brief Method to send packets to one or more destinations
1450  */
1451  NETIO_Interface_sendFunc send;
1452 
1453  /*ci
1454  * \brief Method to ACK/NACK a packet upstream
1455  */
1456  NETIO_Interface_acknackFunc acknack;
1457 
1458  /*ci
1459  * \brief Method to request packet upstream
1460  */
1461  NETIO_Interface_requestFunc request;
1462 
1463  NETIO_Interface_return_loanFunc return_loan;
1464 
1465  /*ci
1466  * \brief Method to cancel a transmission downstream
1467  */
1468  NETIO_Interface_xmit_removeFunc xmit_remove;
1469 
1470  /*ci
1471  * \brief Method to add a destination route to an interface
1472  */
1473  NETIO_Interface_add_routeFunc add_route;
1474 
1475  /*ci
1476  * \brief Method to remote a route to a destination from an interface
1477  */
1478  NETIO_Interface_delete_routeFunc delete_route;
1479 
1480  /*ci
1481  * \brief Method to reserve addresses to listen to on an interface
1482  */
1483  NETIO_Interface_reserve_addressFunc reserve_address;
1484 
1485  /*ci
1486  * \brief Method to start listening for data from a peer interface
1487  */
1488  NETIO_Interface_bindFunc bind;
1489 
1490  /*ci
1491  * \brief Method to stop listening for data from a peer interface
1492  */
1493  NETIO_Interface_unbindFunc unbind;
1494 
1495  /*ci
1496  * \brief Method to forward a packet to an interface upstream
1497  */
1498  NETIO_Interface_receiveFunc receive;
1499 
1500  /*ci
1501  * \brief Method to get the interface to forward packets to from an
1502  * downstream interface
1503  */
1504  NETIO_Interface_get_external_interfaceFunc get_external_interface;
1505 
1506  /*ci
1507  * \brief Method to add a path from an interface to an upstream interface
1508  */
1509  NETIO_Interface_bind_externalFunc bind_external;
1510 
1511  /*ci
1512  * \brief Method to remove a path from an interface to an upstream interface
1513  */
1514  NETIO_Interface_unbind_externalFunc unbind_external;
1515 
1516  /*ci
1517  * \brief Method to set the state of an interface
1518  */
1519  NETIO_Interface_set_stateFunc set_state;
1520 
1521  /*ci
1522  * \brief Method to release addresses to listen to on an interface
1523  */
1524  NETIO_Interface_release_addressFunc release_address;
1525 
1526  /*ci
1527  * \brief Method to query an interface if it can resolve an address or not
1528  */
1529  NETIO_Interface_resolve_adddressFunc resolve_address;
1530 
1531  /*ci
1532  * \brief Method to query an interface for what addresses it can forward
1533  * packets too
1534  */
1535  NETIO_Interface_get_route_tableFunc get_route_table;
1536 
1537  /*ci
1538  * \brief Method to post external events to an interface
1539  */
1540  NETIO_Interface_post_eventFunc post_event;
1541 };
1542 
1543 /*ci
1544  * \brief Wrapper to call of the NETIO_InterfaceFactory->create_component
1545  *
1546  * \param[in] f_ The NETIO interface factory
1547  * \param[in] p_ The property
1548  * \param[in] l_ The listener
1549  */
1550 #define NETIO_InterfaceFactory_create_component(f_,p_,l_) \
1551  (NETIO_Interface_T*)((f_)->intf->create_component(\
1552  (f_),p_,l_))
1553 
1554 /*ci
1555  * \brief Wrapper to call of the NETIO_InterfaceFactory->delete_component
1556  *
1557  * \param[in] f_ The NETIO interface factory
1558  * \param[in] intf_ The NETIO interface to delete
1559  */
1560 #define NETIO_InterfaceFactory_delete_component(f_,intf_) \
1561  (f_)->intf->delete_component(f_,(&(intf_)->_parent))
1562 
1563 /*ci
1564  * \brief Wrapper to call the \ref NETIO_InterfaceI::send
1565  *
1566  * \details
1567  * Forward a packet from a source interface to a destination
1568  *
1569  * \param[in] self_ NETIO interface to send from
1570  * \param[in] src_intf_ The source interface for the packet
1571  * \param[in] dst_addr_ The destination address for the packet
1572  * \param[in] pkt_ The packet to send
1573  *
1574  * \return RTI_TRUE on success, RTI_FALSE on failure
1575  */
1576 #define NETIO_Interface_send(self_,src_intf_,dst_addr_,pkt_) \
1577  ((struct NETIO_InterfaceI*)(\
1578  (self_)->_parent._intf))->send(self_,src_intf_,dst_addr_,pkt_)
1579 
1580 /*ci
1581  * \brief Wrapper to call \ref NETIO_InterfaceI::acknack
1582  *
1583  * \details
1584  * An acknack is processed for a peer. If all peers who should receive this
1585  * sample as acked it, then it can be ack'ed in the queue and is up for removal
1586  * A peer (source parameter) must acknack a sample at most once.
1587  *
1588  * \param[in] self_ The NETIO interface receiving the acknack
1589  * \param[in] src_intf_ The peer source address of the acknack
1590  * \param[in] sn_ The packet_id/SN of the NETIO_Packet being acked/nacked
1591  * \param[in] nack_ RTI_TRUE if this is a negative acknowledgment
1592  *
1593  * \return RTI_TRUE on success, RTI_FALSE on failure
1594  */
1595 #define NETIO_Interface_acknack(self_,src_intf_,sn_,nack_) \
1596  ((struct NETIO_InterfaceI*)(\
1597  (self_)->_parent._intf))->acknack(self_,src_intf_,sn_,nack_)
1598 
1599 /*ci
1600  * \brief Wrapper to call \ref NETIO_InterfaceI::request
1601  *
1602  * \details
1603  * Request a SN from source interface and destination address.
1604  * if SN is not available nextpktid_ contains the next available
1605  * SN.
1606  *
1607  * \param[in] self_ The NETIO interface receiving the request
1608  * \param[in] src_ The peer source address of the request
1609  * \param[in] dst_ The peer destination address of the request
1610  * \param[in] pkt_ The requested packet if it existed, NULL
1611  * otherwise
1612  * \param[in] pktid_ The packet_id/SN of the NETIO_Packet being
1613  * requested
1614  * \param[in] nextpktid_ The if packet_id is not available, the next
1615  * available SN/packet_id
1616  *
1617  * \return RTI_TRUE on success, RTI_FALSE on failure
1618  */
1619 #define NETIO_Interface_request(self_,src_,dst_,pkt_,pktid_,nextpktid_) \
1620  ((struct NETIO_InterfaceI*)(\
1621  (self_)->_parent._intf))->request(self_,src_,dst_,pkt_,pktid_,nextpktid_)
1622 
1623 #define NETIO_Interface_return_loan(self_,src_,pkt_,pkt_id_) \
1624  ((struct NETIO_InterfaceI*)(\
1625  (self_)->_parent._intf))->return_loan(self_,src_,pkt_,pkt_id_)
1626 
1627 /*ci
1628  * \brief Wrapper to call \ref NETIO_InterfaceI::xmit_remove
1629  *
1630  * \details
1631  * Inform all downstream interfaces all attempts at delivering a packet
1632  * should be cancelled.
1633  *
1634  * \param[in] self_ NETIO interface to cancel a transmit on
1635  * \param[in] dst_ The destination address of the packet
1636  * \param[in] pkt_id_ The packet_id/SN of the NETIO_Packet to cancel
1637  *
1638  * \return RTI_TRUE on success, RTI_FALSE on failure
1639  */
1640 #define NETIO_Interface_xmit_remove(self_,dst_,pkt_id_) \
1641  ((struct NETIO_InterfaceI*)(\
1642  (self_)->_parent._intf))->xmit_remove(self_,dst_,pkt_id_)
1643 
1644 /*ci
1645  * \brief Wrapper to call \ref NETIO_InterfaceI::add_route
1646  *
1647  * \details
1648  * Add route to a matching peer to be reached via a downstream interface
1649  * using the specified downstream address.
1650  *
1651  * \param[in] self_ NETIO interface to add the route too
1652  * \param[in] dst_ The destination address for the route
1653  * \param[in] intf_ The downstream interface
1654  * \param[in] intf_addr The address to pass to the downstream interface
1655  * \param[in] prop_ The route property
1656  * \param[in] ex_ Whether the route already existed
1657  *
1658  * \return RTI_TRUE on success, RTI_FALSE on failure
1659  */
1660 #define NETIO_Interface_add_route(self_,dst_,intf_,intf_addr,prop_,ex_) \
1661  ((struct NETIO_InterfaceI*)(\
1662  (self_)->_parent._intf))->add_route(self_,dst_,intf_,intf_addr,prop_,ex_)
1663 
1664 /*ci
1665  * \brief Wrapper to call \ref NETIO_InterfaceI::delete_route
1666  *
1667  * \details
1668  * Remove a route to a peer, either because it no longer matches or that the
1669  * peer has been deleted.
1670  *
1671  * \param[in] self_ NETIO interface to add the route too
1672  * \param[in] dst_ The destination address for the route
1673  * \param[in] intf_ The downstream interface
1674  * \param[in] intf_addr_ The address to pass to the downstream interface
1675  * \param[out] exist_ Whether the route existed
1676  *
1677  * \return RTI_TRUE on success, RTI_FALSE on failure. Note that is it not
1678  * considered a failure if the interface didn't exist.
1679  */
1680 #define NETIO_Interface_delete_route(self_,dst_,intf_,intf_addr_,exist_) \
1681  ((struct NETIO_InterfaceI*)(\
1682  (self_)->_parent._intf))->delete_route(self_,dst_,intf_,intf_addr_,exist_)
1683 
1684 /*ci
1685  * \brief Wrapper to call \ref NETIO_InterfaceI::reserve_address
1686  *
1687  * \details
1688  * Reserve addresses on an interface too listen using the requested addresses
1689  * as the starting point. The resulting addresses may be fewer than requested,
1690  * even 0 is legal.
1691  *
1692  * \param[in] self_ NETIO interface to reserve addresses on
1693  * \param[in] src_addr_ List of requested addresses
1694  * \param[inout] pub_addr_ List of addresses that are reserved
1695  * \param[in] prop_ Properties to use to listen on the reserved addresses
1696  *
1697  * \return RTI_TRUE on success, RTI_FALSE on failure.
1698  */
1699 #define NETIO_Interface_reserve_address(self_,src_addr_,pub_addr_,prop_)\
1700 ((struct NETIO_InterfaceI*)(\
1701 (self_)->_parent._intf))->reserve_address(self_,src_addr_,pub_addr_,prop_)
1702 
1703 /*ci
1704  * \brief Wrapper to call \ref NETIO_InterfaceI::release_address
1705  *
1706  * Release an address previsously reserved. The address will no longer be
1707  * listened on by the caller.
1708  *
1709  * \param[in] self_ NETIO interface to release addresses on
1710  * \param[in] src_addr_ Address to release
1711  *
1712  * \return RTI_TRUE on success, RTI_FALSE on failure.
1713  */
1714 #define NETIO_Interface_release_address(self_,src_addr_)\
1715 ((struct NETIO_InterfaceI*)(\
1716 (self_)->_parent._intf))->release_address(self_,src_addr_)
1717 
1718 /*ci
1719  * \brief Wrapper to call \ref NETIO_InterfaceI::bind
1720  *
1721  * \details
1722  * When an interface is matched with another interface (how is outside the
1723  * scope of this function) an entry in the bind-table for the interface is
1724  * created. The peer-to-peer state between the two interfaces should be
1725  * maintained based on this relationship until an unbind is performed.
1726  *
1727  * \param[in] self_ NETIO interface to bind
1728  * \param[in] src_ The address to bind to
1729  * \param[in] prop_ The property to use for the bind
1730  * \param[out] ex_ Whether a previous bind existed or not
1731  *
1732  * \return RTI_TRUE on success, RTI_FALSE on failure.
1733  */
1734 #define NETIO_Interface_bind(self_,src_,prop_,ex_) \
1735  ((struct NETIO_InterfaceI*)(\
1736  (self_)->_parent._intf))->bind(self_,src_,prop_,ex_)
1737 
1738 /*ci
1739  * \brief Wrapper to call \ref NETIO_InterfaceI::unbind
1740  *
1741  * \details
1742  * When an interface is unmatched from another interface (how is outside the
1743  * scope of this function) any entry in the bind-table for the interface can
1744  * safely be removed (although not required). No state is expected to be
1745  * maintained from this point on
1746  *
1747  * \param[in] self_ NETIO interface to unbind
1748  * \param[in] src_ The address to unbind from
1749  * \param[in] dst_ Interface to unbind from
1750  * \param[out] exist_ Whether a bind existed or not
1751  *
1752  * \return RTI_TRUE on success, RTI_FALSE on failure.
1753  */
1754 #define NETIO_Interface_unbind(self_,src_,dst_,exist_) \
1755  ((struct NETIO_InterfaceI*)(\
1756  (self_)->_parent._intf))->unbind(self_,src_,dst_,exist_)
1757 
1758 /*ci
1759  * \brief Wrapper to call \ref NETIO_InterfaceI::bind_external
1760  *
1761  * \details
1762  * When an upstream interface want to listen to a data from a local
1763  * downstream interface it binds to the downstream interface using the
1764  * external bind function. This typically means adding an interface to a
1765  * bind table in the downstream interface so the downstream interface is
1766  * able to forward data upstream.
1767  *
1768  * \param[in] src_intf_ NETIO interface to bind to upstream interface
1769  * \param[in] src_adr_ The address to bind to
1770  * \param[in] dst_intf_ The upstream interface
1771  * \param[in] dst_adr_ The address to pass to the upstream interface
1772  * \param[in] p_ The properties for the bind
1773  * \param[out] e_ Whether a previous bind already existed for this entry
1774  *
1775  * \return RTI_TRUE on success, RTI_FALSE on failure.
1776  */
1777 #define NETIO_Interface_bind_external(src_intf_,src_adr_,dst_intf_,dst_adr_,p_,e_) \
1778 ((struct NETIO_InterfaceI*)(\
1779  (src_intf_)->_parent._intf))->bind_external(src_intf_,src_adr_,dst_intf_,dst_adr_,p_,e_)
1780 
1781 /*ci
1782  * \brief Wrapper to call \ref NETIO_InterfaceI::unbind_external
1783  *
1784  * \details
1785  * When an upstream interface no longer want to listen to a data from a local
1786  * downstream interface it unbinds from the downstream interface using the
1787  * external unbind function. This typically means removing an interface from a
1788  * bind table in the downstream interface so the downstream interface no longer
1789  * forwards data upstream to a non-existant interface.
1790  *
1791  * \param[in] src_intf_ NETIO interface to unbind from upstream interface
1792  * \param[in] src_adr_ The address to unbind from
1793  * \param[in] dst_adr_ The upstream interface
1794  * \param[in] dst_intf_ The address to passed to the upstream interface
1795  * \param[out] exist_ Whether a previous bind already existed for this entry
1796  *
1797  * \return RTI_TRUE on success, RTI_FALSE on failure.
1798  */
1799 #define NETIO_Interface_unbind_external(src_intf_,src_adr_,dst_adr_,dst_intf_,exist_) \
1800 ((struct NETIO_InterfaceI*)(\
1801  (src_intf_)->_parent._intf))->unbind_external(src_intf_,src_adr_,dst_adr_,dst_intf_,exist_)
1802 
1803 /*ci
1804  * \brief Wrapper to call \ref NETIO_InterfaceI::receive
1805  *
1806  * \details
1807  *
1808  * A NETIO interface receives data from a downstream interface.
1809  * The data can be in in different protocol formats. Depending on the
1810  * downstream protocol different actions may be taken, but semantically it
1811  * should not matter where data is coming from. The receive interface is
1812  * synchronous, _all_ processing takes place in the context of the downstream
1813  * receive context, such as a thread.
1814  *
1815  * \param[in] self_ The interface receiving data
1816  * \param[in] src_ The source address of the data
1817  * \param[in] dst_ The destination address of the data
1818  * \param[in] p_ A NETIO_Packet with the payload
1819  *
1820  * \return RTI_TRUE on success, RTI_FALSE on failure
1821  */
1822 #define NETIO_Interface_receive(self_,src_,dst_,p_) \
1823  ((struct NETIO_InterfaceI*)(\
1824  (self_)->_parent._intf))->receive(self_,src_,dst_,p_)
1825 
1826 /*ci
1827  * \brief Wrapper to call \ref NETIO_InterfaceI::get_external_interface
1828  *
1829  * \details
1830  * When an interface is bound to a downstream interface it is must provide
1831  * which interface and address the downstream interface should use when
1832  * forwarding a NETIO_Packet.
1833  *
1834  * \param[in] self_ NETIO interface to get the external interface for
1835  * \param[in] src_ The address to send to
1836  * \param[out] ul_ The interface to use
1837  * \param[out] dst_ The destination address to use
1838  *
1839  * \return RTI_TRUE on success, RTI_FALSE on failure.
1840  */
1841 #define NETIO_Interface_get_external_interface(self_,src_,ul_,dst_) \
1842  ((struct NETIO_InterfaceI*)(\
1843  (self_)->_parent._intf))->get_external_interface(self_,src_,ul_,dst_)
1844 
1845 /*ci
1846  * \brief Wrapper to call \ref NETIO_InterfaceI::set_state
1847  *
1848  * \details
1849  * Set the state of an interface, the interface is not required to perform
1850  * any action, this is interface dependent.
1851  *
1852  * \param[in] self_ NETIO interface to set state on
1853  * \param[in] state_ New state
1854  *
1855  * \return RTI_TRUE on success, RTI_FALSE on failure.
1856  */
1857 #define NETIO_Interface_set_state(self_,state_) \
1858  ((struct NETIO_InterfaceI*)(\
1859  (self_)->_parent._intf))->set_state(self_,state_)
1860 
1861 /*ci
1862  * \brief Wrapper to call \ref NETIO_InterfaceI::resolve_address
1863  *
1864  * \details
1865  * Request an interface to convert a string address to a \ref NETIO_Address.
1866  * If an interface successfully translated it is_invalid_ is set to RTI_TRUE,
1867  * otherwise false and the content of the output is undefined.
1868  *
1869  * \param[out] self_ Interface requested to do the conversion
1870  * \param[in] address_ Address to convert
1871  * \param[out] resolved_ Converted address on success
1872  * \param[out] is_invalid_ Whether the address is valid or not
1873  *
1874  * \return RTI_TRUE on success, RTI_FALSE on failure.
1875  */
1876 #define NETIO_Interface_resolve_address(self_,address_,resolved_,is_invalid_) \
1877 ((struct NETIO_InterfaceI*)(\
1878  (self_)->_parent._intf))->resolve_address(self_,address_,resolved_,is_invalid_)
1879 
1880 /*ci
1881  * \brief Wrapper to call \ref NETIO_InterfaceI::get_route_table
1882  *
1883  * \details
1884  * Query an interface for what addresses it can forward packets too. Not
1885  * all interfaces provides a routing table, this is implementation dependent.
1886  *
1887  * \param[in] self_ The NETIO interface
1888  * \param[inout] address_ Sequence of NETIO addresses this interface understands
1889  * \param[inout] netmask_ Sequence of the corresponding netmasks
1890  *
1891  * \return RTI_TRUE on success, RTI_FALSE on failure.
1892  */
1893 #define NETIO_Interface_get_route_table(self_,address_,netmask_) \
1894  ((struct NETIO_InterfaceI*)(\
1895  (self_)->_parent._intf))->get_route_table(self_,address_,netmask_)
1896 
1897 /*ci
1898  * \brief Wrapper to call \ref NETIO_InterfaceI::post_event
1899  *
1900  * \details
1901  * Post an external event on the interface
1902  *
1903  * \param[in] self_ The interface interface the event occurred on
1904  * \param[in] src_intf_ The source of the event
1905  * \param[in] event_ The NETIO event
1906  *
1907  * \return RTI_TRUE if the event was handled successfully, RTI_FALSE if not
1908  */
1909 #define NETIO_Interface_post_event(self_,src_intf_,event_) \
1910  ((struct NETIO_InterfaceI*)(\
1911  (self_)->_parent._intf))->post_event(self_,src_intf_,event_)
1912 
1913 #ifdef __cplusplus
1914 }
1915 #endif
1916 
1917 
1918 #endif /* netio_interface_h */
1919 
1920 /*ci @} */

RTI Connext Micro Version 2.4.4.0 Copyright © Thu Apr 30 2015 Real-Time Innovations, Inc