ua_securechannel_manager.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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_CHANNEL_MANAGER_H_
  5. #define UA_CHANNEL_MANAGER_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "ua_util.h"
  10. #include "ua_server.h"
  11. #include "ua_securechannel.h"
  12. #include "queue.h"
  13. typedef struct channel_list_entry {
  14. UA_SecureChannel channel;
  15. LIST_ENTRY(channel_list_entry) pointers;
  16. } channel_list_entry;
  17. typedef struct UA_SecureChannelManager {
  18. LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels
  19. UA_UInt32 currentChannelCount;
  20. UA_UInt32 lastChannelId;
  21. UA_UInt32 lastTokenId;
  22. UA_Server *server;
  23. } UA_SecureChannelManager;
  24. UA_StatusCode
  25. UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server);
  26. /* Remove a all securechannels */
  27. void
  28. UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm);
  29. /* Remove timed out securechannels with a delayed callback. So all currently
  30. * scheduled jobs with a pointer to a securechannel can finish first. */
  31. void
  32. UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm,
  33. UA_DateTime nowMonotonic);
  34. UA_StatusCode
  35. UA_SecureChannelManager_create(UA_SecureChannelManager *const cm, UA_Connection *const connection,
  36. const UA_SecurityPolicy *const securityPolicy,
  37. const UA_AsymmetricAlgorithmSecurityHeader *const asymHeader);
  38. UA_StatusCode
  39. UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_SecureChannel *channel,
  40. const UA_OpenSecureChannelRequest *request,
  41. UA_OpenSecureChannelResponse *response);
  42. UA_StatusCode
  43. UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_SecureChannel *channel,
  44. const UA_OpenSecureChannelRequest *request,
  45. UA_OpenSecureChannelResponse *response);
  46. UA_SecureChannel *
  47. UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId);
  48. UA_StatusCode
  49. UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId);
  50. #ifdef __cplusplus
  51. } // extern "C"
  52. #endif
  53. #endif /* UA_CHANNEL_MANAGER_H_ */