ua_securechannel_manager.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_open(UA_SecureChannelManager *cm, UA_Connection *conn,
  36. const UA_OpenSecureChannelRequest *request,
  37. UA_OpenSecureChannelResponse *response);
  38. UA_StatusCode
  39. UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_Connection *conn,
  40. const UA_OpenSecureChannelRequest *request,
  41. UA_OpenSecureChannelResponse *response);
  42. UA_SecureChannel *
  43. UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId);
  44. UA_StatusCode
  45. UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId);
  46. #ifdef __cplusplus
  47. } // extern "C"
  48. #endif
  49. #endif /* UA_CHANNEL_MANAGER_H_ */