ua_server.h 44 KB

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