ua_services.h 16 KB

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