RTI Cloud Discovery Service Version 7.7.0
clouddiscoveryservice_service.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2025 Real-Time Innovations, Inc. All rights reserved.
3 * No duplications, whole or partial, manual or electronic, may be made
4 * without express written permission. Any such copies, or revisions thereof,
5 * must display this notice unaltered.
6 * This code contains trade secrets of Real-Time Innovations, Inc.
7 */
8
9#ifndef clouddiscoveryservice_service_h
10#define clouddiscoveryservice_service_h
11
12
13#ifndef clouddiscoveryservice_dll_h
14 #include "clouddiscoveryservice/clouddiscoveryservice_dll.h"
15#endif
16#ifndef clouddiscoveryservice_infrastructure_h
18#endif
19#ifndef routingservice_infrastructure_h
20 #include "routingservice/routingservice_infrastructure.h"
21#endif
22#ifndef ndds_c_h
23 #include "ndds/ndds_c.h"
24#endif
25#ifndef core_version_version_h
26 #include "core_version/core_version_version.h"
27#endif
28#ifndef ndds_config_c_h
29 #include "ndds/ndds_config_c.h"
30#endif
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/*e \file
37 \brief Implements the @product.
38*/
39
40extern CDSDllVariable const struct RTI_CDS_DomainListProperty
41 RTI_CDS_DOMAIN_LIST_DEFAULT;
42
43extern CDSDllVariable const char *RTI_CDS_TRANSPORT_UNICAST_ALIAS_DEFAULT;
44
45extern CDSDllVariable int RTI_CDS_TRANSPORT_UNICAST_RECEIVE_PORT_DEFAULT;
46
47extern CDSDllVariable struct RTI_CDS_TransportSelectionProperty
48 RTI_CDS_TRANSPORT_SELECTION_DEFAULT;
49
50extern CDSDllVariable const RTI_UINT64
51 CDS_FLOW_CONTROLLER_OUTPUT_BANDWITH_UNLIMITED;
52
53extern CDSDllVariable const struct RTI_CDS_FlowControllerProperty
54 RTI_CDS_FLOW_CONTROLLER_PROPERTY_DEFAULT;
55
56extern CDSDllVariable const struct RTI_CDS_ForwarderEventProperty
57 RTI_CDS_FORWARDER_EVENT_PROPERTY_DEFAULT;
58
59
60#define RTI_CDS_FLOW_CONTROLLER_PROPERTY_DEFAULT_VALUE \
61 { \
62 RTI_CDS_FLOW_CONTROLLER_JOBS_UNLIMITED, \
63 RTI_CDS_FLOW_CONTROLLER_JOBS_UNLIMITED, { 40, 30, 30 }, \
64 DDS_DURATION_INFINITE_VALUE \
65 }
66
67/*e \defgroup RTI_CDS_ServiceProperty Service Property
68 *
69 * \ingroup RTI_CDS_ServiceLibModule
70 *
71 * @brief Service Property for @product. Use this in conjunction with
72 * \ref RTI_CDS_ServiceLibModule, to configure @product in your code.
73 */
74
75/*e \ingroup RTI_CDS_ServiceProperty
76 *
77 * @brief Configuration property for @product.
78 */
80 /*e
81 * @brief Path to an @product configuration file
82 *
83 * If not \c NULL, this file is loaded; otherwise,
84 * if \c cfg_strings is not \c NULL, that XML code is loaded
85 *
86 * \default NULL.
87 */
88 char *cfg_file;
89
90 /*e
91 * @brief XML configuration represented as strings
92 *
93 * An array of strings that altogether make up an
94 * XML document to configure @product. This parameter is used
95 * only if \ref cfg_file is \c NULL.
96 *
97 * For example:
98 *
99 * \code
100 * int MY_CLOUD_DISCOVERY_SERVICE_CFG_SIZE = 3;
101 * const char *
102 * MY_CLOUD_DISCOVERY_SERVICE_CFG[MY_CLOUD_DISCOVERY_SERVICE_CFG_SIZE] =
103 * {"<dds>
104 * <cloud_discovery_service name=\"MyServiceName\">"
105 * ...
106 * </cloud_discovery_service>
107 * </dds>"};
108 *
109 * property.cfg_strings = MY_CLOUD_DISCOVERY_SERVICE_CFG;
110 * property.cfg_strings_count = MY_CLOUD_DISCOVERY_SERVICE_CFG_SIZE;
111 * \endcode
112 *
113 * The reason for using an array instead of one single string is to
114 * get around the limited size of literal strings in C.
115 * In general, if you create the XML string dynamically
116 * using one single string in the array,
117 * setting \ref cfg_strings_count to 1 is enough:
118 *
119 * \code
120 * property.cfg_strings = malloc(sizeof(char *));
121 * property.cfg_strings[0] = "<dds><cloud_discovery_service>...</dds>";
122 * property.cfg_strings_count = 1;
123 * \endcode
124 *
125 * If your target system doesn't support a file system, you can use
126 * XML strings to configure the service. To ease this process, a
127 * utility is shipped to generate a C string array from a text file.
128 * You can find this utility in
129 * [@product installation directory]/resource/perl/cStringifyFile.pl
130 *
131 * \default NULL.
132 */
133 const char **cfg_strings;
134
135 /*e
136 * @brief Size of the array \ref cfg_strings
137 *
138 * \default 0.
139 */
140 unsigned int cfg_strings_count;
141
142 /*e
143 * @brief The name of the @product instance to run
144 *
145 * This is the name used to find the
146 * \verbatim <cloud_discovery_service> \endverbatim
147 * XML tag in the configuration file; this is the default name that will
148 * be used to refer to this execution in remote administration and
149 * monitoring if application_name isn't specified.
150 *
151 * \default NULL (use built-in configuration)
152 */
154
155 /*e
156 * @brief Assigns a name to the execution of the @product
157 *
158 * Remote commands and status information will refer to the RTI Cloud
159 * Discovery Service using this name.
160 *
161 * \default service_name if this value is NULL.
162 */
164
165 /*e
166 * @brief Controls whether the service applies XSD validation to the loaded
167 * configuration.
168 *
169 * \default DDS_BOOLEAN_TRUE
170 */
172
173 /*e
174 * @brief Set it to true to avoid loading the standard files usually loaded
175 * by @product
176 *
177 * Only the configuration in \ref cfg_file or \ref cfg_strings will be
178 * loaded.
179 *
180 * \default DDS_BOOLEAN_FALSE
181 */
183
184 /*e
185 * @brief The verbosity of the service
186 *
187 * Values:
188 * <ul>
189 * <li> \ref RTI_CDS_LOG_VERBOSITY_SILENT
190 * <li> \ref RTI_CDS_LOG_VERBOSITY_EXCEPTIONS
191 * <li> \ref RTI_CDS_LOG_VERBOSITY_WARNINGS
192 * <li> \ref RTI_CDS_LOG_VERBOSITY_INFO
193 * <li> \ref RTI_CDS_LOG_VERBOSITY_ALL
194 * <li> \ref RTI_CDS_LOG_VERBOSITY_DEBUG
195 * </ul>
196 *
197 * \default RTI_CDS_LOG_VERBOSITY_EXCEPTIONS
198 */
200
201 /*e
202 * @brief The verbosity of \ndds core libraries
203 *
204 * Values:
205 * <ul>
206 * <li> \ref RTI_CDS_LOG_VERBOSITY_SILENT
207 * <li> \ref RTI_CDS_LOG_VERBOSITY_EXCEPTIONS
208 * <li> \ref RTI_CDS_LOG_VERBOSITY_WARNINGS
209 * <li> \ref RTI_CDS_LOG_VERBOSITY_INFO
210 * <li> \ref RTI_CDS_LOG_VERBOSITY_ALL
211 * <li> \ref RTI_CDS_LOG_VERBOSITY_DEBUG
212 * </ul>
213 *
214 * \default RTI_CDS_LOG_VERBOSITY_EXCEPTIONS
215 */
217
218 /*e
219 * @brief Specifies the transport and receive ports used to receive and
220 * send discovery traffic. Specifically, a receive resource is uniquely
221 * identified by a transport class-receive port pair.
222 * Overrides XML configuration if specified.
223 */
224 struct RTI_CDS_TransportSelectionProperty transport_selection;
225
226 /*e
227 * @brief Specifies the set of domain IDs the service will accept
228 * announcements from.
229 *
230 * \default Unspecified. Use value from XML configuration.
231 */
232 struct RTI_CDS_DomainListProperty domain_list;
233
234 /*e
235 * @brief Set this to true to enable remote administration
236 * or false to disable it.
237 *
238 * \default DDS_BOOLEAN_FALSE
239 */
241
242 /*e
243 * @brief If \ref enable_administration is true, this is
244 * the domain ID to use for remote administration.
245 *
246 * Takes precedence over the XML configuration.
247 * If \ref enable_administration is false, this value is not used
248 * even if remote administration is enabled in the XML configuration.
249 *
250 * \default 0
251 */
253
254 /*e
255 * @brief Set this to true to enable monitoring or false to disable it.
256 *
257 * \default DDS_BOOLEAN_FALSE
258 */
259 DDS_Boolean enable_monitoring;
260
261 /*e
262 * @brief If \ref enable_monitoring is true, this is
263 * the domain ID to use for publishing monitoring topics.
264 *
265 * Takes precedence over the XML configuration.
266 * If \ref enable_monitoring is false, this value is not used
267 * even if monitoring is enabled in the XML configuration.
268 *
269 * \default 0
270 */
272
273 /*e
274 * @brief Path to an @product license file
275 *
276 * If not \c NULL, this file is checked for a valid license; otherwise,
277 * default location will be used. This parameter is only used if your
278 * installation requires a license file.
279 *
280 * \default NULL.
281 */
283
284 /*e
285 * @brief Dictionary of user variables.
286 * The dictionary provides a parallel way to expand XML configuration
287 * variables in the form $(my_var), when they are not defined in the
288 * environment.
289 *
290 * \default empty
291 */
292 struct RTI_RoutingServiceProperties user_environment;
293};
294
295#define RTI_CDS_Property_INITIALIZER \
296 { \
297 NULL, /* cfg_file */ \
298 NULL, /* cfg_strings */ \
299 0, /* cfg_strings_count */ \
300 NULL, /* service_name */ \
301 NULL, /* application_name */ \
302 DDS_BOOLEAN_FALSE, /* enforce_xsd_validation */ \
303 DDS_BOOLEAN_FALSE, /* skip_default_files */ \
304 0, /* service_verbosity */ \
305 0, /* dds_verbosity */ \
306 RTI_CDS_TransportSelectionProperty_INITIALIZER, /* transport_selection \
307 */ \
308 RTI_CDS_DomainListProperty_INITIALIZER, /* domain_list */ \
309 0, /* enable_administration */ \
310 0, /* administration_domain_id */ \
311 0, /* enable_monitoring */ \
312 0, /* monitoring_domain_id */ \
313 NULL, /* license_file_name */ \
314 { \
315 NULL, 0, 1 \
316 } /* user_environment */ \
317 }
318
319extern CDSDllVariable const struct RTI_CDS_Property RTI_CDS_PROPERTY_DEFAULT;
320
331extern CDSDllExport DDS_Boolean
333
349extern CDSDllExport struct RTI_CDS_Property *RTI_CDS_Property_copy(
350 struct RTI_CDS_Property *to,
351 const struct RTI_CDS_Property *from);
352
362extern CDSDllExport void RTI_CDS_Property_finalize(
363 struct RTI_CDS_Property *self);
364
365/*e \defgroup RTI_CDS_ServiceLibModule Library API
366 * \ingroup CDS
367 * @brief @product can be deployed as a C library linked into your application
368 * on select architectures.
369 *
370 * This API allows you to create, configure and start @product instances from
371 * your application.
372 *
373 * The following code shows the typical use of the API:
374 *
375 * \code
376 *
377 * struct RTI_CDS_Property property = RTI_CDS_Property_INITIALIZER;
378 * struct RTI_CDS_Service *service = NULL;
379 *
380 * property.cfg_file = "my_cloud_discovery_service_cfg.xml";
381 * property.service_name = "my_cloud_discovery_service";
382 * ...
383 *
384 * service = RTI_CDS_Service_new(&property);
385 * if (service == NULL) {
386 * printf("Error ...");
387 * return -1;
388 * }
389 *
390 * if (!RTI_CDS_Service_start(service)) {
391 * printf("Error ...");
392 * RTI_CDS_Service_delete(service);
393 * return -1;
394 * }
395 *
396 * while (keep_running) {
397 * sleep();
398 * ...
399 * }
400 *
401 * RTI_CDS_Service_delete(service);
402 *
403 * return 0;
404 *
405 * \endcode
406 *
407 * Instead of a file, you can use XML strings to configure @product.
408 * See \ref RTI_CDS_ServiceProperty for more information.
409 * <p>
410 * To build your application you need to link with the @product library
411 * in <b> &lt;@ndds home&gt;/bin/&lt;architecture&gt;/ </b>
412 *
413 * An example is provided at
414 * <b>https://github.com/rticommunity/rticonnextdds-examples/tree/master/examples/cloud_discovery_service/library_api</b>.
415 *
416 * ### Development Requirements
417 *
418 * | | Linux Systems | Windows
419 * Systems | | ----------------------------: |
420 * :----------------------------: | :---------------------------: | | Link
421 * Libraries (Compile Time) | librticlouddiscoveryservice.so |
422 * rticlouddiscoveryservice.dll | | Shared Libraries (Run Time) |
423 * librtiroutingservice.so | rtiroutingservice.dll | | ^ |
424 * librtidlc.so | rtidlc.dll | | ^ |
425 * librticonnextmsgc.so | rticonnextmsgc.dll | | ^ |
426 * libnddsmetp.so | nddsmetp.dll | | ^ |
427 * librtiapputilsc.so | rtiapputilsc.dll | | ^ |
428 * librtixml2.so | rtixml2.dll | | ^ |
429 * libnddsc.so | nddsc.dll | | ^ |
430 * libnddscore.so | nddscore.dll | | Static
431 * Libraries | librticlouddiscoveryservicez.a |
432 * rticlouddiscoveryservicez.lib | | ^ |
433 * librtiroutingservicez.a | rtiroutingservicez.lib | | ^ |
434 * librtidlcz.a | rtidlcz.lib | | ^ |
435 * librticonnextmsgcz.a | rticonnextmsgcz.lib | | ^ |
436 * libnddsmetpz.a | nddsmetpz.lib | | ^ |
437 * librtiapputilscz.a | rtiapputilscz.lib | | ^ |
438 * librtixml2z.a | rtixml2z.lib | | ^ |
439 * libnddscz.a | nddscz.lib | | ^ |
440 * libnddscorez.a | nddscorez.lib | | Headers |
441 * clouddiscoveryservice/clouddiscoveryservice_service.h | |
442 *
443 * <b>NOTE:</b> If you are using debug libraries, remember to add the 'd' suffix
444 * to the library name. For shared libraries on macOS systems, the library name
445 * is the same as that for Linux except the extension is '.dylib' instead of
446 * '.so'.
447 */
448
449#ifdef DOXYGEN_DOCUMENTATION_ONLY
455struct RTI_CDS_Service { };
456#endif
457
458struct RTI_CDS_Service;
459
475extern CDSDllExport struct RTI_CDS_Service *RTI_CDS_Service_new(
476 const struct RTI_CDS_Property *property);
477
489extern CDSDllExport void RTI_CDS_Service_delete(struct RTI_CDS_Service *self);
490
504extern CDSDllExport DDS_Boolean
506
521extern CDSDllExport DDS_Boolean
523
532extern CDSDllExport DDS_Boolean RTI_CDS_Service_finalize_globals(void);
533
539extern CDSDllExport DDS_Boolean
541
558extern CDSDllExport DDS_Boolean
560 struct RTI_CDS_Service *self,
561 const char *rtps_psk_secret_passphrase);
562
563/*e \ingroup CDSLogModule
564 * @brief Logs a message with the specified level within the running instance of
565 * @product. The message will be printed under the log of the currently
566 * executing
567 * @product, if the instance was started with \p log_level or higher verbosity.
568 *
569 * The message is specified with a format and a format parameter, in a similar
570 * fashion to the standard C printf() operation.
571 *
572 * The generated log will be part of logging stream of the running
573 * @product, if the \p log_level is part of the configured verbosity.
574 * The result log message may include additional information according to the
575 * Connext logging configuration, such as Advlog Context, thread ID, line
576 * number, etc. Additionally, the result log message will contain a newline
577 * character at the end, so the format does not need to contain it.
578 *
579 * @param [in] log_level Log level associated to the message
580 * @param [in] format message format specification
581 * @param [in] ... variablelength argument (stdarg)
582 */
583extern CDSDllExport void RTI_CDS_Logger_log(
584 NDDS_Config_LogLevel log_level,
585 const char *format,
586 ...);
587
588/*e \ingroup CDSLogModule
589 * @brief Log verbosity level: exceptions + warnings + info + periodic + content
590 */
591extern CDSDllVariable const int RTI_CDS_LOG_VERBOSITY_DEBUG;
592
593/*e \ingroup CDSLogModule
594 * @brief Log verbosity level: exceptions + warnings + info + periodic
595 */
596extern CDSDllVariable const int RTI_CDS_LOG_VERBOSITY_ALL;
597
598/*e \ingroup CDSLogModule
599 * @brief Log verbosity level: exceptions + warnings + info
600 */
601extern CDSDllVariable const int RTI_CDS_LOG_VERBOSITY_INFO;
602
603/*e \ingroup CDSLogModule
604 * @brief Log verbosity level: exceptions + warnings
605 */
606extern CDSDllVariable const int RTI_CDS_LOG_VERBOSITY_WARNINGS;
607
608/*e \ingroup CDSLogModule
609 * @brief Log verbosity level: exceptions
610 */
611extern CDSDllVariable const int RTI_CDS_LOG_VERBOSITY_EXCEPTIONS;
612
613/*e \ingroup CDSLogModule
614 * @brief Log verbosity level: silent
615 */
616extern CDSDllVariable const int RTI_CDS_LOG_VERBOSITY_SILENT;
617
618extern CDSDllExport void RTI_CDS_Service_print_available_configI(
619 struct RTI_CDS_Service *self);
620
621
622#ifdef __cplusplus
623} /* extern "C" */
624#endif
625
626#endif /* clouddiscoveryservice_service_h */
const int RTI_CDS_LOG_VERBOSITY_ALL
Log verbosity level: exceptions + warnings + info + periodic.
const int RTI_CDS_LOG_VERBOSITY_SILENT
Log verbosity level: silent.
void RTI_CDS_Logger_log(NDDS_Config_LogLevel log_level, const char *format,...)
Logs a message with the specified level within the running instance of RTI Cloud Discovery Service....
const int RTI_CDS_LOG_VERBOSITY_DEBUG
Log verbosity level: exceptions + warnings + info + periodic + content.
const int RTI_CDS_LOG_VERBOSITY_EXCEPTIONS
Log verbosity level: exceptions.
const int RTI_CDS_LOG_VERBOSITY_INFO
Log verbosity level: exceptions + warnings + info.
const int RTI_CDS_LOG_VERBOSITY_WARNINGS
Log verbosity level: exceptions + warnings.
DDS_Boolean RTI_CDS_Service_update_rtps_psk_secret_passphrase(struct RTI_CDS_Service *self, const char *rtps_psk_secret_passphrase)
Sets the dds.sec.crypto.rtps_psk_secret_passphrase property for the RTI Cloud Discovery Service insta...
DDS_Boolean RTI_CDS_Service_finalize_globals(void)
void RTI_CDS_Service_delete(struct RTI_CDS_Service *self)
Stop and delete an RTI Cloud Discovery Service instance.
struct RTI_CDS_Service * RTI_CDS_Service_new(const struct RTI_CDS_Property *property)
Create a new RTI Cloud Discovery Service instance.
DDS_Boolean RTI_CDS_Service_start(struct RTI_CDS_Service *self)
Start RTI Cloud Discovery Service.
DDS_Boolean RTI_CDS_Service_is_started(struct RTI_CDS_Service *self)
Query whether this RTI Cloud Discovery Service is currently started.
DDS_Boolean RTI_CDS_Service_stop(struct RTI_CDS_Service *self)
Stop RTI Cloud Discovery Service.
struct RTI_CDS_Property * RTI_CDS_Property_copy(struct RTI_CDS_Property *to, const struct RTI_CDS_Property *from)
Copy the values of a Service Property variable into another.
void RTI_CDS_Property_finalize(struct RTI_CDS_Property *self)
Finalize an instance of the Service Property variable.
DDS_Boolean RTI_CDS_Property_initialize(struct RTI_CDS_Property *self)
Initialize an instance of the Service Property variable with empty values.
Data structure to configure the forwarder resend event mechanism. It allows CDS to resend a new or up...
Definition: clouddiscoveryservice_infrastructure.h:151
Configuration property for RTI Cloud Discovery Service.
Definition: clouddiscoveryservice_service.h:79
const char ** cfg_strings
XML configuration represented as strings.
Definition: clouddiscoveryservice_service.h:133
struct RTI_CDS_DomainListProperty domain_list
Specifies the set of domain IDs the service will accept announcements from.
Definition: clouddiscoveryservice_service.h:232
int administration_domain_id
If enable_administration is true, this is the domain ID to use for remote administration.
Definition: clouddiscoveryservice_service.h:252
char * license_file_name
Path to an RTI Cloud Discovery Service license file.
Definition: clouddiscoveryservice_service.h:282
struct RTI_CDS_TransportSelectionProperty transport_selection
Specifies the transport and receive ports used to receive and send discovery traffic....
Definition: clouddiscoveryservice_service.h:224
DDS_Boolean enforce_xsd_validation
Controls whether the service applies XSD validation to the loaded configuration.
Definition: clouddiscoveryservice_service.h:171
int dds_verbosity
The verbosity of RTI Connext core libraries.
Definition: clouddiscoveryservice_service.h:216
DDS_Boolean enable_administration
Set this to true to enable remote administration or false to disable it.
Definition: clouddiscoveryservice_service.h:240
DDS_Boolean skip_default_files
Set it to true to avoid loading the standard files usually loaded by RTI Cloud Discovery Service.
Definition: clouddiscoveryservice_service.h:182
unsigned int cfg_strings_count
Size of the array cfg_strings.
Definition: clouddiscoveryservice_service.h:140
int monitoring_domain_id
If enable_monitoring is true, this is the domain ID to use for publishing monitoring topics.
Definition: clouddiscoveryservice_service.h:271
char * application_name
Assigns a name to the execution of the RTI Cloud Discovery Service.
Definition: clouddiscoveryservice_service.h:163
int service_verbosity
The verbosity of the service.
Definition: clouddiscoveryservice_service.h:199
struct RTI_RoutingServiceProperties user_environment
Dictionary of user variables. The dictionary provides a parallel way to expand XML configuration vari...
Definition: clouddiscoveryservice_service.h:292
DDS_Boolean enable_monitoring
Set this to true to enable monitoring or false to disable it.
Definition: clouddiscoveryservice_service.h:259
char * service_name
The name of the RTI Cloud Discovery Service instance to run.
Definition: clouddiscoveryservice_service.h:153
char * cfg_file
Path to an RTI Cloud Discovery Service configuration file.
Definition: clouddiscoveryservice_service.h:88
RTI Cloud Discovery Service.
Definition: clouddiscoveryservice_service.h:454