ua_services.h 16 KB

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