32 #ifndef netio_interface_h
33 #define netio_interface_h
39 #ifndef osapi_config_h
49 #ifndef reda_sequenceNumber_h
50 #include "reda/reda_sequenceNumber.h"
54 #include "db/db_api.h"
61 #ifndef netio_address_h
62 #include "netio/netio_address.h"
102 #define NETIO_PROTOCOL_INTRA (1)
108 #define NETIO_PROTOCOL_RTPS (2)
114 #define NETIO_PROTOCOL_UDP (3)
124 #define NETIO_RTPS_FLAGS_DISPOSE (0x1)
131 #define NETIO_RTPS_FLAGS_UNREGISTER (0x2)
137 #define NETIO_RTPS_FLAGS_LIVELINESS (0x4)
143 #define NETIO_RTPS_FLAGS_INLINEQOS (0x8)
150 #define NETIO_RTPS_FLAGS_LOST_DATA (0x10)
158 #define NETIO_RTPS_FLAGS_COMMIT_DATA (0x20)
164 #define NETIO_RTPS_FLAGS_DATA (0x40)
170 #define NETIO_RTPS_FLAGS_LAST_WRITE_FOR_SN (0x80)
176 #define NETIO_RTPS_FLAGS_LITTLE_ENDIAN (0x100)
181 struct NETIO_RtpsInfo
186 struct REDA_Buffer *inline_data;
191 struct NETIO_GuidPrefix guid_prefix;
197 struct NETIO_IntraInfo
202 const void *user_data;
208 struct REDA_Buffer *inline_data;
214 #define NETIO_IntraInfo_INITIALIZER \
223 struct NETIO_PacketInfo
228 struct REDA_SequenceNumber sn;
238 RTI_UINT8 valid_data;
248 struct NETIO_Guid instance;
253 RTI_UINT32 rtps_flags;
259 struct REDA_SequenceNumber committable_sn;
266 struct REDA_SequenceNumber first_available_sn;
272 struct REDA_SequenceNumber lost_sample_sn;
278 RTI_UINT32 lost_sample_count;
284 RTI_INT32 protocol_id;
292 struct NETIO_IntraInfo intra_info;
293 struct NETIO_RtpsInfo rtps_data;
301 #define NETIO_PacketInfo_INITIALIZER \
303 REDA_SEQUENCE_NUMBER_ZERO, \
304 OSAPI_NTP_TIME_ZERO, \
307 NETIO_ADDRESS_GUID_UNKNOWN, \
309 REDA_SEQUENCE_NUMBER_ZERO, \
310 REDA_SEQUENCE_NUMBER_ZERO, \
311 REDA_SEQUENCE_NUMBER_ZERO, \
314 {{NULL,NULL},{NULL,{{0,0,0,0,0,0,0,0,0,0,0,0}}}}\
330 struct NETIO_Address source;
335 struct NETIO_Address local_source;
347 RTI_SIZE_T max_length;
363 RTI_SIZE_T saved_head_pos;
369 RTI_SIZE_T saved_tail_pos;
375 struct NETIO_PacketInfo info;
380 struct NETIO_AddressSeq *dests;
392 typedef struct NETIO_Packet NETIO_Packet_T;
399 typedef struct REDA_SequenceNumber NETIO_PacketId_T;
405 #define NETIO_Packet_INITIALIZER \
407 NETIO_Address_INITIALIZER,\
408 NETIO_Address_INITIALIZER,\
415 NETIO_PacketInfo_INITIALIZER,\
433 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
434 NETIO_Packet_set_head(NETIO_Packet_T *packet,RTI_INT32 delta);
449 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
450 NETIO_Packet_set_tail(NETIO_Packet_T *packet,RTI_INT32 delta);
466 MUST_CHECK_RETURN NETIODllExport
void*
467 NETIO_Packet_get_head(NETIO_Packet_T *packet);
483 MUST_CHECK_RETURN NETIODllExport
void*
484 NETIO_Packet_get_tail(NETIO_Packet_T *packet);
505 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
506 NETIO_Packet_initialize(NETIO_Packet_T *packet,
508 RTI_SIZE_T init_length,
509 RTI_SIZE_T trailer_length,
510 struct NETIO_AddressSeq *dest_seq);
524 SHOULD_CHECK_RETURN NETIODllExport RTI_BOOL
525 NETIO_Packet_finalize(NETIO_Packet_T *packet);
535 MUST_CHECK_RETURN NETIODllExport
struct NETIO_PacketInfo*
536 NETIO_Packet_get_info(NETIO_Packet_T *packet);
545 NETIO_Packet_set_source(NETIO_Packet_T *packet,
struct NETIO_Address *src);
558 SHOULD_CHECK_RETURN NETIODllExport RTI_SIZE_T
559 NETIO_Packet_get_payload_length(NETIO_Packet_T *packet);
574 NETIO_Packet_save_positions(NETIO_Packet_T *packet);
588 NETIO_Packet_restore_positions(NETIO_Packet_T *packet);
604 NETIO_Packet_save_positions_to(NETIO_Packet_T *packet,
622 NETIO_Packet_restore_positions_from(NETIO_Packet_T *packet,
640 #define NETIO_TABLE_NAME_SIZE (16)
645 struct NETIO_InterfaceProperty
647 struct RT_ComponentProperty _parent;
648 RTI_INT32 max_routes;
656 #define NETIO_InterfaceProperty_INITIALIZER \
658 RT_ComponentProperty_INITIALIZER,\
671 struct NETIO_InterfaceListener
676 struct RT_ComponentListener _parent;
683 #define NETIO_InterfaceListener_INITIALIZE \
685 RT_ComponentListener_INITIALIZER \
698 struct NETIO_InterfaceFactoryProperty
703 struct RT_ComponentFactoryProperty _parent;
710 #define NETIO_InterfaceFactoryProperty_INITIALIZER \
712 RT_ComponentFactoryProperty_INITIALIZER \
723 NETIO_INTERFACESTATE_CREATED,
728 NETIO_INTERFACESTATE_ENABLED
729 } NETIO_InterfaceState_T;
740 struct NETIO_Interface
745 struct RT_Component _parent;
762 struct NETIO_Address local_address;
767 NETIO_InterfaceState_T state;
773 typedef struct NETIO_Interface NETIO_Interface_T;
778 struct NETIOBindProperty
791 #define NETIOBindProperty_INITIALIZER \
799 struct NETIORouteProperty
812 #define NETIORouteProperty_INITIALIZER \
820 struct NETIOBindEntryKey
825 struct NETIO_Address source;
830 struct NETIO_Address destination;
836 struct NETIOBindEntry
841 struct NETIO_Address source;
846 struct NETIO_Address destination;
851 NETIO_Interface_T *intf;
862 NETIO_ROUTESTATE_ACTIVE,
867 NETIO_ROUTESTATE_INACTIVE
868 } NETIO_RouteState_T;
874 struct NETIORouteEntryKey
879 struct NETIO_Address destination;
884 NETIO_Interface_T *intf;
889 struct NETIO_Address intf_address;
895 struct NETIORouteEntry
900 struct NETIO_Address destination;
905 NETIO_Interface_T *intf;
910 struct NETIO_Address intf_address;
915 NETIO_RouteState_T state;
926 NETIO_EVENTKIND_INACTIVE_PEER,
931 NETIO_EVENTKIND_ACTIVE_PEER
937 struct NETIO_Event_PeerActivity
942 struct NETIO_Address peer_addr;
947 RTI_INT32 inactive_total;
952 RTI_INT32 inactive_change;
957 RTI_INT32 active_total;
962 RTI_INT32 active_change;
974 NETIO_EventKind_T kind;
981 struct NETIO_Event_PeerActivity peer_activity;
985 struct NETIO_InterfaceI;
1000 NETIO_Interface_Table_name_from_id(
char *tbl_name,
1001 union RT_ComponentFactoryId *
id,
1003 RTI_INT32 instance);
1017 MUST_CHECK_RETURN NETIODllExport RTI_BOOL
1018 NETIO_Interface_initialize(
struct NETIO_Interface *netio,
1019 struct NETIO_InterfaceI *netio_intf,
1020 const struct NETIO_InterfaceProperty *
const property,
1021 const struct NETIO_InterfaceListener *
const listener);
1033 SHOULD_CHECK_RETURN NETIODllExport RTI_BOOL
1034 NETIO_Interface_finalize(
struct NETIO_Interface *netio);
1054 MUST_CHECK_RETURN NETIODllExport RTI_INT32
1055 NETIO_Interface_compare_route(RTI_INT32 flags,
1056 const DB_Record_T op1,
void *op2);
1075 MUST_CHECK_RETURN NETIODllExport RTI_INT32
1076 NETIO_Interface_compare_bind(RTI_INT32 flags,
1077 const DB_Record_T op1,
void *op2);
1091 FUNCTION_MUST_TYPEDEF(
1093 (*NETIO_Interface_sendFunc)(NETIO_Interface_T *
self,
1094 struct NETIO_Interface *source,
1095 struct NETIO_Address *destination,
1096 NETIO_Packet_T *packet)
1111 FUNCTION_MUST_TYPEDEF(
1113 (*NETIO_Interface_receiveFunc)(NETIO_Interface_T *netio_intf,
1114 struct NETIO_Address *src_addr,
1115 struct NETIO_Address *dst_addr,
1116 NETIO_Packet_T *packet)
1131 FUNCTION_MUST_TYPEDEF(
1133 (*NETIO_Interface_acknackFunc)(NETIO_Interface_T *
self,
1134 struct NETIO_Address *source,
1135 NETIO_PacketId_T *packet_id,
1156 FUNCTION_MUST_TYPEDEF(
1158 (*NETIO_Interface_requestFunc)(NETIO_Interface_T *
self,
1159 struct NETIO_Address *source,
1160 struct NETIO_Address *dest,
1161 NETIO_Packet_T **packet,
1162 NETIO_PacketId_T *packet_id,
1163 NETIO_PacketId_T *actual_packet_id)
1179 FUNCTION_MUST_TYPEDEF(
1181 (*NETIO_Interface_return_loanFunc)(NETIO_Interface_T *
self,
1182 struct NETIO_Address *source,
1183 NETIO_Packet_T *packet,
1184 NETIO_PacketId_T *packet_id)
1198 FUNCTION_MUST_TYPEDEF(
1200 (*NETIO_Interface_xmit_removeFunc)(NETIO_Interface_T *
self,
1201 struct NETIO_Address *destination,
1202 NETIO_PacketId_T *packet_id)
1217 FUNCTION_MUST_TYPEDEF(
1219 (*NETIO_Interface_add_routeFunc)(NETIO_Interface_T *
self,
1220 struct NETIO_Address *dst_addr,
1221 NETIO_Interface_T *via_intf,
1222 struct NETIO_Address *via_addr,
1223 struct NETIORouteProperty *property,
1241 FUNCTION_MUST_TYPEDEF(
1243 (*NETIO_Interface_delete_routeFunc)(NETIO_Interface_T *
self,
1244 struct NETIO_Address *dst_addr,
1245 NETIO_Interface_T *via_intf,
1246 struct NETIO_Address *via_addr,
1262 FUNCTION_MUST_TYPEDEF(
1264 (*NETIO_Interface_bindFunc)(NETIO_Interface_T *netio_intf,
1265 struct NETIO_Address *src_addr,
1266 struct NETIOBindProperty *property,
1282 FUNCTION_MUST_TYPEDEF(
1284 (*NETIO_Interface_unbindFunc)(NETIO_Interface_T *netio_intf,
1285 struct NETIO_Address *src_addr,
1286 NETIO_Interface_T *dst_intf,
1304 FUNCTION_MUST_TYPEDEF(
1306 (*NETIO_Interface_bind_externalFunc)(NETIO_Interface_T *src_intf,
1307 struct NETIO_Address *src_addr,
1308 NETIO_Interface_T *dst_intf,
1309 struct NETIO_Address *dst_addr,
1310 struct NETIOBindProperty *property,
1327 FUNCTION_MUST_TYPEDEF(
1329 (*NETIO_Interface_unbind_externalFunc)(NETIO_Interface_T *src_intf,
1330 struct NETIO_Address *src_addr,
1331 NETIO_Interface_T *dst_intf,
1332 struct NETIO_Address *dst_addr,
1349 FUNCTION_MUST_TYPEDEF(
1351 (*NETIO_Interface_get_external_interfaceFunc)(NETIO_Interface_T *netio_intf,
1352 struct NETIO_Address *src_addr,
1353 NETIO_Interface_T **dst_intf,
1354 struct NETIO_Address *dst_addr)
1369 FUNCTION_MUST_TYPEDEF(
1371 (*NETIO_Interface_reserve_addressFunc)(NETIO_Interface_T *
self,
1372 struct NETIO_AddressSeq *req_address,
1373 struct NETIO_AddressSeq *rsvd_address,
1374 struct NETIOBindProperty *property)
1387 FUNCTION_MUST_TYPEDEF(
1389 (*NETIO_Interface_release_addressFunc)(NETIO_Interface_T *
self,
1390 struct NETIO_Address *src_addr)
1403 FUNCTION_MUST_TYPEDEF(
1405 (*NETIO_Interface_set_stateFunc)(NETIO_Interface_T *netio_intf,
1406 NETIO_InterfaceState_T state)
1421 FUNCTION_MUST_TYPEDEF(
1423 (*NETIO_Interface_resolve_adddressFunc)(NETIO_Interface_T *netio_intf,
1424 const char *address_string,
1425 struct NETIO_Address *address_value,
1440 FUNCTION_MUST_TYPEDEF(
1442 (*NETIO_Interface_get_route_tableFunc)(NETIO_Interface_T *netio_intf,
1443 struct NETIO_AddressSeq *address,
1444 struct NETIO_NetmaskSeq *netmask)
1458 FUNCTION_MUST_TYPEDEF(
1460 (*NETIO_Interface_post_eventFunc)(NETIO_Interface_T *
self,
1461 NETIO_Interface_T *src_intf,
1462 struct NETIO_Event *event)
1480 FUNCTION_MUST_TYPEDEF(
1482 (*NETIO_Interface_lookup_routeFunc)(
struct NETIO_Interface *netio_intf,
1483 struct NETIO_Address *dst_reader,
1484 struct NETIO_Interface *via_intf,
1485 struct NETIO_Address *via_address,
1486 RTI_BOOL *route_exists)
1493 struct NETIO_InterfaceI
1498 struct RT_ComponentI _parent;
1503 NETIO_Interface_sendFunc send;
1508 NETIO_Interface_acknackFunc acknack;
1513 NETIO_Interface_requestFunc request;
1515 NETIO_Interface_return_loanFunc return_loan;
1520 NETIO_Interface_xmit_removeFunc xmit_remove;
1525 NETIO_Interface_add_routeFunc add_route;
1530 NETIO_Interface_delete_routeFunc delete_route;
1535 NETIO_Interface_reserve_addressFunc reserve_address;
1540 NETIO_Interface_bindFunc bind;
1545 NETIO_Interface_unbindFunc unbind;
1550 NETIO_Interface_receiveFunc receive;
1556 NETIO_Interface_get_external_interfaceFunc get_external_interface;
1561 NETIO_Interface_bind_externalFunc bind_external;
1566 NETIO_Interface_unbind_externalFunc unbind_external;
1571 NETIO_Interface_set_stateFunc set_state;
1576 NETIO_Interface_release_addressFunc release_address;
1581 NETIO_Interface_resolve_adddressFunc resolve_address;
1587 NETIO_Interface_get_route_tableFunc get_route_table;
1592 NETIO_Interface_post_eventFunc post_event;
1597 NETIO_Interface_lookup_routeFunc lookup_route;
1607 #define NETIO_InterfaceFactory_create_component(f_,p_,l_) \
1608 (NETIO_Interface_T*)((f_)->intf->create_component(\
1617 #define NETIO_InterfaceFactory_delete_component(f_,intf_) \
1618 (f_)->intf->delete_component(f_,(&(intf_)->_parent))
1633 #define NETIO_Interface_send(self_,src_intf_,dst_addr_,pkt_) \
1634 ((struct NETIO_InterfaceI*)(\
1635 (self_)->_parent._intf))->send(self_,src_intf_,dst_addr_,pkt_)
1652 #define NETIO_Interface_acknack(self_,src_intf_,sn_,nack_) \
1653 ((struct NETIO_InterfaceI*)(\
1654 (self_)->_parent._intf))->acknack(self_,src_intf_,sn_,nack_)
1676 #define NETIO_Interface_request(self_,src_,dst_,pkt_,pktid_,nextpktid_) \
1677 ((struct NETIO_InterfaceI*)(\
1678 (self_)->_parent._intf))->request(self_,src_,dst_,pkt_,pktid_,nextpktid_)
1693 #define NETIO_Interface_return_loan(self_,src_,pkt_,pkt_id_) \
1694 ((struct NETIO_InterfaceI*)(\
1695 (self_)->_parent._intf))->return_loan(self_,src_,pkt_,pkt_id_)
1710 #define NETIO_Interface_xmit_remove(self_,dst_,pkt_id_) \
1711 ((struct NETIO_InterfaceI*)(\
1712 (self_)->_parent._intf))->xmit_remove(self_,dst_,pkt_id_)
1730 #define NETIO_Interface_add_route(self_,dst_,intf_,intf_addr,prop_,ex_) \
1731 ((struct NETIO_InterfaceI*)(\
1732 (self_)->_parent._intf))->add_route(self_,dst_,intf_,intf_addr,prop_,ex_)
1750 #define NETIO_Interface_delete_route(self_,dst_,intf_,intf_addr_,exist_) \
1751 ((struct NETIO_InterfaceI*)(\
1752 (self_)->_parent._intf))->delete_route(self_,dst_,intf_,intf_addr_,exist_)
1769 #define NETIO_Interface_reserve_address(self_,src_addr_,pub_addr_,prop_)\
1770 ((struct NETIO_InterfaceI*)(\
1771 (self_)->_parent._intf))->reserve_address(self_,src_addr_,pub_addr_,prop_)
1784 #define NETIO_Interface_release_address(self_,src_addr_) \
1785 ((struct NETIO_InterfaceI*)(\
1786 (self_)->_parent._intf))->release_address(self_,src_addr_)
1804 #define NETIO_Interface_bind(self_,src_,prop_,ex_) \
1805 ((struct NETIO_InterfaceI*)(\
1806 (self_)->_parent._intf))->bind(self_,src_,prop_,ex_)
1824 #define NETIO_Interface_unbind(self_,src_,dst_,exist_) \
1825 ((struct NETIO_InterfaceI*)(\
1826 (self_)->_parent._intf))->unbind(self_,src_,dst_,exist_)
1847 #define NETIO_Interface_bind_external(src_intf_,src_adr_,dst_intf_,dst_adr_,p_,e_) \
1848 ((struct NETIO_InterfaceI*)(\
1849 (src_intf_)->_parent._intf))->bind_external(src_intf_,src_adr_,dst_intf_,dst_adr_,p_,e_)
1869 #define NETIO_Interface_unbind_external(src_intf_,src_adr_,dst_adr_,dst_intf_,exist_) \
1870 ((struct NETIO_InterfaceI*)(\
1871 (src_intf_)->_parent._intf))->unbind_external(src_intf_,src_adr_,dst_adr_,dst_intf_,exist_)
1892 #define NETIO_Interface_receive(self_,src_,dst_,p_) \
1893 ((struct NETIO_InterfaceI*)(\
1894 (self_)->_parent._intf))->receive(self_,src_,dst_,p_)
1911 #define NETIO_Interface_get_external_interface(self_,src_,ul_,dst_) \
1912 ((struct NETIO_InterfaceI*)(\
1913 (self_)->_parent._intf))->get_external_interface(self_,src_,ul_,dst_)
1927 #define NETIO_Interface_set_state(self_,state_) \
1928 ((struct NETIO_InterfaceI*)(\
1929 (self_)->_parent._intf))->set_state(self_,state_)
1946 #define NETIO_Interface_resolve_address(self_,address_,resolved_,is_invalid_) \
1947 ((struct NETIO_InterfaceI*)(\
1948 (self_)->_parent._intf))->resolve_address(self_,address_,resolved_,is_invalid_)
1963 #define NETIO_Interface_get_route_table(self_,address_,netmask_) \
1964 ((struct NETIO_InterfaceI*)(\
1965 (self_)->_parent._intf))->get_route_table(self_,address_,netmask_)
1979 #define NETIO_Interface_post_event(self_,src_intf_,event_) \
1980 ((struct NETIO_InterfaceI*)(\
1981 (self_)->_parent._intf))->post_event(self_,src_intf_,event_)
1994 #define NETIO_Interface_lookup_route(self_,dst_reader_,via_intf_,\
1995 via_address_,route_exists_) \
1996 ((struct NETIO_InterfaceI*)(\
1997 (self_)->_parent._intf))->lookup_route(self_,dst_reader_,via_intf_,\
1998 via_address_,route_exists_)