22 #ifndef netio_interface_h
23 #define netio_interface_h
29 #ifndef osapi_config_h
39 #ifndef reda_sequenceNumber_h
40 #include "reda/reda_sequenceNumber.h"
44 #include "db/db_api.h"
51 #ifndef netio_address_h
52 #include "netio/netio_address.h"
78 #define NETIO_PROTOCOL_INTRA (1)
84 #define NETIO_PROTOCOL_RTPS (2)
90 #define NETIO_PROTOCOL_UDP (3)
100 #define NETIO_RTPS_FLAGS_DISPOSE (0x1)
107 #define NETIO_RTPS_FLAGS_UNREGISTER (0x2)
113 #define NETIO_RTPS_FLAGS_LIVELINESS (0x4)
119 #define NETIO_RTPS_FLAGS_INLINEQOS (0x8)
126 #define NETIO_RTPS_FLAGS_LOST_DATA (0x10)
134 #define NETIO_RTPS_FLAGS_COMMIT_DATA (0x20)
142 #define NETIO_RTPS_FLAGS_DATA (0x40)
148 #define NETIO_RTPS_FLAGS_LAST_WRITE_FOR_SN (0x80)
154 #define NETIO_RTPS_FLAGS_LITTLE_ENDIAN (0x100)
159 struct NETIO_RtpsInfo
164 struct REDA_Buffer *inline_data;
169 struct NETIO_GuidPrefix guid_prefix;
175 struct NETIO_IntraInfo
180 const void *user_data;
186 struct REDA_Buffer *inline_data;
192 #define NETIO_IntraInfo_INITIALIZER \
201 struct NETIO_PacketInfo
206 struct REDA_SequenceNumber sn;
218 RTI_UINT8 valid_data;
223 struct NETIO_Guid instance;
228 RTI_UINT32 rtps_flags;
234 struct REDA_SequenceNumber committable_sn;
241 struct REDA_SequenceNumber first_available_sn;
247 struct REDA_SequenceNumber lost_sample_sn;
253 RTI_UINT32 lost_sample_count;
259 RTI_INT32 protocol_id;
267 struct NETIO_IntraInfo intra_info;
268 struct NETIO_RtpsInfo rtps_data;
276 #define NETIO_PacketInfo_INITIALIZER \
278 REDA_SEQUENCE_NUMBER_ZERO, \
279 OSAPI_NTP_TIME_ZERO, \
282 NETIO_ADDRESS_GUID_UNKNOWN, \
284 REDA_SEQUENCE_NUMBER_ZERO, \
285 REDA_SEQUENCE_NUMBER_ZERO, \
286 REDA_SEQUENCE_NUMBER_ZERO, \
289 {{NULL,NULL},{NULL,{{0,0,0,0,0,0,0,0,0,0,0,0}}}}\
305 struct NETIO_Address source;
317 RTI_SIZE_T max_length;
333 RTI_SIZE_T saved_head_pos;
339 RTI_SIZE_T saved_tail_pos;
345 struct NETIO_PacketInfo info;
350 struct NETIO_AddressSeq *dests;
356 typedef struct NETIO_Packet NETIO_Packet_T;
363 typedef struct REDA_SequenceNumber NETIO_PacketId_T;
369 #define NETIO_Packet_INITIALIZER \
371 NETIO_Address_INITIALIZER,\
378 NETIO_PacketInfo_INITIALIZER,\
395 MUST_CHECK_RETURN NETIODllExport
RTI_BOOL
396 NETIO_Packet_set_head(NETIO_Packet_T *packet,RTI_INT32 delta);
411 MUST_CHECK_RETURN NETIODllExport
RTI_BOOL
412 NETIO_Packet_set_tail(NETIO_Packet_T *packet,RTI_INT32 delta);
428 MUST_CHECK_RETURN NETIODllExport
void*
429 NETIO_Packet_get_head(NETIO_Packet_T *packet);
445 MUST_CHECK_RETURN NETIODllExport
void*
446 NETIO_Packet_get_tail(NETIO_Packet_T *packet);
467 MUST_CHECK_RETURN NETIODllExport
RTI_BOOL
468 NETIO_Packet_initialize(NETIO_Packet_T *packet,
470 RTI_SIZE_T init_length,
471 RTI_SIZE_T trailer_length,
472 struct NETIO_AddressSeq *dest_seq);
485 SHOULD_CHECK_RETURN NETIODllExport
RTI_BOOL
486 NETIO_Packet_finalize(NETIO_Packet_T *packet);
499 MUST_CHECK_RETURN NETIODllExport
struct NETIO_PacketInfo*
500 NETIO_Packet_get_info(NETIO_Packet_T *packet);
503 NETIO_Packet_set_source(NETIO_Packet_T *packet,
struct NETIO_Address *src);
516 SHOULD_CHECK_RETURN NETIODllExport RTI_SIZE_T
517 NETIO_Packet_get_payload_length(NETIO_Packet_T *packet);
532 NETIO_Packet_save_positions(NETIO_Packet_T *packet);
546 NETIO_Packet_restore_positions(NETIO_Packet_T *packet);
562 NETIO_Packet_save_positions_to(NETIO_Packet_T *packet,
580 NETIO_Packet_restore_positions_from(NETIO_Packet_T *packet,
597 struct NETIO_InterfaceProperty
599 struct RT_ComponentProperty _parent;
600 RTI_INT32 max_routes;
608 #define NETIO_InterfaceProperty_INITIALIZER \
610 RT_ComponentProperty_INITIALIZER,\
623 struct NETIO_InterfaceListener
628 struct RT_ComponentListener _parent;
635 #define NETIO_InterfaceListener_INITIALIZE \
637 RT_ComponentListener_INITIALIZER \
650 struct NETIO_InterfaceFactoryProperty
655 struct RT_ComponentFactoryProperty _parent;
662 #define NETIO_InterfaceFactoryProperty_INITIALIZER \
664 RT_ComponentFactoryProperty_INITIALIZER \
675 NETIO_INTERFACESTATE_CREATED,
680 NETIO_INTERFACESTATE_ENABLED
681 } NETIO_InterfaceState_T;
692 struct NETIO_Interface
697 struct RT_Component _parent;
713 struct NETIO_InterfaceListener _listener;
720 struct NETIO_Address local_address;
725 NETIO_InterfaceState_T state;
731 typedef struct NETIO_Interface NETIO_Interface_T;
736 struct NETIOBindProperty
749 #define NETIOBindProperty_INITIALIZER \
757 struct NETIORouteProperty
766 #define NETIORouteProperty_INITIALIZER \
774 struct NETIOBindEntryKey
779 struct NETIO_Address source;
784 struct NETIO_Address destination;
790 struct NETIOBindEntry
795 struct NETIO_Address source;
800 struct NETIO_Address destination;
805 NETIO_Interface_T *intf;
816 NETIO_ROUTESTATE_ACTIVE,
821 NETIO_ROUTESTATE_INACTIVE
822 } NETIO_RouteState_T;
828 struct NETIORouteEntryKey
833 struct NETIO_Address destination;
838 NETIO_Interface_T *intf;
843 struct NETIO_Address intf_address;
849 struct NETIORouteEntry
854 struct NETIO_Address destination;
859 NETIO_Interface_T *intf;
864 struct NETIO_Address intf_address;
869 NETIO_RouteState_T state;
880 NETIO_EVENTKIND_INACTIVE_PEER,
885 NETIO_EVENTKIND_ACTIVE_PEER
891 struct NETIO_Event_PeerActivity
896 struct NETIO_Address peer_addr;
901 RTI_INT32 inactive_total;
906 RTI_INT32 inactive_change;
911 RTI_INT32 active_total;
916 RTI_INT32 active_change;
928 NETIO_EventKind_T kind;
934 struct NETIO_Event_PeerActivity peer_activity;
938 struct NETIO_InterfaceI;
952 NETIO_Interface_Table_name_from_id(
char *tbl_name,
953 union RT_ComponentFactoryId *
id,
969 MUST_CHECK_RETURN NETIODllExport
RTI_BOOL
970 NETIO_Interface_initialize(
struct NETIO_Interface *netio,
971 struct NETIO_InterfaceI *netio_intf,
972 const struct NETIO_InterfaceProperty *
const property,
973 const struct NETIO_InterfaceListener *
const listener);
984 SHOULD_CHECK_RETURN NETIODllExport
RTI_BOOL
985 NETIO_Interface_finalize(
struct NETIO_Interface *netio);
1002 MUST_CHECK_RETURN NETIODllExport RTI_INT32
1003 NETIO_Interface_compare_route(RTI_INT32 flags,
1004 const DB_Record_T op1,
void *op2);
1021 MUST_CHECK_RETURN NETIODllExport RTI_INT32
1022 NETIO_Interface_compare_bind(RTI_INT32 flags,
1023 const DB_Record_T op1,
void *op2);
1037 FUNCTION_MUST_TYPEDEF(
1039 (*NETIO_Interface_sendFunc)(
1040 NETIO_Interface_T *
self,
1041 struct NETIO_Interface *source,
1042 struct NETIO_Address *destination,
1043 NETIO_Packet_T *packet)
1058 FUNCTION_MUST_TYPEDEF(
1060 (*NETIO_Interface_receiveFunc)(
1061 NETIO_Interface_T *netio_intf,
1062 struct NETIO_Address *src_addr,
1063 struct NETIO_Address *dst_addr,
1064 NETIO_Packet_T *packet)
1079 FUNCTION_MUST_TYPEDEF(
1081 (*NETIO_Interface_acknackFunc)(
1082 NETIO_Interface_T *
self,
1083 struct NETIO_Address *source,
1084 NETIO_PacketId_T *packet_id,
1105 FUNCTION_MUST_TYPEDEF(
1107 (*NETIO_Interface_requestFunc)(
1108 NETIO_Interface_T *
self,
1109 struct NETIO_Address *source,
1110 struct NETIO_Address *dest,
1111 NETIO_Packet_T **packet,
1112 NETIO_PacketId_T *packet_id,
1113 NETIO_PacketId_T *actual_packet_id)
1117 FUNCTION_MUST_TYPEDEF(
1119 (*NETIO_Interface_return_loanFunc)(
1120 NETIO_Interface_T *
self,
1121 struct NETIO_Address *source,
1122 NETIO_Packet_T *packet,
1123 NETIO_PacketId_T *packet_id)
1137 FUNCTION_MUST_TYPEDEF(
1139 (*NETIO_Interface_xmit_removeFunc)(
1140 NETIO_Interface_T *
self,
1141 struct NETIO_Address *destination,
1142 NETIO_PacketId_T *packet_id)
1157 FUNCTION_MUST_TYPEDEF(
1159 (*NETIO_Interface_add_routeFunc)(
1160 NETIO_Interface_T *
self,
1161 struct NETIO_Address *dst_addr,
1162 NETIO_Interface_T *via_intf,
1163 struct NETIO_Address *via_addr,
1164 struct NETIORouteProperty *property,
1182 FUNCTION_MUST_TYPEDEF(
1184 (*NETIO_Interface_delete_routeFunc)(
1185 NETIO_Interface_T *
self,
1186 struct NETIO_Address *dst_addr,
1187 NETIO_Interface_T *via_intf,
1188 struct NETIO_Address *via_addr,
1204 FUNCTION_MUST_TYPEDEF(
1206 (*NETIO_Interface_bindFunc)(NETIO_Interface_T *netio_intf,
1207 struct NETIO_Address *src_addr,
1208 struct NETIOBindProperty *property,
1224 FUNCTION_MUST_TYPEDEF(
1226 (*NETIO_Interface_unbindFunc)(NETIO_Interface_T *netio_intf,
1227 struct NETIO_Address *src_addr,
1228 NETIO_Interface_T *dst_intf,
1246 FUNCTION_MUST_TYPEDEF(
1248 (*NETIO_Interface_bind_externalFunc)(NETIO_Interface_T *src_intf,
1249 struct NETIO_Address *src_addr,
1250 NETIO_Interface_T *dst_intf,
1251 struct NETIO_Address *dst_addr,
1252 struct NETIOBindProperty *property,
1269 FUNCTION_MUST_TYPEDEF(
1271 (*NETIO_Interface_unbind_externalFunc)(NETIO_Interface_T *src_intf,
1272 struct NETIO_Address *src_addr,
1273 NETIO_Interface_T *dst_intf,
1274 struct NETIO_Address *dst_addr,
1291 FUNCTION_MUST_TYPEDEF(
1293 (*NETIO_Interface_get_external_interfaceFunc)(NETIO_Interface_T *netio_intf,
1294 struct NETIO_Address *src_addr,
1295 NETIO_Interface_T **dst_intf,
1296 struct NETIO_Address *dst_addr)
1311 FUNCTION_MUST_TYPEDEF(
1313 (*NETIO_Interface_reserve_addressFunc)(NETIO_Interface_T *
self,
1314 struct NETIO_AddressSeq *req_address,
1315 struct NETIO_AddressSeq *rsvd_address,
1316 struct NETIOBindProperty *property)
1329 FUNCTION_MUST_TYPEDEF(
1331 (*NETIO_Interface_release_addressFunc)(NETIO_Interface_T *
self,
1332 struct NETIO_Address *src_addr)
1345 FUNCTION_MUST_TYPEDEF(
1347 (*NETIO_Interface_set_stateFunc)(NETIO_Interface_T *netio_intf,
1348 NETIO_InterfaceState_T state)
1363 FUNCTION_MUST_TYPEDEF(
1365 (*NETIO_Interface_resolve_adddressFunc)(NETIO_Interface_T *netio_intf,
1366 const char *address_string,
1367 struct NETIO_Address *address_value,
1382 FUNCTION_MUST_TYPEDEF(
1384 (*NETIO_Interface_get_route_tableFunc)(NETIO_Interface_T *netio_intf,
1385 struct NETIO_AddressSeq *address,
1386 struct NETIO_NetmaskSeq *netmask)
1400 FUNCTION_MUST_TYPEDEF(
1402 (*NETIO_Interface_post_eventFunc)(NETIO_Interface_T *
self,
1403 NETIO_Interface_T *src_intf,
1404 struct NETIO_Event *event)
1411 struct NETIO_InterfaceI
1416 struct RT_ComponentI _parent;
1421 NETIO_Interface_sendFunc send;
1426 NETIO_Interface_acknackFunc acknack;
1431 NETIO_Interface_requestFunc request;
1433 NETIO_Interface_return_loanFunc return_loan;
1438 NETIO_Interface_xmit_removeFunc xmit_remove;
1443 NETIO_Interface_add_routeFunc add_route;
1448 NETIO_Interface_delete_routeFunc delete_route;
1453 NETIO_Interface_reserve_addressFunc reserve_address;
1458 NETIO_Interface_bindFunc bind;
1463 NETIO_Interface_unbindFunc unbind;
1468 NETIO_Interface_receiveFunc receive;
1474 NETIO_Interface_get_external_interfaceFunc get_external_interface;
1479 NETIO_Interface_bind_externalFunc bind_external;
1484 NETIO_Interface_unbind_externalFunc unbind_external;
1489 NETIO_Interface_set_stateFunc set_state;
1494 NETIO_Interface_release_addressFunc release_address;
1499 NETIO_Interface_resolve_adddressFunc resolve_address;
1505 NETIO_Interface_get_route_tableFunc get_route_table;
1510 NETIO_Interface_post_eventFunc post_event;
1520 #define NETIO_InterfaceFactory_create_component(f_,p_,l_) \
1521 (NETIO_Interface_T*)((f_)->intf->create_component(\
1530 #define NETIO_InterfaceFactory_delete_component(f_,intf_) \
1531 (f_)->intf->delete_component(f_,(&(intf_)->_parent))
1546 #define NETIO_Interface_send(self_,src_intf_,dst_addr_,pkt_) \
1547 ((struct NETIO_InterfaceI*)(\
1548 (self_)->_parent._intf))->send(self_,src_intf_,dst_addr_,pkt_)
1565 #define NETIO_Interface_acknack(self_,src_intf_,sn_,nack_) \
1566 ((struct NETIO_InterfaceI*)(\
1567 (self_)->_parent._intf))->acknack(self_,src_intf_,sn_,nack_)
1589 #define NETIO_Interface_request(self_,src_,dst_,pkt_,pktid_,nextpktid_) \
1590 ((struct NETIO_InterfaceI*)(\
1591 (self_)->_parent._intf))->request(self_,src_,dst_,pkt_,pktid_,nextpktid_)
1593 #define NETIO_Interface_return_loan(self_,src_,pkt_,pkt_id_) \
1594 ((struct NETIO_InterfaceI*)(\
1595 (self_)->_parent._intf))->return_loan(self_,src_,pkt_,pkt_id_)
1610 #define NETIO_Interface_xmit_remove(self_,dst_,pkt_id_) \
1611 ((struct NETIO_InterfaceI*)(\
1612 (self_)->_parent._intf))->xmit_remove(self_,dst_,pkt_id_)
1630 #define NETIO_Interface_add_route(self_,dst_,intf_,intf_addr,prop_,ex_) \
1631 ((struct NETIO_InterfaceI*)(\
1632 (self_)->_parent._intf))->add_route(self_,dst_,intf_,intf_addr,prop_,ex_)
1650 #define NETIO_Interface_delete_route(self_,dst_,intf_,intf_addr_,exist_) \
1651 ((struct NETIO_InterfaceI*)(\
1652 (self_)->_parent._intf))->delete_route(self_,dst_,intf_,intf_addr_,exist_)
1669 #define NETIO_Interface_reserve_address(self_,src_addr_,pub_addr_,prop_)\
1670 ((struct NETIO_InterfaceI*)(\
1671 (self_)->_parent._intf))->reserve_address(self_,src_addr_,pub_addr_,prop_)
1684 #define NETIO_Interface_release_address(self_,src_addr_)\
1685 ((struct NETIO_InterfaceI*)(\
1686 (self_)->_parent._intf))->release_address(self_,src_addr_)
1704 #define NETIO_Interface_bind(self_,src_,prop_,ex_) \
1705 ((struct NETIO_InterfaceI*)(\
1706 (self_)->_parent._intf))->bind(self_,src_,prop_,ex_)
1724 #define NETIO_Interface_unbind(self_,src_,dst_,exist_) \
1725 ((struct NETIO_InterfaceI*)(\
1726 (self_)->_parent._intf))->unbind(self_,src_,dst_,exist_)
1747 #define NETIO_Interface_bind_external(src_intf_,src_adr_,dst_intf_,dst_adr_,p_,e_) \
1748 ((struct NETIO_InterfaceI*)(\
1749 (src_intf_)->_parent._intf))->bind_external(src_intf_,src_adr_,dst_intf_,dst_adr_,p_,e_)
1769 #define NETIO_Interface_unbind_external(src_intf_,src_adr_,dst_adr_,dst_intf_,exist_) \
1770 ((struct NETIO_InterfaceI*)(\
1771 (src_intf_)->_parent._intf))->unbind_external(src_intf_,src_adr_,dst_adr_,dst_intf_,exist_)
1792 #define NETIO_Interface_receive(self_,src_,dst_,p_) \
1793 ((struct NETIO_InterfaceI*)(\
1794 (self_)->_parent._intf))->receive(self_,src_,dst_,p_)
1811 #define NETIO_Interface_get_external_interface(self_,src_,ul_,dst_) \
1812 ((struct NETIO_InterfaceI*)(\
1813 (self_)->_parent._intf))->get_external_interface(self_,src_,ul_,dst_)
1827 #define NETIO_Interface_set_state(self_,state_) \
1828 ((struct NETIO_InterfaceI*)(\
1829 (self_)->_parent._intf))->set_state(self_,state_)
1846 #define NETIO_Interface_resolve_address(self_,address_,resolved_,is_invalid_) \
1847 ((struct NETIO_InterfaceI*)(\
1848 (self_)->_parent._intf))->resolve_address(self_,address_,resolved_,is_invalid_)
1863 #define NETIO_Interface_get_route_table(self_,address_,netmask_) \
1864 ((struct NETIO_InterfaceI*)(\
1865 (self_)->_parent._intf))->get_route_table(self_,address_,netmask_)
1879 #define NETIO_Interface_post_event(self_,src_intf_,event_) \
1880 ((struct NETIO_InterfaceI*)(\
1881 (self_)->_parent._intf))->post_event(self_,src_intf_,event_)