RTI Distributed Logger API Version 7.7.0
rti_dl_xml_c.h
1/*
2 * (c) Copyright, Real-Time Innovations, 2012-2015.
3 * All rights reserved.
4 * No duplications, whole or partial, manual or electronic, may be made
5 * without express written permission. Any such copies, or
6 * revisions thereof, must display this notice unaltered.
7 * This code contains trade secrets of Real-Time Innovations, Inc.
8 */
9
10#ifndef rti_dl_xml_c_h
11#define rti_dl_xml_c_h
12
13#include "rti_dl/rti_dl_dll_c.h"
14#include "rti_dl/rti_dl_c.h"
15#include "log/log_dll.h"
16#include "osapi/osapi_type.h"
17#include "ndds/ndds_c.h"
18
19#include "ndds/ndds_config_c.h"
20#include "dds_c/dds_c_log_impl.h"
21
22#include "dds_c/dds_c_xml.h"
23
24
25/* ------------------------------------------------------------ */
26/*i
27 * @defgroup RTI_DL_XMLConfig RTI DL XML Configuration API
28 *
29 * @brief This API contains the functions necessary by the RTI infrastructure
30 * services and tools to use the RTI Distributed Logger.
31 *
32 * This API can be used for internal development when integrating RTI
33 * Distributed Logger in the XML configuration of their application or service.
34*/
35/* ------------------------------------------------------------ */
36
37/*i
38 * @ingroup RTI_DL_XMLConfig
39 * @brief The top level tag text for the Distributed Logger XML configuration
40 * extension class. This constant is intended to be used by applications and
41 * services using the Distributed Logger XML configuration capabilities when
42 * registering the XML extension class with their RTI XML Parser instances.
43 */
44#define RTI_DL_XML_TOP_LEVEL_TAG "distributed_logger"
45
46typedef void (*RTI_DL_XMLConfig_ParseErrorLogFunction)(
47 const char *logMessage,
48 const char *methodName,
49 int lineNumber);
50
51/* Forward declaration of type */
52struct RTI_DL_XMLConfig;
53
54
55typedef struct RTI_DL_XMLConfig RTI_DL_XMLConfig;
56
57
58/*i
59 * @ingroup RTI_DL_XMLConfig
60 * @brief Create a new instance of the RTI Distributed Logger XML extension
61 * class.
62 *
63 * The calling service or application is responsible for registering the
64 * extension class with the RTI XML Parser.
65 * @param parseErrorFunction A pointer to the method used to log
66 * @return An instance of XML extension class associated with Distributed
67 * Logger. If the instance could not be created, <code>NULL</code> is returned.
68 */
69extern RTIDLCDllExport struct RTIXMLExtensionClass *
70RTI_DL_XMLConfig_createXMLExtensionClass(
71 RTI_DL_XMLConfig_ParseErrorLogFunction parseErrorFunction);
72
73
74/*i
75 * @ingroup RTI_DL_XMLConfig
76 * @brief Delete an instance of the Distributed Logger XML extension class.
77 * @param extensionClass The extension class to be deleted.
78 */
79extern RTIDLCDllExport void RTI_DL_XMLConfig_destroyXMLExtensionClass(
80 struct RTIXMLExtensionClass *extensionClass);
81
82
83/*i
84 * @ingroup RTI_DL_XMLConfig
85 * @brief Helper method that gets the XML object associated with Distributed
86 * Logger from a root XML object passed as a parameter.
87 *
88 * @param rootObject A valid non-null parent XML object.
89 * @return The XML object associated with the Distributed Logger configuration.
90 * If the object couldn't be found, <code>null</code> is returned.
91 */
92extern RTIDLCDllExport const RTI_DL_XMLConfig *
93RTI_DL_XMLConfig_getXMLConfigFromXMLRoot(struct RTIXMLObject *rootObject);
94
95/*i
96 * Get the associated Distributed Logger XML object from a root XML DOM.
97 * @param rootObject The root XML object to look for the Distributed Logger XML
98 * configuration.
99 * @return It returns <code>true</code> if the XML object associated with the
100 * Distributed Logger configuration was found; otherwise it returns
101 * <code>false</code>.
102 */
103extern RTIDLCDllExport struct RTIXMLObject *
104RTI_DL_XMLConfig_getDLXMLObjectFromRoot(struct RTIXMLObject *rootObject);
105
106/*i
107 * @ingroup RTI_DL_XMLConfig
108 * @brief Starts Distributed Logger using the options, the domain participant,
109 * and a specific application kind string.
110 *
111 * This method is a utility method, useful for using Distributed Logger
112 * within other services or applications that will provide the options (maybe
113 * parsed via XML), the domain participant to hook up to, and the application
114 * kind identification.
115 * If the enabled setting in the options is set to false (it's disabled) then
116 * Distributed Logger won't be started.
117 * Also, if the Distributed Logger instance has already been created this method
118 * has no effect (it doesn't finalize Distributed Logger and restart it; if this
119 * is needed, the <code>RTI_DL_DistLogger_finalizeInstance</code> method has to
120 * be used before calling this method again).
121 * @pre The domainParticipant instance must be valid and non-null.
122 * @pre The Distributed Logger options object passed as a parameter must be
123 * valid and non-null.
124 * @param domainParticipant The domain participant to use for logging.
125 * @param xmlConfiguration The Distributed Logger configuration extracted from
126 * the XML parsing process.
127 * @param applicationKind The application kind string for the configuration
128 * settings.
129 * @return If the parameters are <code>null</code> or Distributed Logger could
130 * not be started, returns <code>false</code>. If the <b>enabled</b> option in
131 * the XML configuration is <code>true</code> and Distributed Logger could be
132 * started, or the <b>enabled</b> option is <code>false</code>, returns
133 * <code>true</code>.
134 */
135extern RTIDLCDllExport RTIBool RTI_DL_XMLConfig_startWithXMLConfiguration(
136 DDS_DomainParticipant * domainParticipant,
137 RTI_DL_Options * options,
138 const char * applicationKind);
139
140
141/*i
142 * Get the Distributed Logger options obtained by the parsing process.
143 * @param self A valid and non-null XML configuration instance to get the
144 * Distributed Logger options from.
145 * @return The DL options instance associated with this XML configuration
146 * object, or <code>null</code> if it doesn't exist.
147 */
148extern RTIDLCDllExport RTI_DL_Options * RTI_DL_XMLConfig_getDLOptions(
149 const struct RTI_DL_XMLConfig * self);
150
151#endif /* rti_dl_xml_c_h */