DDS Discovery数据
9.6.2.1 Discovery traffic
Discovery流量是由Participant和Endpoint发现协议生成的,对于Simple Discovery Protocols(SPDP和SEDP),discovery流量在Participant内建(builtin)的终端节点(Endpoint)之间交互。
SPDP的内建(builtin)终端节点上配置了well-known端口,如下表,
Discovery traffic type | SPDP well-known port | Default port number expression
------------------------ ---------------------------------- ---------------------------------Multicast | SPDP_WELL_KNOWN_MULITICAST_PORT | PB + DG * domainid + d0
------------------------ ---------------------------------- ---------------------------------Unicast | SPDP_WELL_KNOWN_UNICAST_PORT | PB + DG * domainid + d1 + PG * partid
------------------------ ---------------------------------- ---------------------------------
在这里,domainid是Participant所属的domain的ID
partid是participant的标识符(participantid在RTPSDomainImpl::createParticipant中赋给RTPSParticipantAttributes)
DG = DomainID Gaid = 250
PG = ParticipantId Gain = 2
PB = Port base = 7400
d0, d1, d2, d3是额外的偏移值
d0 = 0
d1 = 10
d2 = 1
d3 = 11
SPDP和SEDP使用相同的通信端口。
9.6.2.2 User traffic
User流量在Participant创建的User终端节点(Endpoint)之间交互。因此,User流量和Discovery(SPDP,SEDP)无关。User终端节点使用的端口的计算方式如下:
User traffic type | Default port number expression
-------------------- -----------------------------------------------Multicast | PB + DG * domainId + d2
-------------------- -----------------------------------------------Unicast | PB + DG * domainId + d3 + PG * participantId
-------------------- -----------------------------------------------
9.6.2.4 Default multicast address
默认预配置的地址集合中必须包含如下组播地址(UDPv4):
DefaultMulticastLocator = {LOCATOR_KIND_UDPv4, “239.255.0.1”, PB + DG * domainId + d0}
最后一个是组播的端口
所有的Participant的PDP通信locator中必须包括该地址
SPDPbuiltinParticipantWriter.readerLOocators CONTAINS DefaultMulticastLocator
SPDPbuiltinParticipantReader.multicastLocatorList CONTAINS DefaultMulticastLocator
5.3.2.3. Initial peers (https://fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/simple.html)
根据RTPS标准,每个RTPSParticipant必须在两个端口上监听PDP元数据信息,其中一个端口绑定单播地址,另一个绑定组播地址。
FastDDS允许用户自己配置initial peers(初始化对等节点列表),其中包括一个或者多个IP+端口,这些IP+端口分别是不同远端Participant监听用于交换PDP数据的,因此本地的Participant只需要想这些initial peers发送PDP流量数据即可。
Participant的initial peers中包含IP和端口的键值对集合,这些IP+端口是要和本地Participant进行PDP流量交互的其他Participant所监听的,这些地址可以是单播地址或者组播地址。
如果initial peers中没有元素的话,那么DefaultMulticastLocator会被加入initial peers。