Skip to content

Commit 03898dd

Browse files
author
Jason2866
committed
resolve conflicts
1 parent 9c86ab1 commit 03898dd

File tree

502 files changed

+40020
-8005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

502 files changed

+40020
-8005
lines changed

tools/platformio-build-esp32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
"UNITY_INCLUDE_CONFIG_H",
301301
"WITH_POSIX",
302302
"_GNU_SOURCE",
303-
("IDF_VER", '\\"v4.4-dev-3401-gb86fe0c66c\\"'),
303+
("IDF_VER", '\\"v4.4-dev-3235-g3e370c4296\\"'),
304304
"ESP_PLATFORM",
305305
"ARDUINO_ARCH_ESP32",
306306
"ESP32",

tools/platformio-build-esp32c3.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,6 @@
263263
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wifi_provisioning", "include"),
264264
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_littlefs", "src"),
265265
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp_littlefs", "include"),
266-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include"),
267-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "tool"),
268-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "typedef"),
269-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "image"),
270-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "math"),
271-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "nn"),
272-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "layer"),
273-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "detect"),
274-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "esp-face", "include", "model_zoo"),
275266
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "fb_gfx", "include"),
276267
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
277268
],
@@ -282,7 +273,7 @@
282273
],
283274

284275
LIBS=[
285-
"-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lunity", "-lcmock", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lesp_https_server", "-lesp_lcd", "-lprotobuf-c", "-lprotocomm", "-lmdns", "-lesp_local_ctrl", "-lsdmmc", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lwear_levelling", "-lfatfs", "-lfreemodbus", "-ljsmn", "-ljson", "-llibsodium", "-lmqtt", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_lcd", "-lesp_local_ctrl", "-lesp_https_server", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lesp_adc_cal", "-lesp_hid", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lprotocomm", "-lbt", "-lbtdm_app", "-lprotobuf-c", "-lmdns", "-lconsole", "-ljson", "-lcat_face_detect", "-lhuman_face_detect", "-ldl", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lm", "-lnewlib", "-lstdc++", "-lpthread", "-lgcc", "-lcxx", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc"
276+
"-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lasio", "-lbt", "-lcbor", "-lunity", "-lcmock", "-lcoap", "-lconsole", "-lnghttp", "-lesp-tls", "-lesp_adc_cal", "-lesp_hid", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lesp_https_server", "-lesp_lcd", "-lprotobuf-c", "-lprotocomm", "-lmdns", "-lesp_local_ctrl", "-lsdmmc", "-lesp_serial_slave_link", "-lesp_websocket_client", "-lexpat", "-lwear_levelling", "-lfatfs", "-lfreemodbus", "-ljsmn", "-ljson", "-llibsodium", "-lmqtt", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lesp_littlefs", "-lfb_gfx", "-lasio", "-lcbor", "-lcmock", "-lunity", "-lcoap", "-lesp_lcd", "-lesp_local_ctrl", "-lesp_https_server", "-lesp_websocket_client", "-lexpat", "-lfreemodbus", "-ljsmn", "-llibsodium", "-lmqtt", "-lesp_adc_cal", "-lesp_hid", "-lfatfs", "-lwear_levelling", "-lopenssl", "-lspiffs", "-lwifi_provisioning", "-lprotocomm", "-lbt", "-lbtdm_app", "-lprotobuf-c", "-lmdns", "-lconsole", "-ljson", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lesp_ringbuf", "-lefuse", "-lesp_ipc", "-ldriver", "-lesp_pm", "-lmbedtls", "-lapp_update", "-lbootloader_support", "-lspi_flash", "-lnvs_flash", "-lpthread", "-lesp_gdbstub", "-lespcoredump", "-lesp_phy", "-lesp_system", "-lesp_rom", "-lhal", "-lvfs", "-lesp_eth", "-ltcpip_adapter", "-lesp_netif", "-lesp_event", "-lwpa_supplicant", "-lesp_wifi", "-llwip", "-llog", "-lheap", "-lsoc", "-lesp_hw_support", "-lriscv", "-lesp_common", "-lesp_timer", "-lfreertos", "-lnewlib", "-lcxx", "-lapp_trace", "-lnghttp", "-lesp-tls", "-ltcp_transport", "-lesp_http_client", "-lesp_http_server", "-lesp_https_ota", "-lsdmmc", "-lesp_serial_slave_link", "-lmbedtls", "-lmbedcrypto", "-lmbedx509", "-lcoexist", "-lcore", "-lespnow", "-lmesh", "-lnet80211", "-lpp", "-lsmartconfig", "-lwapi", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lesp_phy", "-lphy", "-lbtbb", "-lm", "-lnewlib", "-lstdc++", "-lpthread", "-lgcc", "-lcxx", "-lapp_trace", "-lgcov", "-lapp_trace", "-lgcov", "-lc"
286277
],
287278

288279
CPPDEFINES=[
@@ -291,7 +282,7 @@
291282
"UNITY_INCLUDE_CONFIG_H",
292283
"WITH_POSIX",
293284
"_GNU_SOURCE",
294-
("IDF_VER", '\\"v4.4-dev-3401-gb86fe0c66c\\"'),
285+
("IDF_VER", '\\"v4.4-dev-3235-g3e370c4296\\"'),
295286
"ESP_PLATFORM",
296287
"ARDUINO_ARCH_ESP32",
297288
"ESP32",

tools/platformio-build-esp32s2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
"UNITY_INCLUDE_CONFIG_H",
287287
"WITH_POSIX",
288288
"_GNU_SOURCE",
289-
("IDF_VER", '\\"v4.4-dev-3401-gb86fe0c66c\\"'),
289+
("IDF_VER", '\\"v4.4-dev-3235-g3e370c4296\\"'),
290290
"ESP_PLATFORM",
291291
"ARDUINO_ARCH_ESP32",
292292
"ESP32",
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/*
2+
* address.h -- representation of network addresses
3+
*
4+
* Copyright (C) 2010-2011,2015-2016 Olaf Bergmann <bergmann@tzi.org>
5+
*
6+
* This file is part of the CoAP library libcoap. Please see README for terms
7+
* of use.
8+
*/
9+
10+
/**
11+
* @file address.h
12+
* @brief Representation of network addresses
13+
*/
14+
15+
#ifndef COAP_ADDRESS_H_
16+
#define COAP_ADDRESS_H_
17+
18+
#include <assert.h>
19+
#include <stdint.h>
20+
#include <string.h>
21+
#include <sys/types.h>
22+
#include "libcoap.h"
23+
24+
#if defined(WITH_LWIP)
25+
26+
#include <lwip/ip_addr.h>
27+
28+
typedef struct coap_address_t {
29+
uint16_t port;
30+
ip_addr_t addr;
31+
} coap_address_t;
32+
33+
#define _coap_address_equals_impl(A, B) \
34+
((A)->port == (B)->port \
35+
&& (!!ip_addr_cmp(&(A)->addr,&(B)->addr)))
36+
37+
#define _coap_address_isany_impl(A) ip_addr_isany(&(A)->addr)
38+
39+
#define _coap_is_mcast_impl(Address) ip_addr_ismulticast(&(Address)->addr)
40+
41+
#elif defined(WITH_CONTIKI)
42+
43+
#include "uip.h"
44+
45+
typedef struct coap_address_t {
46+
uip_ipaddr_t addr;
47+
uint16_t port;
48+
} coap_address_t;
49+
50+
#define _coap_address_equals_impl(A,B) \
51+
((A)->port == (B)->port \
52+
&& uip_ipaddr_cmp(&((A)->addr),&((B)->addr)))
53+
54+
/** @todo implementation of _coap_address_isany_impl() for Contiki */
55+
#define _coap_address_isany_impl(A) 0
56+
57+
#define _coap_is_mcast_impl(Address) uip_is_addr_mcast(&((Address)->addr))
58+
59+
#else /* WITH_LWIP || WITH_CONTIKI */
60+
61+
/** multi-purpose address abstraction */
62+
typedef struct coap_address_t {
63+
socklen_t size; /**< size of addr */
64+
union {
65+
struct sockaddr sa;
66+
struct sockaddr_in sin;
67+
struct sockaddr_in6 sin6;
68+
} addr;
69+
} coap_address_t;
70+
71+
/**
72+
* Compares given address objects @p a and @p b. This function returns @c 1 if
73+
* addresses are equal, @c 0 otherwise. The parameters @p a and @p b must not be
74+
* @c NULL;
75+
*/
76+
int coap_address_equals(const coap_address_t *a, const coap_address_t *b);
77+
78+
COAP_STATIC_INLINE int
79+
_coap_address_isany_impl(const coap_address_t *a) {
80+
/* need to compare only relevant parts of sockaddr_in6 */
81+
switch (a->addr.sa.sa_family) {
82+
case AF_INET:
83+
return a->addr.sin.sin_addr.s_addr == INADDR_ANY;
84+
case AF_INET6:
85+
return memcmp(&in6addr_any,
86+
&a->addr.sin6.sin6_addr,
87+
sizeof(in6addr_any)) == 0;
88+
default:
89+
;
90+
}
91+
92+
return 0;
93+
}
94+
#endif /* WITH_LWIP || WITH_CONTIKI */
95+
96+
/**
97+
* Resets the given coap_address_t object @p addr to its default values. In
98+
* particular, the member size must be initialized to the available size for
99+
* storing addresses.
100+
*
101+
* @param addr The coap_address_t object to initialize.
102+
*/
103+
COAP_STATIC_INLINE void
104+
coap_address_init(coap_address_t *addr) {
105+
assert(addr);
106+
memset(addr, 0, sizeof(coap_address_t));
107+
#if !defined(WITH_LWIP) && !defined(WITH_CONTIKI)
108+
/* lwip and Contiki have constant address sizes and doesn't need the .size part */
109+
addr->size = sizeof(addr->addr);
110+
#endif
111+
}
112+
113+
/* Convenience function to copy IPv6 addresses without garbage. */
114+
115+
COAP_STATIC_INLINE void
116+
coap_address_copy( coap_address_t *dst, const coap_address_t *src ) {
117+
#if defined(WITH_LWIP) || defined(WITH_CONTIKI)
118+
memcpy( dst, src, sizeof( coap_address_t ) );
119+
#else
120+
memset( dst, 0, sizeof( coap_address_t ) );
121+
dst->size = src->size;
122+
if ( src->addr.sa.sa_family == AF_INET6 ) {
123+
dst->addr.sin6.sin6_family = src->addr.sin6.sin6_family;
124+
dst->addr.sin6.sin6_addr = src->addr.sin6.sin6_addr;
125+
dst->addr.sin6.sin6_port = src->addr.sin6.sin6_port;
126+
dst->addr.sin6.sin6_scope_id = src->addr.sin6.sin6_scope_id;
127+
} else if ( src->addr.sa.sa_family == AF_INET ) {
128+
dst->addr.sin = src->addr.sin;
129+
} else {
130+
memcpy( &dst->addr, &src->addr, src->size );
131+
}
132+
#endif
133+
}
134+
135+
#if defined(WITH_LWIP) || defined(WITH_CONTIKI)
136+
/**
137+
* Compares given address objects @p a and @p b. This function returns @c 1 if
138+
* addresses are equal, @c 0 otherwise. The parameters @p a and @p b must not be
139+
* @c NULL;
140+
*/
141+
COAP_STATIC_INLINE int
142+
coap_address_equals(const coap_address_t *a, const coap_address_t *b) {
143+
assert(a); assert(b);
144+
return _coap_address_equals_impl(a, b);
145+
}
146+
#endif
147+
148+
/**
149+
* Checks if given address object @p a denotes the wildcard address. This
150+
* function returns @c 1 if this is the case, @c 0 otherwise. The parameters @p
151+
* a must not be @c NULL;
152+
*/
153+
COAP_STATIC_INLINE int
154+
coap_address_isany(const coap_address_t *a) {
155+
assert(a);
156+
return _coap_address_isany_impl(a);
157+
}
158+
159+
#if !defined(WITH_LWIP) && !defined(WITH_CONTIKI)
160+
161+
/**
162+
* Checks if given address @p a denotes a multicast address. This function
163+
* returns @c 1 if @p a is multicast, @c 0 otherwise.
164+
*/
165+
int coap_is_mcast(const coap_address_t *a);
166+
#else /* !WITH_LWIP && !WITH_CONTIKI */
167+
/**
168+
* Checks if given address @p a denotes a multicast address. This function
169+
* returns @c 1 if @p a is multicast, @c 0 otherwise.
170+
*/
171+
COAP_STATIC_INLINE int
172+
coap_is_mcast(const coap_address_t *a) {
173+
return a && _coap_is_mcast_impl(a);
174+
}
175+
#endif /* !WITH_LWIP && !WITH_CONTIKI */
176+
177+
#endif /* COAP_ADDRESS_H_ */

0 commit comments

Comments
 (0)