TCP functions to listen, connect, send, receive and close sockets.
More...
|
#define | EWF_VALIDATE_TCP_SOCKET_POINTER(socket_ptr) |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_SET_CONTEXT_ID ("!SetContextId") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_SET_CONNECTION_TIMEOUT ("!SetConnectionTimeout") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_IS_CONNECTED ("!IsConnected") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_IS_BOUND ("!IsBound") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_USES_TLS ("!UsesTLS") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_PEER_ADDRESSS ("!PeerAddress") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_LOCAL_ADDRESSS ("!LocalAddress") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_SENT_BYTES ("!SentBytes") |
|
#define | EWF_ADAPTER_TCP_SOCKET_CONTROL_RECEIVED_BYTES ("!ReceivedBytes") |
|
|
ewf_result | ewf_adapter_tcp_open (ewf_adapter *adapter_ptr, ewf_socket_tcp *socket_ptr) |
| Open a TCP socket. More...
|
|
ewf_result | ewf_adapter_tcp_close (ewf_socket_tcp *socket_ptr) |
| Close a TCP socket. More...
|
|
ewf_result | ewf_adapter_tcp_control (ewf_socket_tcp *socket_ptr, const char *control_str, const uint8_t *buffer_ptr, uint32_t *buffer_length_ptr) |
| Control a TCP socket This is mainly used to funnel implementation specific functionality. More...
|
|
ewf_result | ewf_adapter_tcp_set_tls_configuration (ewf_socket_tcp *socket_ptr, uint32_t tls_configuration_id) |
| Set the TLS context for the socket. More...
|
|
ewf_result | ewf_adapter_tcp_bind (ewf_socket_tcp *socket_ptr, uint32_t port) |
| Binds a TCP socket to a port. More...
|
|
ewf_result | ewf_adapter_tcp_listen (ewf_socket_tcp *socket_ptr) |
| Listens to incomming connections on a socket. More...
|
|
ewf_result | ewf_adapter_tcp_accept (ewf_socket_tcp *socket_ptr, ewf_socket_tcp *socket_new_ptr) |
| Accept a new connection on a listening TCP socket. More...
|
|
ewf_result | ewf_adapter_tcp_connect (ewf_socket_tcp *socket_ptr, const char *server_str, uint32_t port) |
| Connect a TCP socket to a server. More...
|
|
ewf_result | ewf_adapter_tcp_shutdown (ewf_socket_tcp *socket_ptr) |
| Shutdown a TCP socket. More...
|
|
ewf_result | ewf_adapter_tcp_send (ewf_socket_tcp *socket_ptr, const uint8_t *buffer_ptr, uint32_t buffer_length) |
| Send data over a TCP socket. More...
|
|
ewf_result | ewf_adapter_tcp_receive (ewf_socket_tcp *socket_ptr, uint8_t *buffer_ptr, uint32_t *buffer_length, bool wait) |
| Receive data over a TCP socket. More...
|
|
ewf_result | ewf_adapter_tcp_receive_callback_set (ewf_socket_tcp *socket_ptr, ewf_adapter_tcp_receive_callback callback) |
| Register a user TCP receive callback function. More...
|
|
ewf_result | ewf_adapter_tcp_disconnect_callback_set (ewf_socket_tcp *socket_ptr, ewf_adapter_tcp_disconnect_callback callback) |
| Register a user TCP disconnect callback function. More...
|
|
TCP functions to listen, connect, send, receive and close sockets.
◆ EWF_VALIDATE_TCP_SOCKET_POINTER
#define EWF_VALIDATE_TCP_SOCKET_POINTER |
( |
|
socket_ptr | ) |
|
Value:do { \
if ((socket_ptr == NULL) || \
(socket_ptr->adapter_ptr == NULL)) \
{ \
EWF_LOG_ERROR("The TCP socket pointer is invalid.\n"); \
} \
} while(0)
@ EWF_RESULT_INVALID_FUNCTION_ARGUMENT
Definition: ewf.h:69
◆ ewf_adapter_tcp_disconnect_callback
A function pointer type for TCP disconnect callbacks.
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_receive_callback
typedef ewf_result(* ewf_adapter_tcp_receive_callback) (ewf_socket_tcp *socket_ptr, const uint8_t *buffer_ptr, uint32_t buffer_length) |
A function pointer type for TCP receive callbacks.
- Parameters
-
[in] | buffer_ptr | A pointer to a buffer with the received data |
[in] | buffer_length | The length of the data pointed by buffer_ptr |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_accept()
Accept a new connection on a listening TCP socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in,out] | socket | a pointer to a variable that will hold the new TCP socket from the accepted connection |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_bind()
Binds a TCP socket to a port.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in] | port | the port number to bind to |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_close()
Close a TCP socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_connect()
Connect a TCP socket to a server.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in] | server | the address or name of the server to connect to |
[in] | port | the port number to connect to |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_control()
ewf_result ewf_adapter_tcp_control |
( |
ewf_socket_tcp * |
socket_ptr, |
|
|
const char * |
control_str, |
|
|
const uint8_t * |
buffer_ptr, |
|
|
uint32_t * |
buffer_length_ptr |
|
) |
| |
Control a TCP socket This is mainly used to funnel implementation specific functionality.
- Parameters
-
[in] | socket_ptr | a pointer to a TCP socket |
[in] | control_str | a pointer to NULL terminated string with the control command to issue |
[in] | buffer_ptr | a pointer to a buffer with additional data for the command |
[in] | buffer_length_ptr | the length of the buffer pointer by buffer_ptr on call, the size used on return |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_disconnect_callback_set()
Register a user TCP disconnect callback function.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in] | callback | the function pointer to the user callback |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_listen()
Listens to incomming connections on a socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_open()
Open a TCP socket.
- Parameters
-
[in] | adapter_ptr | A pointer to the adapter |
[in,out] | socket_ptr | A pointer to a TCP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_receive()
ewf_result ewf_adapter_tcp_receive |
( |
ewf_socket_tcp * |
socket_ptr, |
|
|
uint8_t * |
buffer_ptr, |
|
|
uint32_t * |
buffer_length, |
|
|
bool |
wait |
|
) |
| |
Receive data over a TCP socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in,out] | buffer | a pointer to the buffer that is going to receive the data |
[in,out] | buffer_length | a pointer to an unsigned holds the size of the buffer on entry and the buffer_length and on return |
[in] | wait | a boolean indicating if the function should wait until data is available, true wait, false return immediately |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_receive_callback_set()
Register a user TCP receive callback function.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in] | callback | the function pointer to the user callback |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_send()
Send data over a TCP socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
[in] | buffer | a pointer to the data to be sent |
[in] | buffer_length | the number of bytes to be sent |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_set_tls_configuration()
Set the TLS context for the socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_tcp_shutdown()
Shutdown a TCP socket.
- Parameters
-
[in] | socket_ptr | A pointer to a TCP socket |
- Returns
- ewf_result success and error conditions