ua_server.h 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  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. */
  538. UA_StatusCode UA_EXPORT
  539. UA_Server_register_discovery(UA_Server *server, const char* discoveryServerUrl,
  540. const char* semaphoreFilePath);
  541. /* Unregister the given server instance from the discovery server.
  542. * This should only be called when the server is shutting down.
  543. * @param server
  544. * @param discoveryServerUrl if set to NULL, the default value
  545. * 'opc.tcp://localhost:4840' will be used
  546. */
  547. UA_StatusCode UA_EXPORT
  548. UA_Server_unregister_discovery(UA_Server *server, const char* discoveryServerUrl);
  549. /* Adds a periodic job to register the server with the LDS (local discovery server)
  550. * periodically. The interval between each register call is given as second parameter.
  551. * It should be 10 minutes by default (= 10*60*1000).
  552. *
  553. * The delayFirstRegisterMs parameter indicates the delay for the first register call.
  554. * If it is 0, the first register call will be after intervalMs milliseconds,
  555. * otherwise the server's first register will be after delayFirstRegisterMs.
  556. *
  557. * When you manually unregister the server, you also need to cancel the periodic job,
  558. * otherwise it will be automatically be registered again.
  559. *
  560. * @param server
  561. * @param discoveryServerUrl if set to NULL, the default value 'opc.tcp://localhost:4840' will be used
  562. * @param intervalMs
  563. * @param delayFirstRegisterMs
  564. * @param periodicJobId */
  565. UA_StatusCode UA_EXPORT
  566. UA_Server_addPeriodicServerRegisterJob(UA_Server *server, const char* discoveryServerUrl,
  567. const UA_UInt32 intervalMs, 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, void* data);
  571. /* Set the callback which is called if another server registeres or unregisteres
  572. * with this instance. If called multiple times, previous data will be
  573. * overwritten.
  574. *
  575. * @param server
  576. * @param cb the callback
  577. * @param data data passed to the callback
  578. * @return UA_STATUSCODE_SUCCESS on success
  579. */
  580. void UA_EXPORT
  581. UA_Server_setRegisterServerCallback(UA_Server *server,
  582. UA_Server_registerServerCallback cb,
  583. void* data);
  584. #ifdef UA_ENABLE_DISCOVERY_MULTICAST
  585. /**
  586. * Callback for server detected through mDNS. Data is passed from the register call
  587. * @param isServerAnnounce indicates if the server has just been detected. If set to false, this means the server is shutting down.
  588. * @param isTxtReceived indicates if we already received the corresponding TXT record with the path and caps data
  589. **/
  590. typedef void (*UA_Server_serverOnNetworkCallback)(const UA_ServerOnNetwork *serverOnNetwork, UA_Boolean isServerAnnounce, UA_Boolean isTxtReceived, void* data);
  591. /**
  592. * Set the callback which is called if another server is found through mDNS or deleted.
  593. * It will be called for any mDNS message from the remote server, thus it may be called multiple times for the same instance.
  594. * Also the SRV and TXT records may arrive later, therefore for the first call the server capabilities may not be set yet.
  595. * If called multiple times, previous data will be overwritten.
  596. * @param server
  597. * @param cb the callback
  598. * @param data data passed to the callback
  599. * @return UA_STATUSCODE_SUCCESS on success
  600. */
  601. void UA_EXPORT
  602. UA_Server_setServerOnNetworkCallback(UA_Server *server,
  603. UA_Server_serverOnNetworkCallback cb,
  604. void* data);
  605. #endif
  606. #endif
  607. /**
  608. * Method Call
  609. * ----------- */
  610. #ifdef UA_ENABLE_METHODCALLS
  611. UA_CallMethodResult UA_EXPORT
  612. UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request);
  613. #endif
  614. /**
  615. * Node Management
  616. * ---------------
  617. *
  618. * Callback Mechanisms
  619. * ^^^^^^^^^^^^^^^^^^^
  620. * There are four mechanisms for callbacks from the node-based information model
  621. * into userspace:
  622. *
  623. * - Datasources for variable nodes, where the variable content is managed
  624. * externally
  625. * - Value-callbacks for variable nodes, where userspace is notified when a
  626. * read/write occurs
  627. * - Object lifecycle management, where a user-defined constructor and
  628. * destructor is added to an object type
  629. * - Method callbacks, where a user-defined method is exposed in the information
  630. * model
  631. *
  632. * .. _datasource:
  633. *
  634. * Data Source Callback
  635. * ~~~~~~~~~~~~~~~~~~~~
  636. *
  637. * The server has a unique way of dealing with the content of variables. Instead
  638. * of storing a variant attached to the variable node, the node can point to a
  639. * function with a local data provider. Whenever the value attribute is read,
  640. * the function will be called and asked to provide a UA_DataValue return value
  641. * that contains the value content and additional timestamps.
  642. *
  643. * It is expected that the read callback is implemented. The write callback can
  644. * be set to a null-pointer. */
  645. typedef struct {
  646. void *handle; /* A custom pointer to reuse the same datasource functions for
  647. multiple sources */
  648. /* Copies the data from the source into the provided value.
  649. *
  650. * @param handle An optional pointer to user-defined data for the
  651. * specific data source
  652. * @param nodeid Id of the read node
  653. * @param includeSourceTimeStamp If true, then the datasource is expected to
  654. * set the source timestamp in the returned value
  655. * @param range If not null, then the datasource shall return only a
  656. * selection of the (nonscalar) data. Set
  657. * UA_STATUSCODE_BADINDEXRANGEINVALID in the value if this does not
  658. * apply.
  659. * @param value The (non-null) DataValue that is returned to the client. The
  660. * data source sets the read data, the result status and optionally a
  661. * sourcetimestamp.
  662. * @return Returns a status code for logging. Error codes intended for the
  663. * original caller are set in the value. If an error is returned,
  664. * then no releasing of the value is done. */
  665. UA_StatusCode (*read)(void *handle, const UA_NodeId nodeid,
  666. UA_Boolean includeSourceTimeStamp,
  667. const UA_NumericRange *range, UA_DataValue *value);
  668. /* Write into a data source. The write member of UA_DataSource can be empty
  669. * if the operation is unsupported.
  670. *
  671. * @param handle An optional pointer to user-defined data for the
  672. * specific data source
  673. * @param nodeid Id of the node being written to
  674. * @param data The data to be written into the data source
  675. * @param range An optional data range. If the data source is scalar or does
  676. * not support writing of ranges, then an error code is returned.
  677. * @return Returns a status code that is returned to the user
  678. */
  679. UA_StatusCode (*write)(void *handle, const UA_NodeId nodeid,
  680. const UA_Variant *data, const UA_NumericRange *range);
  681. } UA_DataSource;
  682. UA_StatusCode UA_EXPORT
  683. UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
  684. const UA_DataSource dataSource);
  685. /**
  686. * .. _value-callback:
  687. *
  688. * Value Callback
  689. * ~~~~~~~~~~~~~~
  690. * Value Callbacks can be attached to variable and variable type nodes. If
  691. * not-null, they are called before reading and after writing respectively. */
  692. typedef struct {
  693. /* Pointer to user-provided data for the callback */
  694. void *handle;
  695. /* Called before the value attribute is read. It is possible to write into the
  696. * value attribute during onRead (using the write service). The node is
  697. * re-opened afterwards so that changes are considered in the following read
  698. * operation.
  699. *
  700. * @param handle Points to user-provided data for the callback.
  701. * @param nodeid The identifier of the node.
  702. * @param data Points to the current node value.
  703. * @param range Points to the numeric range the client wants to read from
  704. * (or NULL). */
  705. void (*onRead)(void *handle, const UA_NodeId nodeid,
  706. const UA_Variant *data, const UA_NumericRange *range);
  707. /* Called after writing the value attribute. The node is re-opened after
  708. * writing so that the new value is visible in the callback.
  709. *
  710. * @param handle Points to user-provided data for the callback.
  711. * @param nodeid The identifier of the node.
  712. * @param data Points to the current node value (after writing).
  713. * @param range Points to the numeric range the client wants to write to (or
  714. * NULL). */
  715. void (*onWrite)(void *handle, const UA_NodeId nodeid,
  716. const UA_Variant *data, const UA_NumericRange *range);
  717. } UA_ValueCallback;
  718. UA_StatusCode UA_EXPORT
  719. UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId,
  720. const UA_ValueCallback callback);
  721. /**
  722. * .. _object-lifecycle:
  723. *
  724. * Object Lifecycle Management Callbacks
  725. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  726. * Lifecycle management adds constructor and destructor callbacks to
  727. * object types. */
  728. typedef struct {
  729. /* Returns the instance handle that is then attached to the node */
  730. void * (*constructor)(const UA_NodeId instance);
  731. void (*destructor)(const UA_NodeId instance, void *instanceHandle);
  732. } UA_ObjectLifecycleManagement;
  733. UA_StatusCode UA_EXPORT
  734. UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server,
  735. UA_NodeId nodeId,
  736. UA_ObjectLifecycleManagement olm);
  737. /**
  738. * Method Callbacks
  739. * ~~~~~~~~~~~~~~~~ */
  740. typedef UA_StatusCode
  741. (*UA_MethodCallback)(void *methodHandle, const UA_NodeId *objectId,
  742. const UA_NodeId *sessionId, void *sessionHandle,
  743. size_t inputSize, const UA_Variant *input,
  744. size_t outputSize, UA_Variant *output);
  745. #ifdef UA_ENABLE_METHODCALLS
  746. UA_StatusCode UA_EXPORT
  747. UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId,
  748. UA_MethodCallback method, void *handle);
  749. #endif
  750. /**
  751. * .. _addnodes:
  752. *
  753. * Node Addition and Deletion
  754. * ^^^^^^^^^^^^^^^^^^^^^^^^^^
  755. *
  756. * When creating dynamic node instances at runtime, chances are that you will
  757. * not care about the specific NodeId of the new node, as long as you can
  758. * reference it later. When passing numeric NodeIds with a numeric identifier 0,
  759. * the stack evaluates this as "select a random unassigned numeric NodeId in
  760. * that namespace". To find out which NodeId was actually assigned to the new
  761. * node, you may pass a pointer `outNewNodeId`, which will (after a successfull
  762. * node insertion) contain the nodeId of the new node. You may also pass NULL
  763. * pointer if this result is not relevant. The namespace index for nodes you
  764. * create should never be 0, as that index is reserved for OPC UA's
  765. * self-description (namespace * 0).
  766. *
  767. * The methods for node addition and deletion take mostly const arguments that
  768. * are not modified. When creating a node, a deep copy of the node identifier,
  769. * node attributes, etc. is created. Therefore, it is possible to call for
  770. * example `UA_Server_addVariablenode` with a value attribute (a :ref:`variant`)
  771. * pointing to a memory location on the stack. If you need changes to a variable
  772. * value to manifest at a specific memory location, please use a
  773. * :ref:`datasource` or a :ref:`value-callback`. */
  774. /* The instantiation callback is used to track the addition of new nodes. It is
  775. * also called for all sub-nodes contained in an object or variable type node
  776. * that is instantiated. */
  777. typedef struct {
  778. UA_StatusCode (*method)(const UA_NodeId objectId,
  779. const UA_NodeId typeDefinitionId, void *handle);
  780. void *handle;
  781. } UA_InstantiationCallback;
  782. /* Don't use this function. There are typed versions as inline functions. */
  783. UA_StatusCode UA_EXPORT
  784. __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
  785. const UA_NodeId *requestedNewNodeId,
  786. const UA_NodeId *parentNodeId,
  787. const UA_NodeId *referenceTypeId,
  788. const UA_QualifiedName browseName,
  789. const UA_NodeId *typeDefinition,
  790. const UA_NodeAttributes *attr,
  791. const UA_DataType *attributeType,
  792. UA_InstantiationCallback *instantiationCallback,
  793. UA_NodeId *outNewNodeId);
  794. static UA_INLINE UA_StatusCode
  795. UA_Server_addVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  796. const UA_NodeId parentNodeId,
  797. const UA_NodeId referenceTypeId,
  798. const UA_QualifiedName browseName,
  799. const UA_NodeId typeDefinition,
  800. const UA_VariableAttributes attr,
  801. UA_InstantiationCallback *instantiationCallback,
  802. UA_NodeId *outNewNodeId) {
  803. return __UA_Server_addNode(server, UA_NODECLASS_VARIABLE, &requestedNewNodeId,
  804. &parentNodeId, &referenceTypeId, browseName,
  805. &typeDefinition, (const UA_NodeAttributes*)&attr,
  806. &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES],
  807. instantiationCallback, outNewNodeId);
  808. }
  809. static UA_INLINE UA_StatusCode
  810. UA_Server_addVariableTypeNode(UA_Server *server,
  811. const UA_NodeId requestedNewNodeId,
  812. const UA_NodeId parentNodeId,
  813. const UA_NodeId referenceTypeId,
  814. const UA_QualifiedName browseName,
  815. const UA_NodeId typeDefinition,
  816. const UA_VariableTypeAttributes attr,
  817. UA_InstantiationCallback *instantiationCallback,
  818. UA_NodeId *outNewNodeId) {
  819. return __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE,
  820. &requestedNewNodeId, &parentNodeId, &referenceTypeId,
  821. browseName, &typeDefinition,
  822. (const UA_NodeAttributes*)&attr,
  823. &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES],
  824. instantiationCallback, outNewNodeId);
  825. }
  826. static UA_INLINE UA_StatusCode
  827. UA_Server_addObjectNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  828. const UA_NodeId parentNodeId,
  829. const UA_NodeId referenceTypeId,
  830. const UA_QualifiedName browseName,
  831. const UA_NodeId typeDefinition,
  832. const UA_ObjectAttributes attr,
  833. UA_InstantiationCallback *instantiationCallback,
  834. UA_NodeId *outNewNodeId) {
  835. return __UA_Server_addNode(server, UA_NODECLASS_OBJECT, &requestedNewNodeId,
  836. &parentNodeId, &referenceTypeId, browseName,
  837. &typeDefinition, (const UA_NodeAttributes*)&attr,
  838. &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES],
  839. instantiationCallback, outNewNodeId);
  840. }
  841. static UA_INLINE UA_StatusCode
  842. UA_Server_addObjectTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  843. const UA_NodeId parentNodeId,
  844. const UA_NodeId referenceTypeId,
  845. const UA_QualifiedName browseName,
  846. const UA_ObjectTypeAttributes attr,
  847. UA_InstantiationCallback *instantiationCallback,
  848. UA_NodeId *outNewNodeId) {
  849. return __UA_Server_addNode(server, UA_NODECLASS_OBJECTTYPE, &requestedNewNodeId,
  850. &parentNodeId, &referenceTypeId, browseName,
  851. &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  852. &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES],
  853. instantiationCallback, outNewNodeId);
  854. }
  855. static UA_INLINE UA_StatusCode
  856. UA_Server_addViewNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  857. const UA_NodeId parentNodeId,
  858. const UA_NodeId referenceTypeId,
  859. const UA_QualifiedName browseName,
  860. const UA_ViewAttributes attr,
  861. UA_InstantiationCallback *instantiationCallback,
  862. UA_NodeId *outNewNodeId) {
  863. return __UA_Server_addNode(server, UA_NODECLASS_VIEW, &requestedNewNodeId,
  864. &parentNodeId, &referenceTypeId, browseName,
  865. &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  866. &UA_TYPES[UA_TYPES_VIEWATTRIBUTES],
  867. instantiationCallback, outNewNodeId);
  868. }
  869. static UA_INLINE UA_StatusCode
  870. UA_Server_addReferenceTypeNode(UA_Server *server,
  871. const UA_NodeId requestedNewNodeId,
  872. const UA_NodeId parentNodeId,
  873. const UA_NodeId referenceTypeId,
  874. const UA_QualifiedName browseName,
  875. const UA_ReferenceTypeAttributes attr,
  876. UA_InstantiationCallback *instantiationCallback,
  877. UA_NodeId *outNewNodeId) {
  878. return __UA_Server_addNode(server, UA_NODECLASS_REFERENCETYPE,
  879. &requestedNewNodeId, &parentNodeId, &referenceTypeId,
  880. browseName, &UA_NODEID_NULL,
  881. (const UA_NodeAttributes*)&attr,
  882. &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES],
  883. instantiationCallback, outNewNodeId);
  884. }
  885. static UA_INLINE UA_StatusCode
  886. UA_Server_addDataTypeNode(UA_Server *server,
  887. const UA_NodeId requestedNewNodeId,
  888. const UA_NodeId parentNodeId,
  889. const UA_NodeId referenceTypeId,
  890. const UA_QualifiedName browseName,
  891. const UA_DataTypeAttributes attr,
  892. UA_InstantiationCallback *instantiationCallback,
  893. UA_NodeId *outNewNodeId) {
  894. return __UA_Server_addNode(server, UA_NODECLASS_DATATYPE, &requestedNewNodeId,
  895. &parentNodeId, &referenceTypeId, browseName,
  896. &UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
  897. &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES],
  898. instantiationCallback, outNewNodeId);
  899. }
  900. UA_StatusCode UA_EXPORT
  901. UA_Server_addDataSourceVariableNode(UA_Server *server,
  902. const UA_NodeId requestedNewNodeId,
  903. const UA_NodeId parentNodeId,
  904. const UA_NodeId referenceTypeId,
  905. const UA_QualifiedName browseName,
  906. const UA_NodeId typeDefinition,
  907. const UA_VariableAttributes attr,
  908. const UA_DataSource dataSource,
  909. UA_NodeId *outNewNodeId);
  910. #ifdef UA_ENABLE_METHODCALLS
  911. UA_StatusCode UA_EXPORT
  912. UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
  913. const UA_NodeId parentNodeId,
  914. const UA_NodeId referenceTypeId,
  915. const UA_QualifiedName browseName,
  916. const UA_MethodAttributes attr,
  917. UA_MethodCallback method, void *handle,
  918. size_t inputArgumentsSize,
  919. const UA_Argument* inputArguments,
  920. size_t outputArgumentsSize,
  921. const UA_Argument* outputArguments,
  922. UA_NodeId *outNewNodeId);
  923. #endif
  924. UA_StatusCode UA_EXPORT
  925. UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
  926. UA_Boolean deleteReferences);
  927. /**
  928. * Reference Management
  929. * -------------------- */
  930. UA_StatusCode UA_EXPORT
  931. UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
  932. const UA_NodeId refTypeId,
  933. const UA_ExpandedNodeId targetId, UA_Boolean isForward);
  934. UA_StatusCode UA_EXPORT
  935. UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
  936. const UA_NodeId referenceTypeId, UA_Boolean isForward,
  937. const UA_ExpandedNodeId targetNodeId,
  938. UA_Boolean deleteBidirectional);
  939. #ifdef __cplusplus
  940. }
  941. #endif
  942. #endif /* UA_SERVER_H_ */