/* * Copyright (c) 2024 Real-Time Innovations, Inc. All rights reserved. * No duplications, whole or partial, manual or electronic, may be made * without express written permission. Any such copies, or revisions thereof, * must display this notice unaltered. * This code contains trade secrets of Real-Time Innovations, Inc. */ #ifndef netio_common_h #define netio_common_h #ifndef osapi_type_h #include "osapi/osapi_type.h" #endif #ifndef osapi_ntptime_h #include "osapi/osapi_ntptime.h" #endif #ifndef reda_buffer_h #include "reda/reda_buffer.h" #endif #ifndef reda_inlineList_h #include "reda/reda_inlineList.h" #endif #ifndef reda_skiplist_h #include "reda/reda_skiplist.h" #endif #ifndef netio_cap_include_manager_h #include "netio_cap/netio_cap_manager.h" #endif #include "netio/netio_dll.h" #ifndef transport_interface_h #include "transport/transport_interface.h" #endif #ifndef cdr_encapsulation_h #include "cdr/cdr_encapsulation.h" #endif #ifdef __cplusplus extern "C" { #endif struct REDAWorker; /* forward declare to appease compiler */ struct RTINetioConfigurator; /* forward declare to appease compiler */ /* ================================================================= */ /* Address Filter */ /* ================================================================= */ /*e * \defgroup RTINetioAddressFilterClass RTINetioAddressFilter * \ingroup RTINetioCommonComponent * \brief A logical group of IPv6 addresses, using bitmask concept. * * A logical address group whose members are all addresses that match the * subnet when filtered through the mask. That is, an address x is allowed * by filter if filter.address == (filter.mask & x) where '&' is the bitwise * AND. * * e.g. All IPv4 multicast ::E000:0/100, where decimal 100 means the * following binary bitmap format: * \verbatim * 11111 ... 11111000...000 * <- 100 -------><- 28 --> * <- 128 ----------------> * \endverbatim * * e.g. All IPv4 localhost class (127.x.x.x) is expressed as ::7F00:0/104 * * e.g. Any address would be allowed by ::0/::0, or ::0/0 * * @section RTINetioAddressFilter_ipv6 IPv6 Address Ranges * * Unspecified ::/128 * Loopback ::1/128 * Multicast FF00::/8 * * Link-local unicast FE80::/10 [DEPRECATED!!] * Site-local unicast FEC0::/10 * Global unicast (everything else) ~= ::/0 * * Service range (loopback, multicast, unicast) * = ::/0 * * @section RTINetioAddressFilter_ipv4 IPv4 Address Ranges * * Loopback: 127.0.0.1 * = ::7F00:0001/128 * * Multicast: [::224.0.0.0, ::239.255.255.255 ] * = [::E000:0, ::EFFF:FFFF ] * = ::E000:0/100 * * Unicast: (everything else) * [::0.0.0.0, ::223.255.255.255] * = [::0:0, ::DFFF:FFFF] * + * [::240.0.0.0, ::255.255.255.255] * = [::F000:0, ::FFFF:FFFF] * * Service range (loopback, multicast, unicast) * = ::/96 * * @section RTINetioAddressFilter_ipv4to6 IPv4 compatible IPv6 addresses * * For the UDP/IP transport plugin class, we use * the "IPv4 compatible IPv6 addresses". Such addresses only use * the lower 32 bits of the IPv6 address. The remaining bits are zero. * * @see RTINetioAddressFilter_filter RTI_NETIO_ADDRESS_FILTER_ANY */ /*e * \ingroup RTINetioAddressFilterClass * \brief member fields * * subnet address and mask combination. For the simple case where the * mask is of the pattern 11...1100...0, the prefix may be abbreviated * with address/N where N is the # of '1's in the mask in decimal. */ struct RTINetioAddressFilter { /*e * Address portion of the filter. Only the bits that correspond to * the "1" of the mask bit matter. */ NDDS_Transport_Address_t address; /*e mask for the address */ NDDS_Transport_Address_t mask; }; /*e \ingroup RTINetioAddressFilterClass * @see REDAOrderedDataTypeCompareFunction */ extern RTINetioDllExport int RTINetioAddressFilter_compare( const struct RTINetioAddressFilter *l, const struct RTINetioAddressFilter *r); /*e \ingroup RTINetioAddressFilterClass * \brief Is the address allowed by the filter? * * @pre Valid args * @post none * @behavior may be macroed for performance * @param me * @param address \b In. address to check. * * @return RTI_TRUE if match, RTI_FALSE otherwise. * * @exception none * @mtsafety See UML model * * \code * if (RTINetioAddressFilter_filter(filter, address)) { // match! * // address is allowed * } else { * // log rejected * } * \endcode */ extern RTINetioDllExport RTIBool RTINetioAddressFilter_filter( const struct RTINetioAddressFilter *me, const NDDS_Transport_Address_t *address); #define RTI_NETIO_ADDRESS_INVALID { \ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} } /*e \ingroup RTINetioAddressFilterClass * \brief All addresses are selected by this filter. * * ::/0 * * Use this to initialize stack variable. * * \code * RTINetioAddressFilter filter = NDDS_FILTER_ANY; * \endcode */ #define RTI_NETIO_ADDRESS_FILTER_ANY {\ RTI_NETIO_ADDRESS_INVALID, \ RTI_NETIO_ADDRESS_INVALID} /*e \ingroup RTINetioAddressFilterClass * \brief IPv6 Unspecified address range * * ::/128 */ #define RTI_NETIO_ADDRESS_FILTER_UNSPECIFIED { \ RTI_NETIO_ADDRESS_INVALID, \ {{0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, \ 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF}} } /*e \ingroup RTINetioAddressFilterClass * \brief IPv6 Loopback. * * ::1/128 */ #define RTI_NETIO_ADDRESS_FILTER_LOOPBACK { \ {{0, 0, 0, 1}}, \ {{0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, \ 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF}} } /*e \ingroup RTINetioAddressFilterClass * \brief IPv6 Multicast. * * FF00::/8 */ #define RTI_NETIO_ADDRESS_FILTER_MULTICAST { \ {{0xFF,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, \ 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}}, \ {{0xFF,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, \ 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}} } /*i \ingroup RTINetioAddressFilterClass * \brief IPv6 Link Local Unicast. (Now deprecated in IPv6) * * FE80::/10 */ #define RTI_NETIO_ADDRESS_FILTER_SITE_LOCAL_UNICAST { \ {{0xFE,0xC0,0x00,0x00, 0x00,0x00,0x00,0x00, \ 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}}, \ {{0xFF,0xC0,0x00,0x00, 0x00,0x00,0x00,0x00, \ 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00}} } /*e \ingroup RTINetioAddressFilterClass * \brief Convert the address/bit-count representation into an AddressFilter * representation. Sets the insignificant bits in the addressfilter * address and mask to zero. * * @pre Valid args * @post none * @param me \st_in Must be non-NULL. * @param address_range_in \st_in Address whose signifcant bits represent the * address filter. Must be non-NULL. * @param transport_address_bit_count_in \st_in Number of bits used for the * transport address. These bits are set to zero in the * address filter. Must be in [-128,128]. * * @return RTI_TRUE on success, RTI_FALSE on failure (precondition not met). */ extern RTINetioDllExport RTIBool RTINetioAddressFilter_from( struct RTINetioAddressFilter *me, const NDDS_Transport_Address_t *address_range_in, int transport_address_bit_count_in); /* ================================================================= */ /* Alias List */ /* ================================================================= */ /*e \defgroup RTINetioAliasListType RTINetioAliasList * \ingroup RTINetioCommonComponent * \brief A string that contains a comma separated list of aliases. * * A string comprising of comma separated alias strings. * * An alias list contains several alias strings, separated by comma, * and NULL terminated. * * An "empty" string is regarded as a wildcard. */ /*e \ingroup RTINetioAliasListType * \brief Maximum length of the alias list string. */ #define RTI_NETIO_ALIAS_LIST_LENGTH_MAX (128) /*e * @ingroup RTINetioAliasListType * @brief Must contain a NULL terminated string. */ struct RTINetioAliasList { /*e @brief An NULL terminated string of characters. * * One extra element, to guarantee that it is always * terminated by a '\0' character. Thus strncpy() * can be safely used: * * \code * RTIAliasList aliasList = RTI_NETIO_ALIAS_LIST_DEFAULT; * strncpy(aliasList.element, sourceAliasString, * RTI_NETIO_ALIAS_LIST_LENGTH_MAX); * \endcode */ char element[RTI_NETIO_ALIAS_LIST_LENGTH_MAX+1]; }; /*e \ingroup RTINetioAliasListType * @brief Initialize an alias list. */ extern RTINetioDllExport void RTINetioAliasList_init(struct RTINetioAliasList* me); /*e \ingroup RTINetioAliasListType * @brief Initialize an alias list from a null terminated string * of names, separated by RTI_NETIO_ALIAS_LIST_SEPARATOR. * * Only the first RTI_NETIO_ALIAS_LIST_LENGTH_MAX characters are * copied. * * @param stringValueIn \st_in The string value to use to set the alias * */ extern RTINetioDllExport void RTINetioAliasList_fromString( struct RTINetioAliasList* me, const char* stringValueIn); /*i \ingroup RTINetioLocatorType * @brief Retrieves the alias part of the specified locator string. * * If the specified locator does not have an alias, an empty string is set * in aliasString. * * @param aliasString Output buffer containing the alias string. * Must have capacity at least * RTI_NETIO_ALIAS_LIST_LENGTH_MAX. */ extern RTINetioDllExport void RTINetioAliasList_fromLocatorString( struct RTINetioAliasList *me, const char *locatorString); /*e \ingroup RTINetioAliasListType * @brief Initialize an alias list from a string array. * * Only the first RTI_NETIO_ALIAS_LIST_LENGTH_MAX characters are * copied. * * @param stringValueIn \st_in The string value to use to set the alias * */ extern RTINetioDllExport RTIBool RTINetioAliasList_fromStringArray( struct RTINetioAliasList *me, const char **stringArray, int stringArrayLength); /*e \ingroup RTINetioAliasListType * @brief Convert to a string. * * @return the string value */ extern RTINetioDllExport const char* RTINetioAliasList_toString(struct RTINetioAliasList* me); /*e \ingroup RTINetioAliasListType * @brief Append \c listIn separated by RTI_NETIO_ALIAS_LIST_SEPARATOR. * * Only as many characters from \c listIn are copied, as will fit in the * available space in \c me. * * @param listIn \st_in The list to append. * * @return RTI_TRUE if the listIn completely fit into this aliasList; * false otherwise. */ extern RTINetioDllExport RTIBool RTINetioAliasList_append( struct RTINetioAliasList* me, const struct RTINetioAliasList* listIn); /*e \ingroup RTINetioAliasListType * @brief Append \c stringIn separated by RTI_NETIO_ALIAS_LIST_SEPARATOR. * * Only as many characters from \c stringIn are copied, as will fit in the * available space in \c me. * * @param stringIn \st_in The string to append. * * @return RTI_TRUE if the stringIn completely fit into this aliasList; * false otherwise. */ extern RTINetioDllExport RTIBool RTINetioAliasList_appendFromString( struct RTINetioAliasList* me, const char *stringIn); /*e \ingroup RTINetioAliasListType * @brief Split the list into by its head (the first element) and tail * (the remaining elements). This is like the (CAR ..) and (CDR ..) * function in LISP. * * @pre \p headOut and \p tailOut are non-NULL. * * @param headOut \st_out The first element of the list. * @param tailOut \st_out The remaining elements of the list. * * @return RTI_FALSE if the list is empty; RTI_TRUE otherwise. */ extern RTINetioDllExport RTIBool RTINetioAliasList_split( const struct RTINetioAliasList* me, struct RTINetioAliasList* headOut, struct RTINetioAliasList* tailOut); /*e \ingroup RTINetioAliasListType * @brief Does the \c candidateList contain an alias that "matches" * with the \c targetList? * * A match occurs if either: * - \c candidateList contains an alias that is also contained * in \c targetList (i.e. they have an alias in common) * - \c candidateList is the wildcard (empty string) * RTI_NETIO_ALIAS_LIST_DEFAULT; in which case it matches any \c * targetList (including empty string, RTI_NETIO_ALIAS_LIST_DEFAULT). * * @note Comparisons ignore leading and trailing whitespace on each alias and * treat aliases case-insensitively. * * @return RTI_TRUE ifthere is a match; RTI_FALSE otherwise. */ extern RTINetioDllExport RTIBool RTINetioAliasList_match( struct RTINetioAliasList* candidateListIn, struct RTINetioAliasList* targetListIn); /*e \ingroup RTINetioAliasListType * @brief Compare two instances */ extern RTINetioDllExport int RTINetioAliasList_compare( const struct RTINetioAliasList *l, const struct RTINetioAliasList *r); /*e \ingroup RTINetioAliasListType * @brief Print an instance */ extern RTINetioDllExport void RTINetioAliasList_print( const struct RTINetioAliasList *data, const char *desc, int indent); /*e \ingroup RTINetioAliasListType * \brief The character used to separate the aliases in an * AliasList string. */ #define RTI_NETIO_ALIAS_LIST_SEPARATOR ',' /*e \ingroup RTINetioAliasListType * \brief Default value of alias list is the empty string, and * represents a \b wildcard for matching purposes. * * Can be used to initialize stack variables. * \code * RTIAliasList aliasList = RTI_NETIO_ALIAS_LIST_DEFAULT; * \endcode * * @see RTINetioAliasList_match() */ #define RTI_NETIO_ALIAS_LIST_DEFAULT { {\ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_UDPv4 { {\ 'u', 'd', 'p', 'v', '4', 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_UDPv4_WAN { { \ 'u', 'd', 'p', 'v', '4', '_', 'w', 'a', 'n', 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_UDPv6 { {\ 'u', 'd', 'p', 'v', '6', 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_INTRA { {\ 'i', 'n', 't', 'r', 'a', 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_SHMEM { {\ 's', 'h', 'm', 'e', 'm', 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_STARFABRIC { {\ 's', 't', 'a', 'r', 'f', 'a', 'b', 'r', 'i', 'c', \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /*i \ingroup RTINetioAliasListType * \brief Helper to facilitate Refactoring */ #define RTI_NETIO_ALIAS_LIST_INTRA_UDPv4 { {\ 'i', 'n', 't', 'r', 'a', RTI_NETIO_ALIAS_LIST_SEPARATOR, 'u', 'd', 'p', 'v', \ '4', 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ 0 /* Guarantee NULL terminated */ \ }} /* ================================================================= */ /* Locator */ /* ================================================================= */ /*e \defgroup RTINetioLocatorType RTINetioLocator * \ingroup RTINetioCommonComponent * * \brief A Locator consists of a Transport Plugin class, an, * IPv6 address, a port number, and an array of encapsulations. * A locator completely specifies the information necessary to send/receive a * message. * * @see NDDS_Transport_ClassId_t NDDS_Transport_Address_t NDDS_Transport_Port_t */ /* * This maximum is obtained from the RTPS spec: * 9.4.2.10 LocatorList: The PSM mapping for the LocatorList SubmessageElement * defined in Section 8.3.5.11 is given by the following IDL definition: * typedef sequence LocatorList; */ #define RTPS_LOCATOR_LIST_MAX_SIZE (8) /* * This is the current maximum number of locators RTI Connext DDS supports. * This is a hard limit used for preallocating multiple structures across the * whole tree. Also, it is used as a hard limit for multiple checks we perform * in higher modules. Note that while this defines a hard limit, a should limit * can be imposed by the middleware configuration. * * Right now, we have decided to set this to two times the RTPS limit. This * should provide plenty locators for supporting three interfaces while enabling * three ip transports plus shared memory. */ #define RTI_NETIO_RTPS_LOCATOR_LIST_MAX_SIZE (2*RTPS_LOCATOR_LIST_MAX_SIZE) /* * Maximum used for lists that don't need more that a couple of locators (e.g., * multicast locators). Used to reduce memory usage. */ #define RTI_NETIO_RTPS_LOCATOR_REDUCED_LIST_MAX_SIZE (RTPS_LOCATOR_LIST_MAX_SIZE/2) #define RTI_NETIO_RTPS_LOCATOR_LIST_DEFAULT { \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID \ } #define RTI_NETIO_RTPS_LOCATOR_REDUCED_LIST_DEFAULT { \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID, \ RTI_NETIO_LOCATOR_INVALID \ } /* * Special value for dds.domain_participant.initial_locator_list_size * indicating that the initial size of all locator lists in a participant * should be automatically determined based on the number of local locators. */ #define RTI_NETIO_RTPS_LOCATOR_AUTO_LIST_SIZE -1 #define RTINetioLocator_isValidListSize(size__) \ (((size__) == RTI_NETIO_RTPS_LOCATOR_AUTO_LIST_SIZE) \ || ((size__) > 0 && (size__) <= RTI_NETIO_RTPS_LOCATOR_LIST_MAX_SIZE)) #define NETIO_LOCATOR_ENCAPSULATION_COUNT_MAX (4) #define NETIO_LOCATOR_ENCAPSULATION_ARRAY_INVALID {0, 0, 0, 0} /*e @ingroup RTINetioLocatorType * @brief The locator type. */ struct RTINetioLocator { /*e @brief A transport class. */ NDDS_Transport_ClassId_t transport; /*e @brief An address. Must be unique for the transport class in the domain. */ NDDS_Transport_Address_t address; /*e @brief Address hostname */ char *hostname; /*e @brief A port number. */ NDDS_Transport_Port_t port; /*e @brief Number of encapsulations */ RTI_UINT32 encapsulationCount; /*e @brief encapsulation IDs */ RTIEncapsulationId encapsulations[NETIO_LOCATOR_ENCAPSULATION_COUNT_MAX]; /*e @brief loss probability */ RTI_FLOAT32 lossProbability; /*e * @brief Flag that indicates whether a locator is disabled. */ RTIBool disabled; }; /*e * @ingroup RTINetioLocatorType * @brief The maximum hostname length that should be passed to * RTINetioLocator_copy. */ #define NDDS_TRANSPORT_MAX_HOSTNAME_LENGTH (256) /*e \ingroup RTINetioLocatorInfoType * @brief Initialize a locator info from its constituents. * @pre Each member in the parameter list must be non-NULL. */ extern RTINetioDllExport void RTINetioLocator_from( struct RTINetioLocator *me, NDDS_Transport_ClassId_t transportIn, const NDDS_Transport_Address_t *addressIn, NDDS_Transport_Port_t portIn); /*e \ingroup RTINetioLocatorType * \brief For logging * @see REDAOrderedDataTypePrintFunction */ extern RTINetioDllExport void RTINetioLocator_print( const struct RTINetioLocator *me, const char *desc, int indent); /*i \ingroup RTINetioLocatorType * \brief For logging * @see REDAOrderedDataTypePrintFunction */ extern RTINetioDllExport void RTINetioLocator_printODT( void *me, const char *desc, int indent); #define RTI_NETIO_LOCATOR_STRING_BUFFER_SIZE \ RTI_NETIO_ALIAS_LIST_LENGTH_MAX \ +3 /*strlen("://")*/ + NDDS_TRANSPORT_ADDRESS_STRING_BUFFER_SIZE \ + 6 /*strlen(":99999")*/ + 1 /*i \ingroup RTINetioLocatorType * @brief Converts a locator into a string with the following format: * * ://
: * * The alias parameter is optional. If not provided the transport class * is printed instead. */ extern RTINetioDllExport RTIBool RTINetioLocator_toString( const struct RTINetioLocator *me, const struct RTINetioAliasList *aliasList, char *buffer, size_t bufferSize); /*e \ingroup RTINetioLocatorType * @see REDAOrderedDataTypeCompareFunction */ extern RTINetioDllExport int RTINetioLocator_compare( const struct RTINetioLocator *l, const struct RTINetioLocator *r); /*i \ingroup RTINetioLocatorType * @brief Locator compare, with encapsulation */ extern RTINetioDllExport int RTINetioLocator_compareWithEncapsulationODT(void *l, void *r); /*e \ingroup RTINetioLocatorType */ struct RTINetioLocatorCompareOptions { RTIBool compareEncapsulations; RTIBool compareHostname; RTIBool compareAddress; RTIBool comparePort; }; #define RTI_NETIO_LOCATOR_COMPARE_OPTIONS_DEFAULT \ { \ RTI_FALSE, /* compareEncapsulations */ \ RTI_FALSE, /* compareHostname */ \ RTI_FALSE, /* compareAddress*/ \ RTI_FALSE /* comparePort */ \ } /*e \ingroup RTINetioLocatorType */ extern RTINetioDllExport int RTINetioLocator_compareWithCompareOptions( const struct RTINetioLocator *l, const struct RTINetioLocator *r, const struct RTINetioLocatorCompareOptions *compareOptions); /*e \ingroup RTINetioLocatorType */ extern RTINetioDllExport void RTINetioLocator_addEncapsulations( struct RTINetioLocator *me, int encapsulationCount, RTIEncapsulationId *encapsulations, RTIBool *foundMoreThanProvidedFor); /*e \ingroup RTINetioLocatorInfoType * @brief Initializes the locator. * @pre The parameters cannot be NULL. */ extern RTINetioDllExport void RTINetioLocator_initialize(struct RTINetioLocator *me); /*e \ingroup RTINetioLocatorInfoType * @brief Finalizes the locator. * @pre The parameters cannot be NULL. */ extern RTINetioDllExport void RTINetioLocator_finalize(struct RTINetioLocator *me); /*e \ingroup RTINetioLocatorInfoType * @brief Copies a locator allocating new memory if needed. * @pre The parameters cannot be NULL. */ extern RTINetioDllExport RTIBool RTINetioLocator_copy( struct RTINetioLocator *me, const struct RTINetioLocator *base); /*e * @ingroup RTINetioLocatorType * @brief Compares two arrays of RTINetioLocator structures. * * @param countLeft Number of elements in the left array. * @param left Pointer to the first element of the left RTINetioLocator array. * @param countRight Number of elements in the right array. * @param right Pointer to the first element of the right RTINetioLocator array. * * @return int Returns 0 if arrays are equal, a non-zero value if they differ, * or -1 if a precondition fails. */ extern RTINetioDllExport int RTINetioLocator_arrayCompare( int countLeft, const struct RTINetioLocator *left, int countRight, const struct RTINetioLocator *right); /*e \ingroup RTINetioLocatorType * \brief Invalid Locator. * * Used to initialize stack variable, as in * \code * RTINetioLocator myLocator = RTI_NETIO_LOCATOR_INVALID; * \endcode */ #define RTI_NETIO_LOCATOR_INVALID \ { \ NDDS_TRANSPORT_CLASSID_INVALID, /* transportClass */ \ RTI_NETIO_ADDRESS_INVALID, /* address */ \ NULL, /* hostname */ \ 0, /* port */ \ 0, /* encapsulationCount */ \ NETIO_LOCATOR_ENCAPSULATION_ARRAY_INVALID, /* encapsulationIDs */ \ 0.0, /* lossProbability */ \ RTI_FALSE /* disabled */ \ } #define RTINetioLocator_isValid(locator__) ( \ (locator__)->transport != NDDS_TRANSPORT_CLASSID_INVALID \ ) #define RTINetioLocator_getValidCount(locator__) ( \ RTINetioLocator_isValid(locator__) ? 1 : 0 \ ) /*e \ingroup RTINetioLocatorType * A way to specify a list of locators, linked together with REDAInlineList */ struct RTINetioLocatorInlineNode { struct REDAInlineListNode parent; struct RTINetioLocator self; }; #define RTINetioLocatorInlineNode_INITIALIZER \ { \ REDAInlineListNode_INITIALIZER, /* parent */ \ RTI_NETIO_LOCATOR_INVALID /* self */ \ } struct REDAFastBufferPool; /*e \ingroup RTINetioLocatorType */ extern RTINetioDllExport struct RTINetioLocatorInlineNode* RTINetioLocatorInlineList_findEA( struct REDAInlineList* me, const struct RTINetioLocator* locatorIn); /*e \ingroup RTINetioLocatorType */ extern RTINetioDllExport struct RTINetioLocatorInlineNode * RTINetioLocatorInlineList_addToFrontEA( struct REDAInlineList *me, struct REDAFastBufferPool *nodePoolIn, const struct RTINetioLocator *locatorIn); /*e \ingroup RTINetioLocatorType */ extern RTINetioDllExport void RTINetioLocatorInlineList_removeEA( struct REDAInlineList *me, struct REDAFastBufferPool *nodePoolIn, const struct RTINetioLocator *locatorIn); /*e \ingroup RTINetioLocatorType */ extern RTINetioDllExport void RTINetioLocatorInlineList_finalizeEA( struct REDAInlineList* me, struct REDAFastBufferPool* nodePoolIn); #define RTI_NETIO_DESTINATION_LIST_NODE_FLAGS_INITIAL_PEER 0x02 #define RTI_NETIO_DESTINATION_LIST_NODE_INVALID_IP_FLAG 0x01 #define RTI_NETIO_DESTINATION_LIST_NODE_FLAGS_DEFAULT 0x00 typedef RTI_UINT32 RTINetioDestinationListFlags; /*e \ingroup RTINetioLocatorType * A Locator Inline Node with a refCount. */ struct RTINetioDestinationListNode { struct RTINetioLocatorInlineNode parent; /* * Indicates how many times a destination has been asserted to the list. * This increases every time we call RTINetioDestinationList_assert with * the same locator. This can be greater than zero if multiple remote * participants are using the same locator (ie if one shut down but hasn't * lost liveliness yet), if multiples hostnames map to the same address, * or if a node is an initial_peer node that has multiple WAN locators * that map to it. When this is 0 a node can be removed from the list. */ RTI_UINT32 refcount; RTINetioDestinationListFlags flags; /* * Indicates how many times fully discovered remote participants are using * a locator in the list. This is only used for SPDP2 currently and tracks * when initial_peers should be disabled and re-enabled. * * When a remote participant is fully discovered we increment this count * and disable the destination (aka remove it from the anon writer). When * a remote participant stops using this locator or goes away, we decrement * this count. When this count goes to 0, we can re-enable the destination * (aka re-add it to the anon writer) * * This may be greater than 0 for a WAN initial_peer that has multiple * UUID+public locators associated with it, or for a locator that is * being used by multiple remote participants (for example if one shutdown * ungracefully and has not been removed but a new participant has * been started). * * It is also possible for the remoteParticipantRefCount to be greater than * 0 and for the locator to NOT be disabled. In the above shutdown scenario * the remoteParticipantRefCount will become 1 with SPDP2 once the first * participant is fully discovered. The destination will be re-enabled * when the second participant is discovered, and the * remoteParticipantRefCount will go to 2. When the second remote * participant is fully discovered, the destination will be disabled again * and the remoteParticipantRefCount will remain 2. This is so that the * destination is only fully re-enabled when both participants are removed * and the remoteParticipantRefCount goes to 0. */ RTI_UINT32 remoteParticipantRefCount; /* * @brief Initial peer refcount. This is used to keep track of how many * times a locator has been asserted as an initial peer. * * A locator can be asserted as an initial when: * - A participant is created with the locator as initial peer * - The user call DomainParticipant_add_peer * - The DNS tracker resolves a hostname to the locator * * This counter is only relevant for locators in the * RTINetioDestinationList::list */ RTI_UINT32 initialPeerRefCount; }; #define RTINetioDestinationListNode_INITIALIZER \ { \ RTINetioLocatorInlineNode_INITIALIZER, /* parent */ \ 0, /* refcount */ \ RTI_NETIO_DESTINATION_LIST_NODE_FLAGS_DEFAULT, /* flags */ \ 0, /* remoteParticipantRefCount */ \ 0 /* initialPeerRefCount */ \ } struct RTINetioDestinationList; /** * @brief Gets the input locator refCount(s). * * This callback is used to get the fullyDiscoveredRemoteParticipantRefCount * and refCount of a locator. * * @param listenerData InOut. The listener data. * @param fullyDiscoveredRemoteParticipantRefCount Out. Indicates how many times * fully discovered remote participants are using a locator in the list. * @param refCount Out. Indicates how many times a destination has been asserted * to the destList. * @param locator In. The locator for which the refCount(s) are requested. * @param worker InOut. The worker. * * @return RTI_TRUE if success, RTI_FALSE if error. */ typedef RTIBool (*RTINetioDestinationListListenerGetLocatorRefCountCallback)( void *listenerData, RTI_UINT32 *fullyDiscoveredRemoteParticipantRefCount, RTI_UINT32 *refCount, const struct RTINetioLocator *locator, struct REDAWorker *worker); /** * @brief The listener for the RTINetioDestinationList */ struct RTINetioDestinationListListener { /** * @brief Listener data. */ void *listenerData; /** * @brief Gets the input locator refCount(s). */ RTINetioDestinationListListenerGetLocatorRefCountCallback getLocatorRefCount; }; /** * @brief The initializer for the RTINetioDestinationListListener */ #define RTINetioDestinationListListener_INITIALIZER \ { \ NULL, /* userData */ \ NULL /* getLocatorRefCount */ \ } /*e \ingroup RTINetioLocatorType * A RTINetioDestinationList keeps two sorted inline lists of destinations. * The sorting is ensured upon insertion and update. A destination is formed by * a locator, a refcount that represents how many times that locator has been * asserted and the flags of the destination. A locator can have a hostname, * that is resolved to an IP address. * * The first list of the RTINetioDestinationList keeps the destinations ignoring * the hostname of the locators. The second list keeps the destinations that * specified a name. If a name is resolved to a specific IP address, the * refcount of the destination in the first list includes the refcount * of the corresponding destination with name from the second list. If a name * cannot be resolved to a specific IP address the destination is not inserted * in the first list and the node in the second list has the invalid flag * enabled. * * A hostname cannot be referring to two different IP addresses, assertions on * the list will fail if the IP address doesn't match the one previously stored. * However, two or more different names can point to the same IP address. In * that case the corresponding destination of the first list will include all * the refcounts from destinations of the second list that resolve to that * IP address. * * The IP address that a hostname is resolved to must be in the first list unless * it is marked as invalid. If the user removes all the references to a specific * IP address (by forcing the removal of the IP address) and a name is resolved * to that same IP address the destination of the second list is marked as * invalid. * * The invalid flag of a destination is unmarked if the corresponding name is * asserted or if the DNS Tracker updates the resolved IP address. */ struct RTINetioDestinationList { /* * Inline list in which destinations are sorted based on (transport_class, * IP address, port). We search the skiplist * using RTINetioDestinationListNode_compare to determine where nodes in * the list belong and then add them to both this list and the skiplist. * We have this list and a skiplist because the property used by commend * to set this list uses an inline list but we want to be able to search * quickly. */ struct REDAInlineList list; /* * Ordered inline list of named destinations based on (transport_class, IP * address, port). This is updated when the DNS * tracker resolves a new hostname. Each entry in this list can correspond * to an entry in the list (not to multiple), but multiple entries in this * list can correspond to the same address in the list. */ struct REDAInlineList listWithNames; /* * Skip list that contains the nodes in list. This is used to make * finding a node in the list faster. Any node that is in list will also * be in searchList. When nodes are removed from list, they are also * removed from searchList. * * RTINetioDestinationListNode_compare is the compare function used and * compares based on compareAddress and comparePort. */ struct REDASkiplist searchList; struct REDASkiplistDescription searchListDescription; /* * List that contains all locators that have been changed (ie added, * removed, enabled, disabled) since the last time that * RTINetioDestinationList_resetChangeList() was called. This is used * to update the participant announcement channel's list of * destinations without copying the entire list each time. */ struct REDAInlineList changeList; struct REDAFastBufferPool* pool; struct REDAExclusiveArea *ea; /* * Pointer to configurator. The configurator and the list MUST share the * same EA (table EA) to prevent deadlocking when the list uses the * configurator's EA to get transport plugin information. */ struct RTINetioConfigurator *configurator; /** * @brief Listener for the destination list. */ struct RTINetioDestinationListListener listener; }; #define RTINetioDestinationList_INITIALIZER \ { \ REDA_INLINE_LIST_EMPTY, /* list */ \ REDA_INLINE_LIST_EMPTY, /* listWithNames */ \ REDA_SKIPLIST_INITIALIZER, /* searchList */ \ REDA_SKIPLIST_DESCRIPTION_INITIALIZER, /* searchListDescription \ */ \ REDA_INLINE_LIST_EMPTY, /* changeList */ \ NULL, /* pool */ \ NULL, /* ea */ \ NULL, /* configurator */ \ RTINetioDestinationListListener_INITIALIZER /* listener */ \ } /*e \ingroup RTINetioLocatorType * @brief Finalizes the RTINetioDestinationList */ extern RTINetioDllExport void RTINetioDestinationList_finalize( struct RTINetioDestinationList *me); /*e * \ingroup RTINetioLocatorType * @brief Initializes the RTINetioDestinationList * * @param me List to initialize * @param configurator Pointer to netio configurator, used to access transports. * We use the configuratorTableEA from the confiugrator as the EA for the * list. * @param listener Optional pointer to the listener. * * @return RTI_TRUE if success, RTI_FALSE if error */ extern RTINetioDllExport RTIBool RTINetioDestinationList_init( struct RTINetioDestinationList *me, struct RTINetioConfigurator *configurator, const struct RTINetioDestinationListListener *listener); /*e * \ingroup RTINetioLocatorType * @brief Asserts a list of destinations into the RTINetioDestinationList. If a * destination has a name, the destination is also asserted in the second list * only if the resolved IP address matches the previously stored IP address * in the list with names. * * @param newHostAdded: True if at least one destination was added * @param newHostWithNameAdded: True if at least one destination with a new name * was added * @param destinationList: The list of destinations to assert * @param destinationCount: The number of elements in the destinationList * parameter * @param fullyDiscoveredRemoteParticipantRefCount: This is only greater than * zero when adding an initial_peer, NOT when asserting destinations from * a remote participant. For SPDP2 this is a count of the number of times the * locator appears in the remote participant table with participants that HAVE * been fully discovered. This corresponds to the number of times the locator * has been disabled. This is used to populate the remoteParticipantRefCount * on newly added locators. * @param refCount: This field has two uses. It is used with DNS to count * how many times a hostname has been resolved to an address. For SPDP2 this is * also used with add_peer() as a count of the number of times the locator * appears in the remote participant table with participants that HAVE NOT been * fully discovered. This corresponds to the number of times the locator has * been added but not disabled. This is used to populate the refcount on newly * added locators. This should only be greater than zero when asserting new * initial_peers NOT when asserting destinations from a remote participant. * This is also only actually used for this purpose when adding WAN * initial_peers because the initial_peer will not exactly match any remote * participant locators that have already been added. * @param flags: The flags to be set on the node. This bitmap has * RTI_NETIO_DESTINATION_LIST_NODE_FLAGS_INITIAL_PEER set when called from * RTINetioDestinationList_update and * DISCSimpleParticipantDiscoveryBasePlugin_assertInitialDestinations. * @param worker Pointer to worker * * @return RTI_TRUE if success, RTI_FALSE if there was an error. */ extern RTINetioDllExport RTIBool RTINetioDestinationList_assert( struct RTINetioDestinationList *me, int *newHostAdded, int *newHostWithNameAdded, const struct RTINetioLocator *destinationList, int destinationCount, RTI_UINT32 fullyDiscoveredRemoteParticipantRefCount, RTI_UINT32 refCount, RTINetioDestinationListFlags flags, struct REDAWorker *worker); /*e * \ingroup RTINetioLocatorType * @brief Enables a list of destinations in the destinationList. If the * locator is found in the destinationList and is an initial_peer, we decrement * the remoteParticipantRefCount. We will then only unset the DISABLED flag on * that node if the remoteParticipantRefCount is 0. If it is not in the * destinationList, we will continue to the next * locator. * * @param me Pointer to list * @param destinationEnabled: True if at least one destination was enabled * @param destinationList: The list of destinations * @param destinationCount: The number of elements in the list of destinations * @param worker Pointer to worker * * @return RTI_TRUE if success, RTI_FALSE if there was an error. */ extern RTINetioDllExport RTIBool RTINetioDestinationList_enableDiscoveryPeer( struct RTINetioDestinationList *me, RTIBool *destinationEnabled, const struct RTINetioLocator *destinationList, int destinationCount, struct REDAWorker *worker); /*e * \ingroup RTINetioLocatorType * @brief Remove an entry from the destination list ignoring the hostname of the * locator * * @param destinationList: The list of destinations * @param destinationWasRemoved: True if at least one destination was removed. * @param destinationCount: The number of elements in the list of destinations * @param disableDestinationOnly: If true, the destination will only be disabled * if the refcount is 0 and will not be fully removed. This cannot be used * if forceDestinationRemoval is also true. * @param nameRefCount: The refcount of the name locator associated with * the first destination in destinationList. This parameter is only used when * destinationCount is 1. * @param forceDestinationRemoval: If true, the destinations will be removed * independently of their associated refcount. This cannot be used if * disableDestinationOnly is also true. * * @return RTI_TRUE if success, RTI_FALSE if error. Can still return true even * if no destinations are removed as long as there are no errors, so you must * check the value of destinationWasRemoved if you care whether a destination * was actually removed */ extern RTINetioDllExport RTIBool RTINetioDestinationList_removeOrDisable( struct RTINetioDestinationList *me, RTIBool *destinationWasRemoved, const struct RTINetioLocator *destinationList, int destinationCount, RTIBool disableDestinationOnly, RTI_UINT32 nameRefCount, RTIBool forceDestinationRemoval, struct REDAWorker *worker); #define RTINetioDestinationList_disable( \ me__, \ destinationWasRemoved__, \ destinationList__, \ destinationCount__, \ worker__) \ RTINetioDestinationList_removeOrDisable( \ (me__), \ (destinationWasRemoved__), /* destinationWasRemoved */ \ (destinationList__), \ (destinationCount__), \ RTI_TRUE, /* disableDestinationOnly */ \ 0, /* nameRefCount */ \ RTI_FALSE, /* forceDestinationRemoval */ \ (worker__)) #define RTINetioDestinationList_remove( \ me__, \ destinationWasRemoved__, \ destinationList__, \ destinationCount__, \ nameRefCount__, \ forceDestinationRemoval__, \ worker__) \ RTINetioDestinationList_removeOrDisable( \ (me__), \ (destinationWasRemoved__), /* destinationWasRemoved */ \ (destinationList__), \ (destinationCount__), \ RTI_FALSE, /* disableDestinationOnly */ \ nameRefCount__, \ (forceDestinationRemoval__), \ (worker__)) /*e \ingroup RTINetioLocatorType * @brief Remove an entry from the second list of the destination list. This API * only removes an element from the first list if the refcount was the same as * the one for the corresponding destination on the second list (this means that * all the contribution to the refcount of the element on the first list came * from the element with name that is being removed). * * Locators without name are ignored by this API. * * @param destinationWasRemoved: If true at least one destination was * removed from the list. * @param destinationWithNameWasRemoved: If true at least one destination was * removed from the list with names. * @param destinationList: The list of destinations. * @param destinationCount: The number of elements in the list of destinations. * @param forceDestinationRemoval: If true, the destinations will be removed * from the second list independently of their associated refcount. */ extern RTINetioDllExport RTIBool RTINetioDestinationList_removeName( struct RTINetioDestinationList *me, RTIBool *destinationWasRemoved, RTIBool *destinationWithNameWasRemoved, const struct RTINetioLocator *destinationList, int destinationCount, RTIBool forceDestinationRemoval, struct REDAWorker *worker); /*e \ingroup RTINetioLocatorType * @brief Updates the IP address that a hostname is resolved to and ensures that * the two lists of the RTINetioDestinationList are in a consistent state after * update. * * @param destinationWithName: A destination whose name is going to be updated. * @param newAddress: The new resolved IP address for the hostname. * @param destinationUpdated: Indicates if at least one destination was updated. */ extern RTINetioDllExport RTIBool RTINetioDestinationList_update( struct RTINetioDestinationList *me, const struct RTINetioLocator *destinationWithName, const NDDS_Transport_Address_t *newAddress, RTIBool *destinationUpdated, struct REDAWorker *worker); /*e \ingroup RTINetioLocatorType * @brief Start an iteration on one of the lists of the RTINetioDestinationList. * It enters the exclusive area of the lists and returns the first node. * * @param nodeOut: The first node of the list. * @param useNameList: If true the node returned belongs to the listWithNames. */ extern RTINetioDllExport RTIBool RTINetioDestinationList_startIteration( struct RTINetioDestinationList *me, struct RTINetioDestinationListNode **nodeOut, RTIBool useNameList, struct REDAWorker *worker); /*e \ingroup RTINetioLocatorType * @brief Ends an iteration on one of the lists of the RTINetioDestinationList. * It exits the exclusive area of the lists. * * @param nodeOut: The first node of the list. * @param useNameList: If true the node returned belongs to the listWithNames. */ extern RTINetioDllExport RTIBool RTINetioDestinationList_endIteration( struct RTINetioDestinationList *me, struct REDAWorker *worker); /*e * \ingroup RTINetioLocatorType * @brief Remove all locators from the RTINetioDestinationLists's changeList * You must be within the destination list's EA before calling this function. * * @param me RTINetioDestinationList */ extern RTINetioDllExport void RTINetioDestinationList_resetChangeList( struct RTINetioDestinationList *me); /*e * \ingroup RTINetioLocatorType * @brief Finds the first equivalent locator within the list for discovery peers * comparison. This will first convert the address to its * equivalent initial peer locator using * RTINetioConfigurator_getEquivalentInitialPeerAddress and will then search * for that node. * * @param me Pointer to list * @param locatorIn Locator to find in list * @param ignoreEqualAddress If TRUE we will not return nodes that exactly match * the locator address passed in, but will only return nodes that are equivalent * but different. This is used to differentiate between initial peer nodes and * added remote participant nodes when doing enable/disable operations * @param configurator Pointer to configurator * @param worker Pointer to worker * * @return Pointer to equivalent locator if found, NULL if not found. */ extern RTINetioDllExport struct RTINetioDestinationListNode * RTINetioDestinationList_findEquivalentInitialPeerEA( struct RTINetioDestinationList *me, const struct RTINetioLocator *locatorIn, RTIBool ignoreEqualAddress, struct REDAWorker *worker); /* ================================================================= */ /* Locator Info */ /* ================================================================= */ /*e \defgroup RTINetioLocatorInfoType RTINetioLocatorInfo * \ingroup RTINetioCommonComponent * \brief Convenience for defining RTIEntryport and RTIDestination types. * * Ensures that the information required to specify a destination or * entryport is kept togethr in single structure. * * Also, ensures that there is one common place where additiona fileds * can be added (or removed) to sepcify a destination and/or entryport. */ /*e \ingroup RTINetioLocatorInfoType * \brief Base type for an RTIDestination or an RTIEntryport. */ struct RTINetioLocatorInfo { /*e @brief A locator. */ struct RTINetioLocator locator; /*e @brief Transport specific priority */ int transport_priority; /*e @brief Alias list, that specifies the list of transport plugin instances that should handle the locator. */ struct RTINetioAliasList aliasList; }; /*e \ingroup RTINetioLocatorInfoType * \brief For logging * @see REDAOrderedDataTypePrintFunction */ extern RTINetioDllExport void RTINetioLocatorInfo_print( const struct RTINetioLocatorInfo *me, const char *desc, int indent); /*e \ingroup RTINetioLocatorInfoType * @see REDAOrderedDataTypeCompareFunction */ extern RTINetioDllExport int RTINetioLocatorInfo_compare( const struct RTINetioLocatorInfo *l, const struct RTINetioLocatorInfo *r, RTIBool compareAddress); /*e \ingroup RTINetioLocatorInfoType * \brief A value to initialize a variable on the stack. */ #define RTI_NETIO_LOCATOR_INFO_DEFAULT { \ RTI_NETIO_LOCATOR_INVALID, /* Locator */ \ NDDS_TRANSPORT_PRIORITY_DEFAULT, /* transport priority */ \ RTI_NETIO_ALIAS_LIST_DEFAULT /* aliasList */ } /*e \ingroup RTINetioLocatorInfoType * \brief A value to initialize a variable on the stack. */ /* clang-format off */ #define RTI_NETIO_LOCATOR_INFO_INTRA { \ { NDDS_TRANSPORT_CLASSID_INTRA, \ RTI_NETIO_ADDRESS_INVALID, NULL, 0, 0, {0}, 0, RTI_FALSE }, \ NDDS_TRANSPORT_PRIORITY_DEFAULT, /* transport priority */ \ RTI_NETIO_ALIAS_LIST_INTRA, /* aliasList */ } /* clang-format on */ /*e \ingroup RTINetioLocatorInfoType * \brief A value to initialize a variable on the stack. */ /* clang-format off */ #define RTI_NETIO_LOCATOR_INFO_SHMEM { \ { NDDS_TRANSPORT_CLASSID_SHMEM, \ RTI_NETIO_ADDRESS_INVALID, NULL, 0, 0, {0}, 0, RTI_FALSE }, \ NDDS_TRANSPORT_PRIORITY_DEFAULT, /* transport priority */ \ RTI_NETIO_ALIAS_LIST_SHMEM, /* aliasList */ } /* clang-format on */ /*e \ingroup RTINetioLocatorInfoType * \brief A value to initialize a variable on the stack. */ /* clang-format off */ #define RTI_NETIO_LOCATOR_INFO_UDPv4 { \ { NDDS_TRANSPORT_CLASSID_UDPv4, \ RTI_NETIO_ADDRESS_INVALID, NULL, 0, 0, {0}, 0, RTI_FALSE }, \ NDDS_TRANSPORT_PRIORITY_DEFAULT, /* transport priority */ \ RTI_NETIO_ALIAS_LIST_UDPv4 /* aliasList */ } /* clang-format on */ /*e \ingroup RTINetioLocatorInfoType * \brief A value to initialize a variable on the stack. */ /* clang-format off */ #define RTI_NETIO_LOCATOR_INFO_UDPv4_WAN { \ { NDDS_TRANSPORT_CLASSID_UDPv4_WAN, \ RTI_NETIO_ADDRESS_INVALID, NULL, 0, 0, {0}, 0, RTI_FALSE }, \ NDDS_TRANSPORT_PRIORITY_DEFAULT, /* transport priority */ \ RTI_NETIO_ALIAS_LIST_UDPv4_WAN, /* aliasList */ } /* clang-format on */ /*e \ingroup RTINetioLocatorInfoType * \brief A value to initialize a variable on the stack. */ /* clang-format off */ #define RTI_NETIO_LOCATOR_INFO_UDPv6 { \ { NDDS_TRANSPORT_CLASSID_UDPv6, \ RTI_NETIO_ADDRESS_INVALID, NULL, 0, 0, {0}, 0, RTI_FALSE }, \ NDDS_TRANSPORT_PRIORITY_DEFAULT, /* transport priority */ \ RTI_NETIO_ALIAS_LIST_UDPv6, /* aliasList */ } /* clang-format on */ /* ================================================================= */ /* Message Received */ /* ================================================================= */ /*e \defgroup RTINetioMessageClass RTINetioMessage * \ingroup RTINetioCommonComponent * \brief Class to represent a received message. */ /*e * \ingroup RTINetioMessageClass * * \brief Notify that we are done with the received message. * * It is possible that high performance transports lend their internal buffer * to higher layer to avoid copying memory. In that case, it is crucial that * the higher layer releases the memory as soon as read is done, to avoid * running out of memory in the transport. * * Implementation that allow multiple threads to process messages * sent to 1 ReceiveResource (as returned by * NDDS_Transport_create_recvresource_fnc_rEA) must guarantee * thread safety if the same param argument is doled out to those * receiver threads. That is, the following implementations need not * provide MT safety: *
    *
  • Those that do not need this implementation (of course!) *
  • Those for whom the param argument does not resolve to a resource * that will be accessed concurrently. *
  • Those for whom the param argument DOES resolve to a resource * that will be accessed concurrently, but which is internally MT safe. * <\UL> * * We require that the propagation of the message to upper layers always be * within the same context as the thread that made the call to the * RTINetioReceiver_receiveFast() function. Furthermore, this function * must be called before calling RTINetioReceiver_returnLoan()/ * RTINetioReceiver_returnLoanAndDisownResource. * * This means that a compliant implementation of a receive thread will exhibit * the following sequence of calls made using the netio API: * \code * RTINetioReceiver_receiveFast() * RTINetioReceiver_returnLoan() (only if supporting resource bounded mode) * RTINetioReceiver_returnLoanAndDisownResource() * \endcode * However, in the future, to support such concepts as a zero-copy transport, * this requirement will need to be removed such that the * return_loaned_buffer function may be called elsewhere as needed. At * that time, some transports may need to be strengthened and modified * to meet this requirement. * * @internal See bug #8205 for more details. */ /*e \ingroup RTINetioMessageClass * \brief Information about the received message, to be set * by the receiving transport. * * @see RTINetioMessage_return_loaned_buffer */ struct RTINetioMessage { NDDS_Transport_Message_t message; struct RTINtpTime timestamp; struct NDDS_Transport_Context_t transportContext; }; #define RTI_NETIO_MESSAGE_INVALID { \ NDDS_TRANSPORT_MESSAGE_INVALID, \ RTI_NTP_TIME_ZERO, \ NDDS_TRANSPORT_CONTEXT_INVALID \ } /* * @brief Structure used to pack together Network Capture arguments that are * going to be passed from mig to netio, through RTINetioSender_sendFast in * GeneratorContext.c. */ struct RTINetioCapArguments { struct RTINetioCapManager *manager; struct RTINetioCapTransportGatherBuffer rtpsBuffer; struct RTINetioCapTransportGatherBuffer rtpsDecodedBuffer; struct RTINetioCapTransportGatherBuffer rtpsDecodedSubmessagesBuffer; }; #define RTINetioCapArguments_INITIALIZER { \ NULL, \ RTI_NETIO_CAP_TRANSPORT_GATHER_BUFFER_INITIALIZER, \ RTI_NETIO_CAP_TRANSPORT_GATHER_BUFFER_INITIALIZER, \ RTI_NETIO_CAP_TRANSPORT_GATHER_BUFFER_INITIALIZER } /* ================================================================= */ /* ================================================================= */ /* Installed Transports Properties */ /* ================================================================= */ struct RTINetioTransportInfo { NDDS_Transport_ClassId_t classid; RTI_INT32 messageSizeMax; }; /** * In the existing implementation, it is not required to keep * a level relationship between the table EAs in NETIO because we do not take * one EA inside another. * * The EAs can also refer to the same EA. * * However, the level of these EAs is determined by the maximum EA level in * which the caller to the netio APIs can be. * * See DomainParticipantConcurrency.c for details on different EA levels. */ struct RTINetioConcurrency { struct REDAExclusiveArea *configuratorTableEa; struct REDAExclusiveArea *senderTableEa; struct REDAExclusiveArea *receiverTableEa; }; #define RTINetioConcurrency_INITIALIZER {NULL, NULL, NULL} #ifdef __cplusplus } /* extern "C" */ #endif #include "netio/netio_common_impl.h" #endif /* netio_common_h */