nanocoap_sock.h File Reference

nanocoap high-level API More...

Detailed Description

nanocoap high-level API

Kaspar Schleiser

Definition in file nanocoap_sock.h.

#include <stdint.h>
#include <unistd.h>
#include "net/sock/udp.h"
+ Include dependency graph for nanocoap_sock.h:

Go to the source code of this file.


int nanocoap_server (sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
 Start a nanocoap server instance. More...
ssize_t nanocoap_get (sock_udp_ep_t *remote, const char *path, uint8_t *buf, size_t len)
 Simple synchronous CoAP get. More...

Function Documentation

◆ nanocoap_get()

ssize_t nanocoap_get ( sock_udp_ep_t remote,
const char *  path,
uint8_t *  buf,
size_t  len 

Simple synchronous CoAP get.

[in]remoteremote UDP endpoint
[in]pathremote path
[out]bufbuffer to write response to
[in]lenlength of buffer
length of response on success
<0 on error

◆ nanocoap_server()

int nanocoap_server ( sock_udp_ep_t local,
uint8_t *  buf,
size_t  bufsize 

Start a nanocoap server instance.

This function only returns if there's an error binding to local, or if receiving of UDP packets fails.

[in]locallocal UDP endpoint to bind to
[in]bufinput buffer to use
[in]bufsizesize of buf
-1 on error