ua_securechannel_manager.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #include "ua_util_internal.h"
  13. #include "ua_server.h"
  14. #include "ua_workqueue.h"
  15. #include "ua_securechannel.h"
  16. #include "open62541_queue.h"
  17. _UA_BEGIN_DECLS
  18. typedef struct channel_entry {
  19. UA_DelayedCallback cleanupCallback;
  20. TAILQ_ENTRY(channel_entry) pointers;
  21. UA_SecureChannel channel;
  22. } channel_entry;
  23. typedef struct {
  24. TAILQ_HEAD(, channel_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. _UA_END_DECLS
  57. #endif /* UA_CHANNEL_MANAGER_H_ */