Working with pluggable transports.
Working with pluggable transports.
Changing the automatically registered built-in transports
- The DDS_TRANSPORTBUILTIN_MASK_DEFAULT specifies the transport plugins that will be automatically registered with a newly created DDS_DomainParticipant by default.
- This default can be changed by changing the value of the value of TRANSPORT_BUILTIN Qos Policy on the DDS_DomainParticipant
- To change the DDS_DomainParticipantQos::transport_builtin Qos Policy:
DDS_ReturnCode_t DDS_DomainParticipantFactory_get_default_participant_qos(DDS_DomainParticipantFactory *self, struct DDS_DomainParticipantQos *qos)
Initializes the DDS_DomainParticipantQos instance with default values.
#define DDS_DomainParticipantQos_INITIALIZER
Initializer for new QoS instances.
Definition: domain.ifc:1581
@ DDS_TRANSPORTBUILTIN_UDPv4
Built-in UDPv4 transport, ::UDPv4 Transport.
Definition: infrastructure.ifc:4337
@ DDS_TRANSPORTBUILTIN_SHMEM
Built-in shared memory transport, ::Shared Memory Transport.
Definition: infrastructure.ifc:4341
QoS policies supported by a DDS_DomainParticipant entity.
Definition: domain.ifc:1372
struct DDS_TransportBuiltinQosPolicy transport_builtin
<<extension>> Transport Builtin policy, TRANSPORT_BUILTIN.
Definition: domain.ifc:1390
DDS_TransportBuiltinKindMask mask
Specifies the built-in transports that are registered automatically when the DDS_DomainParticipant is...
Definition: infrastructure.ifc:4409
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");
}
@ DDS_RETCODE_OK
Successful return.
Definition: infrastructure.ifc:1339
DDS_ReturnCode_t NDDS_Transport_Support_get_builtin_transport_property(DDS_DomainParticipant *participant_in, DDS_TransportBuiltinKind builtin_transport_kind_in, struct NDDS_Transport_Property_t *builtin_transport_property_inout)
Get the properties used to create a builtin transport plugin.
#define NDDS_TRANSPORT_UDPV4_PROPERTY_DEFAULT
Use this to initialize a NDDS_Transport_UDPv4_Property_t structure.
Definition: udpv4.ifc:531
Base configuration structure that must be inherited by derived Transport Plugin classes.
Definition: interface_user.ifc:61
Configurable IPv4/UDP Transport-Plugin properties.
Definition: udpv4.ifc:150
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");
}
DDS_ReturnCode_t NDDS_Transport_Support_set_builtin_transport_property(DDS_DomainParticipant *participant_in, DDS_TransportBuiltinKind builtin_transport_kind_in, const struct NDDS_Transport_Property_t *builtin_transport_property_in)
Set the properties used to create a builtin transport plugin.
- 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");
}
NDDS_Transport_Plugin * NDDS_Transport_UDPv4_new(const struct NDDS_Transport_UDPv4_Property_t *property_in)
Create an instance of a UDPv4 Transport Plugin.
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}};
Addresses are stored individually as network-ordered bytes.
Definition: common_user.ifc:551
- 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");
}
RTICdrLong DDS_Long
Defines a long integer data type, equivalent to IDL/CDR long.
Definition: dds_c.1.0/interface/common.ifc:244
#define DDS_SEQUENCE_INITIALIZER
An initializer for new sequence instances.
Definition: sequence.ifc:566
Instantiates FooSeq < char* > with value type semantics.
Definition: infrastructure.ifc:430
- 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);
DDS_Boolean NDDS_Transport_Handle_is_nil(const NDDS_Transport_Handle_t *self)
Is the given transport handle the NIL transport handle?
const NDDS_Transport_Handle_t NDDS_TRANSPORT_HANDLE_NIL
The NIL transport handle.
NDDS_TRANSPORT_HANDLE_TYPE_NATIVE NDDS_Transport_Handle_t
An opaque type representing the handle to a transport plugin registered with a DDS_DomainParticipant.
Definition: ndds_transport_c.ifc:81
*NDDS_Transport_Handle_t NDDS_Transport_Support_register_transport(DDS_DomainParticipant *participant_in, NDDS_Transport_Plugin *transport_in, const struct DDS_StringSeq *aliases_in, const NDDS_Transport_Address_t *network_address_in)
Register a transport plugin for use with a DDS_DomainParticipant, assigning it a network_address.
- [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");
}
DDS_ReturnCode_t NDDS_Transport_Support_add_receive_route(const NDDS_Transport_Handle_t *transport_handle_in, const NDDS_Transport_Address_t *address_range_in, DDS_Long address_range_bit_count_in)
Add a route for incoming messages.
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");
}
DDS_ReturnCode_t NDDS_Transport_Support_add_send_route(const NDDS_Transport_Handle_t *transport_handle_in, const NDDS_Transport_Address_t *address_range_in, DDS_Long address_range_bit_count_in)
Add a route for outgoing messages.