9 #ifndef __ewf_adapter_winsock2__h__included__
10 #define __ewf_adapter_winsock2__h__included__
33 #ifndef EWF_ADAPTER_WINSOCK2_TCP_ENABLED
34 #define EWF_ADAPTER_WINSOCK2_TCP_ENABLED (1)
37 #ifndef EWF_ADAPTER_WINSOCK2_UDP_ENABLED
38 #define EWF_ADAPTER_WINSOCK2_UDP_ENABLED (1)
86 #if EWF_ADAPTER_WINSOCK2_TCP_ENABLED
92 ewf_result ewf_adapter_winsock2_tcp_control(
ewf_socket_tcp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
93 ewf_result ewf_adapter_winsock2_tcp_set_tls_configuration(
ewf_socket_tcp* socket_ptr, uint32_t tls_configuration_id);
99 ewf_result ewf_adapter_winsock2_tcp_send(
ewf_socket_tcp* socket_ptr,
const uint8_t* buffer_ptr, uint32_t buffer_length);
100 ewf_result ewf_adapter_winsock2_tcp_receive(
ewf_socket_tcp* socket_ptr, uint8_t* buffer_ptr, uint32_t* buffer_length,
bool wait);
112 #if EWF_ADAPTER_WINSOCK2_UDP_ENABLED
118 ewf_result ewf_adapter_winsock2_udp_control(
ewf_socket_udp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
119 ewf_result ewf_adapter_winsock2_udp_set_dtls_configuration(
ewf_socket_udp* socket_ptr, uint32_t dtls_configuration_id);
122 ewf_result ewf_adapter_winsock2_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);
123 ewf_result ewf_adapter_winsock2_udp_receive_from(
ewf_socket_udp* socket_ptr,
char* remote_address, uint32_t* remote_address_length_ptr, uint32_t* remote_port_ptr,
char* buffer_ptr, uint32_t* buffer_length_ptr,
bool wait);
152 IN_ADDR ipv4_address;
153 IN_ADDR ipv4_netmask;
154 IN_ADDR ipv4_gateway;
167 #ifdef EWF_PARAMETER_CHECKING
168 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_HEADER(adapter_ptr) \
170 (adapter_ptr)->struct_magic = EWF_ADAPTER_STRUCT_MAGIC; \
171 (adapter_ptr)->struct_size = EWF_ADAPTER_STRUCT_SIZE; \
172 (adapter_ptr)->struct_version = EWF_ADAPTER_VERSION; \
173 (adapter_ptr)->struct_type = EWF_ADAPTER_TYPE_WINSOCK2; \
176 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_HEADER(adapter_ptr)
179 #if EWF_ADAPTER_WINSOCK2_TCP_ENABLED
180 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_TCP_API(adapter_ptr) \
182 adapter_ptr->tcp_api_ptr = &ewf_adapter_winsock2_api_tcp; \
185 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_TCP_API(adapter_ptr)
188 #if EWF_ADAPTER_WINSOCK2_UDP_ENABLED
189 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_UDP_API(adapter_ptr) \
191 adapter_ptr->udp_api_ptr = &ewf_adapter_winsock2_api_udp; \
194 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_UDP_API(adapter_ptr)
197 #if EWF_ADAPTER_WINSOCK2_TLS_BASIC_ENABLED
198 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_TLS_BASIC_API(adapter_ptr) \
200 adapter_ptr->tls_basic_api_ptr = &ewf_adapter_winsock2_api_tls_basic; \
203 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_TLS_BASIC_API(adapter_ptr)
206 #if EWF_ADAPTER_WINSOCK2_MQTT_BASIC_ENABLED
207 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_MQTT_BASIC_API(adapter_ptr) \
209 adapter_ptr->mqtt_basic_api_ptr = &ewf_adapter_winsock2_api_mqtt_basic; \
212 #define EWF_ADAPTER_WINSOCK2_INITIALIZE_MQTT_BASIC_API(adapter_ptr)
221 #define EWF_ADAPTER_WINSOCK2_STATIC_DECLARE(adapter_ptr, adapter_name_symb, data_allocator_ptr_param) \
223 static ewf_adapter_winsock2 ewf_adapter_winsock2__implementation__##adapter_name_symb = {0}; \
224 static ewf_adapter ewf_adapter_winsock2__##adapter_name_symb = {0}; \
225 ewf_adapter_winsock2__##adapter_name_symb.implementation_ptr = &(ewf_adapter_winsock2__implementation__##adapter_name_symb); \
226 adapter_ptr = &(ewf_adapter_winsock2__##adapter_name_symb); \
227 EWF_ADAPTER_WINSOCK2_INITIALIZE_HEADER(adapter_ptr); \
228 ewf_adapter_winsock2__##adapter_name_symb.control_api_ptr = &ewf_adapter_winsock2_api_control; \
229 ewf_adapter_winsock2__##adapter_name_symb.info_api_ptr = &ewf_adapter_winsock2_api_info; \
230 EWF_ADAPTER_WINSOCK2_INITIALIZE_TCP_API(adapter_ptr); \
231 EWF_ADAPTER_WINSOCK2_INITIALIZE_UDP_API(adapter_ptr); \
232 EWF_ADAPTER_WINSOCK2_INITIALIZE_TLS_BASIC_API(adapter_ptr); \
233 EWF_ADAPTER_WINSOCK2_INITIALIZE_MQTT_BASIC_API(adapter_ptr); \
The Embedded Wireless Framework adapter API implementation.
struct _ewf_adapter_winsock2 ewf_adapter_winsock2
The WinSock2 adapter driver data structure.
struct _ewf_adapter_winsock2_socket ewf_adapter_winsock2_socket
Internal structure for socket status
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
The adapter control API type.
Definition: ewf_adapter_api_control.h:28
Definition: ewf_adapter_api_info.h:26
The TCP API structure.
Definition: ewf_adapter_api_tcp.h:76
The UDP API type.
Definition: ewf_adapter_api_udp.h:63
Internal structure for socket status
Definition: ewf_adapter_winsock2.h:143
The WinSock2 adapter driver data structure.
Definition: ewf_adapter_winsock2.h:150
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The TCP socket structure definition.
Definition: ewf_adapter_api_tcp.h:47
The UDP socket structure definition.
Definition: ewf_adapter_api_udp.h:40