- 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
508 lines
17 KiB
C
508 lines
17 KiB
C
/*
|
|
* (c) Copyright, Real-Time Innovations, 2002-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 routingservice_test_system_h
|
|
#define routingservice_test_system_h
|
|
|
|
#include "osapi/osapi_type.h"
|
|
#include "routingservice/routingservice_dll.h"
|
|
#include "dds_c/dds_c_subscription.h"
|
|
#include "dds_c/dds_c_domain.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*i \file
|
|
@brief RTI Routing Service test infrastructure
|
|
*/
|
|
|
|
/*i***************************************************************************/
|
|
/* System */
|
|
/*i***************************************************************************/
|
|
|
|
/*i
|
|
* Configuration options for the ROUTERServiceTesterSystem.
|
|
*
|
|
*/
|
|
struct ROUTERServiceTesterSystemProperty{
|
|
/* QoS for the created participants. If NULL default QoS is used */
|
|
struct DDS_DomainParticipantQos *participantQos;
|
|
/* Whether the participantQos is configured */
|
|
RTIBool configureParticipantQos;
|
|
/*
|
|
* Participant partition to be used when creating a participant. If NULL,
|
|
* then no participant partition is used.
|
|
* Note: using this in conjunction with domain tag is not recommended.
|
|
*/
|
|
const char *participantPartition;
|
|
/*
|
|
* Domain tag to be used when creating a participant. If NULL, then no
|
|
* domain tag is used.
|
|
* Note: using this in conjunction with participant partition is not
|
|
* recommended.
|
|
*/
|
|
const char *domainTag;
|
|
/* Whether created participants can discover each other */
|
|
RTIBool ignoreParticipants;
|
|
/* Whether the participants are enabled on creation */
|
|
RTIBool autoenableParticipants;
|
|
/*
|
|
* @brief Specifies whether to create the default publisher for each
|
|
* participant
|
|
*/
|
|
RTIBool createDefaultPublisher;
|
|
/*
|
|
* @brief Specifies whether to create the default subscriber for each
|
|
* participant
|
|
*/
|
|
RTIBool createDefaultSubscriber;
|
|
/* @brief Flag to indicate that participants should enable SPDP2 */
|
|
RTIBool enableSpdp2;
|
|
};
|
|
|
|
|
|
|
|
/*i
|
|
* @brief ROUTERServiceTesterParticipant definition. Association of a
|
|
* participant with a publisher and subscriber.
|
|
*
|
|
* Each participant is created with the same QoS settings. Optionally, a
|
|
* default publisher and a default subscriber can also be also created for
|
|
* each participant. The publisherQos and subscriberQos are set with
|
|
* Topic access scope.
|
|
*/
|
|
struct ROUTERServiceTesterParticipant {
|
|
DDS_DomainParticipant * participant;
|
|
/* @brief default publisher */
|
|
DDS_Publisher * publisher;
|
|
/* @brief default subscriber */
|
|
DDS_Subscriber * subscriber;
|
|
};
|
|
|
|
/*i
|
|
* @brief ROUTERServiceTesterEntities definition. Association of a DataWriter
|
|
* and a DataReader with a topic.
|
|
*/
|
|
struct ROUTERServiceTesterEntities {
|
|
DDS_DataWriter * writer;
|
|
DDS_DataReader * reader;
|
|
DDS_Topic * topic;
|
|
};
|
|
|
|
#define ROUTERServiceTesterSystemProperty_DEFAULT \
|
|
{ \
|
|
NULL, /* participantQos */ \
|
|
RTI_TRUE, /* configureParticipantQos */ \
|
|
NULL, /* participantPartition */ \
|
|
NULL, /* domainTag */ \
|
|
RTI_TRUE, /* ignoreParticipants */ \
|
|
RTI_TRUE, /* autoenableParticipants */ \
|
|
RTI_TRUE, /* createDefaultPublisher */ \
|
|
RTI_TRUE, /* createDefaultSubscriber */ \
|
|
RTI_FALSE /* enableSpdp2 */ \
|
|
}
|
|
|
|
#define ROUTERServiceTesterParticipant_INITIALIZER { NULL, NULL, NULL}
|
|
#define ROUTERServiceTesterEntities_INITIALIZER { NULL, NULL, NULL}
|
|
#define ROUTERServiceTesterSystem_INITIALIZER { \
|
|
NULL, \
|
|
{ ROUTERServiceTesterParticipant_INITIALIZER, \
|
|
ROUTERServiceTesterParticipant_INITIALIZER, \
|
|
ROUTERServiceTesterParticipant_INITIALIZER, \
|
|
ROUTERServiceTesterParticipant_INITIALIZER }, \
|
|
{NULL} \
|
|
}
|
|
|
|
#define ROUTER_SERVICE_TESTER_PARTICIPANT_PUBSUB_MAX (8)
|
|
#define ROUTER_SERVICE_TESTER_SYSTEM_PARTICIPANTS_MAX (4)
|
|
|
|
extern ROUTERDllVariable
|
|
const char* ROUTER_TEST_SYSTEM_INITIAL_PEERS[];
|
|
|
|
extern ROUTERDllVariable
|
|
const int ROUTER_TEST_SYSTEM_INITIAL_PEERS_LENGTH;
|
|
|
|
struct ROUTERServiceTesterParticipantBuiltinTopicListener;
|
|
|
|
/*i
|
|
* @brief ROUTERServiceTesterSystem definition. An array of
|
|
* ROUTERServiceTesterParticipant that can be used to create entities up to
|
|
* ROUTER_SERVICE_TESTER_SYSTEM_PARTICIPANTS_MAX different domains.
|
|
*/
|
|
struct ROUTERServiceTesterSystem {
|
|
DDS_DomainParticipantFactory * factory;
|
|
struct ROUTERServiceTesterParticipant
|
|
participants[ROUTER_SERVICE_TESTER_SYSTEM_PARTICIPANTS_MAX];
|
|
/*i @brief listener data for the built-in participant topic */
|
|
struct ROUTERServiceTesterParticipantBuiltinTopicListener * participantBuiltinTopicListenerData[
|
|
ROUTER_SERVICE_TESTER_SYSTEM_PARTICIPANTS_MAX];
|
|
};
|
|
|
|
/*i
|
|
* @brief Deletes a ROUTERServiceTesterSystem.
|
|
*
|
|
*/
|
|
extern ROUTERDllExport
|
|
void ROUTERServiceTester_deleteSystem(
|
|
struct ROUTERServiceTesterSystem * system);
|
|
|
|
/*i
|
|
* @brief Creates a system with the specified number of
|
|
* ROUTERServiceTesterParticipant.
|
|
*
|
|
* Each participant is created with the same QoS settings. Optionally, a
|
|
* default publisher and a default subscriber can also be also created for
|
|
* each participant.
|
|
* - The publisherQos and subscriberQos are set with Topic access scope.
|
|
*
|
|
* @param domainIds Array of domain Ids from which participants are created.
|
|
* The array index maps directly into the array of participants.
|
|
* @param domainIdCount Size of the domain Ids array. It also specifies the number
|
|
of participants to create.
|
|
*
|
|
* @return The created system or NULL on error.
|
|
*/
|
|
extern ROUTERDllExport
|
|
struct ROUTERServiceTesterSystem * ROUTERServiceTester_createSystem(
|
|
DDS_DomainId_t *domainIds,
|
|
int domainIdCount,
|
|
const struct ROUTERServiceTesterSystemProperty *property,
|
|
const char *partitionName);
|
|
|
|
/*i
|
|
*
|
|
* @brief Creates a participants in the first available index within the
|
|
* specified test system.
|
|
*/
|
|
extern ROUTERDllExport
|
|
DDS_DomainParticipant * ROUTERServiceTester_createParticipant(
|
|
struct ROUTERServiceTesterSystem *system,
|
|
DDS_DomainId_t domainId,
|
|
const struct ROUTERServiceTesterSystemProperty *property);
|
|
|
|
/*i
|
|
* @brief Gets the index of the specified participant within the system.
|
|
*/
|
|
extern ROUTERDllExport
|
|
int ROUTERServiceTester_getSystemParticipantIndex(
|
|
const struct ROUTERServiceTesterSystem *system,
|
|
const DDS_DomainParticipant *participant);
|
|
|
|
/*i
|
|
* @brief Deletes the participant at the specified index
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_deleteParticipant(
|
|
struct ROUTERServiceTesterSystem *system,
|
|
int index);
|
|
|
|
/*i
|
|
* @brief Initializes a ROUTERServiceTesterEntities from the
|
|
* ROUTERServiceTesterParticipant specified by its index within the system.
|
|
*
|
|
* This operation can create a DataReader and A DataWriter from a topic specified
|
|
* by its name. The operation will assert the topic with the specified name.
|
|
* If a topic does not exist, it creates a new one with the specified name.
|
|
* If it exists, it reuses it and the type name is ignored.
|
|
*
|
|
* @param participantIndex Specifies the participant from which the entities
|
|
* are created.
|
|
* @param publisherIndex Specifies the publisher within the participant
|
|
* @param subscriberIndex Specifies the subscriber within the participant
|
|
* @param typeName Name of the type for the topic when it is created for first
|
|
* time.
|
|
* @param topicName Name of the topic from which the endpoints are created.
|
|
* @param createReader Indicates whether to create a DataReader.
|
|
* @param createWriter Indicates whether to create a DataWriter.
|
|
* @param readerQos QoS for the DataReader. If NULL, default with
|
|
* DDS_KEEP_ALL_HISTORY_QOS will be used.
|
|
* @param writerQos QoS for the DataWriter. If NULL, default with
|
|
* DDS_KEEP_ALL_HISTORY_QOS will be used.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_createEntitiesWithQos(
|
|
struct ROUTERServiceTesterSystem * system,
|
|
struct ROUTERServiceTesterEntities * entities,
|
|
int participantIndex,
|
|
int publisherIndex,
|
|
int subscriberIndex,
|
|
const char * typeName,
|
|
const char * topicName,
|
|
RTIBool createReader,
|
|
RTIBool createWriter,
|
|
const struct DDS_DataReaderQos * inReaderQos,
|
|
const struct DDS_DataWriterQos * inWriterQos);
|
|
|
|
/*i
|
|
* @brief Initializes a ROUTERServiceTesterEntities from the
|
|
* ROUTERServiceTesterParticipant specified by its index within the system.
|
|
*
|
|
* This operation creates a DataReader from a CFT with the specified parameters.
|
|
* The operation will lookup the specified related topic and create a CFT
|
|
* from it. If a CTF already exists with the specified name, the operation will
|
|
* try to delete it first and create a new one.
|
|
*
|
|
* @param participantIndex Specifies the participant from which the entities
|
|
* are created.
|
|
* @param subscriberIndex Specifies the subscriber within the participant
|
|
* @param relatedTopicName Related topic of the CFT.
|
|
* @param cftName Name of the content filtered topic.
|
|
* @param filterExpression Expression for the CFT.
|
|
* @param expressionParameters Expression parameters for the CFT.
|
|
* @param filterClass Class of the ContentFilter of for the CFT.
|
|
* @param readerQos Qos for the DataReader. If NULL, default with
|
|
* DDS_KEEP_ALL_HISTORY_QOS will be used.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_createReaderFromCftWithQos(
|
|
struct ROUTERServiceTesterSystem * system,
|
|
struct ROUTERServiceTesterEntities * entities,
|
|
int participantIndex,
|
|
int subscriberIndex,
|
|
const char * relatedTopicName,
|
|
const char * cftName,
|
|
const char * filterExpression,
|
|
const struct DDS_StringSeq * expressionParameters,
|
|
const char * filterClass,
|
|
struct DDS_DataReaderQos * readerQos);
|
|
|
|
/*i
|
|
* @brief Returns the number of discovered participants.
|
|
*/
|
|
extern ROUTERDllExport
|
|
int ROUTERServiceTester_getDiscoveredParticipantCount(
|
|
DDS_DomainParticipant *participant);
|
|
|
|
/*i
|
|
* @brief Waits for discovery of the specified number of participants
|
|
*
|
|
* @return True when the participants discovers the specified number
|
|
* of participants
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_waitForParticipants(
|
|
DDS_DomainParticipant *participant,
|
|
int discoveredParticipantCount);
|
|
|
|
/*i
|
|
* @brief Returns the number of matching publications for the specified
|
|
* DataReader.
|
|
*
|
|
* @param reader DataReader to check the number of matching DataWriters.
|
|
*/
|
|
extern ROUTERDllExport
|
|
int ROUTERServiceTester_getMatchedPublicationCount(DDS_DataReader * reader);
|
|
|
|
/*i
|
|
* @brief Returns the number of matching subscriptions for the specified
|
|
* DataWriter.
|
|
*
|
|
* @param writer DataReader to check the number of matching DataReaders.
|
|
*/
|
|
extern ROUTERDllExport
|
|
int ROUTERServiceTester_getMatchedSubscriptionCount(DDS_DataWriter * writer);
|
|
|
|
/*i
|
|
* @brief Blocks until the specified reader has received the specified total
|
|
* number of samples and has the specified number of samples in the cache.
|
|
*
|
|
* The operation first waits for the total number of samples. When this condition
|
|
* occurs then it waits for the cache state. The maximum wait time is 10 seconds
|
|
* for each condition. If during this time the received sample state never
|
|
* matches the specified values, the operation will return false.
|
|
*
|
|
* @param reader Reader for which the sample state is checked.
|
|
* @param receivedTotalCount Total number of samples received by the reader.
|
|
* @param cacheSampleCount Current number of sample in the reader's cache.
|
|
*
|
|
* @return True when the sample state matches the specified values or false
|
|
* otherwise.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_waitForReceivedSampleState(
|
|
DDS_DataReader * reader,
|
|
int receivedTotalCount,
|
|
int cacheSampleCount);
|
|
|
|
/*
|
|
* @brief Blocks until the specified writer and reader have both at least one
|
|
* matching endpoint.
|
|
*
|
|
* The maximum wait time is timeoutInSecs seconds.
|
|
*
|
|
* @return True when both writer and reader have at least one matching endpoint.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_waitForRouteEndpointDiscovery(
|
|
DDS_DataWriter *writer,
|
|
DDS_DataReader *reader,
|
|
int timeoutInSecs);
|
|
|
|
/*
|
|
* @brief Blocks until the specified reader receives the specified number of
|
|
* samples.
|
|
* This operation will read samples from the reader until it gets as many samples
|
|
* as specified. The samples will remain in the reader cache but their state
|
|
* will be read.
|
|
*
|
|
* The maximum wait time is 10 seconds.
|
|
*
|
|
* @return True when the reader receives the specified number of samples.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_waitForData(
|
|
DDS_DataReader * reader,
|
|
int expectedSampleCount);
|
|
|
|
/*
|
|
* @brief Blocks until the specified reader receives the specified number of
|
|
* samples.
|
|
*
|
|
* This operation will read samples from the reader until it gets as many samples
|
|
* as specified. The samples will remain in the reader cache but their state
|
|
* will be read.
|
|
*
|
|
* countInvalidData will determine if invalid samples are counted towards the
|
|
* expectedSampleCount.
|
|
*
|
|
* The maximum wait time is 10 seconds.
|
|
*
|
|
* @return True when the reader receives the specified number of samples.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_waitForDataWithParams(
|
|
DDS_DataReader *reader,
|
|
int expectedSampleCount,
|
|
RTIBool countInvalidData,
|
|
int waitTime);
|
|
|
|
/**
|
|
* @brief
|
|
* Blocks until the specified reader receives the expected number of dispose samples.
|
|
*
|
|
* This operation will read samples from the reader until it gets as many dispose
|
|
* samples for instances as specified. The samples will remain in the reader cache
|
|
* but their state will be read. You can also choose to specify the particular
|
|
* instance whose dispose sample you want to be detected by passing a value for
|
|
* the handle argument.
|
|
*
|
|
* @param
|
|
* expectedSampleCount will how many instances will be disposed.
|
|
*
|
|
* @param
|
|
* handle specifies a particular instance whose dispose is to be detected.
|
|
*
|
|
* The maximum wait time is 10 seconds.
|
|
*
|
|
* @return True when the reader receives the specified number of dispose samples.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTester_waitForDispose(
|
|
DDS_DataReader *reader,
|
|
const DDS_InstanceHandle_t *handle,
|
|
int expectedSampleCount);
|
|
|
|
/*
|
|
* --- Data integrity ---------------------------------------------------------
|
|
*/
|
|
|
|
/*i
|
|
* @brief Class for checking valid reception of data.
|
|
*
|
|
* Implements a DataReaderListener's onDataAvailable to check data reception
|
|
* integrity.
|
|
*
|
|
* It allows specifying the original set of data that should be received by
|
|
* a DataReader. In order to compare data samples, a
|
|
* REDAOrderedDataTypeCompareFunction must be specified.
|
|
*/
|
|
struct ROUTERServiceTesterDataChecker {
|
|
|
|
/* implements DataReaderListener*/
|
|
struct DDS_DataReaderListener asReaderListener;
|
|
/* name to identify this DataChecker */
|
|
char * name;
|
|
/* array of original samples */
|
|
void ** originalSampleArray;
|
|
/* array of original sample infos */
|
|
struct DDS_SampleInfo ** originalSampleInfoArray;
|
|
/* Array of received samples counters */
|
|
int * receivedSampleCounterArray;
|
|
/* Array of data readers receiving each of the samples */
|
|
DDS_DataReader ** dataReaderReceivingSampleArray;
|
|
/* arrays length */
|
|
int arrayLength;
|
|
/* Operation to compare data samples */
|
|
REDAOrderedDataTypeCompareFunction compareSample;
|
|
/* Operation to compare sample info */
|
|
REDAOrderedDataTypeCompareFunction compareSampleInfo;
|
|
/* Total number of received samples */
|
|
int receivedCount;
|
|
/* Flag to indicate data received correctly */
|
|
DDS_Boolean receivedDataOk;
|
|
/* Flag to ignore reception of duplicates */
|
|
DDS_Boolean ignoreDuplicates;
|
|
};
|
|
|
|
#define ROUTERServiceTesterDataChecker_INITIALIZER {\
|
|
DDS_DataReaderListener_INITIALIZER, \
|
|
NULL, \
|
|
NULL, \
|
|
NULL, \
|
|
NULL, \
|
|
NULL, \
|
|
0, \
|
|
NULL,\
|
|
NULL,\
|
|
0, \
|
|
DDS_BOOLEAN_FALSE, \
|
|
DDS_BOOLEAN_FALSE}
|
|
|
|
/*i
|
|
* @brief Finalizes ROUTERServiceTesterDataChecker
|
|
*/
|
|
extern ROUTERDllExport
|
|
void ROUTERServiceTesterDataChecker_finalize(
|
|
struct ROUTERServiceTesterDataChecker * self);
|
|
|
|
/*i
|
|
* @brief Initializes a ROUTERServiceTesterDataChecker to check the specified
|
|
* original sample set.
|
|
*
|
|
* @param name \b In. Name of this object. Useful to identify checkers when
|
|
* multiple are used.
|
|
* @param originalSampleArray \b In. Array containing the expected samples.
|
|
* @param arrayLength \b In. length of the originalSampleArray
|
|
* @param compareSamplesFunction \b In. Function used to compare a received
|
|
* samples with the expected samples.
|
|
*/
|
|
extern ROUTERDllExport
|
|
RTIBool ROUTERServiceTesterDataChecker_initialize(
|
|
struct ROUTERServiceTesterDataChecker * self,
|
|
const char * name,
|
|
void ** originalSampleArray,
|
|
int arrayLength,
|
|
REDAOrderedDataTypeCompareFunction compareSamplesFunction);
|
|
|
|
/*i
|
|
* @brief Resets the the state of the data reception integrity
|
|
*/
|
|
extern ROUTERDllExport
|
|
void ROUTERServiceTesterDataChecker_resetReceivedSampleInformation(
|
|
struct ROUTERServiceTesterDataChecker * self);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif /* routingservice_test_system_h */
|