/* ( (c) Copyright, Real-Time Innovations, 2003-2024. * 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 cdr_encapsulation_h #define cdr_encapsulation_h #ifndef cdr_dll_h #include "cdr/cdr_dll.h" #endif #ifndef osapi_type_h #include "osapi/osapi_type.h" #endif #include "xcdr/xcdr_stream.h" /* For VxWorks defines */ #ifdef RTI_VXWORKS #include #endif #ifdef __cplusplus extern "C" { #endif /* OMG CDR Big Endian */ #define RTI_CDR_ENCAPSULATION_ID_CDR_BE RTI_XCDR_ENCAPSULATION_ID_CDR_BE /* OMG CDR Little Endian */ #define RTI_CDR_ENCAPSULATION_ID_CDR_LE RTI_XCDR_ENCAPSULATION_ID_CDR_LE /* Parameter List OMG CDR Big Endian */ #define RTI_CDR_ENCAPSULATION_ID_PL_CDR_BE RTI_XCDR_ENCAPSULATION_ID_PL_CDR_BE /* Parameter List OMG CDR Little Endian */ #define RTI_CDR_ENCAPSULATION_ID_PL_CDR_LE RTI_XCDR_ENCAPSULATION_ID_PL_CDR_LE #define RTI_CDR_ENCAPSULATION_ID_CDR2_BE RTI_XCDR_ENCAPSULATION_ID_CDR2_BE #define RTI_CDR_ENCAPSULATION_ID_CDR2_LE RTI_XCDR_ENCAPSULATION_ID_CDR2_LE #define RTI_CDR_ENCAPSULATION_ID_D_CDR2_BE RTI_XCDR_ENCAPSULATION_ID_D_CDR2_BE #define RTI_CDR_ENCAPSULATION_ID_D_CDR2_LE RTI_XCDR_ENCAPSULATION_ID_D_CDR2_LE #define RTI_CDR_ENCAPSULATION_ID_PL_CDR2_BE RTI_XCDR_ENCAPSULATION_ID_PL_CDR2_BE #define RTI_CDR_ENCAPSULATION_ID_PL_CDR2_LE RTI_XCDR_ENCAPSULATION_ID_PL_CDR2_LE /* #define RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE 0x0004 */ /* #define RTI_CDR_ENCAPSULATION_ID_PL_CDR_NATIVE 0x0005 */ #define RTI_CDR_ENCAPSULATION_ID_INVALID 0xFFFFU #define RTI_CDR_ENCAPSULATION_ID_ALREADY_PROCESSED 0xFFFE #define RTI_CDR_ENCAPSULATION_OPTIONS_NONE RTI_XCDR_ENCAPSULATION_OPTIONS_NONE #define RTI_CDR_ENCAPSULATION_HEADER_SIZE RTI_XCDR_ENCAPSULATION_HEADER_SIZE #define RTI_CDR_COMPRESSION_HEADER_SIZE RTI_XCDR_COMPRESSION_HEADER_SIZE /* {parameterId, parameterLength}. Used for inlineQos ParameterList. */ #define RTI_CDR_PARAMETER_SHORT_HEADER_SIZE 4 #define RTI_CDR_SHORT_PARAMETER_LENGTH 2 #define RTI_CDR_ENCAPSULATION_ID_SIZE RTI_XCDR_ENCAPSULATION_ID_SIZE #define RTI_CDR_ENCAPSULATION_OPTIONS_SIZE RTI_XCDR_ENCAPSULATION_OPTIONS_SIZE #ifdef RTI_ENDIAN_LITTLE #define RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE RTI_CDR_ENCAPSULATION_ID_CDR_LE #define RTI_CDR_ENCAPSULATION_ID_PL_CDR_NATIVE RTI_CDR_ENCAPSULATION_ID_PL_CDR_LE #define RTI_CDR_ENCAPSULATION_ID_CDR2_NATIVE RTI_CDR_ENCAPSULATION_ID_CDR2_LE #define RTI_CDR_ENCAPSULATION_ID_PL_CDR2_NATIVE RTI_CDR_ENCAPSULATION_ID_PL_CDR2_LE #define RTI_CDR_ENCAPSULATION_ID_D_CDR2_NATIVE RTI_CDR_ENCAPSULATION_ID_D_CDR2_LE #else #define RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE RTI_CDR_ENCAPSULATION_ID_CDR_BE #define RTI_CDR_ENCAPSULATION_ID_PL_CDR_NATIVE RTI_CDR_ENCAPSULATION_ID_PL_CDR_BE #define RTI_CDR_ENCAPSULATION_ID_CDR2_NATIVE RTI_CDR_ENCAPSULATION_ID_CDR2_BE #define RTI_CDR_ENCAPSULATION_ID_PL_CDR2_NATIVE RTI_CDR_ENCAPSULATION_ID_PL_CDR2_BE #define RTI_CDR_ENCAPSULATION_ID_D_CDR2_NATIVE RTI_CDR_ENCAPSULATION_ID_D_CDR2_BE #endif /* Vendor specific encapsulation IDs start from 0xC000 */ #define RTI_ENCAPSULATION_ID_SHMEM_REF_PLAIN 0xC000 #define RTI_ENCAPSULATION_ID_SHMEM_REF_FLAT_DATA 0xC001 typedef RTI_UINT16 RTIEncapsulationId; typedef RTI_UINT16 RTIEncapsulationOptions; extern RTICdrDllExport RTIBool RTICdrEncapsulation_validPlainCdrEncapsulationId( RTIEncapsulationId identifer); extern RTICdrDllExport RTIBool RTICdrEncapsulation_validParameterCdrEncapsulationId( RTIEncapsulationId identifer); extern RTICdrDllExport RTIBool RTICdrEncapsulation_validDelimitedCdrEncapsulationId( RTIEncapsulationId identifer); extern RTICdrDllExport RTIBool RTICdrEncapsulation_validCdrV1EncapsulationId( RTIEncapsulationId identifer); extern RTICdrDllExport RTIBool RTICdrEncapsulation_validCdrV2EncapsulationId( RTIEncapsulationId identifer); extern RTICdrDllExport RTIBool RTICdrEncapsulation_validCdrEncapsulationId( RTIEncapsulationId identifer); extern RTICdrDllExport RTIBool RTICdrEncapsulation_validShmemRefEncapsulationId( RTIEncapsulationId identifer); /* * We prefer validCdrEncapsulationId, but we use validEncapsulationId in * generated code, so we keep its definition for backward compatibility. */ extern RTICdrDllExport RTIBool RTICdrEncapsulation_validEncapsulationId( RTIEncapsulationId identifer); /* * Get the native endianness of the machine. This function should be used * instead of RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE in code that could * potentially be compiled by the user, such as in generated code. If the * macro is used in these contexts, RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE * will always resolve to RTI_CDR_ENCAPSULATION_ID_CDR_BE because the user * does not define RTI_ENDIAN_LITTLE when they compile their code. */ extern RTICdrDllExport RTIEncapsulationId RTICdrEncapsulation_getNativeCdrEncapsulationId(void); /* * If identifier is not a PL encapsulation, this function returns its * corresponding PL encapsulation. */ extern RTICdrDllExport RTIEncapsulationId RTICdrEncapsulation_getParameterCdrEncapsulationId( RTIEncapsulationId plainCdrEncapsulationId); extern RTICdrDllExport RTIBool RTICdrEncapsulation_isLittleEndianCdrEncapsulationId( RTIEncapsulationId encapsulationId); extern RTICdrDllExport RTIBool RTICdrEncapsulation_isBigEndianCdrEncapsulationId( RTIEncapsulationId encapsulationId); struct RTIEncapsulationInfo { RTIEncapsulationId encapsulationId; RTIBool getLazy; RTIBool returnImmediate; RTIBool useZeroCopy; }; #define RTI_ENCAPSULATION_INFO_DEFAULT \ { \ RTI_CDR_ENCAPSULATION_ID_CDR_NATIVE, /* encapsulationId */ \ RTI_FALSE, /* getLazy */ \ RTI_FALSE, /* returnImmediate */ \ RTI_FALSE, /* doZeroCopy */ \ } /* ----------------------------------------------------------------- */ /* Extensible types definitions */ /* ----------------------------------------------------------------- */ /*e \ingroup RTICdrEncapsulationModule * * \brief Parameter header alignment in the (de)serialization buffer */ #define RTI_CDR_PARAMETER_HEADER_ALIGNMENT 4 /*e \ingroup RTICdrEncapsulationModule * * \brief Maximum user parameter ID that can be encapsulated without requiring * extended encapsulation. */ #define RTI_CDR_PID_NON_EXTENDED_USER_MAX_VALUE 0x3F00 /*e \ingroup RTICdrEncapsulationModule * * \brief Maximum parameter ID that can be encapsulated without requiring * extended encapsulation. */ #define RTI_CDR_PID_NON_EXTENDED_ABSOLUTE_MAX_VALUE 0x3FFF /*e \ingroup RTICdrEncapsulationModule * * \brief Allows the specification of large member ID and/or data length values */ #define RTI_CDR_PID_EXTENDED 0x3F01 /*e \ingroup RTICdrEncapsulationModule * * \brief Indicates the end of the parameter list data structure * * RTPS specifies that the PID value 1 shall be used to terminate parameter lists * within the DDS built-in topic data types. Rather than reserving this parameter * ID for all types, thereby complicating the member ID-to-parameter ID mapping * rules for all producers and consumers of this Data Representation, Simple * Discovery types only shall be subject to a special case: member ID 1 shall * not be used, and either parameter ID 0x3F02 or parameter ID 1 shall terminate * the parameter list. These types consist of the built-in topic data types, * and those other types that contain them as members, as defined by [RTPS]. */ #define RTI_CDR_PID_LIST_END 0x3F02 /*e \ingroup RTICdrEncapsulationModule * * \brief All consumers of this Data Representation shall ignore parameters with this ID */ #define RTI_CDR_PID_IGNORE 0x3F03 /*e \ingroup RTICdrEncapsulationModule * * \brief Indicates whether the parameter has an implementation-specific interpretation */ #define RTI_CDR_PARAMETER_FLAG_IMPL_EXTENSION 0x8000 /*e \ingroup RTICdrEncapsulationModule * * \brief indicates whether the parameter, if its ID is not recognized by the consuming * implementation, may be simply ignored or whether it causes the entire data sample to be * discarded */ #define RTI_CDR_PARAMETER_FLAG_MUST_UNDERSTAND 0x4000 /*e \ingroup RTICdrEncapsulationModule * * \brief indicates whether the parameter, if its ID is not recognized by the consuming * implementation, may be simply ignored or whether it causes the entire data sample to be * discarded */ #define RTI_CDR_LONG_PARAMETER_FLAG_MUST_UNDERSTAND 0x40000000 /*e \ingroup RTICdrTypeModule * \brief Extracts the extension and must understand flags from the input parameter */ extern RTICdrDllExport void RTICdrParameterId_stripOutFlags(RTI_UINT16 * paramaterId); /*e \ingroup RTICdrTypeModule * \brief Extracts the extension and must understand flags from the input parameter */ extern RTICdrDllExport void RTICdrLongParameterId_stripOutFlags(RTI_UINT32 * paramaterId); #ifdef __cplusplus } /* extern "C" */ #endif #include "cdr/cdr_encapsulation_impl.h" #endif /* cdr_encapsulation_h */