9 #ifndef __ewf_adapter_udp__h__included__
10 #define __ewf_adapter_udp__h__included__
46 #define EWF_VALIDATE_UDP_SOCKET_POINTER(socket_ptr) \
48 if ((socket_ptr == NULL) || \
49 (socket_ptr->adapter_ptr == NULL)) \
51 EWF_LOG_ERROR("The UDP socket pointer is invalid.\n"); \
52 return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
56 #define EWF_ADAPTER_UDP_SOCKET_QUERY_IS_BOUND ("?IsBound")
57 #define EWF_ADAPTER_UDP_SOCKET_QUERY_USES_TLS ("?UsesTLS")
58 #define EWF_ADAPTER_UDP_SOCKET_QUERY_SENT_BYTES ("?SentBytes")
59 #define EWF_ADAPTER_UDP_SOCKET_QUERY_RECEIVED_BYTES ("?ReceivedBytes")
67 ewf_result(*control)(
ewf_socket_udp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
73 ewf_result(*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);
74 ewf_result(*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);
The Embedded Wireless Framework.
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.
Definition: ewf_adapter_api_udp.h:36
struct _ewf_adapter_api_udp ewf_adapter_api_udp
The UDP API type.
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.
Definition: ewf_adapter_api_udp.c:46
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.
Definition: ewf_adapter_api_udp.c:64
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.
Definition: ewf_adapter_api_udp.c:73
ewf_result ewf_adapter_udp_close(ewf_socket_udp *socket_ptr)
Close a UDP socket.
Definition: ewf_adapter_api_udp.c:28
ewf_result ewf_adapter_udp_shutdown(ewf_socket_udp *socket_ptr)
Shutdown a UDP socket.
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.
Definition: ewf_adapter_api_udp.c:37
ewf_result ewf_adapter_udp_open(ewf_adapter *adapter_ptr, ewf_socket_udp *socket_ptr)
Open a UDP socket.
Definition: ewf_adapter_api_udp.c:21
ewf_result ewf_adapter_udp_bind(ewf_socket_udp *socket_ptr, uint32_t local_port)
Binds an UDP socket to a local port.
Definition: ewf_adapter_api_udp.c:55
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.
Definition: ewf_adapter_api_udp.c:82
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
The UDP API type.
Definition: ewf_adapter_api_udp.h:63
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The UDP socket structure definition.
Definition: ewf_adapter_api_udp.h:40