The TransportInterface
defines several data members, specifically transport_kind_
, which is essential for identifying the type of transport used in Fast DDS (Data Distribution Service). Below is a detailed explanation of the transport_kind_
member and its associated constants:
Data Member: transport_kind_
- Data Type:
int32_t
- Description: This member serves as a unique identifier for the transport type being utilized. It is protected, meaning it can only be accessed or modified by derived classes within the library and not from external code using the public API.
Importance of transport_kind_
When implementing a custom transport, developers are required to assign this member a unique constant value corresponding to their transport type. This allows the Fast DDS system to recognize and handle various transports appropriately.
Predefined Transport Identifiers
Fast DDS currently uses several predefined identifiers for various transport types, each associated with a specific integer value:
Identifier | Value | Transport Type |
---|---|---|
LOCATOR_KIND_RESERVED | 0 | None. Reserved value for internal use. |
LOCATOR_KIND_UDPv4 | 1 | UDP Transport over IPv4. |
LOCATOR_KIND_UDPv6 | 2 | UDP Transport over IPv6. |
LOCATOR_KIND_TCPv4 | 4 | TCP Transport over IPv4. |
LOCATOR_KIND_TCPv6 | 8 | TCP Transport over IPv6. |
LOCATOR_KIND_SHM | 16 | Shared Memory Transport. |
Usage Scenario
When developing a new custom transport protocol, you would implement it by:
- Subclassing the relevant base class that includes the
TransportInterface
. - Assigning one of your own unique integer constants to
transport_kind_
if you introduce a new transport type or reuse an existing identifier. - Ensuring proper integration with Fast DDS’s framework so that your custom transport can communicate effectively with other components.
Summary
In summary, transport_kind_
is an integral part of Fast DDS’s architecture allowing it to manage different transportation protocols effectively while enabling extensibility through user-defined transports. Each predefined identifier facilitates recognition and differentiation between supported communication methods in distributed systems applications built on Fast DDS technology.
内容由零声教学AI助手提供,问题来源于学员提问