Files
qt6-migration-pipeline/external/rti_connext_dds-7.7.0/include/ndds/netio/netio_test.h
T
torstenandCopilot 342ffd3e5c Update submodule to latest BUILD_RTI fixes
- 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
2026-08-21 19:30:20 +02:00

286 lines
11 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 netio_test_h
#define netio_test_h
#ifndef test_setting_h
#include "rtitest/test_setting.h"
#endif
#ifndef clock_interface_h
#include "clock/clock_interface.h"
#endif
#include "netio/netio_common.h"
/* forward declare */
struct RTIOsapiSemaphore;
#ifndef event_smartTimer_h
#include "event/event_smartTimer.h"
#endif
#ifndef event_activeDatabase_h
#include "event/event_activeDatabase.h"
#endif
#include "netio/netio_configurator.h"
#ifndef osapi_bufferUtils_h
#include "osapi/osapi_bufferUtils.h"
#endif
#ifndef transport_interface_h
#include "transport/transport_interface.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct RTINetioTestSetting {
struct RTITestSetting parent;
int nicCount;
};
extern RTIBool RTINetioTester_calculateClockOverhead(
struct RTIClock *clock,
double *overhead);
extern void RTINetioTester_printLatency(
int configuration,
double sigma_sendTraversalTime,
double sigma_sendTraversalTimeCompensated,
double sigma_sendTraversalTimeSquared,
double sigma_receiveTraversalTime,
double sigma_receiveTraversalTimeCompensated,
double sigma_receiveTraversalTimeSquared,
double sigma_latency,
double sigma_latencyCompensated,
double sigma_latencySquared,
int sampleCount);
/* ================================================================= */
/* Class: Env */
/* ----------------------------------------------------------------- */
/*i \defgroup RTINetioConfiguratorTesterEnvClass RTINetioConfiguratorTesterEnv
* @ingroup RTINetioConfiguratorTesterComponent
* @brief Helper class to setup/teardown the multithreaded environment
* needed for active objects.
*/
struct RTINetioConfiguratorTesterEnv {
struct REDAWorkerFactory *workerFactory;
struct REDAWorker *worker;
struct REDAExclusiveArea *adminEA;
struct REDAExclusiveArea *tableEA;
struct REDAExclusiveArea *recordEA;
/* struct REDAExclusiveArea *intraEA; */
struct RTIClock* clock; /* OPTIONAL: for performance measurements */
};
/* ================================================================= */
/* Class: Signal */
/* ----------------------------------------------------------------- */
/*i \defgroup RTINetioConfiguratorTesterSignalClass RTINetioConfiguratorTesterSignal
* @ingroup RTINetioConfiguratorTesterComponent
* @brief Helper class to setup/teardown signals for notifying/waiting
* for events via a binary semaphore.
*/
struct RTINetioConfiguratorTesterSignal {
struct RTINtpTime sleepTimeVal;
struct RTIOsapiSemaphore *semaphore;
};
/* ================================================================= */
/* Class: Activity */
/* ----------------------------------------------------------------- */
/*i \defgroup RTINetioConfiguratorTesterActivityClass RTINetioConfiguratorTesterActivity
* @ingroup RTINetioConfiguratorTesterComponent
* @brief Helper class to setup/teardown an active database.
*/
struct RTINetioConfiguratorTesterActivity {
struct RTINetioConfiguratorTesterEnv envObj;
struct RTINetioConfiguratorTesterSignal signalObj;
struct RTIEventActiveDatabaseListener activeDbListenerObj;
struct RTIEventTimer *timer;
/*
* NULL means passive database.
* Can only happen when the fileds are set via the from() method.
*/
struct RTIEventActiveDatabase *activeDb; /* Active Database */
struct REDADatabase *dbRef; /* Passive database */
RTI_UINT32 hostId;
RTI_UINT32 appId;
RTI_UINT32 instanceId;
};
#define RTINetioConfiguratorTesterActivity_INITIALIZER { \
{NULL, NULL, NULL, NULL, NULL, NULL}, /* envObj */ \
{{0,0}, NULL}, /* signalObj*/ \
RTI_EVENT_ACTIVE_DATABASE_LISTENER_DEFAULT, /* activeDbListenerObj */ \
NULL, /* timer */ \
NULL, /* activeDb */ \
NULL, /* dbRef */ \
0, /* hostId */ \
0, /* appId */ \
0 /* instanceId */ \
}
/*i @ingroup RTINetioConfiguratorTesterActivityClass
* @brief Initialize the object from elements allocated by someone
* else. Provided to support the (re)use of the unit testing framework
* defined here in higher layer unit tests.
*
* @pre Either \c dbRef should be NULL (in which case it is derived from
* activeDb), or \c activeDb should be NULL (passive database).
*
* A NULL value of \c activeDb indicates a PASSIVE databse
* (eg using PassiveFacade). The \c dbRef specified is used.
*
* If \c activeDb is non-NULL \c dbRef is ignored. It is considered to be
* an active database.
*
* @note teardown() should not be called when when initialized this way.
*/
extern RTINetioDllExport
struct RTINetioConfiguratorTesterActivity *RTINetioConfiguratorTesterActivity_from(
struct RTINetioConfiguratorTesterActivity* me,
struct REDAWorkerFactory *workerFactory,
struct REDAWorker *worker,
struct REDAExclusiveArea *adminEA,
struct REDAExclusiveArea *tableEA,
struct REDAExclusiveArea *recordEA,
struct RTIEventTimer *timer,
struct RTIClock *clock,
const struct RTINtpTime *sleepTimeVal,
struct RTIOsapiSemaphore *semaphore,
struct RTIEventActiveDatabase *activeDb,
struct REDADatabase *dbRef,
RTI_UINT32 hostId,
RTI_UINT32 appId,
RTI_UINT32 instanceId);
/* ================================================================= */
/* Class: Shell */
/* ----------------------------------------------------------------- */
/*i \defgroup RTINetioConfiguratorTesterShellClass RTINetioConfiguratorTesterShell
* @ingroup RTINetioConfiguratorTesterComponent
* @brief Helper class to setup/teardown a configurator.
*/
struct RTINetioConfiguratorTesterShell {
struct RTINetioConfiguratorTesterActivity* activity;
struct RTIEventActiveObjectListener configuratorShutdownListenerObj;
struct RTINetioConfigurator *configurator;
/* Cache plugin pointers so we can call 'delete' on them in teardown() */
NDDS_Transport_Plugin *intraPlugin;
NDDS_Transport_Plugin *shmemPlugin;
NDDS_Transport_Plugin *ipPlugin;
NDDS_Transport_Plugin *ipPlugin2; /* used to store another instance in some tests */
RTIBool isIpv6Configured;
NDDS_Transport_Plugin *ipv6Plugin;
/* predefined aliases */
struct RTINetioAliasList aliasAny;
struct RTINetioAliasList aliasIntra;
struct RTINetioAliasList aliasShmem;
struct RTINetioAliasList aliasUdpv4;
struct RTINetioAliasList aliasUdpv4Intra;
struct RTINetioAliasList aliasUdpv4ShmemIntra;
struct RTINetioAliasList aliasShmemIntra;
struct RTINetioAliasList aliasUdpv6;
struct RTINetioAliasList aliasUdpv6Udpv4;
struct RTINetioAliasList aliasUdpv6Udpv4ShmemIntra;
};
#define RTINetioConfiguratorTesterShell_INITIALIZER { \
NULL, /* activity */ \
RTI_EVENT_ACTIVE_OBJECT_LISTENER_DEFAULT, /* listenerObj */ \
NULL, /* configurator */ \
NULL, /* intraPlugin */ \
NULL, /* shmemPlugin */ \
NULL, /* ipPlugin */ \
NULL, /* ipPlugin2 */ \
RTI_FALSE, /* isIpv6Configured */ \
NULL, /* ipv6Plugin */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasAny */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasIntra */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasShmem */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasUdpv4 */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasUdpv4Intra */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasUdpv4ShmemIntra */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasShmemIntra */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasUdpv6 */ \
RTI_NETIO_ALIAS_LIST_DEFAULT, /* aliasUdpv6Udpv4 */ \
RTI_NETIO_ALIAS_LIST_DEFAULT /* aliasUdpv6Udpv4ShmemIntra */ \
}
extern RTINetioDllExport
RTIBool RTINetioConfiguratorTesterShell_setup(
struct RTINetioConfiguratorTesterShell *me,
struct RTINetioConfiguratorTesterActivity *activityIn);
extern RTINetioDllExport
RTIBool RTINetioConfiguratorTesterShell_teardown(
struct RTINetioConfiguratorTesterShell *me);
extern RTINetioDllExport
RTIBool RTINetioConfiguratorTesterShell_installIntraPlugin(
struct RTINetioConfiguratorTesterShell *me,
struct NDDS_Transport_Intra_Property_t *propertyIn);
extern RTINetioDllExport
RTIBool RTINetioConfiguratorTesterShell_installIpPlugin(
struct RTINetioConfiguratorTesterShell *me,
struct NDDS_Transport_UDPv4_SocketFactory *socketFactoryIn,
struct NDDS_Transport_UDPv4_Property_t *propertyIn);
extern RTINetioDllExport
RTIBool RTINetioConfiguratorTesterShell_installSharedMemoryPlugin(
struct RTINetioConfiguratorTesterShell *me,
const NDDS_Transport_Address_t* networkAddressInOut,
struct NDDS_Transport_Shmem_Property_t *propertyIn);
extern RTINetioDllExport
RTIBool RTINetioConfiguratorTester_populateEntryports(
struct RTINetioConfigurator *configurator,
struct RTINetioLocatorInfo *entryportArray,
int *entryportCount,
int entryportArraySize,
const struct RTINetioAliasList *aliasList,
NDDS_Transport_Port_t port,
int transportPriority,
struct REDAWorker *worker);
/* ================================================================= */
/* Class: LocatorInfo */
/* ----------------------------------------------------------------- */
#define RTINetioLocatorInfo_from( \
me, \
transportIn, \
addressIn, \
portIn, \
priorityIn, \
stringAliasListIn) \
{ \
RTINetioLocator_from(&(me)->locator, transportIn, addressIn, portIn); \
(me)->transport_priority = (priorityIn); \
RTINetioAliasList_fromString(&((me)->aliasList), stringAliasListIn); \
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "netio/netio_test_impl.h"
#endif /* netio_test_h */