2017-07-24 17:42:26 +02:00
|
|
|
/*
|
2018-04-12 11:27:19 +02:00
|
|
|
* Copyright (C) 2017-2018 Freie Universität Berlin
|
2017-07-24 17:42:26 +02:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup net_rdcli_simple Simple CoRE Resource Directory Registration
|
|
|
|
* @ingroup net_rdcli
|
|
|
|
* @brief CoAP-based CoRE Resource Directory client supporting the simple
|
|
|
|
* registration only
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Interface for a simple CoRE RD registration
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NET_RDCLI_SIMPLE_H
|
|
|
|
#define NET_RDCLI_SIMPLE_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-04-12 11:27:19 +02:00
|
|
|
/**
|
|
|
|
* @brief Error codes used by the rdcli_simple implementation
|
|
|
|
*/
|
|
|
|
enum {
|
2018-04-12 11:28:05 +02:00
|
|
|
RDCLI_SIMPLE_OK = 0, /**< all good */
|
|
|
|
RDCLI_SIMPLE_NOADDR = -1, /**< on address conversion errors */
|
|
|
|
RDCLI_SIMPLE_ERROR = -2, /**< on other errors */
|
2018-04-12 11:27:19 +02:00
|
|
|
};
|
|
|
|
|
2017-07-24 17:42:26 +02:00
|
|
|
/**
|
|
|
|
* @brief Initiate the node registration by sending an empty CoAP POST message
|
|
|
|
* to the RD server's /.well-known/core resource
|
2018-04-12 11:27:19 +02:00
|
|
|
*
|
|
|
|
* @return RDCLI_SIMPLE_OK on success
|
2018-04-12 11:28:05 +02:00
|
|
|
* @return RDCLI_SIMPLE_NOADDR if conversion of RD address fails
|
|
|
|
* @return RDCLI_SIMPLE_ERROR if something goes wrong preparing or sending the
|
2018-04-12 11:27:19 +02:00
|
|
|
* initial request
|
2017-07-24 17:42:26 +02:00
|
|
|
*/
|
|
|
|
int rdcli_simple_register(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Spawn a new thread that registers the node and updates the
|
|
|
|
* registration with all responding RDs using the simple registration
|
|
|
|
* process
|
|
|
|
*/
|
|
|
|
void rdcli_simple_run(void);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* NET_RDCLI_SIMPLE_H */
|
|
|
|
/** @} */
|