/* * Copyright (c) 2025 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 commend_facade_h #define commend_facade_h #ifndef osapi_ntptime_h #include "osapi/osapi_ntptime.h" #endif #ifndef reda_orderedDataType_h #include "reda/reda_orderedDataType.h" #endif #ifndef event_generator_h #include "event/event_generator.h" #endif #ifndef event_jobDispatcher_h #include "event/event_jobDispatcher.h" #endif #ifndef netio_cap_include_manager_h #include "netio_cap/netio_cap_manager.h" #endif #ifndef netio_configurator_h #include "netio/netio_configurator.h" #endif #ifndef netio_sender_h #include "netio/netio_sender.h" #endif #ifndef netio_receiver_h #include "netio/netio_receiver.h" #endif #ifndef mig_generator_h #include "mig/mig_generator.h" #endif #ifndef mig_interpreter_h #include "mig/mig_interpreter.h" #endif #ifndef commend_dll_h #include "commend/commend_dll.h" #endif #ifdef __cplusplus extern "C" { #endif struct REDAWorkerFactory; struct COMMENDFacade; struct RTIEventGeneratorListener; struct RTIEventGeneratorListenerStorage; /* Doxygen file-level documentation =====================================*/ /*e \file \brief COMMENDFacade *interface*--as in no implementation. */ /*e \defgroup COMMENDFacadeClass COMMENDFacade \ingroup COMMENDModule \brief A class that satisfies the "facade" design pattern in Gamma et. al. */ typedef RTIBool (*COMMENDFacadeEntryportDescAddFunction)( struct COMMENDFacade *me, struct REDAWeakReference *reference, const struct RTINetioLocatorInfo *entryport, struct REDAWorker *worker); typedef void (*COMMENDFacadeEntryportDescRemoveFunction)( struct COMMENDFacade *me, const struct REDAWeakReference *reference, struct REDAWorker *worker); typedef RTIBool (*COMMENDFacadeEntryportDescCheckFunction)( struct COMMENDFacade *me, RTIBool *hasActiveEntryPorts, const struct REDAWeakReference *referenceToPlugin, struct REDAWorker *worker); typedef void (*COMMENDFacadeDestinationDescRemoveFunction)( struct COMMENDFacade *me, struct RTINetioSenderDestinationGroup *group, const struct REDAWeakReference *reference, struct REDAWorker *worker); /*e \ingroup COMMENDFacadeClass * * @brief Attempts to send an ACK to the destinations given, until the first * successful dispatch to a transport occurs. This is so that we won't drop an * ACK by attempting to give it to only 1 ack destination. * * @post 1 ACK is sent to one of the destinations provided. * * @see MIGGenerator_addAck */ extern COMMENDDllExport RTIBool COMMENDFacade_sendAck( struct COMMENDFacade *me, int *size, const struct REDAWeakReference *destinationArrayIn, int destinationCountIn, int transportPriority, MIGRtpsSubmessageFlag flags, MIGRtpsObjectId readerObjectId, const struct MIGRtpsGuid *writerGuidIn, const struct MIGInterceptorHandlePtrs *writerDirectedInterceptorHandles, const struct MIGRtpsBitmap *bitmap, REDAEpoch epoch, MIGAckKind ackKind, const struct MIGGeneratorSecurityProperty *security, MIGGeneratorEndian endianness, struct REDAWorker *worker); /*e \ingroup COMMENDFacadeClass * Goal was to make this as simple as possible; many other parameters which * may affect the behavior of a facade are just defaults. If you * are not happy with the default behavior, we can expose some of them. */ struct COMMENDFacadeProperty { /* * @brief The method used to generate the ids. * Using the mac address or the ip address. */ RTI_UINT32 autoIdKind; /* * @brief The guid prefix associated with this COMMEND instance. * * Used to initialize the RTPS message interpreter and generator * objects (defined in the MIG module). */ struct MIGRtpsGuidPrefix guidPrefix; /* * @brief The thread participant identification. * * Used to give a meaningful name to the thread. */ char threadParticipantId[RTI_OSAPI_THREAD_PARTICIPANT_ID_MAX_SIZE]; struct RTIEventGeneratorProperty eventGenerator; struct RTIEventJobDispatcherProperty jobDispatcher; struct MIGGeneratorProperty messageGenerator; struct MIGInterpreterProperty interpreter; struct RTINetioReceiverProperty receiver; struct RTINetioSenderProperty sender; }; extern COMMENDDllExport RTIBool COMMENDFacadeProperty_verify(const struct COMMENDFacadeProperty *me); #define COMMEND_FACADE_PROPERTY_DEFAULT \ { \ 0, /* autoIdKind */ \ MIG_RTPS_GUID_PREFIX_UNKNOWN, /* guidPrefix */ \ "#####", /* threadParticipantId */ \ RTI_EVENT_GENERATOR_PROPERTY_DEFAULT, \ RTI_EVENT_JOB_DISPATCHER_PROPERTY_DEFAULT, \ MIG_GENERATOR_PROPERTY_DEFAULT, \ MIG_INTERPRETER_PROPERTY_DEFAULT, \ RTI_NETIO_RECEIVER_PROPERTY_DEFAULT, \ RTI_NETIO_SENDER_PROPERTY_DEFAULT \ } /*e \defgroup COMMENDFacadeClass COMMENDFacade * \ingroup COMMENDModule * Manages all the resources a commend service needs. * @see COMMENDPassiveFacade COMMENDActiveFacade * * There is no public API because COMMENDFacade is only for COMMEND * service implementations. There is nothing besides the construction and * destructor that you can call on this. See the implementations for their * own constructors and destructors. * * Having encapsulated the RTINetioSender and RTINetioReceiver, a * COMMENDFacade is interested in assertion and removal of transport * plugins into and from RTINetioConfigurator, and therefore exposes * a way to get the relevant configurator listeners, as a pure * virtual method. * * This is an abstract class; protected fields are marked with leading _, * according to RTI naming convention. */ struct COMMENDFacade { /*i peer access */ COMMENDFacadeEntryportDescAddFunction addEntryport; /*i peer access */ COMMENDFacadeEntryportDescRemoveFunction removeEntryport; /*i peer access */ COMMENDFacadeEntryportDescCheckFunction checkEntryports; /*i peer access */ COMMENDFacadeDestinationDescRemoveFunction removeDestination; /* <> */ struct REDAWorkerFactory *_workerFactory; /* <> */ struct REDAExclusiveArea *_ea; /* <> */ struct REDADatabase *_database; /* <> */ struct RTIClock *_clock; /* <> */ struct RTIClock *_timestampClock; /* <> */ /* This clock is non-configurable and always shows the wall/system time */ struct RTIClock *_wallClock; /* <> */ struct RTIEventGenerator *_eventGenerator; /* <> */ struct RTIEventJobDispatcher *_jobDispatcher; /* <> */ struct RTINetioSender *_sender; /* <> */ struct RTINetioReceiver *_receiver; /* <> */ struct RTINetioConfigurator *_configurator; /* <> */ struct MIGInterpreter *_messageInterpreter; /* <> */ struct MIGGenerator *_messageGenerator; /* <> */ struct RTINetioCapManager *_netioCapManager; }; /*e \ingroup COMMENDFacadeClass * \brief Helper method for presentation, so it doesn't have to create its own * event generator. Also used throughout COMMEND itself. * @see RTIEventGeneratorEventPostFunction */ extern COMMENDDllExport RTIBool COMMENDFacade_postEvent( struct COMMENDFacade *me, const struct RTINtpTime *time, const struct RTINtpTime *snooze, const struct RTIEventGeneratorListener *listener, const struct RTIEventGeneratorListenerStorage *listenerStorage, int bytesToCompareInReuse, const struct RTIEventGeneratorActivityContextStorage *activityContextStorage); extern COMMENDDllExport RTIBool COMMENDFacade_removeTokenBucket( struct COMMENDFacade *me, struct RTIEventJobDispatcherTokenBucket *tokenBucket); extern COMMENDDllExport struct RTIEventJobDispatcherTokenBucket * COMMENDFacade_assertTokenBucketEDF( struct COMMENDFacade *me, const struct RTIEventJobDispatcherTokenBucketProperty *property); extern COMMENDDllExport struct RTIEventJobDispatcherTokenBucket * COMMENDFacade_assertTokenBucketHPF( struct COMMENDFacade *me, const struct RTIEventJobDispatcherTokenBucketProperty *property); extern COMMENDDllExport struct RTIEventJobDispatcherTokenBucket * COMMENDFacade_assertTokenBucketRR( struct COMMENDFacade *me, const struct RTIEventJobDispatcherTokenBucketProperty *property); extern COMMENDDllExport RTIBool COMMENDFacade_getTokenBucketProperty( struct COMMENDFacade *me, struct RTIEventJobDispatcherTokenBucket *tokenBucket, struct RTIEventJobDispatcherTokenBucketProperty *property); extern COMMENDDllExport RTIBool COMMENDFacade_setTokenBucketProperty( struct COMMENDFacade *me, struct RTIEventJobDispatcherTokenBucket *tokenBucket, const struct RTIEventJobDispatcherTokenBucketProperty *property); extern COMMENDDllExport RTIBool COMMENDFacade_addTokensToBucket( struct COMMENDFacade *me, struct RTIEventJobDispatcherTokenBucket *tokenBucket); extern COMMENDDllExport RTIBool COMMENDFacade_assertThread( struct COMMENDFacade *me, const struct RTIEventJobDispatcherStorage *threadStorage, struct REDAExclusiveArea *eaBeforeAgentFncs, const struct RTIEventJobDispatcherThreadProperty *property); extern COMMENDDllExport RTIBool COMMENDFacade_removeThread( struct COMMENDFacade *me, struct RTIEventJobDispatcherThread *executionThread); extern COMMENDDllExport RTIBool COMMENDFacade_getInstalledTransportPluginCount( struct COMMENDFacade *me, int *pluginCountOut, struct REDAWorker *worker); extern COMMENDDllExport RTIBool COMMENDFacade_getInstalledTransportPlugins( struct COMMENDFacade *me, NDDS_Transport_Plugin **pluginsOut, int *countIn, struct REDAWorker *worker); extern COMMENDDllExport RTIBool COMMENDFacade_getTime(struct COMMENDFacade *me, struct RTINtpTime *time); extern COMMENDDllExport RTIBool COMMENDFacade_getTimestampTime( struct COMMENDFacade *me, struct RTINtpTime *time); extern COMMENDDllExport RTIBool COMMENDFacade_isTimestampClockSameAsClock(struct COMMENDFacade *me); /*e \ingroup COMMENDFacadeClass * \brief Checks if network capture is enabled, and if it was enabled before * we created the DomainParticipant we want to capture for. * * @param facade \b in. facade of the DomainParticipant we want to run a network * capture operation on. */ extern COMMENDDllExport RTIBool COMMENDFacade_isNetworkCaptureEnabled(const struct COMMENDFacade *facade); /*e \ingroup COMMENDFacadeClass * \brief Gets the database associated with the facade. */ extern COMMENDDllExport struct REDADatabase *COMMENDFacade_getDatabase( const struct COMMENDFacade *me); #define COMMEND_PUBLICATION_PRIORITY_UNDEFINED (0) #define COMMEND_PUBLICATION_PRIORITY_AUTOMATIC (-1) #ifdef __cplusplus } /* extern "C" */ #endif #include "commend/commend_facade_impl.h" #endif /* commend_facade_h */