ua_connection_internal.h 2.3 KB

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