ua_server.h 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef UA_SERVER_H_
  5. #define UA_SERVER_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "ua_types.h"
  10. #include "ua_types_generated.h"
  11. #include "ua_types_generated_handling.h"
  12. #include "ua_plugin_log.h"
  13. #include "ua_plugin_network.h"
  14. #include "ua_plugin_access_control.h"
  15. /**
  16. * .. _server:
  17. *
  18. * Server
  19. * ======
  20. *
  21. * Server Configuration
  22. * --------------------
  23. * The configuration structure is passed to the server during initialization. */
  24. typedef struct {
  25. UA_UInt32 min;
  26. UA_UInt32 max;
  27. } UA_UInt32Range;
  28. typedef struct {
  29. UA_Double min;
  30. UA_Double max;
  31. } UA_DoubleRange;
  32. typedef struct {
  33. UA_UInt16 nThreads; /* only if multithreading is enabled */
  34. UA_Logger logger;
  35. /* Server Description */
  36. UA_BuildInfo buildInfo;
  37. UA_ApplicationDescription applicationDescription;
  38. UA_ByteString serverCertificate;
  39. #ifdef UA_ENABLE_DISCOVERY
  40. UA_String mdnsServerName;
  41. size_t serverCapabilitiesSize;
  42. UA_String *serverCapabilities;
  43. #endif
  44. /* Custom DataTypes */
  45. size_t customDataTypesSize;
  46. const UA_DataType *customDataTypes;
  47. /* Networking */
  48. size_t networkLayersSize;
  49. UA_ServerNetworkLayer *networkLayers;
  50. /* Access Control */
  51. UA_AccessControl accessControl;
  52. /* Limits for SecureChannels */
  53. UA_UInt16 maxSecureChannels;
  54. UA_UInt32 maxSecurityTokenLifetime; /* in ms */
  55. /* Limits for Sessions */
  56. UA_UInt16 maxSessions;
  57. UA_Double maxSessionTimeout; /* in ms */
  58. /* Limits for Subscriptions */
  59. UA_DoubleRange publishingIntervalLimits;
  60. UA_UInt32Range lifeTimeCountLimits;
  61. UA_UInt32Range keepAliveCountLimits;
  62. UA_UInt32 maxNotificationsPerPublish;
  63. UA_UInt32 maxRetransmissionQueueSize; /* 0 -> unlimited size */
  64. /* Limits for MonitoredItems */
  65. UA_DoubleRange samplingIntervalLimits;
  66. UA_UInt32Range queueSizeLimits; /* Negotiated with the client */
  67. /* Discovery */
  68. #ifdef UA_ENABLE_DISCOVERY
  69. /* Timeout in seconds when to automatically remove a registered server from
  70. * the list, if it doesn't re-register within the given time frame. A value
  71. * of 0 disables automatic removal. Default is 60 Minutes (60*60). Must be
  72. * bigger than 10 seconds, because cleanup is only triggered approximately
  73. * ervery 10 seconds. The server will still be removed depending on the
  74. * state of the semaphore file. */
  75. UA_UInt32 discoveryCleanupTimeout;
  76. #endif
  77. } UA_ServerConfig;
  78. /**
  79. * .. _server-lifecycle:
  80. *
  81. * Server Lifecycle
  82. * ---------------- */
  83. UA_Server UA_EXPORT * UA_Server_new(const UA_ServerConfig config);
  84. void UA_EXPORT UA_Server_delete(UA_Server *server);
  85. /* Runs the main loop of the server. In each iteration, this calls into the
  86. * networklayers to see if messages have arrived.
  87. *
  88. * @param server The server object.
  89. * @param running The loop is run as long as *running is true.
  90. * Otherwise, the server shuts down.
  91. * @return Returns the statuscode of the UA_Server_run_shutdown method */
  92. UA_StatusCode UA_EXPORT
  93. UA_Server_run(UA_Server *server, volatile UA_Boolean *running);
  94. /* The prologue part of UA_Server_run (no need to use if you call
  95. * UA_Server_run) */
  96. UA_StatusCode UA_EXPORT UA_Server_run_startup(UA_Server *server);
  97. /* Executes a single iteration of the server's main loop.
  98. *
  99. * @param server The server object.
  100. * @param waitInternal Should we wait for messages in the networklayer?
  101. * Otherwise, the timouts for the networklayers are set to zero.
  102. * The default max wait time is 50millisec.
  103. * @return Returns how long we can wait until the next scheduled
  104. * callback (in ms) */
  105. UA_UInt16 UA_EXPORT
  106. UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal);
  107. /* The epilogue part of UA_Server_run (no need to use if you call
  108. * UA_Server_run) */
  109. UA_StatusCode UA_EXPORT UA_Server_run_shutdown(UA_Server *server);
  110. /**
  111. * Repeated Callbacks
  112. * ------------------ */
  113. typedef void (*UA_ServerCallback)(UA_Server *server, void *data);
  114. /* Add a callback for cyclic repetition to the server.
  115. *
  116. * @param server The server object.
  117. * @param callback The callback that shall be added.
  118. * @param interval The callback shall be repeatedly executed with the given interval
  119. * (in ms). The interval must be larger than 5ms. The first execution
  120. * occurs at now() + interval at the latest.
  121. * @param callbackId Set to the identifier of the repeated callback . This can be used to cancel
  122. * the callback later on. If the pointer is null, the identifier is not set.
  123. * @return Upon success, UA_STATUSCODE_GOOD is returned.
  124. * An error code otherwise. */
  125. UA_StatusCode UA_EXPORT
  126. UA_Server_addRepeatedCallback(UA_Server *server, UA_ServerCallback callback,
  127. void *data, UA_UInt32 interval, UA_UInt64 *callbackId);
  128. UA_StatusCode UA_EXPORT
  129. UA_Server_changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId,
  130. UA_UInt32 interval);
  131. /* Remove a repeated callback.
  132. *
  133. * @param server The server object.
  134. * @param callbackId The id of the callback that shall be removed.
  135. * @return Upon sucess, UA_STATUSCODE_GOOD is returned.
  136. * An error code otherwise. */
  137. UA_StatusCode UA_EXPORT
  138. UA_Server_removeRepeatedCallback(UA_Server *server, UA_UInt64 callbackId);
  139. /**
  140. * Reading and Writing Node Attributes
  141. * -----------------------------------
  142. * The functions for reading and writing node attributes call the regular read
  143. * and write service in the background that are also used over the network.
  144. *
  145. * The following attributes cannot be read, since the local "admin" user always
  146. * has full rights.
  147. *
  148. * - UserWriteMask
  149. * - UserAccessLevel
  150. * - UserExecutable */
  151. /* Read an attribute of a node. The specialized functions below provide a more
  152. * concise syntax.
  153. *
  154. * @param server The server object.
  155. * @param item ReadValueIds contain the NodeId of the target node, the id of the
  156. * attribute to read and (optionally) an index range to read parts
  157. * of an array only. See the section on NumericRange for the format
  158. * used for array ranges.
  159. * @param timestamps Which timestamps to return for the attribute.
  160. * @return Returns a DataValue that contains either an error code, or a variant
  161. * with the attribute value and the timestamps. */
  162. UA_DataValue UA_EXPORT
  163. UA_Server_read(UA_Server *server, const UA_ReadValueId *item,
  164. UA_TimestampsToReturn timestamps);
  165. /* Don't use this function. There are typed versions for every supported
  166. * attribute. */
  167. UA_StatusCode UA_EXPORT
  168. __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
  169. UA_AttributeId attributeId, void *v);
  170. static UA_INLINE UA_StatusCode
  171. UA_Server_readNodeId(UA_Server *server, const UA_NodeId nodeId,
  172. UA_NodeId *outNodeId) {
  173. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODEID, outNodeId);
  174. }
  175. static UA_INLINE UA_StatusCode
  176. UA_Server_readNodeClass(UA_Server *server, const UA_NodeId nodeId,
  177. UA_NodeClass *outNodeClass) {
  178. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODECLASS,
  179. outNodeClass);
  180. }
  181. static UA_INLINE UA_StatusCode
  182. UA_Server_readBrowseName(UA_Server *server, const UA_NodeId nodeId,
  183. UA_QualifiedName *outBrowseName) {
  184. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME,
  185. outBrowseName);
  186. }
  187. static UA_INLINE UA_StatusCode
  188. UA_Server_readDisplayName(UA_Server *server, const UA_NodeId nodeId,
  189. UA_LocalizedText *outDisplayName) {
  190. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME,
  191. outDisplayName);
  192. }
  193. static UA_INLINE UA_StatusCode
  194. UA_Server_readDescription(UA_Server *server, const UA_NodeId nodeId,
  195. UA_LocalizedText *outDescription) {
  196. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION,
  197. outDescription);
  198. }
  199. static UA_INLINE UA_StatusCode
  200. UA_Server_readWriteMask(UA_Server *server, const UA_NodeId nodeId,
  201. UA_UInt32 *outWriteMask) {
  202. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
  203. outWriteMask);
  204. }
  205. static UA_INLINE UA_StatusCode
  206. UA_Server_readIsAbstract(UA_Server *server, const UA_NodeId nodeId,
  207. UA_Boolean *outIsAbstract) {
  208. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
  209. outIsAbstract);
  210. }
  211. static UA_INLINE UA_StatusCode
  212. UA_Server_readSymmetric(UA_Server *server, const UA_NodeId nodeId,
  213. UA_Boolean *outSymmetric) {
  214. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_SYMMETRIC,
  215. outSymmetric);
  216. }
  217. static UA_INLINE UA_StatusCode
  218. UA_Server_readInverseName(UA_Server *server, const UA_NodeId nodeId,
  219. UA_LocalizedText *outInverseName) {
  220. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME,
  221. outInverseName);
  222. }
  223. static UA_INLINE UA_StatusCode
  224. UA_Server_readContainsNoLoop(UA_Server *server, const UA_NodeId nodeId,
  225. UA_Boolean *outContainsNoLoops) {
  226. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS,
  227. outContainsNoLoops);
  228. }
  229. static UA_INLINE UA_StatusCode
  230. UA_Server_readEventNotifier(UA_Server *server, const UA_NodeId nodeId,
  231. UA_Byte *outEventNotifier) {
  232. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER,
  233. outEventNotifier);
  234. }
  235. static UA_INLINE UA_StatusCode
  236. UA_Server_readValue(UA_Server *server, const UA_NodeId nodeId,
  237. UA_Variant *outValue) {
  238. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUE, outValue);
  239. }
  240. static UA_INLINE UA_StatusCode
  241. UA_Server_readDataType(UA_Server *server, const UA_NodeId nodeId,
  242. UA_NodeId *outDataType) {
  243. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DATATYPE,
  244. outDataType);
  245. }
  246. static UA_INLINE UA_StatusCode
  247. UA_Server_readValueRank(UA_Server *server, const UA_NodeId nodeId,
  248. UA_Int32 *outValueRank) {
  249. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUERANK,
  250. outValueRank);
  251. }
  252. /* Returns a variant with an int32 array */
  253. static UA_INLINE UA_StatusCode
  254. UA_Server_readArrayDimensions(UA_Server *server, const UA_NodeId nodeId,
  255. UA_Variant *outArrayDimensions) {
  256. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ARRAYDIMENSIONS,
  257. outArrayDimensions);
  258. }
  259. static UA_INLINE UA_StatusCode
  260. UA_Server_readAccessLevel(UA_Server *server, const UA_NodeId nodeId,
  261. UA_Byte *outAccessLevel) {
  262. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
  263. outAccessLevel);
  264. }
  265. static UA_INLINE UA_StatusCode
  266. UA_Server_readMinimumSamplingInterval(UA_Server *server, const UA_NodeId nodeId,
  267. UA_Double *outMinimumSamplingInterval) {
  268. return __UA_Server_read(server, &nodeId,
  269. UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
  270. outMinimumSamplingInterval);
  271. }
  272. static UA_INLINE UA_StatusCode
  273. UA_Server_readHistorizing(UA_Server *server, const UA_NodeId nodeId,
  274. UA_Boolean *outHistorizing) {
  275. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_HISTORIZING,
  276. outHistorizing);
  277. }
  278. static UA_INLINE UA_StatusCode
  279. UA_Server_readExecutable(UA_Server *server, const UA_NodeId nodeId,
  280. UA_Boolean *outExecutable) {
  281. return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EXECUTABLE,
  282. outExecutable);
  283. }
  284. /**
  285. * The following node attributes cannot be changed once a node has been created:
  286. *
  287. * - NodeClass
  288. * - NodeId
  289. * - Symmetric
  290. * - ContainsNoLoop
  291. *
  292. * The following attributes cannot be written from the server, as they are
  293. * specific to the different users and set by the access control callback:
  294. *
  295. * - UserWriteMask
  296. * - UserAccessLevel
  297. * - UserExecutable
  298. *
  299. * Historizing is currently unsupported */
  300. /* Overwrite an attribute of a node. The specialized functions below provide a
  301. * more concise syntax.
  302. *
  303. * @param server The server object.
  304. * @param value WriteValues contain the NodeId of the target node, the id of the
  305. * attribute to overwritten, the actual value and (optionally) an
  306. * index range to replace parts of an array only. of an array only.
  307. * See the section on NumericRange for the format used for array
  308. * ranges.
  309. * @return Returns a status code. */
  310. UA_StatusCode UA_EXPORT
  311. UA_Server_write(UA_Server *server, const UA_WriteValue *value);
  312. /* Don't use this function. There are typed versions with no additional
  313. * overhead. */
  314. UA_StatusCode UA_EXPORT
  315. __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
  316. const UA_AttributeId attributeId,
  317. const UA_DataType *attr_type, const void *attr);
  318. static UA_INLINE UA_StatusCode
  319. UA_Server_writeBrowseName(UA_Server *server, const UA_NodeId nodeId,
  320. const UA_QualifiedName browseName) {
  321. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME,
  322. &UA_TYPES[UA_TYPES_QUALIFIEDNAME], &browseName);
  323. }
  324. static UA_INLINE UA_StatusCode
  325. UA_Server_writeDisplayName(UA_Server *server, const UA_NodeId nodeId,
  326. const UA_LocalizedText displayName) {
  327. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME,
  328. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &displayName);
  329. }
  330. static UA_INLINE UA_StatusCode
  331. UA_Server_writeDescription(UA_Server *server, const UA_NodeId nodeId,
  332. const UA_LocalizedText description) {
  333. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION,
  334. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &description);
  335. }
  336. static UA_INLINE UA_StatusCode
  337. UA_Server_writeWriteMask(UA_Server *server, const UA_NodeId nodeId,
  338. const UA_UInt32 writeMask) {
  339. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
  340. &UA_TYPES[UA_TYPES_UINT32], &writeMask);
  341. }
  342. static UA_INLINE UA_StatusCode
  343. UA_Server_writeIsAbstract(UA_Server *server, const UA_NodeId nodeId,
  344. const UA_Boolean isAbstract) {
  345. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
  346. &UA_TYPES[UA_TYPES_BOOLEAN], &isAbstract);
  347. }
  348. static UA_INLINE UA_StatusCode
  349. UA_Server_writeInverseName(UA_Server *server, const UA_NodeId nodeId,
  350. const UA_LocalizedText inverseName) {
  351. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME,
  352. &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &inverseName);
  353. }
  354. static UA_INLINE UA_StatusCode
  355. UA_Server_writeEventNotifier(UA_Server *server, const UA_NodeId nodeId,
  356. const UA_Byte eventNotifier) {
  357. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER,
  358. &UA_TYPES[UA_TYPES_BYTE], &eventNotifier);
  359. }
  360. static UA_INLINE UA_StatusCode
  361. UA_Server_writeValue(UA_Server *server, const UA_NodeId nodeId,
  362. const UA_Variant value) {
  363. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE,
  364. &UA_TYPES[UA_TYPES_VARIANT], &value);
  365. }
  366. static UA_INLINE UA_StatusCode
  367. UA_Server_writeDataType(UA_Server *server, const UA_NodeId nodeId,
  368. const UA_NodeId dataType) {
  369. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DATATYPE,
  370. &UA_TYPES[UA_TYPES_NODEID], &dataType);
  371. }
  372. static UA_INLINE UA_StatusCode
  373. UA_Server_writeValueRank(UA_Server *server, const UA_NodeId nodeId,
  374. const UA_Int32 valueRank) {
  375. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUERANK,
  376. &UA_TYPES[UA_TYPES_INT32], &valueRank);
  377. }
  378. static UA_INLINE UA_StatusCode
  379. UA_Server_writeArrayDimensions(UA_Server *server, const UA_NodeId nodeId,
  380. const UA_Variant arrayDimensions) {
  381. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE,
  382. &UA_TYPES[UA_TYPES_VARIANT], &arrayDimensions);
  383. }
  384. static UA_INLINE UA_StatusCode
  385. UA_Server_writeAccessLevel(UA_Server *server, const UA_NodeId nodeId,
  386. const UA_Byte accessLevel) {
  387. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
  388. &UA_TYPES[UA_TYPES_BYTE], &accessLevel);
  389. }
  390. static UA_INLINE UA_StatusCode
  391. UA_Server_writeMinimumSamplingInterval(UA_Server *server, const UA_NodeId nodeId,
  392. const UA_Double miniumSamplingInterval) {
  393. return __UA_Server_write(server, &nodeId,
  394. UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
  395. &UA_TYPES[UA_TYPES_DOUBLE],
  396. &miniumSamplingInterval);
  397. }
  398. static UA_INLINE UA_StatusCode
  399. UA_Server_writeExecutable(UA_Server *server, const UA_NodeId nodeId,
  400. const UA_Boolean executable) {
  401. return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_EXECUTABLE,
  402. &UA_TYPES[UA_TYPES_BOOLEAN], &executable); }
  403. /**
  404. * Browsing
  405. * -------- */
  406. UA_BrowseResult UA_EXPORT
  407. UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs,
  408. const UA_BrowseDescription *descr);
  409. UA_BrowseResult UA_EXPORT
  410. UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
  411. const UA_ByteString *continuationPoint);
  412. UA_BrowsePathResult UA_EXPORT
  413. UA_Server_translateBrowsePathToNodeIds(UA_Server *server,
  414. const UA_BrowsePath *browsePath);
  415. #ifndef HAVE_NODEITER_CALLBACK
  416. #define HAVE_NODEITER_CALLBACK
  417. /* Iterate over all nodes referenced by parentNodeId by calling the callback
  418. * function for each child node (in ifdef because GCC/CLANG handle include order
  419. * differently) */
  420. typedef UA_StatusCode
  421. (*UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse,
  422. UA_NodeId referenceTypeId, void *handle);
  423. #endif
  424. UA_StatusCode UA_EXPORT
  425. UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId,
  426. UA_NodeIteratorCallback callback, void *handle);
  427. #ifdef UA_ENABLE_DISCOVERY
  428. /**
  429. * Discovery
  430. * --------- */
  431. /* Register the given server instance at the discovery server.
  432. * This should be called periodically.
  433. * The semaphoreFilePath is optional. If the given file is deleted,
  434. * the server will automatically be unregistered. This could be
  435. * for example a pid file which is deleted if the server crashes.
  436. *
  437. * When the server shuts down you need to call unregister.
  438. *
  439. * @param server
  440. * @param discoveryServerUrl if set to NULL, the default value
  441. * 'opc.tcp://localhost:4840' will be used
  442. * @param semaphoreFilePath optional parameter pointing to semaphore file. */
  443. UA_StatusCode UA_EXPORT
  444. UA_Server_register_discovery(UA_Server *server, const char* discoveryServerUrl,
  445. const char* semaphoreFilePath);
  446. /* Unregister the given server instance from the discovery server.
  447. * This should only be called when the server is shutting down.
  448. * @param server
  449. * @param discoveryServerUrl if set to NULL, the default value
  450. * 'opc.tcp://localhost:4840' will be used */
  451. UA_StatusCode UA_EXPORT
  452. UA_Server_unregister_discovery(UA_Server *server, const char* discoveryServerUrl);
  453. /* Adds a periodic callback to register the server with the LDS (local discovery server)
  454. * periodically. The interval between each register call is given as second parameter.
  455. * It should be 10 minutes by default (= 10*60*1000).
  456. *
  457. * The delayFirstRegisterMs parameter indicates the delay for the first register call.
  458. * If it is 0, the first register call will be after intervalMs milliseconds,
  459. * otherwise the server's first register will be after delayFirstRegisterMs.
  460. *
  461. * When you manually unregister the server, you also need to cancel the
  462. * periodic callback, otherwise it will be automatically be registered again.
  463. *
  464. * @param server
  465. * @param discoveryServerUrl if set to NULL, the default value
  466. * 'opc.tcp://localhost:4840' will be used
  467. * @param intervalMs
  468. * @param delayFirstRegisterMs
  469. * @param periodicCallbackId */
  470. UA_StatusCode UA_EXPORT
  471. UA_Server_addPeriodicServerRegisterCallback(UA_Server *server, const char* discoveryServerUrl,
  472. UA_UInt32 intervalMs,
  473. UA_UInt32 delayFirstRegisterMs,
  474. UA_UInt64 *periodicCallbackId);
  475. /* Callback for RegisterServer. Data is passed from the register call */
  476. typedef void (*UA_Server_registerServerCallback)(const UA_RegisteredServer *registeredServer,
  477. void* data);
  478. /* Set the callback which is called if another server registeres or unregisters
  479. * with this instance. If called multiple times, previous data will be
  480. * overwritten.
  481. *
  482. * @param server
  483. * @param cb the callback
  484. * @param data data passed to the callback
  485. * @return UA_STATUSCODE_SUCCESS on success */
  486. void UA_EXPORT
  487. UA_Server_setRegisterServerCallback(UA_Server *server, UA_Server_registerServerCallback cb,
  488. void* data);
  489. #ifdef UA_ENABLE_DISCOVERY_MULTICAST
  490. /* Callback for server detected through mDNS. Data is passed from the register
  491. * call
  492. *
  493. * @param isServerAnnounce indicates if the server has just been detected. If
  494. * set to false, this means the server is shutting down.
  495. * @param isTxtReceived indicates if we already received the corresponding TXT
  496. * record with the path and caps data */
  497. typedef void (*UA_Server_serverOnNetworkCallback)(const UA_ServerOnNetwork *serverOnNetwork,
  498. UA_Boolean isServerAnnounce,
  499. UA_Boolean isTxtReceived, void* data);
  500. /* Set the callback which is called if another server is found through mDNS or
  501. * deleted. It will be called for any mDNS message from the remote server, thus
  502. * it may be called multiple times for the same instance. Also the SRV and TXT
  503. * records may arrive later, therefore for the first call the server
  504. * capabilities may not be set yet. If called multiple times, previous data will
  505. * be overwritten.
  506. *
  507. * @param server
  508. * @param cb the callback
  509. * @param data data passed to the callback
  510. * @return UA_STATUSCODE_SUCCESS on success */
  511. void UA_EXPORT
  512. UA_Server_setServerOnNetworkCallback(UA_Server *server,
  513. UA_Server_serverOnNetworkCallback cb,
  514. void* data);
  515. #endif /* UA_ENABLE_DISCOVERY_MULTICAST */
  516. #endif /* UA_ENABLE_DISCOVERY */
  517. /**
  518. * Method Call
  519. * ----------- */
  520. #ifdef UA_ENABLE_METHODCALLS
  521. UA_CallMethodResult UA_EXPORT
  522. UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request);
  523. #endif
  524. /**
  525. * Node Management
  526. * ---------------
  527. *
  528. * Callback Mechanisms
  529. * ^^^^^^^^^^^^^^^^^^^
  530. * There are four mechanisms for callbacks from the node-based information model
  531. * into userspace:
  532. *
  533. * - Datasources for variable nodes, where the variable content is managed
  534. * externally
  535. * - Value-callbacks for variable nodes, where userspace is notified when a
  536. * read/write occurs
  537. * - Object lifecycle management, where a user-defined constructor and
  538. * destructor is added to an object type
  539. * - Method callbacks, where a user-defined method is exposed in the information
  540. * model
  541. *
  542. * .. _datasource:
  543. *
  544. * Data Source Callback
  545. * ~~~~~~~~~~~~~~~~~~~~
  546. *
  547. * The server has a unique way of dealing with the content of variables. Instead
  548. * of storing a variant attached to the variable node, the node can point to a
  549. * function with a local data provider. Whenever the value attribute is read,
  550. * the function will be called and asked to provide a UA_DataValue return value
  551. * that contains the value content and additional timestamps.
  552. *
  553. * It is expected that the read callback is implemented. The write callback can
  554. * be set to a null-pointer. */
  555. typedef struct {
  556. void *handle; /* A custom pointer to reuse the same datasource functions for
  557. multiple sources */
  558. /* Copies the data from the source into the provided value.
  559. *
  560. * @param handle An optional pointer to user-defined data for the
  561. * specific data source
  562. * @param nodeid Id of the read node
  563. * @param includeSourceTimeStamp If true, then the datasource is expected to
  564. * set the source timestamp in the returned value
  565. * @param range If not null, then the datasource shall return only a
  566. * selection of the (nonscalar) data. Set
  567. * UA_STATUSCODE_BADINDEXRANGEINVALID in the value if this does not
  568. * apply.
  569. * @param value The (non-null) DataValue that is returned to the client. The
  570. * data source sets the read data, the result status and optionally a
  571. * sourcetimestamp.
  572. * @return Returns a status code for logging. Error codes intended for the
  573. * original caller are set in the value. If an error is returned,
  574. * then no releasing of the value is done. */
  575. UA_StatusCode (*read)(void *handle, const UA_NodeId nodeid,
  576. UA_Boolean includeSourceTimeStamp,
  577. const UA_NumericRange *range, UA_DataValue *value);
  578. /* Write into a data source. The write member of UA_DataSource can be empty
  579. * if the operation is unsupported.
  580. *
  581. * @param handle An optional pointer to user-defined data for the
  582. * specific data source
  583. * @param nodeid Id of the node being written to
  584. * @param data The data to be written into the data source
  585. * @param range An optional data range. If the data source is scalar or does
  586. * not support writing of ranges, then an error code is returned.
  587. * @return Returns a status code that is returned to the user
  588. */
  589. UA_StatusCode (*write)(void *handle, const UA_NodeId nodeid,
  590. const UA_Variant *data, const UA_NumericRange *range);
  591. } UA_DataSource;
  592. UA_StatusCode UA_EXPORT
  593. UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
  594. const UA_DataSource dataSource);
  595. /**
  596. * .. _value-callback:
  597. *
  598. * Value Callback
  599. * ~~~~~~~~~~~~~~
  600. * Value Callbacks can be attached to variable and variable type nodes. If
  601. * not-null, they are called before reading and after writing respectively. */
  602. typedef struct {
  603. /* Pointer to user-provided data for the callback */
  604. void *handle;
  605. /* Called before the value attribute is read. It is possible to write into the
  606. * value attribute during onRead (using the write service). The node is
  607. * re-opened afterwards so that changes are considered in the following read
  608. * operation.
  609. *
  610. * @param handle Points to user-provided data for the callback.
  611. * @param nodeid The identifier of the node.
  612. * @param data Points to the current node value.
  613. * @param range Points to the numeric range the client wants to read from
  614. * (or NULL). */
  615. void (*onRead)(void *handle, const UA_NodeId nodeid,
  616. const UA_Variant *data, const UA_NumericRange *range);
  617. /* Called after writing the value attribute. The node is re-opened after
  618. * writing so that the new value is visible in the callback.
  619. *
  620. * @param handle Points to user-provided data for the callback.
  621. * @param nodeid The identifier of the node.
  622. * @param data Points to the current node value (after writing).
  623. * @param range Points to the numeric range the client wants to write to (or
  624. * NULL). */
  625. void (*onWrite)(void *handle, const UA_NodeId nodeid,
  626. const UA_Variant *data, const UA_NumericRange *range);
  627. } UA_ValueCallback;
  628. UA_StatusCode UA_EXPORT
  629. UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId,
  630. const UA_ValueCallback callback);
  631. /**
  632. * .. _object-lifecycle:
  633. *
  634. * Object Lifecycle Management Callbacks
  635. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  636. * Lifecycle management adds constructor and destructor callbacks to
  637. * object types. */
  638. typedef struct {
  639. /* Returns the instance handle that is then attached to the node */
  640. void * (*constructor)(const UA_NodeId instance);
  641. void (*destructor)(const UA_NodeId instance, void *instanceHandle);
  642. } UA_ObjectLifecycleManagement;
  643. UA_StatusCode UA_EXPORT
  644. UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server,
  645. UA_NodeId nodeId,
  646. UA_ObjectLifecycleManagement olm);
  647. /**
  648. * Method Callbacks
  649. * ~~~~~~~~~~~~~~~~ */
  650. typedef UA_StatusCode
  651. (*UA_MethodCallback)(void *methodHandle, const UA_NodeId *objectId,
  652. const UA_NodeId *sessionId, void *sessionHandle,
  653. size_t inputSize, const UA_Variant *input,
  654. size_t outputSize, UA_Variant *output);
  655. #ifdef UA_ENABLE_METHODCALLS
  656. UA_StatusCode UA_EXPORT
  657. UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId,
  658. UA_MethodCallback method, void *handle);
  659. #endif
  660. /**
  661. * .. _addnodes:
  662. *
  663. * Node Addition and Deletion
  664. * ^^^^^^^^^^^^^^^^^^^^^^^^^^
  665. *
  666. * When creating dynamic node instances at runtime, chances are that you will
  667. * not care about the specific NodeId of the new node, as long as you can
  668. * reference it later. When passing numeric NodeIds with a numeric identifier 0,
  669. * the stack evaluates this as "select a random unassigned numeric NodeId in
  670. * that namespace". To find out which NodeId was actually assigned to the new
  671. * node, you may pass a pointer `outNewNodeId`, which will (after a successfull
  672. * node insertion) contain the nodeId of the new node. You may also pass NULL
  673. * pointer if this result is not relevant. The namespace index for nodes you
  674. * create should never be 0, as that index is reserved for OPC UA's
  675. * self-description (namespace * 0).
  676. *
  677. * The methods for node addition and deletion take mostly const arguments that
  678. * are not modified. When creating a node, a deep copy of the node identifier,
  679. * node attributes, etc. is created. Therefore, it is possible to call for
  680. * example `UA_Server_addVariablenode` with a value attribute (a :ref:`variant`)
  681. * pointing to a memory location on the stack. If you need changes to a variable
  682. * value to manifest at a specific memory location, please use a
  683. * :ref:`datasource` or a :ref:`value-callback`. */
  684. /* Protect against redundant definitions for server/client */
  685. #ifndef UA_DEFAULT_ATTRIBUTES_DEFINED
  686. #define UA_DEFAULT_ATTRIBUTES_DEFINED
  687. /* The default for variables is "BaseDataType" for the datatype, -2 for the
  688. * valuerank and a read-accesslevel. */
  689. UA_EXPORT extern const UA_VariableAttributes UA_VariableAttributes_default;
  690. UA_EXPORT extern const UA_VariableTypeAttributes UA_VariableTypeAttributes_default;
  691. /* Methods are executable by default */
  692. UA_EXPORT extern const UA_MethodAttributes UA_MethodAttributes_default;
  693. /* The remaining attribute definitions are currently all zeroed out */
  694. UA_EXPORT extern const UA_ObjectAttributes UA_ObjectAttributes_default;
  695. UA_EXPORT extern const UA_ObjectTypeAttributes UA_ObjectTypeAttributes_default;
  696. UA_EXPORT extern const UA_ReferenceTypeAttributes UA_ReferenceTypeAttributes_default;
  697. UA_EXPORT extern const UA_DataTypeAttributes UA_DataTypeAttributes_default;
  698. UA_EXPORT extern const UA_ViewAttributes UA_ViewAttributes_default;
  699. #endif
  700. /* The instantiation callback is used to track the addition of new nodes. It is
  701. * also called for all sub-nodes contained in an object or variable type node
  702. * that is instantiated. */
  703. typedef struct {
  704. UA_StatusCode (*method)(const UA_NodeId objectId,
  705. const UA_NodeId typeDefinitionId, void *handle);
  706. void *handle;
  707. } UA_InstantiationCallback;
  708. /* Don't use this function. There are typed versions as inline functions. */
  709. UA_StatusCode UA_EXPORT
  710. __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
  711. const UA_NodeId *requestedNewNodeId,
  712. const UA_NodeId *parentNodeId,
  713. const UA_NodeId *referenceTypeId,
  714. const UA_QualifiedName browseName,
  715. const UA_NodeId *typeDefinition,
  716. const UA_NodeAttributes *attr,
  717. const UA_DataType *attributeType,
  718. UA_InstantiationCallback *instantiationCallback,
  719. UA_NodeId *outNewNodeId);
  720. static UA_INLINE UA_StatusCode
  721. UA_Server_addVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  722. const UA_NodeId parentNodeId,
  723. const UA_NodeId referenceTypeId,
  724. const UA_QualifiedName browseName,
  725. const UA_NodeId typeDefinition,
  726. const UA_VariableAttributes attr,
  727. UA_InstantiationCallback *instantiationCallback,
  728. UA_NodeId *outNewNodeId) {
  729. return __UA_Server_addNode(server, UA_NODECLASS_VARIABLE, &requestedNewNodeId,
  730. &parentNodeId, &referenceTypeId, browseName,
  731. &typeDefinition, (const UA_NodeAttributes*)&attr,
  732. &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES],
  733. instantiationCallback, outNewNodeId);
  734. }
  735. static UA_INLINE UA_StatusCode
  736. UA_Server_addVariableTypeNode(UA_Server *server,
  737. const UA_NodeId requestedNewNodeId,
  738. const UA_NodeId parentNodeId,
  739. const UA_NodeId referenceTypeId,
  740. const UA_QualifiedName browseName,
  741. const UA_NodeId typeDefinition,
  742. const UA_VariableTypeAttributes attr,
  743. UA_InstantiationCallback *instantiationCallback,
  744. UA_NodeId *outNewNodeId) {
  745. return __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE,
  746. &requestedNewNodeId, &parentNodeId, &referenceTypeId,
  747. browseName, &typeDefinition,
  748. (const UA_NodeAttributes*)&attr,
  749. &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES],
  750. instantiationCallback, outNewNodeId);
  751. }
  752. static UA_INLINE UA_StatusCode
  753. UA_Server_addObjectNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  754. const UA_NodeId parentNodeId,
  755. const UA_NodeId referenceTypeId,
  756. const UA_QualifiedName browseName,
  757. const UA_NodeId typeDefinition,
  758. const UA_ObjectAttributes attr,
  759. UA_InstantiationCallback *instantiationCallback,
  760. UA_NodeId *outNewNodeId) {
  761. return __UA_Server_addNode(server, UA_NODECLASS_OBJECT, &requestedNewNodeId,
  762. &parentNodeId, &referenceTypeId, browseName,
  763. &typeDefinition, (const UA_NodeAttributes*)&attr,
  764. &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES],
  765. instantiationCallback, outNewNodeId);
  766. }
  767. static UA_INLINE UA_StatusCode
  768. UA_Server_addObjectTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  769. const UA_NodeId parentNodeId,
  770. const UA_NodeId referenceTypeId,
  771. const UA_QualifiedName browseName,
  772. const UA_ObjectTypeAttributes attr,
  773. UA_InstantiationCallback *instantiationCallback,
  774. UA_NodeId *outNewNodeId) {
  775. return __UA_Server_addNode(server, UA_NODECLASS_OBJECTTYPE, &requestedNewNodeId,
  776. &parentNodeId, &referenceTypeId, browseName,
  777. &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  778. &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES],
  779. instantiationCallback, outNewNodeId);
  780. }
  781. static UA_INLINE UA_StatusCode
  782. UA_Server_addViewNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  783. const UA_NodeId parentNodeId,
  784. const UA_NodeId referenceTypeId,
  785. const UA_QualifiedName browseName,
  786. const UA_ViewAttributes attr,
  787. UA_InstantiationCallback *instantiationCallback,
  788. UA_NodeId *outNewNodeId) {
  789. return __UA_Server_addNode(server, UA_NODECLASS_VIEW, &requestedNewNodeId,
  790. &parentNodeId, &referenceTypeId, browseName,
  791. &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  792. &UA_TYPES[UA_TYPES_VIEWATTRIBUTES],
  793. instantiationCallback, outNewNodeId);
  794. }
  795. static UA_INLINE UA_StatusCode
  796. UA_Server_addReferenceTypeNode(UA_Server *server,
  797. const UA_NodeId requestedNewNodeId,
  798. const UA_NodeId parentNodeId,
  799. const UA_NodeId referenceTypeId,
  800. const UA_QualifiedName browseName,
  801. const UA_ReferenceTypeAttributes attr,
  802. UA_InstantiationCallback *instantiationCallback,
  803. UA_NodeId *outNewNodeId) {
  804. return __UA_Server_addNode(server, UA_NODECLASS_REFERENCETYPE,
  805. &requestedNewNodeId, &parentNodeId, &referenceTypeId,
  806. browseName, &UA_NODEID_NULL,
  807. (const UA_NodeAttributes*)&attr,
  808. &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES],
  809. instantiationCallback, outNewNodeId);
  810. }
  811. static UA_INLINE UA_StatusCode
  812. UA_Server_addDataTypeNode(UA_Server *server,
  813. const UA_NodeId requestedNewNodeId,
  814. const UA_NodeId parentNodeId,
  815. const UA_NodeId referenceTypeId,
  816. const UA_QualifiedName browseName,
  817. const UA_DataTypeAttributes attr,
  818. UA_InstantiationCallback *instantiationCallback,
  819. UA_NodeId *outNewNodeId) {
  820. return __UA_Server_addNode(server, UA_NODECLASS_DATATYPE, &requestedNewNodeId,
  821. &parentNodeId, &referenceTypeId, browseName,
  822. &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  823. &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES],
  824. instantiationCallback, outNewNodeId);
  825. }
  826. UA_StatusCode UA_EXPORT
  827. UA_Server_addDataSourceVariableNode(UA_Server *server,
  828. const UA_NodeId requestedNewNodeId,
  829. const UA_NodeId parentNodeId,
  830. const UA_NodeId referenceTypeId,
  831. const UA_QualifiedName browseName,
  832. const UA_NodeId typeDefinition,
  833. const UA_VariableAttributes attr,
  834. const UA_DataSource dataSource,
  835. UA_NodeId *outNewNodeId);
  836. #ifdef UA_ENABLE_METHODCALLS
  837. UA_StatusCode UA_EXPORT
  838. UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  839. const UA_NodeId parentNodeId,
  840. const UA_NodeId referenceTypeId,
  841. const UA_QualifiedName browseName,
  842. const UA_MethodAttributes attr,
  843. UA_MethodCallback method, void *handle,
  844. size_t inputArgumentsSize,
  845. const UA_Argument* inputArguments,
  846. size_t outputArgumentsSize,
  847. const UA_Argument* outputArguments,
  848. UA_NodeId *outNewNodeId);
  849. #endif
  850. UA_StatusCode UA_EXPORT
  851. UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
  852. UA_Boolean deleteReferences);
  853. /**
  854. * Reference Management
  855. * -------------------- */
  856. UA_StatusCode UA_EXPORT
  857. UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
  858. const UA_NodeId refTypeId,
  859. const UA_ExpandedNodeId targetId, UA_Boolean isForward);
  860. UA_StatusCode UA_EXPORT
  861. UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
  862. const UA_NodeId referenceTypeId, UA_Boolean isForward,
  863. const UA_ExpandedNodeId targetNodeId,
  864. UA_Boolean deleteBidirectional);
  865. /**
  866. * Utility Functions
  867. * ----------------- */
  868. /* Add a new namespace to the server. Returns the index of the new namespace */
  869. UA_UInt16 UA_EXPORT UA_Server_addNamespace(UA_Server *server, const char* name);
  870. /**
  871. * Deprecated Server API
  872. * ---------------------
  873. * This file contains outdated API definitions that are kept for backwards
  874. * compatibility. Please switch to the new API, as the following definitions
  875. * will be removed eventually.
  876. *
  877. * UA_Job API
  878. * ^^^^^^^^^^
  879. * UA_Job was replaced since it unneccessarily exposed server internals to the
  880. * end-user. Please use plain UA_ServerCallbacks instead. The following UA_Job
  881. * definition contains just the fraction of the original struct that was useful
  882. * to end-users. */
  883. typedef enum {
  884. UA_JOBTYPE_METHODCALL
  885. } UA_JobType;
  886. typedef struct {
  887. UA_JobType type;
  888. union {
  889. struct {
  890. void *data;
  891. UA_ServerCallback method;
  892. } methodCall;
  893. } job;
  894. } UA_Job;
  895. UA_DEPRECATED static UA_INLINE UA_StatusCode
  896. UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
  897. UA_UInt32 interval, UA_Guid *jobId) {
  898. return UA_Server_addRepeatedCallback(server, job.job.methodCall.method,
  899. job.job.methodCall.data, interval,
  900. (UA_UInt64*)(uintptr_t)jobId);
  901. }
  902. UA_DEPRECATED static UA_INLINE UA_StatusCode
  903. UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
  904. return UA_Server_removeRepeatedCallback(server,
  905. *(UA_UInt64*)(uintptr_t)&jobId);
  906. }
  907. #ifdef __cplusplus
  908. }
  909. #endif
  910. #endif /* UA_SERVER_H_ */