ua_channel.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef UA_CHANNEL_H_
  2. #define UA_CHANNEL_H_
  3. #include <stdio.h>
  4. #include <memory.h> // memcpy
  5. #include "ua_transport_connection.h"
  6. typedef enum ChannelState {
  7. UA_SL_CHANNEL_CLOSING,
  8. UA_SL_CHANNEL_CLOSED,
  9. UA_SL_CHANNEL_OPENING,
  10. UA_SL_CHANNEL_OPEN
  11. } SL_channelState;
  12. //hide object behind typedef
  13. struct SL_Channel;
  14. typedef struct SL_Channel SL_Channel;
  15. typedef UA_Int32 (*SL_ChannelSecurityTokenProvider)(SL_Channel*, UA_Int32,
  16. SecurityTokenRequestType, UA_ChannelSecurityToken*);
  17. typedef UA_Int32 (*SL_ChannelIdProvider)(UA_UInt32*);
  18. UA_Int32 SL_Channel_new(SL_Channel **channel);
  19. UA_Int32 SL_Channel_init(SL_Channel *channel, UA_TL_Connection *connection,
  20. SL_ChannelIdProvider channelIdProvider,
  21. SL_ChannelSecurityTokenProvider tokenProvider);
  22. UA_Int32 SL_Channel_bind(SL_Channel *channel, UA_TL_Connection *connection);
  23. UA_Int32 SL_Channel_setRemoteSecuritySettings(SL_Channel *channel,
  24. UA_AsymmetricAlgorithmSecurityHeader *asymSecHeader,
  25. UA_SequenceHeader *sequenceHeader);
  26. UA_Int32 SL_Channel_initLocalSecuritySettings(SL_Channel *channel);
  27. UA_Int32 SL_Channel_delete(SL_Channel *channel);
  28. UA_Int32 SL_Channel_deleteMembers(SL_Channel *channel);
  29. UA_Int32 SL_Channel_renewToken(SL_Channel *channel, UA_UInt32 tokenId,
  30. UA_DateTime revisedLifetime, UA_DateTime createdAt);
  31. UA_Int32 SL_Channel_processOpenRequest(SL_Channel *channel, const UA_OpenSecureChannelRequest* request,
  32. UA_OpenSecureChannelResponse* response);
  33. UA_Int32 SL_Channel_processCloseRequest(SL_Channel *channel, const UA_CloseSecureChannelRequest* request);
  34. UA_Int32 SL_Channel_registerTokenProvider(SL_Channel *channel, SL_ChannelSecurityTokenProvider provider);
  35. UA_Int32 SL_Channel_registerChannelIdProvider(SL_ChannelIdProvider provider);
  36. UA_Int32 SL_Channel_checkRequestId(SL_Channel *channel, UA_UInt32 requestId);
  37. UA_Int32 SL_Channel_checkSequenceNumber(SL_Channel *channel, UA_UInt32 sequenceNumber);
  38. UA_Boolean SL_Channel_compare(SL_Channel *channel1, SL_Channel *channel2);
  39. //getters
  40. UA_Int32 SL_Channel_getChannelId(SL_Channel *channel, UA_UInt32 *channelId);
  41. UA_Int32 SL_Channel_getTokenId(SL_Channel *channel, UA_UInt32 *tokenlId);
  42. UA_Int32 SL_Channel_getSequenceNumber(SL_Channel *channel, UA_UInt32 *sequenceNumber);
  43. UA_Int32 SL_Channel_getRequestId(SL_Channel *channel, UA_UInt32 *requestId);
  44. UA_Int32 SL_Channel_getConnectionId(SL_Channel *channel, UA_UInt32 *connectionId);
  45. UA_Int32 SL_Channel_getConnection(SL_Channel *channel, UA_TL_Connection **connection);
  46. UA_Int32 SL_Channel_getState(SL_Channel *channel, SL_channelState *channelState);
  47. UA_Int32 SL_Channel_getLocalAsymAlgSettings(SL_Channel *channel,
  48. UA_AsymmetricAlgorithmSecurityHeader **asymAlgSettings);
  49. UA_Int32 SL_Channel_getRemainingLifetime(SL_Channel *channel, UA_Int32 *lifetime);
  50. UA_Int32 SL_Channel_getRevisedLifetime(SL_Channel *channel, UA_UInt32 *revisedLifetime);
  51. //setters
  52. UA_Int32 SL_Channel_setId(SL_Channel *channel, UA_UInt32 id);
  53. #endif /* UA_CHANNEL_H_ */