ua_services.h 20 KB

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