1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/include/net
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
..
bluetil
cord
dhcpv6
ethernet
fib
gnrc Merge pull request #13485 from miri64/gnrc_dhcpv6/enh/configure-context 2020-03-25 16:48:11 +01:00
iana
ipv4
ipv6
lorawan sys/net/lorawan: fix broken links 2020-03-24 10:39:49 +01:00
ppp
rpl
sixlowpan
skald
sock Merge pull request #13616 from miri64/sock/enh/recv_buf 2020-03-24 17:10:12 +01:00
af.h
arp.h
asymcute.h
ble.h
coap.h
credman.h
csma_sender.h
dhcpv6.h
dns.h
dtls.h
eddystone.h
emcute.h
ethernet.h
ethertype.h
eui48.h
eui64.h sys/net/eui64: fix broken links 2020-03-24 10:39:49 +01:00
fib.h
gcoap.h Merge pull request #13240 from kb2ma/gcoap/deprecate_add_qstring 2020-03-13 08:04:50 -04:00
gnrc.h
icmp.h
icmpv6.h
ieee802154.h
inet_csum.h
ipv4.h
ipv6.h
l2filter.h
l2util.h
lora.h
loramac.h
mqttsn.h
nanocoap_sock.h
nanocoap.h nanocoap: add payload helper functions 2020-05-01 13:58:22 +02:00
ndp.h
netdev_test.h
netif.h
netopt.h
netstats.h
ntp_packet.h
packet.h
ppptype.h
protnum.h
sixlowpan.h
skald.h
sntp.h
sock.h sock: amend with zero-copy receive functions 2020-03-24 14:02:36 +01:00
tcp.h
udp.h
uhcp.h
zep.h