Commit Graph
280 Commits
Author SHA1 Message Date
Ken Bannister 595e8c631f Merge pull request #13726 from benpicco/nanocoap-payload_helper
nanocoap: add payload helper functions
2020-05-03 08:56:30 -04:00
Benjamin Valentin e5c20b143d nanocoap: add coap_payload_put_char() 2020-05-01 13:58:22 +02:00
Benjamin Valentin 2751708341 nanocoap: add payload helper functions
This adds two functions `coap_payload_add()` and `coap_payload_advance()`.

 - `coap_payload_add()` will add n bytes to the payload buffer and advance
    payload pointer accordingly.

    const char hello[] = "Hello CoAP!";
    coap_payload_add(pkt, hello, sizeof(hello));

 - `coap_payload_advance()` will advance the payload buffer after data
    has been added to it.

    int len = snprintf(pkt->payload, pkt->payload_len, "%s %s!", "Hello", "CoAP");
    coap_payload_advance(pkt, len);

I considered adding an additional parameter to keep track of the total request size
(returned size from coap_opt_finish() incremented by each added payload fragment),
but decided against it to keep consistency with the existing API.
2020-05-01 13:58:22 +02:00
Leandro Lanzieri b91c8502dc net/nanocoap/kconfig: Explicitly define type of MODULE_NANOCOAP 2020-04-27 10:06:01 +02:00
Leandro Lanzieri eeea9b7dae net/coap: Expose configurations to Kconfig 2020-04-24 10:06:45 +02:00
Leandro Lanzieri 9e427e1584 net/coap: Move COAP_MAX_RETRANSMIT to 'CONFIG' namespace
COAP_MAX_RETRANSMIT is moved to the compile time configuration macro
namespace.
2020-04-24 10:06:43 +02:00
Leandro Lanzieri afe4244ac9 net/coap: Move COAP_RANDOM_FACTOR_1000 to 'CONFIG' namespace
COAP_RANDOM_FACTOR_1000 is moved to the compile time configuration macro
namespace.
2020-04-24 10:06:43 +02:00
Leandro Lanzieri 072a0d8563 net/coap: Move COAP_ACK_TIMEOUT to 'CONFIG' namespace
COAP_ACK_TIMEOUT is moved to the compile time configuration macro
namespace.
2020-04-24 10:06:40 +02:00
Cenk Gündoğan ea616abfda nanocoap: allow coap_opt_add_string() for zero-terminated strings 2020-04-22 12:28:48 +02:00
Leandro Lanzieri 46507ff247 Merge pull request #13894 from kb2ma/gcoap/ping
net/gcoap: add CoAP ping request
2020-04-21 12:23:54 +02:00
Cenk Gündoğan 6859de7855 nanocoap: export coap_opt_get_uint() 2020-04-17 22:39:44 +02:00
Ken Bannister 6eae4ded84 net/gcoap: create CoAP ping request 2020-04-17 08:15:20 -04:00
Ken Bannister f5a85e2aff net/gcoap: handle CoAP ping request 2020-04-17 08:15:20 -04:00
Ken Bannister 2d3eb1a343 net/nanocoap: validate empty message length 2020-04-17 08:15:20 -04:00
Leandro Lanzieri 0137a06896 net/nanocoap: Expose configurations to Kconfig 2020-04-07 17:00:55 +02:00
Leandro Lanzieri e80dcf2d8b net/application_layer: Add Kconfig file and CoAP menu 2020-04-07 17:00:54 +02:00
Leandro Lanzieri b6be8af81c net/nanocoap: Move NANOCOAP_QS_MAX to 'CONFIG_' namespace 2020-04-07 17:00:53 +02:00
Leandro Lanzieri 2f72189aa2 net/nanocoap: Move NANOCOAP_BLOCK_SIZE_EXP_MAX to 'CONFIG_' namespace 2020-04-07 17:00:53 +02:00
Leandro Lanzieri 4052c01e85 net/nanocoap: Move NANOCOAP_URI_MAX to 'CONFIG_' namespace 2020-04-07 17:00:53 +02:00
Leandro Lanzieri c84576ef6e net/nanocoap: Move NANOCOAP_NOPTS_MAX to 'CONFIG_' namespace 2020-04-07 17:00:52 +02:00
Ken Bannister b32fcd28d1 Merge pull request #13815 from kb2ma/nanocoap/add_canonical_uri_query
net/gcoap: add canonical uri query function names
2020-04-07 06:32:13 -04:00
Ken Bannister 5d95436334 net/cord: use canonical function name to add Uri-Query option 2020-04-06 06:19:44 -04:00
Ken Bannister d57340c964 net/nanocoap: use new Uri-Query functions as primary implementation 2020-04-06 06:19:44 -04:00
Martine Lenders 5c95df3151 Merge pull request #13806 from benpicco/sys/net/dhcpv6-multiple_prefixes
sys/net/dhcpv6: fix requesting multiple prefixes
2020-04-05 01:14:27 +02:00
Benjamin Valentin c8b2483de5 net/gcoap: make use of coap_opt_add_path() 2020-04-04 17:06:04 +02:00
Benjamin Valentin 0e5595cffd sys/net/dhcpv6: fix requesting multiple prefixes
There were two subtle bugs that prevented the DHCPv6 client to request
multiple prefixes for different interfaces.

 - `dhcpv6_client_req_ia_pd()` would fill up *all* leases with the same interface
 - `_parse_reply()` would return after parsing the first answer

With this patch, `gnrc_border_router` gets a prefix on both interfaces of the at86rf215.
2020-04-03 17:02:57 +02:00
Cenk Gündoğan 50900a1fbe nanocoap: add convenience function for PROXY_URI 2020-03-28 14:50:51 +01:00
Cenk Gündoğan 5e42e26a6e nanocoap: add const qualifier to pkt of coap_opt_get_opaque() 2020-03-25 13:38:21 +01:00
Koen Zandberg 1d5010e126 nanocoap: make separate tree handling function
This refactors nanocoap to seperate out the resource tree parsing. It
allows for calling the tree handler with custom resource trees. The
advantage is that a resource with COAP_MATCH_SUBTREE can parse a new
separate resource tree.
2020-03-23 15:08:53 +01:00
Ken Bannister ec2aff4546 Merge pull request #13240 from kb2ma/gcoap/deprecate_add_qstring
net/coap: deprecate gcoap_add_qstring() and update uses
2020-03-13 08:04:50 -04:00
Martine Lenders 20e30ec58b Merge pull request #13622 from gschorcht/net/dhcpv6_fix_opt_len
sys/net/dhcpv6: fixes option length handling in client implementation
2020-03-12 18:56:43 +01:00
Gunar Schorcht a25c61bc8b sys/net/dhcpv6: fix client option length handling 2020-03-12 18:33:17 +01:00
benpicco 1212165222 Merge pull request #13584 from kb2ma/nanocoap/add_uquery_improvements
net/nanocoap: add uquery improvements
2020-03-12 15:18:07 +01:00
Ken Bannister c55837d809 net/nanocoap: add query option directly 2020-03-12 08:44:26 -04:00
Martine S. Lenders 411e320b0c sock_async_event: update for async callback argument support 2020-03-11 16:54:12 +01:00
Martine S. Lenders 6e6e435c65 sock_async: add optional callback argument 2020-03-11 16:54:11 +01:00
Aiman Ismail 64f9658472 nanocoap: add coap_opt_add_uquery2() 2020-03-05 19:06:14 +01:00
Martine Lenders ec6c07d35d Merge pull request #13424 from miri64/examples/enh/dhcpv6-br
examples/gnrc_border_router: add optional DHCPv6 support
2020-02-25 20:08:31 +01:00
benpicco d044800300 Merge pull request #13450 from benpicco/dns-fixes
fix DNS resolution in ping6
2020-02-24 21:58:34 +01:00
Benjamin Valentin 1de14931b8 sock_dns: use the same buffer for request & reply
Saving RAM is more important than saving a few cycles
used by re-creating the request buffer in the error case.

Also reduce the size of the buffer to 128 bytes.
If we are just requesting the AAAA record it is unlikely
for the reply to take up the maximum size of 512 bytes.

We were already placing restrictions on the domain name length,
those are now actually a bit more relaxed (112 bytes instead of 64)
2020-02-24 14:29:17 +01:00
Benjamin Valentin e9a40933f7 sock_dns: fix off-by-one error in _parse_dns_reply() 2020-02-24 14:19:50 +01:00
Ken Bannister e98a6e5932 net/gcoap: update copyright date 2020-02-24 06:22:04 -05:00
Ken Bannister c8cd3f0229 net/gcoap: fix vera++ code style warnings 2020-02-24 06:20:43 -05:00
Ken Bannister 9b63abb718 net/gcoap: cast required for pic32 platform
Fixes bug found during rework for sock_async implementation.
2020-02-22 05:46:07 -05:00
Ken Bannister 0dc1e4c4e7 net/gcoap: fix when no timeout event
Fixes bug found during rework for sock_async implementation.
2020-02-22 05:46:07 -05:00
Martine S. Lenders b929d013d8 dhcpv6_client: re-send SOLICITs after failed ADVERTISE 2020-02-20 16:41:48 +01:00
Ken Bannister d6fa3c7c2f net/gcoap: add timeout event/handler for server response 2020-02-16 09:17:48 -05:00
Ken Bannister ea62734baf net/gcoap: add sock_async event handling
Rework from earlier custom event/msg handling.
2020-02-16 09:17:48 -05:00
Ken Bannister 7f3e953893 net/cord: update for deprecated gcoap function 2020-01-30 06:00:53 -05:00
Ken Bannister 0ed4fe2da6 net/coap: move/rename function to add query option 2020-01-29 09:23:47 -05:00