ua_client_internal.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef UA_CLIENT_INTERNAL_H_
  5. #define UA_CLIENT_INTERNAL_H_
  6. #include "ua_securechannel.h"
  7. #include "queue.h"
  8. /**************************/
  9. /* Subscriptions Handling */
  10. /**************************/
  11. #ifdef UA_ENABLE_SUBSCRIPTIONS
  12. typedef struct UA_Client_NotificationsAckNumber {
  13. LIST_ENTRY(UA_Client_NotificationsAckNumber) listEntry;
  14. UA_SubscriptionAcknowledgement subAck;
  15. } UA_Client_NotificationsAckNumber;
  16. typedef struct UA_Client_MonitoredItem {
  17. LIST_ENTRY(UA_Client_MonitoredItem) listEntry;
  18. UA_UInt32 monitoredItemId;
  19. UA_UInt32 monitoringMode;
  20. UA_NodeId monitoredNodeId;
  21. UA_UInt32 attributeID;
  22. UA_UInt32 clientHandle;
  23. UA_Double samplingInterval;
  24. UA_UInt32 queueSize;
  25. UA_Boolean discardOldest;
  26. void (*handler)(UA_UInt32 monId, UA_DataValue *value, void *context);
  27. void *handlerContext;
  28. } UA_Client_MonitoredItem;
  29. typedef struct UA_Client_Subscription {
  30. LIST_ENTRY(UA_Client_Subscription) listEntry;
  31. UA_UInt32 lifeTime;
  32. UA_UInt32 keepAliveCount;
  33. UA_Double publishingInterval;
  34. UA_UInt32 subscriptionID;
  35. UA_UInt32 notificationsPerPublish;
  36. UA_UInt32 priority;
  37. LIST_HEAD(UA_ListOfClientMonitoredItems, UA_Client_MonitoredItem) monitoredItems;
  38. } UA_Client_Subscription;
  39. void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub);
  40. #endif
  41. /**********/
  42. /* Client */
  43. /**********/
  44. typedef enum {
  45. UA_CLIENTAUTHENTICATION_NONE,
  46. UA_CLIENTAUTHENTICATION_USERNAME
  47. } UA_Client_Authentication;
  48. struct UA_Client {
  49. /* State */
  50. UA_ClientState state;
  51. UA_ClientConfig config;
  52. /* Connection */
  53. UA_Connection connection;
  54. UA_String endpointUrl;
  55. /* SecureChannel */
  56. UA_SecureChannel channel;
  57. UA_UInt32 requestId;
  58. UA_DateTime nextChannelRenewal;
  59. /* Authentication */
  60. UA_Client_Authentication authenticationMethod;
  61. UA_String username;
  62. UA_String password;
  63. /* Session */
  64. UA_UserTokenPolicy token;
  65. UA_NodeId authenticationToken;
  66. UA_UInt32 requestHandle;
  67. /* Subscriptions */
  68. #ifdef UA_ENABLE_SUBSCRIPTIONS
  69. UA_UInt32 monitoredItemHandles;
  70. LIST_HEAD(ListOfUnacknowledgedNotifications, UA_Client_NotificationsAckNumber) pendingNotificationsAcks;
  71. LIST_HEAD(ListOfClientSubscriptionItems, UA_Client_Subscription) subscriptions;
  72. #endif
  73. };
  74. /* Connect to the selected server.
  75. * This will not create a session.
  76. *
  77. * @param client to use
  78. * @param endpointURL to connect (for example "opc.tcp://localhost:16664")
  79. * @return Indicates whether the operation succeeded or returns an error code */
  80. UA_StatusCode UA_EXPORT
  81. UA_Client_connect_no_session(UA_Client *client, const char *endpointUrl);
  82. #endif /* UA_CLIENT_INTERNAL_H_ */