ua_connection.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2014 the contributors as stated in the AUTHORS file
  3. *
  4. * This file is part of open62541. open62541 is free software: you can
  5. * redistribute it and/or modify it under the terms of the GNU Lesser General
  6. * Public License, version 3 (as published by the Free Software Foundation) with
  7. * a static linking exception as stated in the LICENSE file provided with
  8. * open62541.
  9. *
  10. * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
  11. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  13. * details.
  14. */
  15. #ifndef UA_CONNECTION_H_
  16. #define UA_CONNECTION_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #include "ua_types.h"
  21. /**
  22. * @defgroup communication Communication
  23. *
  24. * @{
  25. */
  26. /** Used for zero-copy communication. The array of bytestrings is sent over the
  27. network as a single buffer. */
  28. typedef struct UA_ByteStringArray {
  29. UA_UInt32 stringsSize;
  30. UA_ByteString *strings;
  31. } UA_ByteStringArray;
  32. typedef enum UA_ConnectionState {
  33. UA_CONNECTION_OPENING, ///< The port is open, but we haven't received a HEL
  34. UA_CONNECTION_ESTABLISHED, ///< The port is open and the connection configured
  35. UA_CONNECTION_CLOSING, ///< The port has been closed and the connection will be deleted
  36. } UA_ConnectionState;
  37. typedef struct UA_ConnectionConfig {
  38. UA_UInt32 protocolVersion;
  39. UA_UInt32 sendBufferSize;
  40. UA_UInt32 recvBufferSize;
  41. UA_UInt32 maxMessageSize;
  42. UA_UInt32 maxChunkCount;
  43. } UA_ConnectionConfig;
  44. extern const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard;
  45. /* Forward declaration */
  46. struct UA_SecureChannel;
  47. typedef struct UA_SecureChannel UA_SecureChannel;
  48. typedef struct UA_Connection {
  49. UA_ConnectionState state;
  50. UA_ConnectionConfig localConf;
  51. UA_ConnectionConfig remoteConf;
  52. UA_SecureChannel *channel;
  53. void (*write)(void *connection, UA_ByteStringArray buf);
  54. void (*close)(void *connection);
  55. } UA_Connection;
  56. void UA_EXPORT UA_Connection_detachSecureChannel(UA_Connection *connection);
  57. // void UA_Connection_attachSecureChannel(UA_Connection *connection);
  58. /** @} */
  59. #ifdef __cplusplus
  60. } // extern "C"
  61. #endif
  62. #endif /* UA_CONNECTION_H_ */