ua_services.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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_SERVICES_H_
  5. #define UA_SERVICES_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "ua_server.h"
  10. #include "ua_session.h"
  11. /**
  12. * .. _services:
  13. *
  14. * Services
  15. * ========
  16. *
  17. * In OPC UA, all communication is based on service calls, each consisting of a
  18. * request and a response message. These messages are defined as data structures
  19. * with a binary encoding and listed in :ref:`generated-types`. Since all
  20. * Services are pre-defined in the standard, they cannot be modified by the
  21. * user. But you can use the :ref:`Call <method-services>` service to invoke
  22. * user-defined methods on the server.
  23. *
  24. * The following service signatures are internal and *not visible to users*.
  25. * Still, we present them here for an overview of the capabilities of OPC UA.
  26. * Please refer to the :ref:`client` and :ref:`server` API where the services
  27. * are exposed to end users. Please see part 4 of the OPC UA standard for the
  28. * authoritative definition of the service and their behaviour.
  29. *
  30. * Most services take as input the server, the current session and pointers to
  31. * the request and response structures. Possible error codes are returned as
  32. * part of the response. */
  33. typedef void (*UA_Service)(UA_Server*, UA_Session*,
  34. const void *request, void *response);
  35. typedef UA_StatusCode (*UA_InSituService)(UA_Server*, UA_Session*, UA_MessageContext *mc,
  36. const void *request, UA_ResponseHeader *rh);
  37. /**
  38. * Discovery Service Set
  39. * ---------------------
  40. * This Service Set defines Services used to discover the Endpoints implemented
  41. * by a Server and to read the security configuration for those Endpoints.
  42. *
  43. * FindServers Service
  44. * ^^^^^^^^^^^^^^^^^^^
  45. * Returns the Servers known to a Server or Discovery Server. The Client may
  46. * reduce the number of results returned by specifying filter criteria */
  47. void Service_FindServers(UA_Server *server, UA_Session *session,
  48. const UA_FindServersRequest *request,
  49. UA_FindServersResponse *response);
  50. /**
  51. * GetEndpoints Service
  52. * ^^^^^^^^^^^^^^^^^^^^
  53. * Returns the Endpoints supported by a Server and all of the configuration
  54. * information required to establish a SecureChannel and a Session. */
  55. void Service_GetEndpoints(UA_Server *server, UA_Session *session,
  56. const UA_GetEndpointsRequest *request,
  57. UA_GetEndpointsResponse *response);
  58. #ifdef UA_ENABLE_DISCOVERY
  59. # ifdef UA_ENABLE_DISCOVERY_MULTICAST
  60. /**
  61. * FindServersOnNetwork Service
  62. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  63. * Returns the Servers known to a Discovery Server. Unlike FindServer,
  64. * this Service is only implemented by Discovery Servers. It additionally
  65. * Returns servery which may have been detected trough Multicast */
  66. void Service_FindServersOnNetwork(UA_Server *server, UA_Session *session,
  67. const UA_FindServersOnNetworkRequest *request,
  68. UA_FindServersOnNetworkResponse *response);
  69. # endif /* UA_ENABLE_DISCOVERY_MULTICAST */
  70. /**
  71. * RegisterServer
  72. * ^^^^^^^^^^^^^^
  73. * Registers a remote server in the local discovery service. */
  74. void Service_RegisterServer(UA_Server *server, UA_Session *session,
  75. const UA_RegisterServerRequest *request,
  76. UA_RegisterServerResponse *response);
  77. /**
  78. * RegisterServer2
  79. * ^^^^^^^^^^^^^^^
  80. * This Service allows a Server to register its DiscoveryUrls and capabilities
  81. * with a Discovery Server. It extends the registration information from
  82. * RegisterServer with information necessary for FindServersOnNetwork. */
  83. void Service_RegisterServer2(UA_Server *server, UA_Session *session,
  84. const UA_RegisterServer2Request *request,
  85. UA_RegisterServer2Response *response);
  86. #endif /* UA_ENABLE_DISCOVERY */
  87. /**
  88. * SecureChannel Service Set
  89. * -------------------------
  90. * This Service Set defines Services used to open a communication channel that
  91. * ensures the confidentiality and Integrity of all Messages exchanged with the
  92. * Server.
  93. *
  94. * OpenSecureChannel Service
  95. * ^^^^^^^^^^^^^^^^^^^^^^^^^
  96. * Open or renew a SecureChannel that can be used to ensure Confidentiality and
  97. * Integrity for Message exchange during a Session. */
  98. void Service_OpenSecureChannel(UA_Server *server, UA_SecureChannel* channel,
  99. const UA_OpenSecureChannelRequest *request,
  100. UA_OpenSecureChannelResponse *response);
  101. /**
  102. * CloseSecureChannel Service
  103. * ^^^^^^^^^^^^^^^^^^^^^^^^^^
  104. * Used to terminate a SecureChannel. */
  105. void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel);
  106. /**
  107. * Session Service Set
  108. * -------------------
  109. * This Service Set defines Services for an application layer connection
  110. * establishment in the context of a Session.
  111. *
  112. * CreateSession Service
  113. * ^^^^^^^^^^^^^^^^^^^^^
  114. * Used by an OPC UA Client to create a Session and the Server returns two
  115. * values which uniquely identify the Session. The first value is the sessionId
  116. * which is used to identify the Session in the audit logs and in the Server's
  117. * address space. The second is the authenticationToken which is used to
  118. * associate an incoming request with a Session. */
  119. void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
  120. const UA_CreateSessionRequest *request,
  121. UA_CreateSessionResponse *response);
  122. /**
  123. * ActivateSession
  124. * ^^^^^^^^^^^^^^^
  125. * Used by the Client to submit its SoftwareCertificates to the Server for
  126. * validation and to specify the identity of the user associated with the
  127. * Session. This Service request shall be issued by the Client before it issues
  128. * any other Service request after CreateSession. Failure to do so shall cause
  129. * the Server to close the Session. */
  130. void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
  131. UA_Session *session,
  132. const UA_ActivateSessionRequest *request,
  133. UA_ActivateSessionResponse *response);
  134. /**
  135. * CloseSession
  136. * ^^^^^^^^^^^^
  137. * Used to terminate a Session. */
  138. void Service_CloseSession(UA_Server *server, UA_Session *session,
  139. const UA_CloseSessionRequest *request,
  140. UA_CloseSessionResponse *response);
  141. /**
  142. * Cancel Service
  143. * ^^^^^^^^^^^^^^
  144. * Used to cancel outstanding Service requests. Successfully cancelled service
  145. * requests shall respond with Bad_RequestCancelledByClient. */
  146. /* Not Implemented */
  147. /**
  148. * NodeManagement Service Set
  149. * --------------------------
  150. * This Service Set defines Services to add and delete AddressSpace Nodes and
  151. * References between them. All added Nodes continue to exist in the
  152. * AddressSpace even if the Client that created them disconnects from the
  153. * Server.
  154. *
  155. * AddNodes Service
  156. * ^^^^^^^^^^^^^^^^
  157. * Used to add one or more Nodes into the AddressSpace hierarchy. */
  158. void Service_AddNodes(UA_Server *server, UA_Session *session,
  159. const UA_AddNodesRequest *request,
  160. UA_AddNodesResponse *response);
  161. /**
  162. * AddReferences Service
  163. * ^^^^^^^^^^^^^^^^^^^^^
  164. * Used to add one or more References to one or more Nodes. */
  165. void Service_AddReferences(UA_Server *server, UA_Session *session,
  166. const UA_AddReferencesRequest *request,
  167. UA_AddReferencesResponse *response);
  168. /**
  169. * DeleteNodes Service
  170. * ^^^^^^^^^^^^^^^^^^^
  171. * Used to delete one or more Nodes from the AddressSpace. */
  172. void Service_DeleteNodes(UA_Server *server, UA_Session *session,
  173. const UA_DeleteNodesRequest *request,
  174. UA_DeleteNodesResponse *response);
  175. /**
  176. * DeleteReferences
  177. * ^^^^^^^^^^^^^^^^
  178. * Used to delete one or more References of a Node. */
  179. void Service_DeleteReferences(UA_Server *server, UA_Session *session,
  180. const UA_DeleteReferencesRequest *request,
  181. UA_DeleteReferencesResponse *response);
  182. /**
  183. * .. _view-services:
  184. *
  185. * View Service Set
  186. * ----------------
  187. * Clients use the browse Services of the View Service Set to navigate through
  188. * the AddressSpace or through a View which is a subset of the AddressSpace.
  189. *
  190. * Browse Service
  191. * ^^^^^^^^^^^^^^
  192. * Used to discover the References of a specified Node. The browse can be
  193. * further limited by the use of a View. This Browse Service also supports a
  194. * primitive filtering capability. */
  195. void Service_Browse(UA_Server *server, UA_Session *session,
  196. const UA_BrowseRequest *request,
  197. UA_BrowseResponse *response);
  198. /**
  199. * BrowseNext Service
  200. * ^^^^^^^^^^^^^^^^^^
  201. * Used to request the next set of Browse or BrowseNext response information
  202. * that is too large to be sent in a single response. "Too large" in this
  203. * context means that the Server is not able to return a larger response or that
  204. * the number of results to return exceeds the maximum number of results to
  205. * return that was specified by the Client in the original Browse request. */
  206. void Service_BrowseNext(UA_Server *server, UA_Session *session,
  207. const UA_BrowseNextRequest *request,
  208. UA_BrowseNextResponse *response);
  209. /**
  210. * TranslateBrowsePathsToNodeIds Service
  211. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  212. * Used to translate textual node paths to their respective ids. */
  213. void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
  214. const UA_TranslateBrowsePathsToNodeIdsRequest *request,
  215. UA_TranslateBrowsePathsToNodeIdsResponse *response);
  216. /**
  217. * RegisterNodes Service
  218. * ^^^^^^^^^^^^^^^^^^^^^
  219. * Used by Clients to register the Nodes that they know they will access
  220. * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so
  221. * that the access operations will be more efficient. */
  222. void Service_RegisterNodes(UA_Server *server, UA_Session *session,
  223. const UA_RegisterNodesRequest *request,
  224. UA_RegisterNodesResponse *response);
  225. /**
  226. * UnregisterNodes Service
  227. * ^^^^^^^^^^^^^^^^^^^^^^^
  228. * This Service is used to unregister NodeIds that have been obtained via the
  229. * RegisterNodes service. */
  230. void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
  231. const UA_UnregisterNodesRequest *request,
  232. UA_UnregisterNodesResponse *response);
  233. /**
  234. * Query Service Set
  235. * -----------------
  236. * This Service Set is used to issue a Query to a Server. OPC UA Query is
  237. * generic in that it provides an underlying storage mechanism independent Query
  238. * capability that can be used to access a wide variety of OPC UA data stores
  239. * and information management systems. OPC UA Query permits a Client to access
  240. * data maintained by a Server without any knowledge of the logical schema used
  241. * for internal storage of the data. Knowledge of the AddressSpace is
  242. * sufficient.
  243. *
  244. * QueryFirst Service
  245. * ^^^^^^^^^^^^^^^^^^
  246. * This Service is used to issue a Query request to the Server. */
  247. /* Not Implemented */
  248. /**
  249. * QueryNext Service
  250. * ^^^^^^^^^^^^^^^^^
  251. * This Service is used to request the next set of QueryFirst or QueryNext
  252. * response information that is too large to be sent in a single response. */
  253. /* Not Impelemented */
  254. /**
  255. * Attribute Service Set
  256. * ---------------------
  257. * This Service Set provides Services to access Attributes that are part of
  258. * Nodes.
  259. *
  260. * Read Service
  261. * ^^^^^^^^^^^^
  262. * Used to read attributes of nodes. For constructed attribute values whose
  263. * elements are indexed, such as an array, this Service allows Clients to read
  264. * the entire set of indexed values as a composite, to read individual elements
  265. * or to read ranges of elements of the composite. */
  266. UA_StatusCode Service_Read(UA_Server *server, UA_Session *session, UA_MessageContext *mc,
  267. const UA_ReadRequest *request, UA_ResponseHeader *responseHeader);
  268. /**
  269. * Write Service
  270. * ^^^^^^^^^^^^^
  271. * Used to write attributes of nodes. For constructed attribute values whose
  272. * elements are indexed, such as an array, this Service allows Clients to write
  273. * the entire set of indexed values as a composite, to write individual elements
  274. * or to write ranges of elements of the composite. */
  275. void Service_Write(UA_Server *server, UA_Session *session,
  276. const UA_WriteRequest *request,
  277. UA_WriteResponse *response);
  278. /**
  279. * HistoryRead Service
  280. * ^^^^^^^^^^^^^^^^^^^
  281. * Used to read historical values or Events of one or more Nodes. Servers may
  282. * make historical values available to Clients using this Service, although the
  283. * historical values themselves are not visible in the AddressSpace. */
  284. /* Not Implemented */
  285. /**
  286. * HistoryUpdate Service
  287. * ^^^^^^^^^^^^^^^^^^^^^
  288. * Used to update historical values or Events of one or more Nodes. Several
  289. * request parameters indicate how the Server is to update the historical value
  290. * or Event. Valid actions are Insert, Replace or Delete. */
  291. /* Not Implemented */
  292. /**
  293. * .. _method-services:
  294. *
  295. * Method Service Set
  296. * ------------------
  297. * The Method Service Set defines the means to invoke methods. A method shall be
  298. * a component of an Object. See the section on :ref:`MethodNodes <methodnode>`
  299. * for more information.
  300. *
  301. * Call Service
  302. * ^^^^^^^^^^^^
  303. * Used to call (invoke) a methods. Each method call is invoked within the
  304. * context of an existing Session. If the Session is terminated, the results of
  305. * the method's execution cannot be returned to the Client and are discarded. */
  306. void Service_Call(UA_Server *server, UA_Session *session,
  307. const UA_CallRequest *request,
  308. UA_CallResponse *response);
  309. /**
  310. * MonitoredItem Service Set
  311. * -------------------------
  312. * Clients define MonitoredItems to subscribe to data and Events. Each
  313. * MonitoredItem identifies the item to be monitored and the Subscription to use
  314. * to send Notifications. The item to be monitored may be any Node Attribute.
  315. *
  316. * CreateMonitoredItems Service
  317. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  318. * Used to create and add one or more MonitoredItems to a Subscription. A
  319. * MonitoredItem is deleted automatically by the Server when the Subscription is
  320. * deleted. Deleting a MonitoredItem causes its entire set of triggered item
  321. * links to be deleted, but has no effect on the MonitoredItems referenced by
  322. * the triggered items. */
  323. void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
  324. const UA_CreateMonitoredItemsRequest *request,
  325. UA_CreateMonitoredItemsResponse *response);
  326. /**
  327. * DeleteMonitoredItems Service
  328. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  329. * Used to remove one or more MonitoredItems of a Subscription. When a
  330. * MonitoredItem is deleted, its triggered item links are also deleted. */
  331. void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
  332. const UA_DeleteMonitoredItemsRequest *request,
  333. UA_DeleteMonitoredItemsResponse *response);
  334. /**
  335. * ModifyMonitoredItems Service
  336. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  337. * Used to modify MonitoredItems of a Subscription. Changes to the MonitoredItem
  338. * settings shall be applied immediately by the Server. They take effect as soon
  339. * as practical but not later than twice the new revisedSamplingInterval.
  340. *
  341. * Illegal request values for parameters that can be revised do not generate
  342. * errors. Instead the server will choose default values and indicate them in
  343. * the corresponding revised parameter. */
  344. void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
  345. const UA_ModifyMonitoredItemsRequest *request,
  346. UA_ModifyMonitoredItemsResponse *response);
  347. /**
  348. * SetMonitoringMode Service
  349. * ^^^^^^^^^^^^^^^^^^^^^^^^^
  350. * Used to set the monitoring mode for one or more MonitoredItems of a
  351. * Subscription. */
  352. void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
  353. const UA_SetMonitoringModeRequest *request,
  354. UA_SetMonitoringModeResponse *response);
  355. /**
  356. * SetTriggering Service
  357. * ^^^^^^^^^^^^^^^^^^^^^
  358. * Used to create and delete triggering links for a triggering item. */
  359. /* Not Implemented */
  360. /**
  361. * Subscription Service Set
  362. * ------------------------
  363. * Subscriptions are used to report Notifications to the Client.
  364. *
  365. * CreateSubscription Service
  366. * ^^^^^^^^^^^^^^^^^^^^^^^^^^
  367. * Used to create a Subscription. Subscriptions monitor a set of MonitoredItems
  368. * for Notifications and return them to the Client in response to Publish
  369. * requests. */
  370. void Service_CreateSubscription(UA_Server *server, UA_Session *session,
  371. const UA_CreateSubscriptionRequest *request,
  372. UA_CreateSubscriptionResponse *response);
  373. /**
  374. * ModifySubscription Service
  375. * ^^^^^^^^^^^^^^^^^^^^^^^^^^
  376. * Used to modify a Subscription. */
  377. void Service_ModifySubscription(UA_Server *server, UA_Session *session,
  378. const UA_ModifySubscriptionRequest *request,
  379. UA_ModifySubscriptionResponse *response);
  380. /**
  381. * SetPublishingMode Service
  382. * ^^^^^^^^^^^^^^^^^^^^^^^^^
  383. * Used to enable sending of Notifications on one or more Subscriptions. */
  384. void Service_SetPublishingMode(UA_Server *server, UA_Session *session,
  385. const UA_SetPublishingModeRequest *request,
  386. UA_SetPublishingModeResponse *response);
  387. /**
  388. * Publish Service
  389. * ^^^^^^^^^^^^^^^
  390. * Used for two purposes. First, it is used to acknowledge the receipt of
  391. * NotificationMessages for one or more Subscriptions. Second, it is used to
  392. * request the Server to return a NotificationMessage or a keep-alive
  393. * Message.
  394. *
  395. * Note that the service signature is an exception and does not contain a
  396. * pointer to a PublishResponse. That is because the service queues up publish
  397. * requests internally and sends responses asynchronously based on timeouts. */
  398. void Service_Publish(UA_Server *server, UA_Session *session,
  399. const UA_PublishRequest *request, UA_UInt32 requestId);
  400. /**
  401. * Republish Service
  402. * ^^^^^^^^^^^^^^^^^
  403. * Requests the Subscription to republish a NotificationMessage from its
  404. * retransmission queue. */
  405. void Service_Republish(UA_Server *server, UA_Session *session,
  406. const UA_RepublishRequest *request,
  407. UA_RepublishResponse *response);
  408. /**
  409. * DeleteSubscriptions Service
  410. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  411. * Invoked to delete one or more Subscriptions that belong to the Client's
  412. * Session. */
  413. void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
  414. const UA_DeleteSubscriptionsRequest *request,
  415. UA_DeleteSubscriptionsResponse *response);
  416. /**
  417. * TransferSubscription Service
  418. * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  419. * Used to transfer a Subscription and its MonitoredItems from one Session to
  420. * another. For example, a Client may need to reopen a Session and then transfer
  421. * its Subscriptions to that Session. It may also be used by one Client to take
  422. * over a Subscription from another Client by transferring the Subscription to
  423. * its Session. */
  424. /* Not Implemented */
  425. #ifdef __cplusplus
  426. } // extern "C"
  427. #endif
  428. #endif /* UA_SERVICES_H_ */