Files
qt6-migration-pipeline/external/rti_connext_dds-7.7.0/include/routingservice/routingservice_service_impl.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

665 lines
22 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_service_impl_h
#define routingservice_service_impl_h
#include "routingservice/routingservice_dll.h"
#include "advlog/advlog_context.h"
#include "rtixmlutils/rtixmlutils_object.h"
#include "rtixmlutils/rtixmlutils_property.h"
#include "routingservice/routingservice_service.h"
#include "routingservice/routingservice_remote_config.h"
#include "routingservice/routingservice_monitoring.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RTI_SERVICE_XML_SUPPORT_SAVE_PI_NAME "rti-object-save"
typedef enum {
RTI_ROUTING_SERVICE_SERVICE_ENTITY,
RTI_ROUTING_SERVICE_DOMAIN_ROUTE_ENTITY,
RTI_ROUTING_SERVICE_CONNECTION_ENTITY,
RTI_ROUTING_SERVICE_SESSION_ENTITY,
RTI_ROUTING_SERVICE_AUTO_TOPIC_ROUTE_ENTITY,
RTI_ROUTING_SERVICE_TOPIC_ROUTE_ENTITY,
RTI_ROUTING_SERVICE_INPUT_ENTITY,
RTI_ROUTING_SERVICE_OUTPUT_ENTITY,
RTI_RoutingServiceEntityKind_count,
RTI_RoutingServiceEntityKind_OTHER = RTI_RoutingServiceEntityKind_count
} RTI_RoutingServiceEntityKind;
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Definition of RoutingServiceDescription
*
* The description allows to specify a set of properties and components with
* which a Routing Service can be created.
*/
struct RTI_RoutingServiceDescription {
const struct RTI_RoutingServiceProperty *property;
struct RTI_RoutingServiceEntityListener *entity_listener;
struct RTI_RoutingServiceConfigInterceptor *config_interceptor;
DDS_Boolean enable_entity_advlog_context;
DDS_ServiceQosPolicyKind service_kind;
};
#define RTI_RoutingServiceDescription_INITIALIZER { \
NULL, \
NULL, \
NULL, \
DDS_BOOLEAN_FALSE, \
DDS_NO_SERVICE_QOS}
/*i \ingroup RTI_RoutingServiceLibModule
*
* @brief Creates a new RTI Routing Service instance with the specified
* description.
*
* @param description Input parameters for the service creation.
*
*/
extern ROUTERDllExport
struct RTI_RoutingService *
RTI_RoutingService_new_from_description(
struct RTI_RoutingServiceDescription *description);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Initializes the global state that Routing Service requires to operate.
*
* Calling this operation is not mandatory since RTI_RoutingService_new will
* do it.
*
* @mtsafety On non-Linux, non-Windows systems (i.e. VxWorks):
* UNSAFE for multiple threads to simultaneously make the FIRST
* call to either RTI_RoutingService_initialize_globalsI() or
* RTI_RoutingService_finalize_globalsI(). Subsequent calls are thread safe.
* On Windows and Linux systems, these calls are thread-safe.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_initialize_globalsI(void);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Provide the current total count of globals references
* @return the current references count.
*
*/
extern ROUTERDllExport
RTI_UINT32 RTI_RoutingService_get_globals_reference_countI(void);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Finalize global resources that Routing Service requires to operate.
*
* This operation releases resources specific to Routing Service only. RTI
* Connext DDS global state shall be released separately through
* the DomainParticipantFactory's finalize_instance().
*
* Calling this operation is not mandatory for your application since
* RTI_RoutingService_delete will do it.
*
* @mtsafety On non-Linux, non-Windows systems (i.e. VxWorks):
* UNSAFE for multiple threads to simultaneously make the FIRST
* call to either RTI_RoutingService_initialize_globalsI() or
* RTI_RoutingService_finalize_globalsI(). Subsequent calls are thread safe.
* On Windows and Linux systems, these calls are thread-safe.
*
* @return True on success; otherwise false.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_finalize_globalsI(void);
/*e \ingroup RTI_RoutingServiceLibModule
*
* @brief Finds a processor instance specified by its fully qualified name.
*
* @param self \b In. The Routing Service instance.
* @param processor_full_name \b In. The fully qualified name of the processor.
*
* @mtsafety The lookup operation is thread-safe while accessing the XML DOM.
*
*/
extern ROUTERDllExport
struct RTI_RoutingServiceProcessor *
RTI_RoutingService_lookup_processor(
struct RTI_RoutingService * self,
const char * processor_full_name);
/*
* --- Remote Administration --------------------------------------------------
*/
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Sets the configuration interceptor in this RS.
*
* The operation will fail if the RS is already started.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_set_config_interceptor(
struct RTI_RoutingService * self,
struct RTI_RoutingServiceConfigInterceptor * config_interceptor);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Creates a DomainParticipant properly configured to be reused as a
* remote administration participant.
*
* This operation is necessary if a client application wants to reuse a
* participant for other tasks other than remote administration. In this case,
* the participant must be created in a certain way so the service remote
* administration.
*
* The operation allows receiving a participant QoS that will be used for the
* created participant. The created participant requires certain QoS settings
* that will be added on top of or override the ones in the specified QoS.
*
* @param domain_id \b In. The domain id of the participant.
* @param participant_qos \b In. The QoS of the participant.
* @param service_name \b In. Name of the service used to build the participant
* name that is set in the EntityNameQosPolicy
* @param service_kind \b In. Service kind of the participant.
*
* @return True on success.
*/
extern ROUTERDllExport
DDS_DomainParticipant * RTI_RoutingService_create_remote_admin_participant(
int domain_id,
struct DDS_DomainParticipantQos * participant_qos,
const char *service_name,
DDS_ServiceQosPolicyKind service_kind);
/*i \ingroup RTI_RoutingServiceLibModule
*
* @brief Create a new domain route, session, topic route or auto topic route.
*
* @param self An \ref RTI_RoutingService instance created with \ref RTI_RoutingService_new
* @param parent_name Name of parent entity under which to create new entity
* @param file_name Name of file to read configuration from
* @param xml_snippet XML configuration string for new entity, used if file_name is NULL
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_create_entity(
struct RTI_RoutingService * self,
const char * parent_name,
const char * file_name,
const char * xml_snippet);
/*i \ingroup RTI_RoutingServiceLibModule
*
* @brief Delete domain route, session, topic route or auto topic route.
*
* @param self An \ref RTI_RoutingService instance created with \ref RTI_RoutingService_new
* @param entity_name Name of entity to delete
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_delete_entity(
struct RTI_RoutingService * self,
const char * entity_name);
/*i \ingroup RTI_RoutingServiceLibModule
*
* @brief Get current configuration. Result must be freed with \ref RTI_RoutingService_free_string.
*
* @param self An \ref RTI_RoutingService instance created with \ref RTI_RoutingService_new
*/
extern ROUTERDllExport
char * RTI_RoutingService_get_configuration(
struct RTI_RoutingService * self);
/*i \ingroup RTI_RoutingServiceLibModule
*
* @brief Free string returned from Routing Service calls
*
* @param str String to free
*/
extern ROUTERDllExport
void RTI_RoutingService_free_string(char * str);
/*
* --- ProductInfo ------------------------------------------------------------
*/
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Returns the remote administration replier or NULL if remote
* administration is disabled.
*
* @return the typed remote administration replier.
*/
extern ROUTERDllExport
struct RTI_RoutingServiceAdminReplier * RTI_RoutingService_get_admin_replier(
struct RTI_RoutingService * self);
/**
* \ingroup RTI_RoutingServiceLibModule
* @brief Product Information
*/
struct RTI_RoutingServiceProductInfo {
char * executable_name;
const char * shell_executable_name;
char * product_name;
char * log_product_name;
char * default_app_name;
};
/** \ingroup RTI_RoutingServiceLibModule
@brief Sets the product information
*/
extern ROUTERDllExport
void RTI_RoutingService_set_product_info(
struct RTI_RoutingServiceProductInfo *info);
/** \ingroup RTI_RoutingServiceLibModule
@brief Sets the product information
*/
extern ROUTERDllExport
void RTI_RoutingService_reset_product_info(void);
/** \ingroup RTI_RoutingServiceLibModule
@brief Sets the product information
*/
extern ROUTERDllExport
const struct RTI_RoutingServiceProductInfo *
RTI_RoutingService_get_product_info(void);
typedef const DDS_TypeCode * (*RTI_RoutingServiceTypeProviderFnc)(
const char *topic_name);
/** \ingroup RTI_RoutingServiceLibModule
* @brief Sets the type code provider function.
*/
extern ROUTERDllExport
void RTI_RoutingService_set_type_provider_function(
RTI_RoutingServiceTypeProviderFnc function);
/** \ingroup RTI_RoutingServiceLibModule
@brief Prints in the standard output the list of available RS configuration to load
*/
extern ROUTERDllExport
void RTI_RoutingService_print_available_config(
struct RTI_RoutingServiceProperty *property);
/** \ingroup RTI_RoutingServiceLibModule
@brief Expands the environment variables in the subtree specified by xml_object,
* using dictionary to look up values.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_expand_xml_variables(
struct RTIXMLUTILSObject *xml_object,
const struct RTI_RoutingServiceProperties *dictionary);
/** \ingroup RTI_RoutingServiceLibModule
@brief Looks up the XmlObject object by its fully qualified name.
@mtsafety This operation is thread-safe while accessing the DOM. However,
the returned XML object is not protected once the function returns. This means
that the object could be modified or even removed from the DOM by remote
administration or the service being stopped or terminated.
*/
extern ROUTERDllExport
struct RTIXMLUTILSObject*
RTI_RoutingService_lookup_xml_entity(
struct RTI_RoutingService *self,
RTI_RoutingServiceEntityKind expected_entity_kind,
const char *xml_entity_full_name);
/*
* @brief XML PI inserted together with the XML object of a route created by an
*/
extern ROUTERDllVariable
const char * RTI_ROUTING_SERVICE_XML_AUTOROUTE_FQN_PI_NAME;
/*
* --- Event monitoring ------------------------------------------------------
*/
#define RTI_SERVICE_INVALID_ENTITY_STATE RTI_Service_EntityStateKind_INVALID
#define RTI_SERVICE_ENABLED_ENTITY_STATE RTI_Service_EntityStateKind_ENABLED
#define RTI_SERVICE_DISABLED_ENTITY_STATE RTI_Service_EntityStateKind_DISABLED
#define RTI_SERVICE_STARTED_ENTITY_STATE RTI_Service_EntityStateKind_STARTED
#define RTI_SERVICE_STOPPED_ENTITY_STATE RTI_Service_EntityStateKind_STOPPED
#define RTI_SERVICE_RUNNING_ENTITY_STATE RTI_Service_EntityStateKind_RUNNING
#define RTI_SERVICE_PAUSED_ENTITY_STATE RTI_Service_EntityStateKind_PAUSED
/*
* Default max length for the list of entries and for the list of params.
*/
#define ROUTER_SERVICE_CONTEXT_ENTRY_SIZE_DEFAULT 4
#define ROUTER_SERVICE_CONTEXT_LIST_PARAMS_SIZE_DEFAULT 5
struct RTI_RoutingServiceEntityListenerContext {
/* @brief The kind of entity (service, domain route, session...) */
RTI_RoutingServiceEntityKind entity_kind;
/* @brief Name of the current context's associated entity */
const char *entity_name;
/*
* @brief The state of the associated entity (ENABLED, STARTED, PAUSED, etc)
*/
RTI_Service_EntityStateKind entity_state_kind;
/* @brief Whether the current context is valid or not */
DDS_Boolean ok;
/*
* We need to keep the entries of the context because they are entered in a
* function and left in another function.
* The number of entries is two:
* - An entry for the resource.
* - An entry for the activity.
*
* Cloud Discovery Service:
* The entries are entered into the context using the macro
* CDS_ENTITY_LISTENER_CONTEXT_ENTER_ON_BEFORE in a function.
* The entries are left using the macro
* CDS_ENTITY_LISTENER_CONTEXT_LEAVE_ON_AFTER in another function.
* For example:
* - Enter in RTI_CDSEntityListener_onBeforeCreate
* - Leave in RTI_CDSEntityListener_onAfterCreate
*
* Recorder:
* The entries are entered into the context using the macro
* RTI_ENTITY_LISTENER_CONTEXT_ENTER_ON_BEFORE in a function.
* The entries are left using the macro
* RTI_ENTITY_LISTENER_CONTEXT_LEAVE_ON_AFTER in another function.
* For example:
* - Enter in EntityListener::on_before_create
* - Leave in EntityListener::on_after_create
*/
struct RTIOsapiActivityContextStackEntry logging_context_entries[
ROUTER_SERVICE_CONTEXT_ENTRY_SIZE_DEFAULT];
const void *logging_context_params[
ROUTER_SERVICE_CONTEXT_LIST_PARAMS_SIZE_DEFAULT];
};
#define RTI_RoutingServiceEntityListenerContext_INITIALIZER { \
RTI_RoutingServiceEntityKind_OTHER, \
NULL, \
RTI_SERVICE_INVALID_ENTITY_STATE, \
DDS_BOOLEAN_FALSE \
}
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Prototype of the function called within the creation of an entity.
*/
typedef void (*RTI_RoutingServiceEntityListener_OnCreateEntityFcn)(
void *listener_data,
struct RTI_RoutingServiceEntityListenerContext *context);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Prototype of the function called within an entity state change
*/
typedef void (*RTI_RoutingServiceEntityListener_OnStateChangeFcn)(
void *listener_data,
struct RTI_RoutingServiceEntityListenerContext *context);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Prototype of the function called during the deletion of an
* entity.
*/
typedef void (*RTI_RoutingServiceEntityListener_OnDeleteEntityFcn)(
void *listener_data,
struct RTI_RoutingServiceEntityListenerContext *context);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Prototype of the function called the occurrence of an stream event
*/
typedef void (*RTI_RoutingServiceEntityListener_OnStreamEventFcn)(
void *listener_data,
struct RTI_RoutingServiceEntityListenerContext *context,
const struct RTI_RoutingServiceStreamInfo *stream_info);
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Definition of the EntityListener interface
*
* Routing Service provides status changes notifications through this interface.
* An status change represents a change in the description of an entity (e.g.
* configuration, state, etc).
*
* For each change an entity description, Routing Service notifies an
* instance of this listener, providing the identity of the affected entity.
* If needed, concrete implementations shall use other Library APIs to request
* the entity description.
*/
struct RTI_RoutingServiceEntityListener {
/* @brief implementation data */
void *listener_data;
/* @brief handles the before creation of an entity*/
RTI_RoutingServiceEntityListener_OnCreateEntityFcn
on_before_create;
/* @brief handles the before creation of an entity*/
RTI_RoutingServiceEntityListener_OnCreateEntityFcn
on_after_create;
/* @brief handles the before state change of an entity*/
RTI_RoutingServiceEntityListener_OnStateChangeFcn
on_before_state_change;
/* @brief handles the before state change of an entity*/
RTI_RoutingServiceEntityListener_OnStateChangeFcn
on_after_state_change;
/* @brief handles the before deletion of an entity*/
RTI_RoutingServiceEntityListener_OnDeleteEntityFcn
on_before_delete;
/* @brief handles the before deletion of an entity*/
RTI_RoutingServiceEntityListener_OnDeleteEntityFcn
on_after_delete;
/* @brief handles the before stream event notification*/
RTI_RoutingServiceEntityListener_OnStreamEventFcn
on_before_stream_event;
/* @brief handles the after stream event notification*/
RTI_RoutingServiceEntityListener_OnStreamEventFcn
on_after_stream_event;
};
#define RTI_RoutingServiceEntityListener_INITIALIZER {\
NULL, \
NULL, \
NULL, \
NULL, \
NULL, \
NULL, \
NULL, \
NULL, \
NULL}
/** \ingroup RTI_RoutingServiceLibModule
*
* @brief Installs an EntityListener in this service.
*
* The operation will fail if the service is already started.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_set_entity_listener(
struct RTI_RoutingService *self,
const struct RTI_RoutingServiceEntityListener *listener);
/*i @ingroup RTI_RoutingServiceLibModule
*
* @brief Performs the necessary operations to allow a thread-safe cycle
* of entities updates.
*
* This operation is necessary but not enough condition for safe update of
* underlying entities. Individual entities may require additional safety
* operations based on the type of update (for example, a Route may require
* to be detached from its parent Session).
*
* This operation shall be always followed by end_update() operation after
* the update cycle is done. Also, it must be always called under the service EA.
*
* @return True on success
*
* @see RTI_RoutingService_end_update
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_begin_update(
struct RTI_RoutingService *self);
/*i ingroup RTI_RoutingServiceLibModule
*
* @brief Finalizes the update cycle started with a previous begin_update()
* call.
*
* This operation shall be called only after a successful call to the begin
* counterpart. Also, it must be always called under the service EA.
*
* @return True on success
*
* @see RTI_RoutingService_begin_update
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_end_update(
struct RTI_RoutingService *self);
/*i @ingroup RTI_RoutingServiceLibModule
*
* @brief Detaches the specified Route from its parent Session.
*
* This operation is thread safe when called under the Service EA. After
* a successful detach, the Route will no longer receive Session notifications.
* Events occurring while detached will be queued and dispatch upon attach.
*
* @param[in] route The Route to be detached.
*
* @return True on success
*
* @see RTI_RoutingService_attach_route
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_detach_route(
struct RTI_RoutingService *self,
RTI_RoutingServiceRoute *route);
/*i @ingroup RTI_RoutingServiceLibModule
*
* @brief Attaches the specified Route to its parent Session.
*
* This operation is thread safe when called under the Service EA. After
* a successful attach, the Route will will start receiving Session
* notifications. Previously queued events before the attachment will be
* dispatched immediately.
*
* @param[in] route The Route to be detached.
*
* @return True on success
*
* @see RTI_RoutingService_detach_route
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_attach_route(
struct RTI_RoutingService *self,
RTI_RoutingServiceRoute *route);
/*i
* @brief Suspends the notifications of all the contained Sessions.
*
* The suspend operation is performed in the Sessions that are currently
* started.
*
* @return True on success.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_suspend_sessions(
struct RTI_RoutingService *self);
/*i
* @brief Resumes the notifications of all the contained Sessions.
*
* The resume operation is performed in the Sessions that are currently
* started.
*
* @return True on success.
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingService_resume_sessions(
struct RTI_RoutingService *self);
#define RTI_ROUTING_SERVICE_PREPROCESS_XSLT_PATH_PROPERTY_NAME \
RTI_ROUTING_SERVICE_PROPERTY_PREFIX".preprocess.xslt.path"
/*
* --- Heap Monitoring --------------------------------------------------------
*/
/** \ingroup RTI_RoutingServiceLibModule
@brief Configuration property for the HeapMonitor
*/
struct RTI_RoutingServiceHeapMonitorProperty {
/* @brief Output directory where files are dumped */
char *output_dir;
/* @brief A name to be used in the snapshot files */
char *snapshot_name;
/* @brief Period at which snapshots are taken */
int snapshot_period_millis;
};
#define RTI_RoutingServiceHeapMonitorProperty_INITIALIZER {NULL, NULL, 0}
extern ROUTERDllExport
void RTI_RoutingService_execute_heap_snapshot_loop(
const struct RTI_RoutingServiceHeapMonitorProperty *property,
int stop_after_sec,
DDS_Boolean *exit_loop_flag);
/*
* --- Logger --------------------------------------------------------
*/
extern ROUTERDllExport
void RTI_RoutingServiceLogger_log_with_mask(
RTILogBitmap instrumentation_mask,
NDDS_Config_LogLevel log_level,
const char *format,
...);
extern ROUTERDllExport
void RTI_RoutingServiceLogger_vlog_with_mask(
RTILogBitmap verbosityMask,
NDDS_Config_LogLevel logLevel,
const char *format,
va_list ap);
extern ROUTERDllExport
void RTI_RoutingServiceLogger_set_verbosity(
NDDS_Config_LogVerbosity verbosity);
/*
* --- Properties --------------------------------------------------------
*/
extern ROUTERDllExport
DDS_Boolean RTI_RoutingServiceProperties_from_xml_property_list(
struct RTI_RoutingServiceProperties *dest,
struct RTIXMLUTILSPropertyList *source);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* routingservice_service_impl_h */