Embedded Wireless Framework
ewf_adapter.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_adapter__h__included__
10 #define __ewf_adapter__h__included__
11 
12 #include "ewf.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /************************************************************************/
24 /* Include the headers for the different adapter APIs */
25 
27 #include "ewf_adapter_api_modem.h"
29 #include "ewf_adapter_api_info.h"
30 #include "ewf_adapter_api_tls.h"
32 #include "ewf_adapter_api_dtls.h"
33 #include "ewf_adapter_api_tcp.h"
34 #include "ewf_adapter_api_udp.h"
35 #include "ewf_adapter_api_mqtt.h"
37 
38 /************************************************************************/
42 /************************************************************************/
50 {
51 #ifdef EWF_PARAMETER_CHECKING
52  uint32_t struct_magic;
53  uint32_t struct_size;
54  uint32_t struct_version;
55  uint32_t struct_type;
56 #endif /* EWF_PARAMETER_CHECKING */
57 
58  ewf_adapter_api_control* control_api_ptr;
59  ewf_adapter_api_modem_data* modem_api_data_ptr;
60  ewf_adapter_api_wifi_station* wifi_station_api_ptr;
61  ewf_adapter_api_info* info_api_ptr;
62  ewf_adapter_api_tls_basic* tls_basic_api_ptr;
63  ewf_adapter_api_tls* tls_api_ptr;
64  ewf_adapter_api_dtls* dtls_api_ptr;
65  ewf_adapter_api_tcp* tcp_api_ptr;
66  ewf_adapter_api_udp* udp_api_ptr;
67  ewf_adapter_api_mqtt_basic* mqtt_basic_api_ptr;
69 
74 
82  void* implementation_ptr;
83 };
84 
85 #define EWF_ADAPTER_STRUCT_MAGIC (0x000ADA7E) /* ~~ ada(p)te(r) */
86 #define EWF_ADAPTER_STRUCT_SIZE (sizeof(struct _ewf_adapter))
87 #define EWF_ADAPTER_VERSION (EWF_DEVELOPER_MICROSOFT | 0x0001)
88 
89 #ifdef EWF_PARAMETER_CHECKING
90 #define EWF_ADAPTER_VALIDATE_POINTER(adapter_ptr) \
91 do { \
92  if ((adapter_ptr == NULL) || \
93  (adapter_ptr->struct_magic != EWF_ADAPTER_STRUCT_MAGIC) || \
94  (adapter_ptr->struct_size != EWF_ADAPTER_STRUCT_SIZE) || \
95  (adapter_ptr->struct_version != EWF_ADAPTER_VERSION) || \
96  (adapter_ptr->implementation_ptr == NULL)) \
97  { \
98  EWF_LOG_ERROR("The adapter pointer is invalid.\n"); \
99  return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
100  } \
101 } while(0)
102 #else
103 #define EWF_ADAPTER_VALIDATE_POINTER(allocator_ptr) \
104 do { \
105  if ((adapter_ptr == NULL) || \
106  (adapter_ptr->implementation_ptr == NULL)) \
107  { \
108  EWF_LOG_ERROR("The adapter pointer is invalid.\n"); \
109  return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
110  } \
111 } while(0)
112 #endif /* EWF_PARAMETER_CHECKING */
113 
114 #ifdef EWF_PARAMETER_CHECKING
115 #define EWF_ADAPTER_VALIDATE_POINTER_TYPE(adapter_ptr, adapter_type) \
116 do { \
117  if ((adapter_ptr == NULL) || \
118  (adapter_ptr->struct_magic != EWF_ADAPTER_STRUCT_MAGIC) || \
119  (adapter_ptr->struct_size != EWF_ADAPTER_STRUCT_SIZE) || \
120  (adapter_ptr->struct_version != EWF_ADAPTER_VERSION) || \
121  (adapter_ptr->struct_type != adapter_type)) \
122  { \
123  EWF_LOG_ERROR("The adapter type is invalid.\n"); \
124  return EWF_RESULT_INVALID_FUNCTION_ARGUMENT; \
125  } \
126 } while(0)
127 #else
128 #define EWF_ADAPTER_VALIDATE_POINTER_TYPE(interface_ptr, interface_type)
129 #endif
130 
131 /************************************************************************/
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* __ewf_adapter__h__included__ */
The Embedded Wireless Framework.
The Embedded Wireless Framework adapter control API.
The Embedded Wireless Framework adapter DTLS API.
The Embedded Wireless Framework adapter info API.
The Embedded Wireless Framework modem adapter API.
The Embedded Wireless Framework adapter MQTT API.
The Embedded Wireless Framework adapter basic MQTT API.
The Embedded Wireless Framework adapter TCP API.
The Embedded Wireless Framework adapter TLS API.
The Embedded Wireless Framework adapter TLS basic API.
The Embedded Wireless Framework adapter UDP API.
The Embedded Wireless Framework WiFi adapter station API.
The adapter control API type.
Definition: ewf_adapter_api_control.h:28
the DTLS context API structure
Definition: ewf_adapter_api_dtls.h:78
Definition: ewf_adapter_api_info.h:26
Definition: ewf_adapter_api_modem.h:34
Definition: ewf_adapter_api_mqtt_basic.h:55
Definition: ewf_adapter_api_mqtt.h:84
The TCP API structure.
Definition: ewf_adapter_api_tcp.h:76
The TLS basic API structure.
Definition: ewf_adapter_api_tls_basic.h:29
the TLS configuration API
Definition: ewf_adapter_api_tls.h:138
The UDP API type.
Definition: ewf_adapter_api_udp.h:63
Definition: ewf_adapter_api_wifi_station.h:29
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
ewf_adapter_api_mqtt * mqtt_api_ptr
Definition: ewf_adapter.h:68
ewf_interface * interface_ptr
Definition: ewf_adapter.h:73
The interface structure definition.
Definition: ewf_interface.h:66