UDP functions to bind, connect, send, receive and close sockets.
More...
|
#define | EWF_VALIDATE_UDP_SOCKET_POINTER(socket_ptr) |
|
#define | EWF_ADAPTER_UDP_SOCKET_QUERY_IS_BOUND ("?IsBound") |
|
#define | EWF_ADAPTER_UDP_SOCKET_QUERY_USES_TLS ("?UsesTLS") |
|
#define | EWF_ADAPTER_UDP_SOCKET_QUERY_SENT_BYTES ("?SentBytes") |
|
#define | EWF_ADAPTER_UDP_SOCKET_QUERY_RECEIVED_BYTES ("?ReceivedBytes") |
|
|
ewf_result | ewf_adapter_udp_open (ewf_adapter *adapter_ptr, ewf_socket_udp *socket_ptr) |
| Open a UDP socket. More...
|
|
ewf_result | ewf_adapter_udp_close (ewf_socket_udp *socket_ptr) |
| Close a UDP socket. More...
|
|
ewf_result | ewf_adapter_udp_control (ewf_socket_udp *socket_ptr, const char *control_str, uint8_t *buffer_ptr, uint32_t *buffer_length_ptr) |
| Control an UDP socket This is mainly used to funnel implementation specific functionality. More...
|
|
ewf_result | ewf_adapter_udp_set_dtls_configuration (ewf_socket_udp *socket_ptr, uint32_t dtls_configuration_id) |
| Set the DTLS configuration for the socket. More...
|
|
ewf_result | ewf_adapter_udp_bind (ewf_socket_udp *socket_ptr, uint32_t local_port) |
| Binds an UDP socket to a local port. More...
|
|
ewf_result | ewf_adapter_udp_shutdown (ewf_socket_udp *socket_ptr) |
| Shutdown a UDP socket. More...
|
|
ewf_result | ewf_adapter_udp_send_to (ewf_socket_udp *socket_ptr, const char *remote_address_str, uint32_t remote_port, const uint8_t *buffer_ptr, uint32_t buffer_length) |
| Send data over a UDP socket. More...
|
|
ewf_result | ewf_adapter_udp_receive_from (ewf_socket_udp *socket_ptr, char *remote_address, uint32_t *remote_address_length_ptr, uint32_t *remote_port_ptr, uint8_t *buffer_ptr, uint32_t *buffer_length_ptr, bool wait) |
| Receive data over a UDP socket. More...
|
|
ewf_result | ewf_adapter_udp_receive_callback_set (ewf_socket_udp *socket_ptr, ewf_adapter_udp_receive_callback callback) |
| Register a user UDP receive callback function. More...
|
|
UDP functions to bind, connect, send, receive and close sockets.
◆ EWF_VALIDATE_UDP_SOCKET_POINTER
#define EWF_VALIDATE_UDP_SOCKET_POINTER |
( |
|
socket_ptr | ) |
|
Value:do { \
if ((socket_ptr == NULL) || \
(socket_ptr->adapter_ptr == NULL)) \
{ \
EWF_LOG_ERROR("The UDP socket pointer is invalid.\n"); \
} \
} while(0)
@ EWF_RESULT_INVALID_FUNCTION_ARGUMENT
Definition: ewf.h:69
◆ ewf_adapter_udp_receive_callback
typedef ewf_result(* ewf_adapter_udp_receive_callback) (ewf_socket_udp *socket_ptr, const char *server, uint32_t port, const char *buffer, uint32_t length) |
A function pointer type for TCP receive callbacks.
- Parameters
-
[in] | adapter_ptr | a pointer to an adapter structure |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_udp_bind()
Binds an UDP socket to a local port.
- Parameters
-
[in] | socket_ptr | a pointer to an UDP socket |
[in] | local_port | the port number to bind to |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_udp_close()
Close a UDP socket.
- Parameters
-
[in] | socket_ptr | a pointer to an UDP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_udp_control()
ewf_result ewf_adapter_udp_control |
( |
ewf_socket_udp * |
socket_ptr, |
|
|
const char * |
control_str, |
|
|
uint8_t * |
buffer_ptr, |
|
|
uint32_t * |
buffer_length_ptr |
|
) |
| |
Control an UDP socket This is mainly used to funnel implementation specific functionality.
- Parameters
-
[in] | socket_ptr | a pointer to a UDP socket |
[in] | control_str | a pointer to NULL terminated string with the control string to execute |
[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_udp_open()
Open a UDP socket.
- Parameters
-
[in] | adapter_ptr | a pointer to an adapter structure |
[in] | socket_ptr | a pointer to an UDP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_udp_receive_callback_set()
Register a user UDP receive callback function.
- Parameters
-
[in] | socket_ptr | a pointer to an UDP socket |
[in] | callback | the function pointer to the user callback |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_udp_receive_from()
ewf_result ewf_adapter_udp_receive_from |
( |
ewf_socket_udp * |
socket_ptr, |
|
|
char * |
remote_address, |
|
|
uint32_t * |
remote_address_length_ptr, |
|
|
uint32_t * |
remote_port_ptr, |
|
|
uint8_t * |
buffer_ptr, |
|
|
uint32_t * |
buffer_length_ptr, |
|
|
bool |
wait |
|
) |
| |
Receive data over a UDP socket.
- Parameters
-
[in] | socket_ptr | a pointer to an UDP socket |
[in,out] | remote_address | the address or name of the remote host from which the data was received, or NULL if not needed |
[in,out] | remote_address_length_ptr | the buffer length on input, the size of the remote string on output, or NULL if not needed |
[in,out] | remote_port_ptr | a pointer to a variable to hold the port number from which the data was received, or NULL if not needed |
[in,out] | buffer_ptr | a pointer to the buffer that is going to receive the data |
[in,out] | buffer_length_ptr | 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_udp_send_to()
ewf_result ewf_adapter_udp_send_to |
( |
ewf_socket_udp * |
socket_ptr, |
|
|
const char * |
remote_address_str, |
|
|
uint32_t |
remote_port, |
|
|
const uint8_t * |
buffer_ptr, |
|
|
uint32_t |
buffer_length |
|
) |
| |
Send data over a UDP socket.
- Parameters
-
[in] | socket_ptr | a pointer to an UDP socket |
[in] | remote_address_str | a pointer to a NULL terminated string with the address to send to |
[in] | remote_port | the remote port number to send to |
[in] | buffer_ptr | 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_udp_set_dtls_configuration()
Set the DTLS configuration for the socket.
- Parameters
-
[in] | socket_ptr | a pointer to an UDP socket |
- Returns
- ewf_result success and error conditions
◆ ewf_adapter_udp_shutdown()
Shutdown a UDP socket.
- Parameters
-
[in] | socket_ptr | A pointer to a UDP socket |
- Returns
- ewf_result success and error conditions