ua_connection_internal.h 2.2 KB

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