ua_services.h 16 KB

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