Working with pluggable transports.
More...
Working with pluggable transports.
Changing the automatically registered built-in transports
Changing the properties of the automatically registered builtin transports
The behavior of the automatically registered builtin transports can be altered by changing their properties.
- Tell the DDS_DomainParticipantFactory to create the participants disabled, as described in Turning off auto-enable of newly created participant(s)
- Get the property of the desired builtin transport plugin, say ::UDPv4 Transport
participant,
printf("***Error: get builtin transport property\n");
}
Change the property fields as desired. Note that the properties should be changed carefully, as inappropriate values may prevent communications. For example, the ::UDPv4 Transport properties can be changed to support large messages (assuming the underlying operating system's UDPv4 stack supports the large message size). Note: if message_size_max is increased from the default for any of the built-in transports, then the DDS_ReceiverPoolQosPolicy::buffer_size on the DomainParticipant should also be changed.
property.parent.message_size_max = 9216;
property.recv_socket_buffer_size = 9216;
property.send_socket_buffer_size = 9216;
- Set the property of the desired builtin transport plugin, say ::UDPv4 Transport
participant,
printf("***Error: set builtin transport property\n");
}
Enable the participant to turn on communications with other participants in the domain using the new properties for the automatically registered builtin transport plugins.
Creating a transport
- A transport plugin is created using methods provided by the supplier of the transport plugin.
- For example to create an instance of the ::UDPv4 Transport
NDDS_Transport_Plugin* transport = NULL;
if (transport == NULL) {
printf("***Error: creating transport plugin\n");
}
Deleting a transport
- A transport plugin can only be deleted only after the DDS_DomainParticipant with which it is registered is deleted.
- The virtual destructor provided by the abstract transport plugin API can be used to delete a transport plugin.
transport->delete_cEA(transport, NULL);
Registering a transport with a participant
The basic steps for setting up transport plugins for use in an RTI Connext application are described below.
- Tell the DDS_DomainParticipantFactory to create the participants disabled, as described in Turning off auto-enable of newly created participant(s)
- [Optionally] Changing the automatically registered built-in transports
- [Optionally] Changing the properties of the automatically registered builtin transports
- Create a disabled DDS_DomainParticipant, as described in Setting up a participant
- Decide on the network address for the transport plugin. The network address should be chosen so that the resulting fully qualified address is globally unique (across all transports used 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 on the aliases for the transport plugin. An alias can refer to one or more transport plugins. The transport class name (see Builtin Transport Class Names) are automatically appended to the user-provided aliases. Alias names are useful in creating logical groupings of transports, e.g. all the transports that are configured to support large messages may be given the alias "large_message".
const char* ALIASES[] = {
"my",
"large_message",
};
const DDS_Long ALIASES_LENGTH =
sizeof(ALIASES)/
sizeof(
const char*);
if (!DDS_StringSeq_from_array(&aliases, ALIASES, ALIASES_LENGTH)) {
printf("***Error: creating initializing aliases\n");
}
- Register the transport plugin with the DDS_DomainParticipant. Note that a transport plugin should NOT be registered with more than one DomainParticipant. It is the responsibility of the application programmer to ensure that this requirement is not violated.
participant,
transport,
&aliases,
&network_address);
printf("***Error: registering transport\n");
}
DDS_StringSeq_finalize(&aliases);
- [Optionally] Adding receive routes for a transport
- [Optionally] Adding send routes for a transport
- Enable the participant to turn on communications with other participants in the domain, using the newly registered transport plugins, and automatically registered builtin transport plugins (if any).
Adding receive routes for a transport
- Receive routes can be added to restrict address ranges on which incoming messages can be received. Any number of receive routes can be added, but these must be done before the participant is enabled.
- To restrict the address range from which incoming messages can be received by the transport plugin:
NDDS_Transport_Address_t subnet = {{1,2,3,4, 1,2,3,4, 1,2,3,4, 10,10,0,0}};
printf("***Error: adding receive route\n");
}
Adding send routes for a transport
- Send routes can be added to restrict the address ranges to which outgoing messages can be sent by the transport plugin. Any number of send routes can be added, but these must be done before the participant is enabled.
- To restrict address ranges to which outgoing messages can be sent by the transport plugin:
NDDS_Transport_Address_t subnet = {{1,2,3,4, 1,2,3,4, 1,2,3,4, 10,10,30,0}};
printf("***Error: adding send route\n");
}