DDS_DomainParticipantQos participant_qos; factory->get_default_participant_qos(participant_qos); participant_qos.transport_builtin.mask = DDS_TRANSPORTBUILTIN_SHMEM | DDS_TRANSPORTBUILTIN_UDPv4;
struct NDDS_Transport_UDPv4_Property_t property = NDDS_TRANSPORT_UDPV4_PROPERTY_DEFAULT; if (NDDSTransportSupport::get_builtin_transport_property( participant, DDS_TRANSPORTBUILTIN_UDPv4, (struct NDDS_Transport_Property_t&)property) != DDS_RETCODE_OK) { printf("***Error: get builtin transport property\n"); }
/* Increase the UDPv4 maximum message size to 64K (large messages). */ property.parent.message_size_max = 65535; property.recv_socket_buffer_size = 65535; property.send_socket_buffer_size = 65535;
if (NDDSTransportSupport::set_builtin_transport_property( participant, DDS_TRANSPORTBUILTIN_UDPv4, (struct NDDS_Transport_Property_t&)property) != DDS_RETCODE_OK) { printf("***Error: set builtin transport property\n"); }
NDDS_Transport_Plugin* transport = NULL; struct NDDS_Transport_UDPv4_Property_t property = NDDS_TRANSPORT_UDPV4_PROPERTY_DEFAULT; transport = NDDS_Transport_UDPv4_new(&property); if (transport == NULL) { printf("***Error: creating transport plugin\n"); }
transport->delete_cEA(transport, NULL);
/* Decide on a network address (96 bits for UDPv4), such that the fully qualified unicast address for the transport's interfaces will be globally unique. For example, we use the network address: 1234:1234:1234:0000 It will be prepended to the unicast addresses of the transport plugin's interfaces, to give a fully qualified address that is unique in the domain. */ NDDS_Transport_Address_t network_address = {{1,2,3,4, 1,2,3,4, 1,2,3,4, 0,0,0,0}};
/* Decide aliases, i.e. the names by which this transport plugin will be known */ const char* ALIASES[] = { "my", "large_message", }; const DDS_Long ALIASES_LENGTH = sizeof(ALIASES)/sizeof(const char*); /* Initialize the aliases StringSeq */ DDS_StringSeq aliases; if (!aliases.from_array(ALIASES, ALIASES_LENGTH)) { printf("***Error: creating initializing aliases\n"); }
NDDS_Transport_Handle_t handle = NDDS_TRANSPORT_HANDLE_NIL; handle = NDDSTransportSupport::register_transport( participant, /* Disabled Domain Participant */ transport, /* Transport plugin */ aliases, /* Transport aliases */ network_address); /* Transport network address */ if (NDDS_Transport_Handle_is_nil(&handle)) { printf("***Error: registering transport\n"); }
/* Restrict to receiving messages only on interfaces 1234:1234:1234:10.10.*.* */ NDDS_Transport_Address_t subnet = {{1,2,3,4, 1,2,3,4, 1,2,3,4, 10,10,0,0}}; if (NDDSTransportSupport::add_receive_route(handle, subnet, 112) != DDS_RETCODE_OK) { printf("***Error: adding receive route\n"); }
/* Restrict to sending messages only to addresses (subnets) 1234:1234:1234:10.10.30.* */ NDDS_Transport_Address_t subnet = {{1,2,3,4, 1,2,3,4, 1,2,3,4, 10,10,30,0}}; if (NDDSTransportSupport::add_send_route(handle, subnet, 120) != DDS_RETCODE_OK) { printf("***Error: adding send route\n"); }