Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/rest_client: a multi-transport rest-client for RIOT #17785

Draft
wants to merge 55 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0bef732
[treewide] lora: use int16_t for RSSI value
jia200x Jan 10, 2022
4b3d699
drivers/atwinc15x0: adapt NETOPT_RSSI to int16_t
jia200x Jan 10, 2022
5e99374
Merge pull request #17527 from jia200x/backport/2022.01/pr/lora/fix_r…
aabadie Jan 18, 2022
b8994e9
tests/pkg_relic: increase stacksize
fjmolinas Jan 18, 2022
6a8dedf
Merge pull request #17529 from fjmolinas/backport/2022.01/pr_test_pkg…
fjmolinas Jan 18, 2022
69198a4
drivers/rtt_rtc: select rtc_utils
fjmolinas Jan 18, 2022
79794fd
Merge pull request #17532 from fjmolinas/backport/2022.01/pr_rtt_rtc_…
aabadie Jan 19, 2022
c13b529
tests/pkg_edhoc: handle multiple interfaces
fjmolinas Jan 18, 2022
33c360c
Merge pull request #17549 from fjmolinas/backport/2022.01/pr_edhoc_te…
aabadie Jan 21, 2022
f052a9b
sys/ztimer64/util.c: fix ztimer64_set_timeout_flag
fjmolinas Jan 24, 2022
ec3cc22
Merge pull request #17562 from fjmolinas/backport/2022.01/pr_ztimer64…
emmanuelsearch Jan 25, 2022
336fd75
boards/nucleo-f767zi: Fix adc pin config in periph_conf.h
ststrell Jan 24, 2022
5db69b4
Merge pull request #17570 from maribu/backport/2022.01/nucleo_f767zi_…
aabadie Jan 25, 2022
5ffdabc
release-notes.txt: add 2022.01 release notes
emmanuelsearch Jan 25, 2022
9640e20
Merge pull request #17585 from emmanuelsearch/backport/2022.01/pr-rel…
bergzand Jan 28, 2022
ba4857a
VERSION: add 2022.01 version file
emmanuelsearch Jan 28, 2022
5265213
Merge pull request #17587 from emmanuelsearch/2022.01-branch
kaspar030 Jan 28, 2022
d33e144
pkg/lwip: replace boolean with simple expression
HendrikVE Dec 21, 2021
12ccc0a
pkg/lwip: rename offset to recvd
HendrikVE Dec 21, 2021
9d782bc
pkg/lwip: use intermediate variable instead of max_len
HendrikVE Dec 21, 2021
9395791
pkg/lwip: give lines some more space
HendrikVE Dec 22, 2021
9328e6b
pkg/lwip: remove redundant pointer
HendrikVE Dec 22, 2021
4743823
pkg/lwip: add peek to sock_ip
HendrikVE Dec 27, 2021
50d91de
pkg/lwip: add peek to sock_udp
HendrikVE Dec 27, 2021
cea7731
pkg/lwip: add peek to sock_tcp
HendrikVE Dec 27, 2021
98b5e70
sys/posix: add flag definitions
HendrikVE Feb 3, 2021
8f7c757
sys/posix/socket: implement MSG_PEEK for recvfrom
HendrikVE Feb 3, 2021
371183f
pkg/lwip: add missing initialization for async_cb
HendrikVE Dec 31, 2021
92f569c
sys/posix: add module posix_netdb
HendrikVE Jun 16, 2021
1e83372
tests/posix_netdb: add test
HendrikVE Jan 7, 2022
07f498a
sys/net/application_layer/sock_dns: add pseudomodule auto_init_sock_dns
HendrikVE Jan 1, 2022
845b58a
pkg/wolfmqtt: add wolfmqtt
HendrikVE Jan 14, 2021
28f71a5
examples/wolfmqtt_mqttclient: add example from wolfmqtt pkg
HendrikVE Jan 14, 2021
5e2b332
examples/wolfmqtt_snclient: add example from wolfmqtt pkg
HendrikVE Jan 29, 2021
538e202
examples/wolfmqtt_nbclient: add example from wolfmqtt pkg
HendrikVE Feb 5, 2021
f410a7f
examples/wolfmqtt_multithread: add example from wolfmqtt pkg
HendrikVE Feb 5, 2021
9512727
pkg/wolfmqtt: update package from v1.7 to v1.12.0
HendrikVE Apr 17, 2022
6ac4b49
sys/net/ipv4: ipv4_addr_t pointer should be const
HendrikVE Mar 5, 2022
efae541
pkg/tinydtls: rename condition WITH_RIOT_GNRC to WITH_RIOT
HendrikVE Mar 5, 2022
4288e4b
pkg/tinydtls: remove unnecessary void casts
HendrikVE Mar 5, 2022
eade2b7
pkg/tinydtls: add IPv4 support
HendrikVE Mar 5, 2022
2471588
sys/net/sock_util: fix compilation for IPv4-only mode
HendrikVE Mar 6, 2022
ae425db
sys/net/netutils: add missing string.h include
HendrikVE Mar 6, 2022
862094b
sys/net/netutils: add netutils_get_ipv4()
HendrikVE Mar 6, 2022
9f80903
examples/gcoap: add IPv4 support
HendrikVE Mar 5, 2022
ec54d85
examples/gcoap_dtls: add IPv4 support
HendrikVE Mar 5, 2022
c412e4d
wolfMQTT
HendrikVE Apr 30, 2022
c36c26d
fix wolfmqtt pkg
HendrikVE May 1, 2022
f7e4845
initial rest_client
HendrikVE Nov 2, 2021
ffbedd4
sys/rest_client: add CoAP and CoAPs transport
HendrikVE Apr 30, 2022
0c07b0a
sys/rest_client: add MQTT and MQTT-SN transport
HendrikVE Apr 30, 2022
4a78290
pkg/lwip: make LWIP_NETDEV_STACKSIZE configurable
HendrikVE Apr 30, 2022
0dd366f
sys/net/coap: add kafka media types
HendrikVE Apr 30, 2022
3e6fa50
examples/rest_client_django: add new application
HendrikVE Apr 30, 2022
2b14bbf
examples/rest_client_kafka: add new application
HendrikVE Apr 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pkg/wolfmqtt: update package from v1.7 to v1.12.0
  • Loading branch information
HendrikVE committed Apr 17, 2022
commit 951272760583c22ae5c06a57f49bdb996eac6107
2 changes: 1 addition & 1 deletion pkg/wolfmqtt/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PKG_NAME = wolfmqtt
PKG_URL = https://github.com/wolfssl/wolfmqtt.git
PKG_VERSION = 238a70ec96a7501853b81241352c5091a86e9251 # v1.7
PKG_VERSION = v1.12.0
PKG_LICENSE = GPLv2

include $(RIOTBASE)/pkg/pkg.mk
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
From 4aeefeec027a2e56c2db52158db68bf325af22e5 Mon Sep 17 00:00:00 2001
From 54ec318b58a7deaaa5ae9ba4b3944d35281f3805 Mon Sep 17 00:00:00 2001
From: Hendrik van Essen <hendrik.ve@fu-berlin.de>
Date: Fri, 29 Jan 2021 02:19:42 +0100
Subject: [PATCH 2/8] adapt network code to RIOT
Subject: [PATCH 01/10] adapt network code to RIOT

---
wolfmqtt/mqtt_types.h | 2 +-
wolfmqtt_examples/mqttexample.c | 9 ++
wolfmqtt_examples/mqttnet.c | 188 +++++++++++++++++++-----
wolfmqtt_examples/sn-client/sn-client.c | 13 +-
4 files changed, 172 insertions(+), 40 deletions(-)
examples/mqttexample.c | 9 ++
examples/mqttnet.c | 186 ++++++++++++++++++++++++++-------
examples/sn-client/sn-client.c | 13 ++-
wolfmqtt/mqtt_types.h | 2 +-
4 files changed, 170 insertions(+), 40 deletions(-)

diff --git a/wolfmqtt/mqtt_types.h b/wolfmqtt/mqtt_types.h
index 8d70c2b..d822aca 100644
--- a/wolfmqtt/mqtt_types.h
+++ b/wolfmqtt/mqtt_types.h
@@ -91,7 +91,7 @@
#include <dispatch/dispatch.h>
typedef dispatch_semaphore_t wm_Sem;

- #elif defined(__FreeBSD__) || defined(__linux__)
+ #elif defined(__FreeBSD__) || defined(__linux__) || defined(RIOT_OS)
/* Posix Style Semaphore */
#define WOLFMQTT_POSIX_SEMAPHORES
#include <semaphore.h>
diff --git a/wolfmqtt_examples/mqttexample.c b/wolfmqtt_examples/mqttexample.c
index 42e8035..722cb17 100644
--- a/wolfmqtt_examples/mqttexample.c
+++ b/wolfmqtt_examples/mqttexample.c
@@ -211,7 +211,16 @@ void mqtt_show_usage(MQTTCtx* mqttCtx)
diff --git a/examples/mqttexample.c b/examples/mqttexample.c
index b375156..e919cf0 100644
--- a/examples/mqttexample.c
+++ b/examples/mqttexample.c
@@ -245,7 +245,16 @@ void mqtt_show_usage(MQTTCtx* mqttCtx)
void mqtt_init_ctx(MQTTCtx* mqttCtx)
{
XMEMSET(mqttCtx, 0, sizeof(MQTTCtx));
Expand All @@ -44,11 +31,11 @@ index 42e8035..722cb17 100644
mqttCtx->qos = DEFAULT_MQTT_QOS;
mqttCtx->clean_session = 1;
mqttCtx->keep_alive_sec = DEFAULT_KEEP_ALIVE_SEC;
diff --git a/wolfmqtt_examples/mqttnet.c b/wolfmqtt_examples/mqttnet.c
index f53a8ea..97a51ba 100644
--- a/wolfmqtt_examples/mqttnet.c
+++ b/wolfmqtt_examples/mqttnet.c
@@ -96,6 +96,31 @@
diff --git a/examples/mqttnet.c b/examples/mqttnet.c
index 8bd298a..0b10c87 100644
--- a/examples/mqttnet.c
+++ b/examples/mqttnet.c
@@ -102,6 +102,31 @@
#error wolfMQTT must be built with WOLFMQTT_NONBLOCK defined for Harmony
#endif

Expand Down Expand Up @@ -80,15 +67,15 @@ index f53a8ea..97a51ba 100644
/* Linux */
#else
#include <sys/types.h>
@@ -557,7 +582,6 @@ static int NetConnect(void *context, const char* host, word16 port,
@@ -568,7 +593,6 @@ static int NetConnect(void *context, const char* host, word16 port,
int timeout_ms)
{
SocketContext *sock = (SocketContext*)context;
- int type = SOCK_STREAM;
int rc = -1;
SOERROR_T so_error = 0;
struct addrinfo *result = NULL;
@@ -572,12 +596,28 @@ static int NetConnect(void *context, const char* host, word16 port,
@@ -583,12 +607,28 @@ static int NetConnect(void *context, const char* host, word16 port,
host, port, timeout_ms, mqttCtx->use_tls);

XMEMSET(&hints, 0, sizeof(hints));
Expand Down Expand Up @@ -119,7 +106,7 @@ index f53a8ea..97a51ba 100644

rc = getaddrinfo(host, NULL, &hints, &result);
if (rc == 0) {
@@ -588,18 +628,34 @@ static int NetConnect(void *context, const char* host, word16 port,
@@ -599,18 +639,34 @@ static int NetConnect(void *context, const char* host, word16 port,
goto exit;
}

Expand Down Expand Up @@ -160,7 +147,7 @@ index f53a8ea..97a51ba 100644
}
else {
rc = -1;
@@ -614,7 +670,8 @@ static int NetConnect(void *context, const char* host, word16 port,
@@ -625,7 +681,8 @@ static int NetConnect(void *context, const char* host, word16 port,
rc = -1;

/* Create socket */
Expand All @@ -170,15 +157,16 @@ index f53a8ea..97a51ba 100644
if (sock->fd == SOCKET_INVALID)
goto exit;

@@ -642,8 +699,17 @@ static int NetConnect(void *context, const char* host, word16 port,
@@ -652,9 +709,17 @@ static int NetConnect(void *context, const char* host, word16 port,
}
#endif

+ /* Default to error */
+ rc = -1;
+
/* Start connect */
- rc = SOCK_CONNECT(sock->fd, (struct sockaddr*)&sock->addr, sizeof(sock->addr));
- rc = SOCK_CONNECT(sock->fd, (struct sockaddr*)&sock->addr,
- sizeof(sock->addr));
+ if (sock->addr.ss_family == AF_INET) {
+ rc = SOCK_CONNECT(sock->fd, (struct sockaddr*) &sock->addr, sizeof(struct sockaddr_in));
+ }
Expand All @@ -187,9 +175,9 @@ index f53a8ea..97a51ba 100644
+ }
+
if (rc < 0) {
/* Check for error */
socklen_t len = sizeof(so_error);
@@ -687,8 +753,7 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
/* set default error case */
rc = MQTT_CODE_ERROR_NETWORK;
@@ -702,8 +767,7 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
int timeout_ms)
{
SocketContext *sock = (SocketContext*)context;
Expand All @@ -199,8 +187,8 @@ index f53a8ea..97a51ba 100644
SOERROR_T so_error = 0;
struct addrinfo *result = NULL;
struct addrinfo hints;
@@ -697,13 +762,29 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
PRINTF("NetConnect: Host %s, Port %u, Timeout %d ms, Use TLS %d\n",
@@ -712,13 +776,29 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
PRINTF("NetConnect: Host %s, Port %u, Timeout %d ms, Use TLS %d",
host, port, timeout_ms, mqttCtx->use_tls);

- /* Get address information for host and locate IPv4 */
Expand Down Expand Up @@ -234,7 +222,7 @@ index f53a8ea..97a51ba 100644

rc = getaddrinfo(host, NULL, &hints, &result);
if (rc == 0) {
@@ -714,18 +795,34 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
@@ -729,18 +809,34 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
goto exit;
}

Expand All @@ -243,11 +231,11 @@ index f53a8ea..97a51ba 100644
- if (result_i->ai_family == AF_INET)
+ if (hints.ai_family == AF_UNSPEC) {
+ /* take first result which is either IPv4 or IPv6 */
break;
+ break;
+ }
+ else if (hints.ai_family == result_i->ai_family) {
+ /* take first matching IPv4/IPv6 result */
+ break;
break;
+ }
+
result_i = result_i->ai_next;
Expand Down Expand Up @@ -275,7 +263,7 @@ index f53a8ea..97a51ba 100644
}
else {
rc = -1;
@@ -736,16 +833,17 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
@@ -751,16 +847,17 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
if (rc != 0)
goto exit;

Expand All @@ -301,15 +289,16 @@ index f53a8ea..97a51ba 100644
#ifndef WOLFMQTT_NO_TIMEOUT
fd_set fdset;
struct timeval tv;
@@ -758,8 +856,16 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
@@ -773,9 +870,16 @@ static int SN_NetConnect(void *context, const char* host, word16 port,
(void)timeout_ms;
#endif /* !WOLFMQTT_NO_TIMEOUT */

+ /* Default to error */
+ rc = -1;
+
/* Start connect */
- rc = SOCK_CONNECT(sock->fd, (struct sockaddr*)&sock->addr, sizeof(sock->addr));
- rc = SOCK_CONNECT(sock->fd, (struct sockaddr*)&sock->addr,
- sizeof(sock->addr));
+ if (sock->addr.ss_family == AF_INET) {
+ rc = SOCK_CONNECT(sock->fd, (struct sockaddr*) &sock->addr, sizeof(struct sockaddr_in));
+ }
Expand All @@ -319,16 +308,7 @@ index f53a8ea..97a51ba 100644
}

exit:
@@ -895,7 +1001,7 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
}
/* Check if rx or error */
#ifdef WOLFMQTT_ENABLE_STDIN_CAP
- else if ((!mqttCtx->test_mode && FD_ISSET(STDIN, &recvfds))
+ else if ((!mqttCtx->test_mode && FD_ISSET(STDIN, &recvfds))
#ifdef WOLFMQTT_MULTITHREAD
|| FD_ISSET(sock->pfd[0], &recvfds)
#endif
@@ -903,9 +1009,11 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
@@ -918,9 +1022,11 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
return MQTT_CODE_STDIN_WAKE;
}
#endif
Expand All @@ -342,7 +322,7 @@ index f53a8ea..97a51ba 100644
}
}
else {
@@ -1041,6 +1149,9 @@ int MqttClientNet_Init(MqttNet* net, MQTTCtx* mqttCtx)
@@ -1054,6 +1160,9 @@ int MqttClientNet_Init(MqttNet* net, MQTTCtx* mqttCtx)
}
#endif /* MICROCHIP_MPLAB_HARMONY */

Expand All @@ -352,16 +332,7 @@ index f53a8ea..97a51ba 100644
if (net) {
SocketContext* sockCtx;

@@ -1059,7 +1170,7 @@ int MqttClientNet_Init(MqttNet* net, MQTTCtx* mqttCtx)
sockCtx->fd = SOCKET_INVALID;
sockCtx->stat = SOCK_BEGIN;
sockCtx->mqttCtx = mqttCtx;
-
+
#if defined(WOLFMQTT_MULTITHREAD) && defined(WOLFMQTT_ENABLE_STDIN_CAP)
/* setup the pipe for waking select() */
if (pipe(sockCtx->pfd) != 0) {
@@ -1075,6 +1186,9 @@ int MqttClientNet_Init(MqttNet* net, MQTTCtx* mqttCtx)
@@ -1088,6 +1197,9 @@ int MqttClientNet_Init(MqttNet* net, MQTTCtx* mqttCtx)
#ifdef WOLFMQTT_SN
int SN_ClientNet_Init(MqttNet* net, MQTTCtx* mqttCtx)
{
Expand All @@ -371,12 +342,12 @@ index f53a8ea..97a51ba 100644
if (net) {
SocketContext* sockCtx;

diff --git a/wolfmqtt_examples/sn-client/sn-client.c b/wolfmqtt_examples/sn-client/sn-client.c
index 8dffc14..607986b 100644
--- a/wolfmqtt_examples/sn-client/sn-client.c
+++ b/wolfmqtt_examples/sn-client/sn-client.c
@@ -460,8 +460,17 @@ int main(int argc, char** argv)
mqttCtx.app_name = "sn-client";
diff --git a/examples/sn-client/sn-client.c b/examples/sn-client/sn-client.c
index 38ade12..3492280 100644
--- a/examples/sn-client/sn-client.c
+++ b/examples/sn-client/sn-client.c
@@ -683,8 +683,17 @@ int main(int argc, char** argv)
mqttCtx.client_id = DEFAULT_CLIENT_ID"-SN";

/* Settings for MQTT-SN gateway */
- mqttCtx.host = "localhost";
Expand All @@ -395,6 +366,19 @@ index 8dffc14..607986b 100644

/* parse arguments */
rc = mqtt_parse_args(&mqttCtx, argc, argv);
diff --git a/wolfmqtt/mqtt_types.h b/wolfmqtt/mqtt_types.h
index f8e8f4d..edbe5ea 100644
--- a/wolfmqtt/mqtt_types.h
+++ b/wolfmqtt/mqtt_types.h
@@ -95,7 +95,7 @@
dispatch_semaphore_t sem;
} wm_Sem;

- #elif defined(__FreeBSD__) || defined(__linux__) || defined(__QNX__)
+ #elif defined(__FreeBSD__) || defined(__linux__) || defined(__QNX__) || defined(RIOT_OS)
/* Posix Style Pthread Mutex and Conditional */
#define WOLFMQTT_POSIX_SEMAPHORES
#include <pthread.h>
--
2.25.1

Loading