ua_services.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. #include "ua_nodes.h"
  12. /**
  13. * .. _services:
  14. *
  15. * Services
  16. * ========
  17. *
  18. * In OPC UA, all communication is based on service calls, each consisting of a
  19. * request and a response message. These messages are defined as data structures
  20. * with a binary encoding and listed in :ref:`generated-types`. Since all
  21. * Services are pre-defined in the standard, they cannot be modified by the
  22. * user. But you can use the :ref:`Call <method-services>` service to invoke
  23. * user-defined methods on the server.
  24. *
  25. * The following service signatures are internal and *not visible to users*.
  26. * Still, we present them here for an overview of the capabilities of OPC UA.
  27. * Please refer to the :ref:`client` and :ref:`server` API where the services
  28. * are exposed to end users. Please see part 4 of the OPC UA standard for the
  29. * authoritative definition of the service and their behaviour. */
  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. /**
  36. * Discovery Service Set
  37. * ---------------------
  38. * This Service Set defines Services used to discover the Endpoints implemented
  39. * by a Server and to read the security configuration for those Endpoints. */
  40. void Service_FindServers(UA_Server *server, UA_Session *session,
  41. const UA_FindServersRequest *request,
  42. UA_FindServersResponse *response);
  43. /* Returns the Endpoints supported by a Server and all of the configuration
  44. * information required to establish a SecureChannel and a Session. */
  45. void Service_GetEndpoints(UA_Server *server, UA_Session *session,
  46. const UA_GetEndpointsRequest *request,
  47. UA_GetEndpointsResponse *response);
  48. /* Not Implemented: Service_RegisterServer */
  49. /**
  50. * SecureChannel Service Set
  51. * -------------------------
  52. * This Service Set defines Services used to open a communication channel that
  53. * ensures the confidentiality and Integrity of all Messages exchanged with the
  54. * Server. */
  55. /* Open or renew a SecureChannel that can be used to ensure Confidentiality and
  56. * Integrity for Message exchange during a Session. */
  57. void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
  58. const UA_OpenSecureChannelRequest *request,
  59. UA_OpenSecureChannelResponse *response);
  60. /* Used to terminate a SecureChannel. */
  61. void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel);
  62. /**
  63. * Session Service Set
  64. * -------------------
  65. * This Service Set defines Services for an application layer connection
  66. * establishment in the context of a Session. */
  67. /* Used by an OPC UA Client to create a Session and the Server returns two
  68. * values which uniquely identify the Session. The first value is the sessionId
  69. * which is used to identify the Session in the audit logs and in the Server's
  70. * address space. The second is the authenticationToken which is used to
  71. * associate an incoming request with a Session. */
  72. void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
  73. const UA_CreateSessionRequest *request,
  74. UA_CreateSessionResponse *response);
  75. /* Used by the Client to submit its SoftwareCertificates to the Server for
  76. * validation and to specify the identity of the user associated with the
  77. * Session. This Service request shall be issued by the Client before it issues
  78. * any other Service request after CreateSession. Failure to do so shall cause
  79. * the Server to close the Session. */
  80. void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
  81. UA_Session *session,
  82. const UA_ActivateSessionRequest *request,
  83. UA_ActivateSessionResponse *response);
  84. /* Used to terminate a Session. */
  85. void Service_CloseSession(UA_Server *server, UA_Session *session,
  86. const UA_CloseSessionRequest *request,
  87. UA_CloseSessionResponse *response);
  88. /* Not Implemented: Service_Cancel */
  89. /**
  90. * NodeManagement Service Set
  91. * --------------------------
  92. * This Service Set defines Services to add and delete AddressSpace Nodes and
  93. * References between them. All added Nodes continue to exist in the
  94. * AddressSpace even if the Client that created them disconnects from the
  95. * Server. */
  96. /* Used to add one or more Nodes into the AddressSpace hierarchy. */
  97. void Service_AddNodes(UA_Server *server, UA_Session *session,
  98. const UA_AddNodesRequest *request,
  99. UA_AddNodesResponse *response);
  100. /* Used to add one or more References to one or more Nodes. */
  101. void Service_AddReferences(UA_Server *server, UA_Session *session,
  102. const UA_AddReferencesRequest *request,
  103. UA_AddReferencesResponse *response);
  104. /* Used to delete one or more Nodes from the AddressSpace. */
  105. void Service_DeleteNodes(UA_Server *server, UA_Session *session,
  106. const UA_DeleteNodesRequest *request,
  107. UA_DeleteNodesResponse *response);
  108. /* Used to delete one or more References of a Node. */
  109. void Service_DeleteReferences(UA_Server *server, UA_Session *session,
  110. const UA_DeleteReferencesRequest *request,
  111. UA_DeleteReferencesResponse *response);
  112. /**
  113. * .. _view-services:
  114. *
  115. * View Service Set
  116. * ----------------
  117. * Clients use the browse Services of the View Service Set to navigate through
  118. * the AddressSpace or through a View which is a subset of the AddressSpace. */
  119. /* Used to discover the References of a specified Node. The browse can be
  120. * further limited by the use of a View. This Browse Service also supports a
  121. * primitive filtering capability. */
  122. void Service_Browse(UA_Server *server, UA_Session *session,
  123. const UA_BrowseRequest *request,
  124. UA_BrowseResponse *response);
  125. /* Used to request the next set of Browse or BrowseNext response information
  126. * that is too large to be sent in a single response. "Too large" in this
  127. * context means that the Server is not able to return a larger response or that
  128. * the number of results to return exceeds the maximum number of results to
  129. * return that was specified by the Client in the original Browse request. */
  130. void Service_BrowseNext(UA_Server *server, UA_Session *session,
  131. const UA_BrowseNextRequest *request,
  132. UA_BrowseNextResponse *response);
  133. /* Used to translate textual node paths to their respective ids. */
  134. void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
  135. const UA_TranslateBrowsePathsToNodeIdsRequest *request,
  136. UA_TranslateBrowsePathsToNodeIdsResponse *response);
  137. /* Used by Clients to register the Nodes that they know they will access
  138. * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so
  139. * that the access operations will be more efficient. */
  140. void Service_RegisterNodes(UA_Server *server, UA_Session *session,
  141. const UA_RegisterNodesRequest *request,
  142. UA_RegisterNodesResponse *response);
  143. /* This Service is used to unregister NodeIds that have been obtained via the
  144. * RegisterNodes service. */
  145. void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
  146. const UA_UnregisterNodesRequest *request,
  147. UA_UnregisterNodesResponse *response);
  148. /**
  149. * Query Service Set
  150. * -----------------
  151. * This Service Set is used to issue a Query to a Server. OPC UA Query is
  152. * generic in that it provides an underlying storage mechanism independent Query
  153. * capability that can be used to access a wide variety of OPC UA data stores
  154. * and information management systems. OPC UA Query permits a Client to access
  155. * data maintained by a Server without any knowledge of the logical schema used
  156. * for internal storage of the data. Knowledge of the AddressSpace is
  157. * sufficient. */
  158. /* Not Implemented: Service_QueryFirst */
  159. /* Not Impelemented: Service_QueryNext */
  160. /**
  161. * Attribute Service Set
  162. * ---------------------
  163. * This Service Set provides Services to access Attributes that are part of
  164. * Nodes. */
  165. /* Used to read one or more Attributes of one or more Nodes. For constructed
  166. * Attribute values whose elements are indexed, such as an array, this Service
  167. * allows Clients to read the entire set of indexed values as a composite, to
  168. * read individual elements or to read ranges of elements of the composite. */
  169. void Service_Read(UA_Server *server, UA_Session *session,
  170. const UA_ReadRequest *request,
  171. UA_ReadResponse *response);
  172. /* Used to write one or more Attributes of one or more Nodes. For constructed
  173. * Attribute values whose elements are indexed, such as an array, this Service
  174. * allows Clients to write the entire set of indexed values as a composite, to
  175. * write individual elements or to write ranges of elements of the composite. */
  176. void Service_Write(UA_Server *server, UA_Session *session,
  177. const UA_WriteRequest *request,
  178. UA_WriteResponse *response);
  179. /* Not Implemented: Service_HistoryRead */
  180. /* Not Implemented: Service_HistoryUpdate */
  181. /**
  182. * .. _method-services:
  183. *
  184. * Method Service Set
  185. * ------------------
  186. * The Method Service Set defines the means to invoke methods. A method shall be
  187. * a component of an Object. See the section on :ref:`MethodNodes <methodnode>`
  188. * for more information. */
  189. /* Used to call (invoke) a list of Methods. Each method call is invoked within
  190. * the context of an existing Session. If the Session is terminated, the results
  191. * of the method's execution cannot be returned to the Client and are
  192. * discarded. */
  193. void Service_Call(UA_Server *server, UA_Session *session,
  194. const UA_CallRequest *request,
  195. UA_CallResponse *response);
  196. /**
  197. * MonitoredItem Service Set
  198. * -------------------------
  199. * Clients define MonitoredItems to subscribe to data and Events. Each
  200. * MonitoredItem identifies the item to be monitored and the Subscription to use
  201. * to send Notifications. The item to be monitored may be any Node Attribute. */
  202. /* Used to create and add one or more MonitoredItems to a Subscription. A
  203. * MonitoredItem is deleted automatically by the Server when the Subscription is
  204. * deleted. Deleting a MonitoredItem causes its entire set of triggered item
  205. * links to be deleted, but has no effect on the MonitoredItems referenced by
  206. * the triggered items. */
  207. void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
  208. const UA_CreateMonitoredItemsRequest *request,
  209. UA_CreateMonitoredItemsResponse *response);
  210. /* Used to remove one or more MonitoredItems of a Subscription. When a
  211. * MonitoredItem is deleted, its triggered item links are also deleted. */
  212. void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
  213. const UA_DeleteMonitoredItemsRequest *request,
  214. UA_DeleteMonitoredItemsResponse *response);
  215. void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
  216. const UA_ModifyMonitoredItemsRequest *request,
  217. UA_ModifyMonitoredItemsResponse *response);
  218. /* Used to set the monitoring mode for one or more MonitoredItems of a
  219. Subscription. */
  220. void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
  221. const UA_SetMonitoringModeRequest *request,
  222. UA_SetMonitoringModeResponse *response);
  223. /* Not Implemented: Service_SetTriggering */
  224. /**
  225. * Subscription Service Set
  226. * ------------------------
  227. * Subscriptions are used to report Notifications to the Client. */
  228. /* Used to create a Subscription. Subscriptions monitor a set of MonitoredItems
  229. * for Notifications and return them to the Client in response to Publish
  230. * requests. */
  231. void Service_CreateSubscription(UA_Server *server, UA_Session *session,
  232. const UA_CreateSubscriptionRequest *request,
  233. UA_CreateSubscriptionResponse *response);
  234. /* Used to modify a Subscription. */
  235. void Service_ModifySubscription(UA_Server *server, UA_Session *session,
  236. const UA_ModifySubscriptionRequest *request,
  237. UA_ModifySubscriptionResponse *response);
  238. /* Used to enable sending of Notifications on one or more Subscriptions. */
  239. void Service_SetPublishingMode(UA_Server *server, UA_Session *session,
  240. const UA_SetPublishingModeRequest *request,
  241. UA_SetPublishingModeResponse *response);
  242. /* Used for two purposes. First, it is used to acknowledge the receipt of
  243. * NotificationMessages for one or more Subscriptions. Second, it is used to
  244. * request the Server to return a NotificationMessage or a keep-alive
  245. * Message.
  246. *
  247. * Note that the service signature is an exception and does not contain a
  248. * pointer to a PublishResponse. That is because the service queues up publish
  249. * requests internally and sends responses asynchronously based on timeouts. */
  250. void Service_Publish(UA_Server *server, UA_Session *session,
  251. const UA_PublishRequest *request, UA_UInt32 requestId);
  252. /* Requests the Subscription to republish a NotificationMessage from its
  253. * retransmission queue. */
  254. void Service_Republish(UA_Server *server, UA_Session *session,
  255. const UA_RepublishRequest *request,
  256. UA_RepublishResponse *response);
  257. /* Invoked to delete one or more Subscriptions that belong to the Client's
  258. * Session. */
  259. void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
  260. const UA_DeleteSubscriptionsRequest *request,
  261. UA_DeleteSubscriptionsResponse *response);
  262. /* Not Implemented: Service_TransferSubscription */
  263. #ifdef __cplusplus
  264. } // extern "C"
  265. #endif
  266. #endif /* UA_SERVICES_H_ */