ua_connection_internal.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_CONNECTION_INTERNAL_H_
  5. #define UA_CONNECTION_INTERNAL_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "ua_connection.h"
  10. /**
  11. * The network layer may receive chopped up messages since TCP is a streaming
  12. * protocol. Furthermore, the networklayer may operate on ringbuffers or
  13. * statically assigned memory.
  14. *
  15. * If an entire message is received, it is forwarded directly. But the memory
  16. * needs to be freed with the networklayer-specific mechanism. If a half message
  17. * is received, we copy it into a local buffer. Then, the stack-specific free
  18. * needs to be used.
  19. *
  20. * @param connection The connection
  21. * @param message The received message. The content may be overwritten when a
  22. * previsouly received buffer is completed.
  23. * @param realloced The Boolean value is set to true if the outgoing message has
  24. * been reallocated from the network layer.
  25. * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs, the ingoing message
  26. * and the current buffer in the connection are freed.
  27. */
  28. UA_StatusCode
  29. UA_Connection_completeMessages(UA_Connection *connection, UA_ByteString * UA_RESTRICT message,
  30. UA_Boolean * UA_RESTRICT realloced);
  31. void UA_EXPORT UA_Connection_detachSecureChannel(UA_Connection *connection);
  32. void UA_EXPORT UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel);
  33. /**
  34. * EndpointURL helper
  35. */
  36. /**
  37. * Split the given endpoint url into hostname and port. Some of the chunks are returned as pointer.
  38. * @param endpointUrl The endpoint URL to split up
  39. * @param hostname the target array for hostname. Has to be at least 256 size.
  40. * @param port if url contains port, it will point to the beginning of port. NULL otherwise. It may also include the path part, thus stop at position of path pointer, if it is not NULL.
  41. * @param path points to the first occurance of '/' after the port or NULL if no path in url
  42. * @return UA_STATUSCODE_BADOUTOFRANGE if url too long, UA_STATUSCODE_BADATTRIBUTEIDINVALID if url not starting with 'opc.tcp://', UA_STATUSCODE_GOOD on success
  43. */
  44. UA_StatusCode UA_EXPORT UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname, const char ** port, const char ** path);
  45. #ifdef __cplusplus
  46. } // extern "C"
  47. #endif
  48. #endif /* UA_CONNECTION_INTERNAL_H_ */