TransportMulticastMappingQoS Programmatically

4 posts / 0 new
Last post
Last seen: 3 years 4 months ago
Joined: 01/07/2015
Posts: 5
TransportMulticastMappingQoS Programmatically


I need to create a DomaniParticipant with TransportMulticastMappingQoS set programmaticaly (C++), but unfortunately I've found no such code in RTI examples area.

According to Users Manual, I shoud fill a DDS_TransportMulticastMappingQosPolicy struct which is defined in dds_c_infrastructure.h like:

struct DDS_TransportMulticastMappingQosPolicy {
    /*e \dref_TransportMulticastMappingQosPolicy_value
    struct DDS_TransportMulticastMappingSeq value;



DDS_SEQUENCE(DDS_TransportMulticastMappingSeq, struct DDS_TransportMulticastMapping_t);


struct DDS_TransportMulticastMapping_t {
    /*e \dref_TransportMulticastMapping_t_addresses
    char* addresses;

    /*e \dref_TransportMulticastMapping_t_topic_expression
    char* topic_expression;

    /*e \dref_TransportMulticastMapping_t_mapping_function
    struct DDS_TransportMulticastMappingFunction_t mapping_function;



I am plannig to use a Multicast QoS topic map similar to:

Topic Name (topic_expression field above)        Multicast Add (addresses field above)    Port  (???)


      "ind.any.*"                                                          ""                                   600

      "nor.sys.*"                                                           ""                                  601

      "ade.sys.*"                                                          ""                                  602


Does anyone have a piece of code that  implemments this TransportMulticastMappingQoS for a C++ compiler?

How to add a port number to IP addresses expressions? (I could not find it out in Section of Users Manual) Is it like "IP:PORT" definition?

Thanks in advance!


gianpiero's picture
Last seen: 12 hours 49 min ago
Joined: 06/02/2010
Posts: 177

Hello Julio,

You are right. We don't have examples for that. And we should: hopefully we will have them up soon.

Let me see if I can help you with some code snippets.

Before doing anything get the participant QoS and set two lists of adresses: One for topics starting with F and one for topic starting with B:

DDS_DomainParticipantQos participantQos;
// Get the default participant QoS

// Init the qos.. 
// .. and the sequence... 
// .. with two elements 
DDS_TransportMulticastMappingSeq_ensure_length(&participantQos.multicast_mapping.value, 2,2);

// get the reference to the first element in the sequence ..
v = DDS_TransportMulticastMappingSeq_get_reference(&participantQos.multicast_mapping.value, 0);
//  .. and set the list of addresses .. 
v->addresses = DDS_String_dup(",");
// .. for topic starting with B 
v->topic_expression = DDS_String_dup("B*");

// get the reference to the second element in the sequence ..
v = DDS_TransportMulticastMappingSeq_get_reference(&participantQos.multicast_mapping.value, 1);
// .. and set the list of addresses ..  
v->addresses = DDS_String_dup("[,]");
// .. for topic startign with F 
v->topic_expression = DDS_String_dup("F*"); 


At this point create your participant using the participantQoS you just initialized. 

The dataReader qos, by default has datareaderQos.multicast.value = DDS_AUTOMATIC_TRANSPORT_MULTICAST_QOS.

If datareaderQos.multicast.value is set to DDS_AUTOMATIC_TRANSPORT_MULTICAST_QOS (default) and the DDS_TransportMulticastQosPolicy::value has at least one element with an empty address, then the address will be obtained from DDS_TransportMulticastMappingQosPolicy!

// get the default data reader Qos

// change the  

tmp = DDS_TransportMulticastSettingsSeq_get_reference(&datareaderQos.multicast.value, 0);
tmp->receive_address = DDS_String_dup("");
tmp->receive_port = 3456;

reader = subscriber->create_datareader(
        topic, datareaderQos, NULL,
if (reader == NULL) {
        RTITestLog_exception(METHOD_NAME, &RTI_LOG_GET_FAILURE_s,
        goto done;


 Does it make more sense now? 

I hope the code snippets will help you for now. Try it and feel free to post here for more info or help.



Last seen: 3 years 4 months ago
Joined: 01/07/2015
Posts: 5

Hi gianpiero,

Thanks for your response !!!!

I still have two questions with regard to your post:

1) In Participant QoS is there a way to define a set of MUTICAST ADDRESS+PORT(s) in Multicast Map or just sets of MULTICAST ADRESSES as your code shows?

2) The 2nd part of your post, when you set "tmp" variable you are actually changing datareaderQos ? Do we have to set datareaderQos in orther to have Multicast Map Participant QoS working ? I thought that we just needed to set Participant QoS in both sides (Publisher and Subscriber)...


Thanks again!





gianpiero's picture
Last seen: 12 hours 49 min ago
Joined: 06/02/2010
Posts: 177

Hello Julio, 

Reguarding your first (1) question: I believe there is not way to set the port in the Multicast Map.

Reguarding your second (2) question: TODAY in order for the datareader to use the multicast address that is specified in the participant QoS, you have to specify an empty receive_address in the datareader multicast QoS. But we are addressing this issue for the next release (for future reference the issue number is CORE-6054). 

I hope this helps you out.