ua_services.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. #ifndef UA_SERVICES_H_
  2. #define UA_SERVICES_H_
  3. #include "ua_util.h"
  4. #include "ua_types.h"
  5. #include "ua_types_generated.h"
  6. #include "ua_server.h"
  7. #include "ua_session.h"
  8. #include "ua_nodes.h"
  9. typedef void (*UA_Service)(UA_Server*, UA_Session*, const void*, void*);
  10. /**
  11. * @ingroup server
  12. * @defgroup services Services
  13. *
  14. * @brief The UA services that can be called from a remote user
  15. *
  16. * @{
  17. */
  18. /**
  19. * @name Discovery Service Set
  20. *
  21. * This Service Set defines Services used to discover the Endpoints implemented
  22. * by a Server and to read the security configuration for those Endpoints.
  23. *
  24. * @{
  25. */
  26. void Service_FindServers(UA_Server *server, UA_Session *session,
  27. const UA_FindServersRequest *request,
  28. UA_FindServersResponse *response);
  29. /**
  30. * Returns the Endpoints supported by a Server and all of the configuration
  31. * information required to establish a SecureChannel and a Session.
  32. */
  33. void Service_GetEndpoints(UA_Server *server, UA_Session *session,
  34. const UA_GetEndpointsRequest *request,
  35. UA_GetEndpointsResponse *response);
  36. // Service_RegisterServer
  37. /** @} */
  38. /**
  39. * @name 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. *
  45. * @{
  46. */
  47. /**
  48. * Open or renew a SecureChannel that can be used to ensure Confidentiality and
  49. * Integrity for Message exchange during a Session.
  50. */
  51. void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
  52. const UA_OpenSecureChannelRequest *request,
  53. UA_OpenSecureChannelResponse *response);
  54. /** Used to terminate a SecureChannel. */
  55. void Service_CloseSecureChannel(UA_Server *server, UA_Int32 channelId);
  56. /** @} */
  57. /**
  58. * @name Session Service Set
  59. *
  60. * This Service Set defines Services for an application layer connection
  61. * establishment in the context of a Session.
  62. *
  63. * @{
  64. */
  65. /**
  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. */
  72. void Service_CreateSession(UA_Server *server, UA_Session *session,
  73. const UA_CreateSessionRequest *request,
  74. UA_CreateSessionResponse *response);
  75. /**
  76. * Used by the Client to submit its SoftwareCertificates to the Server for
  77. * validation and to specify the identity of the user associated with the
  78. * Session. This Service request shall be issued by the Client before it issues
  79. * any other Service request after CreateSession. Failure to do so shall cause
  80. * the Server to close the Session.
  81. */
  82. void Service_ActivateSession(UA_Server *server, UA_Session *session,
  83. const UA_ActivateSessionRequest *request,
  84. UA_ActivateSessionResponse *response);
  85. /** Used to terminate a Session. */
  86. void Service_CloseSession(UA_Server *server, UA_Session *session,
  87. const UA_CloseSessionRequest *request,
  88. UA_CloseSessionResponse *response);
  89. // Service_Cancel
  90. /** @} */
  91. /**
  92. * @name NodeManagement Service Set
  93. *
  94. * This Service Set defines Services to add and delete AddressSpace Nodes and References between
  95. * them. All added Nodes continue to exist in the AddressSpace even if the Client that created them
  96. * disconnects from the Server.
  97. *
  98. * @{
  99. */
  100. /** Used to add one or more Nodes into the AddressSpace hierarchy. */
  101. void Service_AddNodes(UA_Server *server, UA_Session *session,
  102. const UA_AddNodesRequest *request,
  103. UA_AddNodesResponse *response);
  104. void Service_AddNodes_single(UA_Server *server, UA_Session *session, const UA_AddNodesItem *item,
  105. UA_AddNodesResult *result);
  106. /** Used to add one or more References to one or more Nodes. */
  107. void Service_AddReferences(UA_Server *server, UA_Session *session,
  108. const UA_AddReferencesRequest *request,
  109. UA_AddReferencesResponse *response);
  110. UA_StatusCode Service_AddReferences_single(UA_Server *server, UA_Session *session,
  111. const UA_AddReferencesItem *item);
  112. /** Used to delete one or more Nodes from the AddressSpace. */
  113. void Service_DeleteNodes(UA_Server *server, UA_Session *session,
  114. const UA_DeleteNodesRequest *request,
  115. UA_DeleteNodesResponse *response);
  116. UA_StatusCode Service_DeleteNodes_single(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
  117. UA_Boolean deleteReferences);
  118. /** Used to delete one or more References of a Node. */
  119. void Service_DeleteReferences(UA_Server *server, UA_Session *session,
  120. const UA_DeleteReferencesRequest *request,
  121. UA_DeleteReferencesResponse *response);
  122. UA_StatusCode Service_DeleteReferences_single(UA_Server *server, UA_Session *session,
  123. const UA_DeleteReferencesItem *item);
  124. /** @} */
  125. /**
  126. * @name View Service Set
  127. *
  128. * Clients use the browse Services of the View Service Set to navigate through
  129. * the AddressSpace or through a View which is a subset of the AddressSpace.
  130. *
  131. * @{
  132. */
  133. /**
  134. * Used to discover the References of a specified Node. The browse can be
  135. * further limited by the use of a View. This Browse Service also supports a
  136. * primitive filtering capability.
  137. */
  138. void Service_Browse(UA_Server *server, UA_Session *session,
  139. const UA_BrowseRequest *request,
  140. UA_BrowseResponse *response);
  141. void Service_Browse_single(UA_Server *server, UA_Session *session,
  142. struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr,
  143. UA_UInt32 maxrefs, UA_BrowseResult *result);
  144. /**
  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. */
  151. void Service_BrowseNext(UA_Server *server, UA_Session *session,
  152. const UA_BrowseNextRequest *request,
  153. UA_BrowseNextResponse *response);
  154. /** Used to translate textual node paths to their respective ids. */
  155. void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
  156. const UA_TranslateBrowsePathsToNodeIdsRequest *request,
  157. UA_TranslateBrowsePathsToNodeIdsResponse *response);
  158. void Service_TranslateBrowsePathsToNodeIds_single(UA_Server *server, UA_Session *session,
  159. const UA_BrowsePath *path, UA_BrowsePathResult *result);
  160. void Service_RegisterNodes(UA_Server *server, UA_Session *session,
  161. const UA_RegisterNodesRequest *request,
  162. UA_RegisterNodesResponse *response);
  163. void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
  164. const UA_UnregisterNodesRequest *request,
  165. UA_UnregisterNodesResponse *response);
  166. /** @} */
  167. /**
  168. * @name Query Service Set
  169. *
  170. * This Service Set is used to issue a Query to a Server. OPC UA Query is
  171. * generic in that it provides an underlying storage mechanism independent Query
  172. * capability that can be used to access a wide variety of OPC UA data stores
  173. * and information management systems. OPC UA Query permits a Client to access
  174. * data maintained by a Server without any knowledge of the logical schema used
  175. * for internal storage of the data. Knowledge of the AddressSpace is
  176. * sufficient.
  177. *
  178. * @{
  179. */
  180. // Service_QueryFirst
  181. // Service_QueryNext
  182. /** @} */
  183. /**
  184. * @name Attribute Service Set
  185. *
  186. * This Service Set provides Services to access Attributes that are part of
  187. * Nodes.
  188. *
  189. * @{
  190. */
  191. /* Mock-Up of the function signature for Unit Tests */
  192. #ifdef BUILD_UNIT_TESTS
  193. UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range);
  194. #endif
  195. /**
  196. * Used to read one or more Attributes of one or more Nodes. For constructed
  197. * Attribute values whose elements are indexed, such as an array, this Service
  198. * allows Clients to read the entire set of indexed values as a composite, to
  199. * read individual elements or to read ranges of elements of the composite.
  200. */
  201. void
  202. Service_Read(UA_Server *server, UA_Session *session,
  203. const UA_ReadRequest *request,
  204. UA_ReadResponse *response);
  205. void
  206. Service_Read_single(UA_Server *server, UA_Session *session,
  207. UA_TimestampsToReturn timestamps,
  208. const UA_ReadValueId *id, UA_DataValue *v);
  209. // Service_HistoryRead
  210. /**
  211. * Used to write one or more Attributes of one or more Nodes. For constructed
  212. * Attribute values whose elements are indexed, such as an array, this Service
  213. * allows Clients to write the entire set of indexed values as a composite, to
  214. * write individual elements or to write ranges of elements of the composite.
  215. */
  216. void
  217. Service_Write(UA_Server *server, UA_Session *session,
  218. const UA_WriteRequest *request,
  219. UA_WriteResponse *response);
  220. /** Single attribute writes are exposed to the userspace. The wvalue may be destroyed (deleteMembers) */
  221. UA_StatusCode
  222. Service_Write_single(UA_Server *server, UA_Session *session, const UA_WriteValue *wvalue);
  223. // Service_HistoryUpdate
  224. /** @} */
  225. /**
  226. * @name Method Service Set
  227. *
  228. * The Method Service Set defines the means to invoke methods. A method shall be
  229. * a component of an Object.
  230. *
  231. * @{
  232. */
  233. #ifdef ENABLE_METHODCALLS
  234. void
  235. Service_Call(UA_Server *server, UA_Session *session,
  236. const UA_CallRequest *request,
  237. UA_CallResponse *response);
  238. #endif
  239. /** @} */
  240. #ifdef ENABLE_SUBSCRIPTIONS
  241. /**
  242. * @name MonitoredItem Service Set
  243. *
  244. * Clients define MonitoredItems to subscribe to data and Events. Each
  245. * MonitoredItem identifies the item to be monitored and the Subscription to use
  246. * to send Notifications. The item to be monitored may be any Node Attribute.
  247. *
  248. * @{
  249. */
  250. /*
  251. * Used to create and add one or more MonitoredItems to a Subscription. A
  252. * MonitoredItem is deleted automatically by the Server when the Subscription is
  253. * deleted. Deleting a MonitoredItem causes its entire set of triggered item
  254. * links to be deleted, but has no effect on the MonitoredItems referenced by
  255. * the triggered items.
  256. */
  257. void
  258. Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
  259. const UA_CreateMonitoredItemsRequest *request,
  260. UA_CreateMonitoredItemsResponse *response);
  261. // Service_ModifyMonitoredItems
  262. // Service_SetMonitoringMode
  263. // Service_SetTriggering
  264. void
  265. Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
  266. const UA_DeleteMonitoredItemsRequest *request,
  267. UA_DeleteMonitoredItemsResponse *response);
  268. /** @} */
  269. /**
  270. * @name Subscription Service Set
  271. *
  272. * Subscriptions are used to report Notifications to the Client.
  273. *
  274. * @{
  275. */
  276. void
  277. Service_CreateSubscription(UA_Server *server, UA_Session *session,
  278. const UA_CreateSubscriptionRequest *request,
  279. UA_CreateSubscriptionResponse *response);
  280. void
  281. Service_ModifySubscription(UA_Server *server, UA_Session *session,
  282. const UA_ModifySubscriptionRequest *request,
  283. UA_ModifySubscriptionResponse *response);
  284. void
  285. Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
  286. const UA_DeleteSubscriptionsRequest *request,
  287. UA_DeleteSubscriptionsResponse *response);
  288. void
  289. Service_Publish(UA_Server *server, UA_Session *session,
  290. const UA_PublishRequest *request, UA_UInt32 requestId);
  291. void
  292. Service_Republish(UA_Server *server, UA_Session *session,
  293. const UA_RepublishRequest *request,
  294. UA_RepublishResponse *response);
  295. // Service_ModifySubscription
  296. // Service_SetPublishingMode
  297. // UA_Int32 Service_SetPublishingMode(UA_Server *server, UA_Session *session,
  298. // const UA_SetPublishingModeRequest *request,
  299. // UA_SetPublishingModeResponse *response);
  300. // Service_TransferSubscription
  301. // Service_DeleteSubscription
  302. /** @} */
  303. #endif
  304. #endif /* UA_SERVICES_H_ */
  305. /** @} */