Configuring the TCP Transport with the Property QosPolicy

The PROPERTY QosPolicy (DDS Extension) allows you to set up name/value pairs of data and attach them to an entity, such as a DomainParticipant.

Like all QoS policies, there are two ways to specify the Property QoS policy:

Programmatically, as described in this section and Getting, Setting, and Comparing QosPolicies. This includes using the add_property() operation to attach name/value pairs to the Property QosPolicy and then configuring the DomainParticipant to use that QosPolicy (by calling set_qos() or specifying QoS values when the DomainParticipant is created).

With an XML QoS Profile, as described in Configuring QoS with XML. This causes Connext DDS to dynamically load the TCP transport library at run time and then implicitly create and register the transport plugin.

To add name/value pairs to the Property QoS policy, use the add_property() operation:

DDS_ReturnCode_t DDSPropertyQosPolicyHelper::add_property  
(DDS_PropertyQosPolicy policy, const char * name,
const char * value, DDS_Boolean propagate)

For more information on add_property() and the other operations in the DDSPropertyQosPolicyHelper class, see PropertyQoSPolicyHelper Operations, as well as the API Reference HTML documentation.

The ‘name’ part of the name/value pairs is a predefined string. The property names for the TCP Transport are described in Properties for NDDS_Transport_TCPv4_Property_t.

Here are the basic steps, taken from the example Hello World application (for details, please see the example application.)

Get the default DomainParticipant QoS from the DomainParticipantFactory.

DDSDomainParticipantFactory::get_instance()->
    get_default_participant_qos(participant_qos);

Disable the builtin transports.

participant_qos.transport_builtin.mask = 
    DDS_TRANSPORTBUILTIN_MASK_NONE;

Set up the DomainParticipant’s Property QoS.

Load the plugin.

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.load_plugins",
    "dds.transport.TCPv4.tcp1",
    DDS_BOOLEAN_FALSE);

Specify the transport plugin library.

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.TCPv4.tcp1.library",
    "nddstransporttcp", 
    DDS_BOOLEAN_FALSE);

Specify the transport’s ‘create’ function.

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property,
    "dds.transport.TCPv4.tcp1.create_function", 
    "NDDS_Transport_TCPv4_create", DDS_BOOLEAN_FALSE);

Set the transport to work in a WAN configuration with a public address:

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.TCPv4.tcp1.parent.classid",
    ”NDDS_TRANSPORT_CLASSID_TCPV4_WAN”, DDS_BOOLEAN_FALSE);

DDSPropertyQosPolicyHelper::add_property (
    participant_qos.property, 
    "dds.transport.TCPv4.public_address", 
    "182.181.2.31", 
    DDS_BOOLEAN_FALSE);

Specify any other properties, as needed.

Create the DomainParticipant using the modified QoS.

participant = 
    DDSTheParticipantFactory->create_participant (
        domainId,
        participant_qos, 
        NULL /* listener */, 
        DDS_STATUS_MASK_NONE);

Property changes should be made before the transport is loaded—either before the DomainParticipant is enabled, before the first DataWriter/DataReader is created, or before the builtin topic reader is looked up, whichever one happens first.

Configuring the TCP Transport to be Loaded Statically

Similar to the previous example, here are the basic steps to load the TCP Transport Plugin statically.

  1. Get the default DomainParticipant QoS from the DomainParticipantFactory.
  2. DDSDomainParticipantFactory::get_instance()->
        get_default_participant_qos(participant_qos);
  3. Disable the builtin transports.
  4. participant_qos.transport_builtin.mask = 
        DDS_TRANSPORTBUILTIN_MASK_NONE;
  5. Set up the DomainParticipant’s Property QoS.
    1. Load the plugin.
    2. DDSPropertyQosPolicyHelper::add_property   
         (participant_qos.property, 
          "dds.transport.load_plugins", 
          "dds.transport.TCPv4.tcp1",DDS_BOOLEAN_FALSE);
    3. Specify the transport’s ‘create’ function pointer.
    4. DDSPropertyQosPolicyHelper::add_pointer_property
         (participant_qos.property, 
          "dds.transport.TCPv4.tcp1.create_function_ptr",
          (void*)NDDS_Transport_TCPv4_create);
    5. Set the transport to work in a WAN configuration with a public address:
    6. DDSPropertyQosPolicyHelper::add_property 
         (participant_qos.property,
         "dds.transport.TCPv4.tcp1.parent.classid",
         ”NDDS_TRANSPORT_CLASSID_TCPV4_WAN”, 
         DDS_BOOLEAN_FALSE);
      DDSPropertyQosPolicyHelper::add_property
         (participant_qos.property,
          "dds.transport.TCPv4.tcp1.public_address",
          "182.181.2.31", 
          DDS_BOOLEAN_FALSE);
    7. Specify any other properties, as needed.
  6. Create the DomainParticipant using the modified QoS.
participant = DDSTheParticipantFactory->create_participant 
    (domainId, participant_qos, 
     NULL /* listener */, DDS_STATUS_MASK_NONE);

Loading TLS Support Libraries Statically

The process to load TLS Support library statically is similar, but in this case both the tls_create_function_ptr and tls_delete_function_ptr properties need to be set.

DDSPropertyQosPolicyHelper::add_pointer_property
    (participant_qos.property,
     "dds.transport.TCPv4.tcp1.tls_create_function_ptr",
     (void*)RTITLS_ConnectionEndpointFactoryTLSv4_create);
DDSPropertyQosPolicyHelper::add_pointer_property
    (participant_qos.property,
     "dds.transport.TCPv4.tcp1.tls_delete_function_ptr",
     (void*)RTITLS_ConnectionEndpointFactoryTLSv4_delete);

© 2018 RTI