ua_securechannel_manager.h 2.5 KB

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