ua_services.h 12 KB

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