ua_server.h 44 KB

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