ua_services.h 14 KB

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