ua_services.h 14 KB

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