CoRE RD Endpoint

Library for using RIOT as CoRE Resource Directory endpoint.

Design Decisions

  • all operations provided by this module are fully synchronous, meaning that the functions will block until an operation is successful or will time out
  • the implementation limits the endpoint to be registered with a single RD at any point in time

enum @182
CORD_EP_OK =  0
everything went as expected
CORD_EP_TIMEOUT = -1
no response from the network
CORD_EP_ERR = -2
internal error or invalid reply
CORD_EP_NORD = -3
not connected to an RD
CORD_EP_OVERFLOW = -4
internal buffers can not handle input
int cord_ep_discover_regif(const sock/udp.h::sock_udp_ep_t * remote, char * regif, msp430_types.h::size_t maxlen)

Discover the registration interface resource of a RD.

Parameters

remote:remote endpoint of the target RD
regif:the registration interface is written to this buffer
maxlen:size of regif

Return values

  • CORD_EP_OK on success
  • CORD_EP_TIMEOUT if the discovery request times out
  • CORD_EP_NORD if addressed endpoint is not a RD
  • CORD_EP_ERR on any other internal error
int cord_ep_register(const sock/udp.h::sock_udp_ep_t * remote, const char * regif)

Initiate the node registration by sending an empty push.

  • if registration fails (e.g. timeout), we are not associated with any RD anymore (even if we have been before we called cord_ep_register)

Note

In case a multicast address is given, the regif parameter MUST be NULL. The first RD responding to the request will be chosen and all replies from other RD servers are ignored.

Parameters

remote:remote endpoint of the target RD
regif:registration interface resource of the RD, it will be discovered automatically when set to NULL

Return values

  • CORD_EP_OK on success
  • CORD_EP_TIMEOUT on registration timeout
  • CORD_EP_NORD if addressed endpoint is not a RD
  • CORD_EP_OVERFLOW if regif does not fit into internal buffer
  • CORD_EP_ERR on any other internal error
int cord_ep_update(void)

Update our current entry at the RD.

Return values

  • CORD_EP_OK on success
  • CORD_EP_TIMEOUT if the update request times out
  • CORD_EP_ERR on any other internal error
int cord_ep_remove(void)

Unregister from a given RD server.

Return values

  • CORD_EP_OK on success
  • CORD_EP_TIMEOUT if the remove request times out
  • CORD_EP_ERR on any other internal error
void cord_ep_dump_status(void)

Dump the current RD connection status to STDIO (for debugging)