ua_services.h 12 KB

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