- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten - svcTabCommon: Export-Header-Fix via Fallback-Target - TrainingAreaBase: Stub-Header für BUILD_RTI=OFF - ddsfts: Include-Pfad und Dependency-Fixes - BUILD_RTI=OFF Compilation vollständig unterstützt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
740 lines
25 KiB
C
740 lines
25 KiB
C
/*
|
|
* 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 mig_interpreter_h
|
|
#define mig_interpreter_h
|
|
|
|
|
|
#ifndef osapi_ntptime_h
|
|
#include "osapi/osapi_ntptime.h"
|
|
#endif
|
|
#ifndef osapi_hash_h
|
|
#include "osapi/osapi_hash.h"
|
|
#endif
|
|
#ifndef netio_common_h
|
|
#include "netio/netio_common.h"
|
|
#endif
|
|
#ifndef reda_worker_h
|
|
#include "reda/reda_worker.h"
|
|
#endif
|
|
#ifndef reda_weakReference_h
|
|
#include "reda/reda_weakReference.h"
|
|
#endif
|
|
#ifndef reda_database_h
|
|
#include "reda/reda_database.h"
|
|
#endif
|
|
#ifndef netio_cap_include_manager_h
|
|
#include "netio_cap/netio_cap_manager.h"
|
|
#endif
|
|
#ifndef mig_dll_h
|
|
#include "mig/mig_dll.h"
|
|
#endif
|
|
#ifndef mig_rtps_h
|
|
#include "mig/mig_rtps.h"
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/* security */
|
|
#define MIG_INTERPRETER_CONTEXT_NUM_DECODE_BUFFERS 2
|
|
|
|
struct MIGInterpreter;
|
|
|
|
struct RTIClock; /* forward declare to appease compiler */
|
|
|
|
struct REDABuffer;
|
|
|
|
struct REDAWorker;
|
|
|
|
struct REDACursor;
|
|
|
|
struct RTIEventActiveObjectListener;
|
|
|
|
struct RTINetioMessage;
|
|
|
|
/*e \defgroup MIGInterpreterClass MIGInterpreter
|
|
\ingroup MIGModule
|
|
|
|
\brief Interpreter fulfills the role of a callback agent table.
|
|
|
|
The user establishes the following contract with the interpreter:
|
|
<OL>
|
|
<LI>The user registers a callback to be called when a message with certain
|
|
signature is detected.
|
|
<LI>A new logical interpreter context is created with
|
|
MIGInterpreter_getContext BEFORE a message is received (optimization
|
|
for better latency).
|
|
<LI>The user uses RTINetioReceiver to receive messages from other
|
|
applications, then calls MIGInterpreter_parse.
|
|
<LI>Interpreter parses the message according to the RTPS protocol,
|
|
using the context already created in the first step, and
|
|
calls the registered callback. Once a message is completely consumed
|
|
(that is, parse completes), the existing context is invalid.
|
|
</OL>
|
|
*/
|
|
|
|
/*e \defgroup MIGInterpreterContextClass MIGInterpreterContext
|
|
\ingroup MIGInterpreterClass
|
|
|
|
\brief For MT safety, each thread interpreting the data gets its own context.
|
|
This is expected to be placed in the REDAWorker storage area through
|
|
REDAWorker_getStorage.
|
|
|
|
@invariant A worker may have 1 and only 1 context while waiting for message
|
|
or parsing a message, and 0 at all other times.
|
|
*/
|
|
|
|
/*e \ingroup MIGInterpreterContextClass
|
|
\brief public member fields
|
|
*/
|
|
struct MIGInterpreterContext {
|
|
/*e RTPS message version */
|
|
MIGRtpsProtocolVersion version;
|
|
/*e RTPS implementation vendor ID of the source */
|
|
MIGRtpsVendorId vendorId;
|
|
/*e */
|
|
MIGRtpsHostId sourceHostId;
|
|
/*e */
|
|
MIGRtpsAppId sourceAppId;
|
|
/*e */
|
|
MIGRtpsInstanceId sourceInstanceId; /*RTPS.2.0*/
|
|
/*e */
|
|
MIGRtpsHostId destinationHostId;
|
|
/*e */
|
|
MIGRtpsAppId destinationAppId;
|
|
/*e */
|
|
MIGRtpsInstanceId destinationInstanceId; /*RTPS.2.0*/
|
|
/*e */
|
|
NDDS_Transport_Address_t unicastReplyIp;
|
|
/*e */
|
|
NDDS_Transport_Port_t unicastReplyPort;
|
|
/*e */
|
|
NDDS_Transport_Address_t multicastReplyIp;
|
|
/*e */
|
|
NDDS_Transport_Port_t multicastReplyPort;
|
|
/*e Valid iff haveTimestamp is true */
|
|
struct RTINtpTime timestamp;
|
|
/*e @see timestamp */
|
|
RTIBool haveTimestamp;
|
|
/*
|
|
* The timestamp (taken as late as possible) when the entire message was
|
|
* about to be put onto the wire. It is transported in the RTPS Header
|
|
* Extension. It is different than INFO_TS (context.timestamp) as
|
|
* rtpsTimestamp is for the message and context.timestamp is for user data.
|
|
*/
|
|
struct RTINtpTime rtpsTimestamp;
|
|
/*
|
|
* The length of the entire message. It is populated in
|
|
* MIGInterpreter_parse and equal to either the messageLength field in
|
|
* RTPS Header Extension or the entire length of the buffer received in
|
|
* the datagram.
|
|
*/
|
|
RTI_UINT32 messageLength;
|
|
|
|
/*
|
|
* The hash stream to store computed checksum for incoming message.
|
|
* We store it here to avoid allocating and deallocating it for every
|
|
* message when RTPS HE CRC is enabled. We may still need to reinitialize
|
|
* the hash stream if we are receiving messages with different CRCs.
|
|
*/
|
|
RTIOsapiHashStream computedHashStream;
|
|
|
|
MIGRtpsDataFlags dataExtraFlags;
|
|
|
|
RTI_UINT16 dataOctetsToInlineQos;
|
|
|
|
/*e */
|
|
MIGRtpsObjectId readerObjectId;
|
|
/*e */
|
|
MIGRtpsObjectId writerObjectId;
|
|
|
|
/*e */
|
|
MIGRtpsSubmessageId submessageId;
|
|
/*e Raw, undeserialized and (possibly) unaligned user data */
|
|
struct REDABuffer data; /* #6672 */
|
|
/*e gives more context to each submessage */
|
|
MIGRtpsSubmessageFlag submessageFlags;
|
|
|
|
/* immutables */
|
|
MIGRtpsHostId _myHostId;
|
|
MIGRtpsAppId _myAppId;
|
|
MIGRtpsInstanceId _myInstanceId; /*RTPS.2.0*/
|
|
/* mutable */
|
|
MIGRtpsObjectId _myObjectId;
|
|
|
|
/* optimization to reduce latency */
|
|
struct REDACursor *_cursor;
|
|
|
|
/*
|
|
* These buffers are used for security cryptographic operations.
|
|
* There are two buffers: one for a decoded RTPS message and one for the
|
|
* decoded submessages.
|
|
* The buffer used for the decoded submessages must be large enough to
|
|
* hold all submessages that can fit in the transport buffer.
|
|
*/
|
|
struct REDABuffer
|
|
_decodeBuffers[MIG_INTERPRETER_CONTEXT_NUM_DECODE_BUFFERS];
|
|
|
|
/* true if we are parsing a decoded submessage */
|
|
RTIBool isParsingDecodedSubmessage;
|
|
};
|
|
|
|
/*e \ingroup MIGInterpreterContextClass
|
|
|
|
may be macroed for performance
|
|
|
|
The interpreter is in byte swap mode
|
|
Deserialize methods usually require direction on whether to byte swap.
|
|
The decision should be based on the endian flag of the current submessage.
|
|
*/
|
|
extern MIGDllExport RTIBool
|
|
MIGInterpreterContext_needsByteSwap(const struct MIGInterpreterContext *contex);
|
|
|
|
/*
|
|
*e \ingroup MIGInterpreterContextClass
|
|
*
|
|
* Deserializes and skips over submessage length
|
|
*/
|
|
extern MIGDllExport void MIGInterpreterContext_deserializeSubmessageDataLength(
|
|
const struct MIGInterpreterContext *context,
|
|
char **dataPtr);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
|
|
\brief These per-interpreter atomic counts are incremented for every
|
|
valid conditions.
|
|
|
|
The count can be queried with WaveProbe.
|
|
*/
|
|
struct MIGInterpreterStat {
|
|
struct MIGRtpsSubmessageStats submessageStats;
|
|
|
|
/*
|
|
* This counter is atomic because multiple receive threads may be
|
|
* incrementing this counter simultaneously.
|
|
*/
|
|
RTI_ATOMIC(RTI_UINT32) successfulParseCount;
|
|
|
|
/*
|
|
* If you add another member here, you must update
|
|
* MIGInterpreterStat_initialize.
|
|
*/
|
|
|
|
unsigned int bufferLengthFailedCount;
|
|
unsigned int nonRtpsMessageCount;
|
|
unsigned int versionMismatchCount;
|
|
unsigned int submessageDataLengthFailedCount;
|
|
unsigned int unknownSubmessageCount;
|
|
|
|
/* corrupted_rtps_message_count_change will be reset only by the public API
|
|
* call - get_participant_protocol_status() */
|
|
RTI_INT64 corruptedRtpsMessageCountChange;
|
|
/* Below two statistics can be retrieved from
|
|
* DomainParticipantProtocolStatus. Hence the table ea needs to be taken
|
|
* before updating them. The corruptedRtpsMessageCount is incremented when
|
|
* the checksum present in the MIG_RTPS_CRC32 submessage is not equal to
|
|
* the computed checksum.
|
|
* */
|
|
RTI_INT64 corruptedRtpsMessageCount;
|
|
struct RTINtpTime lastCorruptedMessageTS;
|
|
};
|
|
|
|
#define MIGInterpreterStat_INITIALIZER \
|
|
{ \
|
|
MIGRtpsSubmessageStats_INITIALIZER, /* submessageStats */ \
|
|
RTI_OSAPI_ATOMIC_LITERAL_PLACEHOLDER(0), /* successfulParseCount */ \
|
|
0, /* bufferLengthFailedCount */ \
|
|
0, /* nonRtpsMessageCount */ \
|
|
0, /* versionMismatchCount */ \
|
|
0, /* submessageDataLengthFailedCount */ \
|
|
0, /* unknownSubmessageCount */ \
|
|
0, /* corruptedRtpsMessageCountChange */ \
|
|
0, /* corruptedRtpsMessageCount */ \
|
|
RTI_NTP_TIME_INVALID /* lastCorruptedMessageTS */ \
|
|
}
|
|
|
|
#define MIGInterpreterStat_initialize(p) \
|
|
{ \
|
|
struct MIGInterpreterStat d = MIGInterpreterStat_INITIALIZER; \
|
|
size_t offsetOfFirstNonAtomicMember = offsetof( \
|
|
struct MIGInterpreterStat, \
|
|
bufferLengthFailedCount); \
|
|
size_t i__; \
|
|
for (i__ = 0; i__ < MIG_RTPS_SUBMESSAGE_BASIC_KINDS_SIZE; ++i__) { \
|
|
RTIOsapiAtomic_initialize( \
|
|
&(p)->submessageStats.basicSubmessageCount[i__], \
|
|
0); \
|
|
} \
|
|
for (i__ = 0; i__ < MIG_RTPS_SUBMESSAGE_SECURE_KINDS_SIZE; ++i__) { \
|
|
RTIOsapiAtomic_initialize( \
|
|
&(p)->submessageStats.secureSubmessageCount[i__], \
|
|
0); \
|
|
} \
|
|
for (i__ = 0; i__ < MIG_RTPS_SUBMESSAGE_VENDOR_KINDS_SIZE; ++i__) { \
|
|
RTIOsapiAtomic_initialize( \
|
|
&(p)->submessageStats.vendorSubmessageCount[i__], \
|
|
0); \
|
|
} \
|
|
RTIOsapiAtomic_initialize( \
|
|
&(p)->successfulParseCount, \
|
|
0); \
|
|
RTIOsapiMemory_copy( \
|
|
(char *) p + offsetOfFirstNonAtomicMember, \
|
|
(char *) &d + offsetOfFirstNonAtomicMember, \
|
|
sizeof(struct MIGInterpreterStat) \
|
|
- offsetOfFirstNonAtomicMember); \
|
|
}
|
|
|
|
struct MIGInterpreterForwarder;
|
|
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
*
|
|
* @brief Forwards decoding of a message or submessage to PRES.
|
|
*
|
|
* @param decodedBuffer \b Out. The result of decoding the input
|
|
*
|
|
* @param encodedBuffer \b In. The input
|
|
*
|
|
* @param isMultiSubmessage \b In. True if this operation is decoding the whole
|
|
* rtps message; false if it's just decoding a submessage
|
|
*
|
|
* @param remoteParticipantId \b In. GUID prefix of the sender
|
|
*
|
|
* @param worker \b In. identifies the receiver thread that is parsing the
|
|
* message.
|
|
*/
|
|
typedef RTIBool (*MIGInterpreter_DecodeFunction)(
|
|
const struct MIGInterpreterForwarder *forwarder,
|
|
struct REDABuffer *decodedBuffer,
|
|
const struct REDABuffer *encodedBuffer,
|
|
RTIBool isMultiSubmessage,
|
|
const MIGRtpsParticipantId *remoteParticipantId,
|
|
struct REDAWorker *worker);
|
|
|
|
struct MIGInterpreterForwarder {
|
|
MIGInterpreter_DecodeFunction decode;
|
|
};
|
|
|
|
struct MIGInterpreterProperty {
|
|
/*e boolean property can be encoded compactly as a bit */
|
|
int bitmap;
|
|
/*e \brief Enforces that the submessages are aligned to 4-bytes as specified
|
|
* in the RTPS protocol.
|
|
*
|
|
* When enabled (default) we will not interoperate with non-patched 4.5d
|
|
* and earlier versions if using data fragmentation.
|
|
*/
|
|
RTIBool enforceSubmessageAlignment;
|
|
/*e security: preallocate buffers to store the output of decode
|
|
operations */
|
|
RTIBool canDecode;
|
|
/*e security: with some exceptions, like participant simple discovery and
|
|
stateless authentication handshake messages */
|
|
RTIBool mustDecodeRtpsMessage;
|
|
/*e security: if participant simple discovery and stateless authentication
|
|
* handshake messages must be encoded with a pre-shared key.
|
|
*/
|
|
RTIBool mustDecodeRtpsBootstrappingMessage;
|
|
/*e \brief Specifies if RTPS CRC32 checksum needs to be validated
|
|
* Used to collect statistics of corrupted RTPS messages.
|
|
*/
|
|
RTIBool crcEnabled;
|
|
/*i \brief Specifies whether the interpreter should log a warning when a
|
|
* participant discovery mismatch is detected (SPDP/SPDP2).
|
|
*/
|
|
RTIBool logParticipantDiscoveryMismatch;
|
|
/*i \brief Specifies whether the participant supports SPDP2 */
|
|
RTIBool isSpdp2;
|
|
/*e control growth of interpreter table */
|
|
struct REDATableProperty listener;
|
|
/*e functions to forward to PRES */
|
|
struct MIGInterpreterForwarder *forwarder;
|
|
};
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
\brief Initialize a stack variable when specifying the property
|
|
\code
|
|
struct MIGInterpreterProperty myProperty = MIG_INTERPRETER_PROPERTY_DEFAULT;
|
|
myProperty.hashBucketCount *= 2; // double hash bucket for faster search
|
|
\endcode
|
|
*/
|
|
#define MIG_INTERPRETER_PROPERTY_DEFAULT \
|
|
{ \
|
|
0, /* bitmap */ \
|
|
RTI_TRUE, /* enforceSubmessageAlignment */ \
|
|
RTI_FALSE, /* canDecode */ \
|
|
RTI_FALSE, /* mustDecodeRtpsMessage */ \
|
|
RTI_FALSE, /* mustDecodeRtpsBootstrappingMessage */ \
|
|
RTI_FALSE, /* crcEnabled */ \
|
|
RTI_TRUE, /* logParticipantDiscoveryMismatch */ \
|
|
RTI_FALSE, /* isSpdp2 */ /* listener */ \
|
|
{ { 32, \
|
|
REDA_FAST_BUFFER_POOL_UNLIMITED, \
|
|
REDA_FAST_BUFFER_POOL_UNLIMITED }, \
|
|
9 /* hashBucketCount */ }, \
|
|
NULL /* forwarder */ \
|
|
}
|
|
|
|
/**e \ingroup MIGInterpterClass
|
|
\brief Gets the interpreter property
|
|
*/
|
|
extern MIGDllExport void MIGInterpreter_getProperty(
|
|
struct MIGInterpreter *me,
|
|
struct MIGInterpreterProperty *property);
|
|
|
|
/**e \ingroup MIGInterpterClass
|
|
\brief Sets the interpreter property
|
|
*/
|
|
extern MIGDllExport void MIGInterpreter_setProperty(
|
|
struct MIGInterpreter *me,
|
|
const struct MIGInterpreterProperty *property);
|
|
|
|
/**e \ingroup MIGInterpterClass
|
|
\brief Get the interpreter ready for destruction.
|
|
*/
|
|
extern MIGDllExport RTIBool
|
|
MIGInterpreter_shutdown(struct MIGInterpreter *me, struct REDAWorker *worker);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
*
|
|
* @pre Valid args. non-NULL optional args values should be valid.
|
|
*
|
|
* @param database \b In. The database in which the interpreter will add its
|
|
* internal table.
|
|
*
|
|
* @param ea \b In. Exclusive area for the internal table
|
|
*
|
|
* @param guidPrefix \b In. The guid of the participant of the application.
|
|
*
|
|
* @param listener \b In. Optional. listener for detecting interpreter stopped
|
|
* event.
|
|
*
|
|
* @param property \b In. Optional. Desired behavior of this interpreter.
|
|
* May be NULL for default property.
|
|
*
|
|
* @param timestampClock \b In. A real time clock used to generate statistics
|
|
* about incoming messages.
|
|
*
|
|
* @param netioCapManager \b in. Structure used for Network Capture to store
|
|
* participant related information. Needed for capturing.
|
|
*
|
|
* @param worker \b In. Identifies the calling thread.
|
|
*
|
|
* @return NULL on failure.
|
|
*
|
|
* @see MIGInterpreter_delete
|
|
*/
|
|
extern MIGDllExport struct MIGInterpreter *MIGInterpreter_new(
|
|
struct REDADatabase *database,
|
|
struct REDAExclusiveArea *ea,
|
|
const struct MIGRtpsGuidPrefix *guidPrefix,
|
|
struct RTIEventActiveObjectListener *listener,
|
|
const struct MIGInterpreterProperty *property,
|
|
struct RTIClock *timestampClock,
|
|
struct RTINetioCapManager *netioCapManager,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
|
|
@param me \b In. "this". If NULL, noop.
|
|
@param worker \b In. Identifies the calling thread.
|
|
|
|
@see MIGInterpreter_new
|
|
*/
|
|
extern MIGDllExport void MIGInterpreter_delete(
|
|
struct MIGInterpreter *me,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
\brief Copies the per-interpreter level statistics to the stat parameter.
|
|
|
|
*/
|
|
extern MIGDllExport void MIGInterpreter_getStat(
|
|
struct MIGInterpreter *me,
|
|
struct MIGInterpreterStat *stat,
|
|
RTIBool clearChange,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
|
|
\brief Prepare a worker for parsing using an interpreter.
|
|
|
|
@pre valid args
|
|
For better latency call before blocking for message.
|
|
@post Worker specific storage for cursor and context have
|
|
been allocated and the context has been initialized.
|
|
|
|
@param resetContext If true, the context is reset to default values.
|
|
|
|
@return Worker specific context on success, NULL on failure.
|
|
|
|
@mtsafety safe
|
|
*/
|
|
extern MIGDllExport struct MIGInterpreterContext *MIGInterpreter_getContext(
|
|
struct MIGInterpreter *me,
|
|
RTIBool resetContext,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \ingroup MIGInterpreterListenerClass
|
|
\brief Save whatever you want (that fits in the space given) in here,
|
|
and the interpreter will call you back when a match occurs.
|
|
|
|
@see MIGInterpreterListenerOnMatchCallback
|
|
*/
|
|
/* RTPS 2.0: supports MIGInterpreterListenerKey with larger GUID */
|
|
struct MIGInterpreterListenerStorage {
|
|
void *field[8];
|
|
};
|
|
|
|
#define MIG_INTERPRETER_LISTENER_STORAGE_INITIALIZER \
|
|
{ \
|
|
{ \
|
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
|
|
} \
|
|
}
|
|
|
|
struct MIGInterpreterListener; /* forward declare to appease compiler */
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
|
|
\brief Interpreter listener callback prototype.
|
|
|
|
@param recordWR \b In. The user will cache whatever data it needs to
|
|
take correct action in the listener, but we use weak reference instead of
|
|
pointer to avoid dangling (dangerous) pointer problem.
|
|
|
|
@param context \b In. The current context of the interpreter. This is
|
|
guaranteed only to be valid during the callback. As such, any information
|
|
such as the data buffer needed beyond the callback must be copied.
|
|
|
|
@param timestamp \b In. Time when message was received on local machine.
|
|
NULL if timestamping is not supported (that is, if the RTINetioReceiver's
|
|
RTI_NETIO_RECEIVER_PROPERTY_BIT_TIMESTAMP is unset).
|
|
|
|
@param storage \b In. (Small) storage space to be cached with this
|
|
listener-key combination.
|
|
|
|
@param submessageSize \b In. The size of the submessage, including
|
|
MIG_RTPS_SUBMESSAGE_HEADER_SIZE.
|
|
|
|
@param worker \b In. identifies the receiver thread that is parsing the
|
|
message.
|
|
|
|
@mtsafety implementer must guarantee safety wrt different threads
|
|
calling the listener with same weakReference.
|
|
*/
|
|
typedef void (*MIGInterpreterListenerOnMatchCallback)(
|
|
const struct MIGInterpreterListener *me,
|
|
const struct MIGInterpreterContext *context,
|
|
const struct RTINtpTime *timestamp,
|
|
const struct MIGInterpreterListenerStorage *storage,
|
|
int submessageSize,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \defgroup MIGInterpreterListenerClass MIGInterpreterListener
|
|
\ingroup MIGInterpreterClass
|
|
Derive from this class to handle onMatch callback
|
|
*/
|
|
|
|
/*e \ingroup MIGInterpreterListenerClass
|
|
\brief methods
|
|
*/
|
|
struct MIGInterpreterListener {
|
|
/*e Called for message matching the requested key */
|
|
MIGInterpreterListenerOnMatchCallback onMatch;
|
|
};
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
|
|
\brief Parse a message, invoking listeners as appropriate.
|
|
|
|
@pre Interpreter and worker pair have been prepared with
|
|
MIGInterpreter_prepare.
|
|
|
|
@post
|
|
<LI> RTINetioMessage_finish may be called.
|
|
<LI>Context is invalid.
|
|
|
|
@param context \b In. Obtained from MIGInterpreter_getContext
|
|
|
|
@param message \b In. A received message returned from
|
|
RTINetioReceiver_receiveFast
|
|
|
|
@param worker \b In.
|
|
|
|
@mtsafety safe
|
|
*/
|
|
extern MIGDllExport void MIGInterpreter_parse(
|
|
struct MIGInterpreter *me,
|
|
struct MIGInterpreterContext *context,
|
|
const struct RTINetioMessage *message,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \defgroup MIGInterpreterListenerKeyClass MIGInterpreterListenerKey
|
|
\ingroup MIGInterpreterClass
|
|
\brief How to identify oneself to the interpreter
|
|
*/
|
|
|
|
/*e \ingroup MIGInterpreterListenerKeyClass
|
|
\brief key contents
|
|
*/
|
|
struct MIGInterpreterListenerKey {
|
|
/*e interested messages coming from this GUID */
|
|
struct MIGRtpsGuid guid;
|
|
/*e to this local object; if message has MIG_RTPS_OBJECT_ID_UNKNOWN,
|
|
it is considered a wildcard and that message will be delivered to
|
|
ANY object that expressed interested in matching GUID */
|
|
MIGRtpsObjectId oid;
|
|
};
|
|
|
|
/*e \ingroup MIGInterpreterListenerKeyClass
|
|
\brief length of stringuified key
|
|
@see MIGInterpreterListenerKey_toString
|
|
*/
|
|
#define MIG_INTERPRETER_LISTENER_KEY_STRING_LENGTH (55)
|
|
|
|
/*e \ingroup MIGInterpreterListenerKeyClass
|
|
may be macroed for performance
|
|
@see MIG_INTERPRETER_LISTENER_KEY_STRING_LENGTH REDAToStringBufferFunction
|
|
REDAOrderedDataType_toStringFiveInt
|
|
*/
|
|
extern MIGDllExport const char *MIGInterpreterListenerKey_toString(
|
|
const void *me,
|
|
struct REDABuffer *str);
|
|
|
|
/*e \ingroup MIGInterpreterListenerKeyClass
|
|
may be macroed for performance
|
|
@see REDAOrderedDataType_compareFiveInt
|
|
*/
|
|
extern MIGDllExport int MIGInterpreterListenerKey_compare(void *l, void *r);
|
|
|
|
/*e \ingroup MIGInterpreterListenerKeyClass
|
|
may be macroed for performance
|
|
@see REDAOrderedDataType_printFiveInt
|
|
*/
|
|
extern MIGDllExport void MIGInterpreterListenerKey_print(
|
|
const void *data,
|
|
const char *desc,
|
|
int indent);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
\brief Register a new listener, idempotently.
|
|
|
|
@pre valid args. The listener may be added multiple times.
|
|
@post Any submessage matching the key will cause the registered
|
|
listener to be called.
|
|
|
|
@param key \b In. Call the listener's callback when this is matched. Must
|
|
consist of an exact valid GUID and OID instance.
|
|
@param listener \b in. see MIGInterpreterListenerOnMatchCallback.
|
|
Must remain valid for while a worker may call the callback.
|
|
@pram storage \b In. <<value type>>
|
|
|
|
@return RTI_TRUE if successful and RTI_FALSE otherwise.
|
|
|
|
@see MIGInterpreter_removeListener MIGInterpreterListenerKey
|
|
*/
|
|
extern MIGDllExport RTIBool MIGInterpreter_assertListener(
|
|
struct MIGInterpreter *me,
|
|
const struct MIGInterpreterListenerKey *key,
|
|
const struct MIGInterpreterListener *listener,
|
|
const struct MIGInterpreterListenerStorage *storage,
|
|
struct REDAWorker *worker);
|
|
|
|
/*e \ingroup MIGInterpreterClass
|
|
|
|
\brief Remove a previously added listener.
|
|
|
|
@pre valid args.
|
|
|
|
@param key \b In. See MIGInterpreter_assertListener
|
|
|
|
@return RTI_TRUE if successful and RTI_FALSE otherwise, such as if not found.
|
|
*/
|
|
extern MIGDllExport RTIBool MIGInterpreter_removeListener(
|
|
struct MIGInterpreter *me,
|
|
const struct MIGInterpreterListenerKey *key,
|
|
struct REDAWorker *worker);
|
|
|
|
/*
|
|
* @ingroup MIGInterpreterClass
|
|
* @brief Returns the amount of bytes left in the buffer from the
|
|
* currentPosition.
|
|
* @param buffer \b In.
|
|
* @param currentPosition \b In. Pointer to the current position.
|
|
* @return The amount of bytes left in the buffer from the currentPosition. Zero
|
|
* if there is no space left or there is an issue with passed parameters.
|
|
*/
|
|
extern MIGDllExport RTI_INT32 MIGInterpreter_getSpaceLeft(
|
|
const struct REDABuffer *buffer,
|
|
const char *currentPosition);
|
|
|
|
/*
|
|
* @ingroup MIGInterpreterClass
|
|
* @brief Returns whether or not there is still bytesToAssert number of bytes
|
|
* left in the buffer from the currentPosition. We provide multiple versions of
|
|
* this function to achieve better design and performance as well as making it
|
|
* less error prone.
|
|
* @param buffer \b In.
|
|
* @param currentPosition \b In. Pointer to the current position.
|
|
* @param bytesToAssert \b In. Number of bytes to assert.
|
|
* @return RTI_TRUE if there is still bytesToAssert number of bytes left in the
|
|
* buffer from the currentPosition, RTI_FALSE otherwise.
|
|
*/
|
|
extern MIGDllExport RTIBool MIGInterpreter_assertBufferSpaceUInt16(
|
|
const struct REDABuffer *buffer,
|
|
const char *currentPosition,
|
|
RTI_UINT16 bytesToAssert);
|
|
|
|
/*
|
|
* @ingroup MIGInterpreterClass
|
|
* @brief Returns whether or not there is still bytesToAssert number of bytes
|
|
* left in the buffer from the currentPosition. We provide multiple versions of
|
|
* this function to achieve better design and performance as well as making it
|
|
* less error prone.
|
|
* @param buffer \b In.
|
|
* @param currentPosition \b In. Pointer to the current position.
|
|
* @param bytesToAssert \b In. Number of bytes to assert.
|
|
* @return RTI_TRUE if there is still bytesToAssert number of bytes left in the
|
|
* buffer from the currentPosition, RTI_FALSE otherwise.
|
|
*/
|
|
extern MIGDllExport RTIBool MIGInterpreter_assertBufferSpaceInt32(
|
|
const struct REDABuffer *buffer,
|
|
const char *currentPosition,
|
|
RTI_INT32 bytesToAssert);
|
|
|
|
/*
|
|
* @ingroup MIGInterpreterClass
|
|
* @brief Returns whether or not there is still bytesToAssert number of bytes
|
|
* left in the buffer from the currentPosition. We provide multiple versions of
|
|
* this function to achieve better design and performance as well as making it
|
|
* less error prone.
|
|
* @param buffer \b In.
|
|
* @param currentPosition \b In. Pointer to the current position.
|
|
* @param bytesToAssert \b In. Number of bytes to assert.
|
|
* @return RTI_TRUE if there is still bytesToAssert number of bytes left in the
|
|
* buffer from the currentPosition, RTI_FALSE otherwise.
|
|
*/
|
|
extern MIGDllExport RTIBool MIGInterpreter_assertBufferSpaceUInt32(
|
|
const struct REDABuffer *buffer,
|
|
const char *currentPosition,
|
|
RTI_UINT32 bytesToAssert);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#include "mig/mig_interpreter_impl.h"
|
|
|
|
#endif /* mig_interpreter_h */
|