ua_services.h 15 KB

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