diff --git a/os/net/app-layer/coap/coap-block1.c b/os/net/app-layer/coap/coap-block1.c index d39e3d730..e08a321d1 100644 --- a/os/net/app-layer/coap/coap-block1.c +++ b/os/net/app-layer/coap/coap-block1.c @@ -36,6 +36,11 @@ * Lars Schmertmann */ +/** + * \addtogroup coap + * @{ + */ + #include #include @@ -47,7 +52,7 @@ #define LOG_MODULE "coap-block1" #define LOG_LEVEL LOG_LEVEL_COAP -/*----------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ /** * \brief Block 1 support within a coap-ressource @@ -111,3 +116,5 @@ coap_block1_handler(coap_message_t *request, coap_message_t *response, return 0; } +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-block1.h b/os/net/app-layer/coap/coap-block1.h index 2d61eaf36..50638ef66 100644 --- a/os/net/app-layer/coap/coap-block1.h +++ b/os/net/app-layer/coap/coap-block1.h @@ -36,6 +36,11 @@ * Lars Schmertmann */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_BLOCK1_H_ #define COAP_BLOCK1_H_ @@ -47,3 +52,4 @@ int coap_block1_handler(coap_message_t *request, coap_message_t *response, uint8_t *target, size_t *len, size_t max_len); #endif /* COAP_BLOCK1_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-blocking-api.c b/os/net/app-layer/coap/coap-blocking-api.c index c8e8a1c6c..0d2c5dc58 100644 --- a/os/net/app-layer/coap/coap-blocking-api.c +++ b/os/net/app-layer/coap/coap-blocking-api.c @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #include "coap-engine.h" #include "coap-blocking-api.h" #include "sys/cc.h" @@ -128,3 +133,4 @@ PT_THREAD(coap_blocking_request PT_END(&state->pt); } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-blocking-api.h b/os/net/app-layer/coap/coap-blocking-api.h index 4a8fba6f0..d9a916c04 100644 --- a/os/net/app-layer/coap/coap-blocking-api.h +++ b/os/net/app-layer/coap/coap-blocking-api.h @@ -29,6 +29,11 @@ * This file is part of the Contiki operating system. */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_BLOCKING_API_H_ #define COAP_BLOCKING_API_H_ @@ -65,3 +70,4 @@ PT_THREAD(coap_blocking_request } #endif /* COAP_BLOCKING_API_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-callback-api.c b/os/net/app-layer/coap/coap-callback-api.c index a83806727..fe3cac6c0 100644 --- a/os/net/app-layer/coap/coap-callback-api.c +++ b/os/net/app-layer/coap/coap-callback-api.c @@ -37,6 +37,10 @@ * Joakim Eriksson, joakime@sics.se */ +/** + * \addtogroup coap + * @{ + */ #include "coap-engine.h" #include "coap-callback-api.h" @@ -151,3 +155,5 @@ coap_send_request(coap_request_state_t *state, coap_endpoint_t *endpoint, progress_request(state); } +/*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-callback-api.h b/os/net/app-layer/coap/coap-callback-api.h index 612157587..6de7ab587 100644 --- a/os/net/app-layer/coap/coap-callback-api.h +++ b/os/net/app-layer/coap/coap-callback-api.h @@ -37,6 +37,11 @@ * Joakim Eriksson, joakime@sics.se */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_CALLBACK_API_H_ #define COAP_CALLBACK_API_H_ @@ -65,3 +70,4 @@ void coap_send_request(coap_request_state_t *state, coap_endpoint_t *endpoint, void (*callback)(coap_request_state_t *state)); #endif /* COAP_CALLBACK_API_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-conf.h b/os/net/app-layer/coap/coap-conf.h index 17f140243..911017ed8 100644 --- a/os/net/app-layer/coap/coap-conf.h +++ b/os/net/app-layer/coap/coap-conf.h @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_CONF_H_ #define COAP_CONF_H_ @@ -99,3 +104,4 @@ #endif /* COAP_OBSERVE_REFRESH_INTERVAL */ #endif /* COAP_CONF_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-constants.h b/os/net/app-layer/coap/coap-constants.h index 574da4759..f73a5b950 100644 --- a/os/net/app-layer/coap/coap-constants.h +++ b/os/net/app-layer/coap/coap-constants.h @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_CONSTANTS_H_ #define COAP_CONSTANTS_H_ @@ -184,3 +189,4 @@ typedef enum { } coap_resource_flags_t; #endif /* COAP_CONSTANTS_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-endpoint.h b/os/net/app-layer/coap/coap-endpoint.h index 705b10fa2..1174a774b 100644 --- a/os/net/app-layer/coap/coap-endpoint.h +++ b/os/net/app-layer/coap/coap-endpoint.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, SICS, Swedish ICT AB. + * Copyright (c) 2016-2018, SICS, Swedish ICT AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +35,11 @@ * Joakim Eriksson */ +/** + * \addtogroup coap-transport + * @{ + */ + #ifndef COAP_ENDPOINT_H_ #define COAP_ENDPOINT_H_ @@ -51,24 +56,92 @@ typedef struct { } coap_endpoint_t; #endif /* COAP_ENDPOINT_CUSTOM */ -void coap_endpoint_copy(coap_endpoint_t *destination, - const coap_endpoint_t *from); +/** + * \brief Copy a CoAP endpoint from one memory area to another. + * + * \param dest A pointer to a CoAP endpoint to copy to. + * \param src A pointer to a CoAP endpoint to copy from. + */ +void coap_endpoint_copy(coap_endpoint_t *dest, const coap_endpoint_t *src); +/** + * \brief Compare two CoAP endpoints. + * + * \param dest A pointer to the first CoAP endpoint. + * \param src A pointer to the second CoAP endpoint. + * \return Non-zero if the endpoints are identical and zero otherwise. + */ int coap_endpoint_cmp(const coap_endpoint_t *e1, const coap_endpoint_t *e2); +/** + * \brief Print a CoAP endpoint via the logging module. + * + * \param ep A pointer to the CoAP endpoint to log. + */ void coap_endpoint_log(const coap_endpoint_t *ep); + +/** + * \brief Print a CoAP endpoint. + * + * \param ep A pointer to the CoAP endpoint to print. + */ void coap_endpoint_print(const coap_endpoint_t *ep); + +/** + * \brief Print a CoAP endpoint to a string. The output is always + * null-terminated unless size is zero. + * + * \param str The string to write to. + * \param size The max number of characters to write. + * \param ep A pointer to the CoAP endpoint to print. + * \return Returns the number of characters needed for the output + * excluding the ending null-terminator or negative if an + * error occurred. + */ int coap_endpoint_snprint(char *str, size_t size, const coap_endpoint_t *ep); +/** + * \brief Parse a CoAP endpoint. + * + * \param text The string to parse. + * \param size The max number of characters in the string. + * \param ep A pointer to the CoAP endpoint to write to. + * \return Returns non-zero if the endpoint was successfully parsed and + * zero otherwise. + */ int coap_endpoint_parse(const char *text, size_t size, coap_endpoint_t *ep); +/** + * \brief Check if a CoAP endpoint is secure (encrypted). + * + * \param ep A pointer to a CoAP endpoint. + * \return Returns non-zero if the endpoint is secure and zero otherwise. + */ int coap_endpoint_is_secure(const coap_endpoint_t *ep); +/** + * \brief Check if a CoAP endpoint is connected. + * + * \param ep A pointer to a CoAP endpoint. + * \return Returns non-zero if the endpoint is connected and zero otherwise. + */ int coap_endpoint_is_connected(const coap_endpoint_t *ep); +/** + * \brief Request a connection to a CoAP endpoint. + * + * \param ep A pointer to a CoAP endpoint. + * \return Returns zero if an error occured and non-zero otherwise. + */ int coap_endpoint_connect(coap_endpoint_t *ep); +/** + * \brief Request that any connection to a CoAP endpoint is discontinued. + * + * \param ep A pointer to a CoAP endpoint. + */ void coap_endpoint_disconnect(coap_endpoint_t *ep); #endif /* COAP_ENDPOINT_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-engine.c b/os/net/app-layer/coap/coap-engine.c index 25d48671e..1327cb3e6 100644 --- a/os/net/app-layer/coap/coap-engine.c +++ b/os/net/app-layer/coap/coap-engine.c @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #include "coap-engine.h" #include "sys/cc.h" #include "lib/list.h" @@ -506,3 +511,4 @@ process_callback(coap_timer_t *t) } } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-engine.h b/os/net/app-layer/coap/coap-engine.h index 48cd4cb63..140ed0211 100644 --- a/os/net/app-layer/coap/coap-engine.h +++ b/os/net/app-layer/coap/coap-engine.h @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_ENGINE_H_ #define COAP_ENGINE_H_ @@ -170,3 +175,4 @@ coap_resource_t *coap_get_next_resource(coap_resource_t *resource); #include "coap-transport.h" #endif /* COAP_ENGINE_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-keystore-simple.c b/os/net/app-layer/coap/coap-keystore-simple.c index e195f1b33..1eb8737e9 100644 --- a/os/net/app-layer/coap/coap-keystore-simple.c +++ b/os/net/app-layer/coap/coap-keystore-simple.c @@ -36,6 +36,11 @@ * Joakim Eriksson */ +/** + * \addtogroup coap-keystore + * @{ + */ + #include "coap-endpoint.h" #include "coap-keystore.h" #include @@ -89,3 +94,4 @@ coap_keystore_simple_init(void) #endif /* WITH_DTLS */ } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-keystore-simple.h b/os/net/app-layer/coap/coap-keystore-simple.h index 6e76927e5..2252002d4 100644 --- a/os/net/app-layer/coap/coap-keystore-simple.h +++ b/os/net/app-layer/coap/coap-keystore-simple.h @@ -36,17 +36,27 @@ * Joakim Eriksson */ +/** + * \addtogroup coap-keystore + * @{ + */ + #ifndef COAP_KEYSTORE_SIMPLE_H_ #define COAP_KEYSTORE_SIMPLE_H_ -/* - * Registers a simple CoAP DTLS keystore with fixed PSK credentials. +/** + * \brief Registers a simple CoAP DTLS keystore with fixed pre-shared key + * credentials. * - * The credentials can be configured in project-conf.h + * The credentials can be configured in project-conf.h as shown in the + * following example: * + * ~~~~~~~~~~~~~~~{.c} * #define COAP_DTLS_PSK_DEFAULT_IDENTITY "user" * #define COAP_DTLS_PSK_DEFAULT_KEY "password" + * ~~~~~~~~~~~~~~~ */ void coap_keystore_simple_init(void); #endif /* COAP_KEYSTORE_SIMPLE_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-keystore.h b/os/net/app-layer/coap/coap-keystore.h index ecf45315c..6a3763d5a 100644 --- a/os/net/app-layer/coap/coap-keystore.h +++ b/os/net/app-layer/coap/coap-keystore.h @@ -29,12 +29,33 @@ * */ +/** + * \file + * API for CoAP keystore + * \author + * Niclas Finne + * Joakim Eriksson + */ + +/** + * \addtogroup coap + * @{ + * + * \defgroup coap-keystore CoAP keystore API + * @{ + * + * The CoAP keystore API defines a common interface for retrieving + * authorization information for CoAP/DTLS. + */ + #ifndef COAP_KEYSTORE_H_ #define COAP_KEYSTORE_H_ #include "coap-endpoint.h" -/* Pre-shared key info */ +/** + * The structure of a CoAP pre-shared key info. + */ typedef struct { const uint8_t *identity_hint; uint16_t identity_hint_len; @@ -44,12 +65,24 @@ typedef struct { uint16_t key_len; } coap_keystore_psk_entry_t; -/* the function for getting the data from a keystore */ -typedef struct coap_keystore { +/** + * The structure of a CoAP keystore. + * + * The keystore implementation provides a function callback for each type of + * authorization supported. The API currently only specifies a function + * callback for pre-shared keys. + */ +typedef struct { int (* coap_get_psk_info)(const coap_endpoint_t *address_info, coap_keystore_psk_entry_t *info); } coap_keystore_t; +/** + * \brief Set the CoAP keystore to use by CoAP. + * \param keystore A pointer to a CoAP keystore. + */ void coap_set_keystore(const coap_keystore_t *keystore); #endif /* COAP_KEYSTORE_H_ */ +/** @} */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-log.c b/os/net/app-layer/coap/coap-log.c index 083c9aaf4..36f3bc016 100644 --- a/os/net/app-layer/coap/coap-log.c +++ b/os/net/app-layer/coap/coap-log.c @@ -36,6 +36,11 @@ * Joakim Eriksson */ +/** + * \addtogroup coap + * @{ + */ + #include "coap-log.h" /*---------------------------------------------------------------------------*/ void @@ -52,3 +57,4 @@ coap_log_string(const char *text, size_t len) } } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-log.h b/os/net/app-layer/coap/coap-log.h index 79457bbe4..2e6a0a359 100644 --- a/os/net/app-layer/coap/coap-log.h +++ b/os/net/app-layer/coap/coap-log.h @@ -36,6 +36,11 @@ * Joakim Eriksson */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_LOG_H_ #define COAP_LOG_H_ @@ -73,6 +78,12 @@ #define LOG_INFO_COAP_STRING(text, len) LOG_COAP_STRING(LOG_LEVEL_INFO, text, len) #define LOG_DBG_COAP_STRING(text, len) LOG_COAP_STRING(LOG_LEVEL_DBG, text, len) +/** + * \brief Logs a CoAP string that has a length but might not be 0-terminated. + * \param text The CoAP string + * \param len The number of characters in the CoAP string + */ void coap_log_string(const char *text, size_t len); #endif /* COAP_LOG_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-observe-client.c b/os/net/app-layer/coap/coap-observe-client.c index f264663eb..af1e89f14 100644 --- a/os/net/app-layer/coap/coap-observe-client.c +++ b/os/net/app-layer/coap/coap-observe-client.c @@ -37,6 +37,11 @@ * Daniele Alessandrelli */ +/** + * \addtogroup coap + * @{ + */ + #include "coap.h" #include "coap-observe-client.h" #include "sys/cc.h" @@ -311,3 +316,4 @@ coap_obs_request_registration(const coap_endpoint_t *endpoint, char *uri, return obs; } #endif /* COAP_OBSERVE_CLIENT */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-observe-client.h b/os/net/app-layer/coap/coap-observe-client.h index 5c1a9a816..79625caff 100644 --- a/os/net/app-layer/coap/coap-observe-client.h +++ b/os/net/app-layer/coap/coap-observe-client.h @@ -37,6 +37,11 @@ * Daniele Alessandrelli */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_OBSERVING_CLIENT_H_ #define COAP_OBSERVING_CLIENT_H_ @@ -118,3 +123,4 @@ coap_observee_t *coap_obs_request_registration(const coap_endpoint_t *endpoint, uint8_t coap_generate_token(uint8_t **token_ptr); #endif /* COAP_OBSERVING_CLIENT_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-observe.c b/os/net/app-layer/coap/coap-observe.c index ae3fe843f..ac336fbd8 100644 --- a/os/net/app-layer/coap/coap-observe.c +++ b/os/net/app-layer/coap/coap-observe.c @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #include #include #include "coap-observe.h" @@ -335,3 +340,4 @@ coap_observe_handler(coap_resource_t *resource, coap_message_t *coap_req, } } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-observe.h b/os/net/app-layer/coap/coap-observe.h index 5a78237cb..c276522c5 100644 --- a/os/net/app-layer/coap/coap-observe.h +++ b/os/net/app-layer/coap/coap-observe.h @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_OBSERVE_H_ #define COAP_OBSERVE_H_ @@ -76,3 +81,4 @@ void coap_observe_handler(coap_resource_t *resource, coap_message_t *request, coap_message_t *response); #endif /* COAP_OBSERVE_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-res-well-known-core.c b/os/net/app-layer/coap/coap-res-well-known-core.c index 752cfa90e..2893925c9 100644 --- a/os/net/app-layer/coap/coap-res-well-known-core.c +++ b/os/net/app-layer/coap/coap-res-well-known-core.c @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #include "coap-engine.h" #include #include @@ -205,3 +210,4 @@ well_known_core_get_handler(coap_message_t *request, coap_message_t *response, RESOURCE(res_well_known_core, "ct=40", well_known_core_get_handler, NULL, NULL, NULL); /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-separate.c b/os/net/app-layer/coap/coap-separate.c index 15f20eefa..318a4e53d 100644 --- a/os/net/app-layer/coap/coap-separate.c +++ b/os/net/app-layer/coap/coap-separate.c @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #include "coap.h" #include "coap-separate.h" #include "coap-transactions.h" @@ -144,3 +149,4 @@ coap_separate_resume(coap_message_t *response, coap_separate_t *separate_store, } } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-separate.h b/os/net/app-layer/coap/coap-separate.h index 2f815188a..97cbdbf92 100644 --- a/os/net/app-layer/coap/coap-separate.h +++ b/os/net/app-layer/coap/coap-separate.h @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_SEPARATE_H_ #define COAP_SEPARATE_H_ @@ -69,3 +74,4 @@ void coap_separate_resume(coap_message_t *response, uint8_t code); #endif /* COAP_SEPARATE_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-timer-default.c b/os/net/app-layer/coap/coap-timer-default.c index f0323dfee..ad1b30d28 100644 --- a/os/net/app-layer/coap/coap-timer-default.c +++ b/os/net/app-layer/coap/coap-timer-default.c @@ -35,6 +35,16 @@ * Joakim Eriksson */ +/** + * \addtogroup coap-timer + * @{ + * + * \defgroup coap-timer-default CoAP timer for Contiki-NG + * @{ + * + * This is an implementation of CoAP timer for Contiki-NG. + */ + #include "coap-timer.h" #include "sys/clock.h" #include "sys/etimer.h" @@ -126,3 +136,5 @@ const coap_timer_driver_t coap_timer_default_driver = { .update = update, }; /*---------------------------------------------------------------------------*/ +/** @} */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-timer.c b/os/net/app-layer/coap/coap-timer.c index 30583d33b..06a65c7f6 100644 --- a/os/net/app-layer/coap/coap-timer.c +++ b/os/net/app-layer/coap/coap-timer.c @@ -35,18 +35,20 @@ * Joakim Eriksson */ +/** + * \addtogroup coap-timer + * @{ + */ + #include "coap-timer.h" #include "lib/list.h" +#include "sys/cc.h" /* Log configuration */ #include "coap-log.h" #define LOG_MODULE "coap-timer" #define LOG_LEVEL LOG_LEVEL_NONE -#ifndef NULL -#define NULL 0 -#endif - LIST(timer_list); static uint8_t is_initialized; /*---------------------------------------------------------------------------*/ @@ -183,3 +185,4 @@ coap_timer_init(void) } } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-timer.h b/os/net/app-layer/coap/coap-timer.h index a0aec4b16..0461232ba 100644 --- a/os/net/app-layer/coap/coap-timer.h +++ b/os/net/app-layer/coap/coap-timer.h @@ -35,6 +35,16 @@ * Joakim Eriksson */ +/** + * \addtogroup coap + * @{ + * + * \defgroup coap-timer CoAP timer API + * @{ + * + * The CoAP timer API defines a common interface for CoAP timer and time functionality. + */ + #ifndef COAP_TIMER_H_ #define COAP_TIMER_H_ @@ -65,8 +75,9 @@ typedef struct { extern const coap_timer_driver_t COAP_TIMER_DRIVER; -/* - * milliseconds since boot +/** + * \brief Get the time since boot in milliseconds. + * \return The number of milliseconds since boot. */ static inline uint64_t coap_timer_uptime(void) @@ -74,8 +85,9 @@ coap_timer_uptime(void) return COAP_TIMER_DRIVER.uptime(); } -/* - * seconds since boot +/** + * \brief Get the time since boot in seconds. + * \return The number of seconds since boot. */ static inline uint32_t coap_timer_seconds(void) @@ -83,57 +95,116 @@ coap_timer_seconds(void) return (uint32_t)(COAP_TIMER_DRIVER.uptime() / 1000); } +/** + * \brief Set a callback function to be called when a CoAP timer expires. + * + * \param timer A pointer to a CoAP timer. + * \param callback A callback function. + */ static inline void coap_timer_set_callback(coap_timer_t *timer, void (* callback)(coap_timer_t *)) { timer->callback = callback; } +/** + * \brief Get user data that has been attached to a CoAP timer. + * + * \param timer A pointer to a CoAP timer. + * \return An opaque pointer to user data or NULL if no user data is + * attached to the timer. + */ static inline void * coap_timer_get_user_data(coap_timer_t *timer) { return timer->user_data; } +/** + * \brief Attach user data to a CoAP timer. + * + * \param timer A pointer to a CoAP timer. + * \param data An opaque pointer to user data. + */ static inline void coap_timer_set_user_data(coap_timer_t *timer, void *data) { timer->user_data = data; } +/** + * \brief Check if a CoAP timer has expired. + * + * \param timer A pointer to a CoAP timer. + * \return Non-zero if the timer has expired, zero otherwise. + */ static inline int coap_timer_expired(const coap_timer_t *timer) { return timer->expiration_time <= coap_timer_uptime(); } +/** + * \brief Stop a pending CoAP timer. + * + * After this function has been called, the timer will be expired + * and will not call the callback function. + * + * \param timer A pointer to a CoAP timer. + */ void coap_timer_stop(coap_timer_t *timer); +/** + * \brief Set a CoAP timer to expire after the specified time. + * + * \param timer A pointer to a CoAP timer. + * \param time The time until the timer expires. + */ void coap_timer_set(coap_timer_t *timer, uint64_t time); /** - * Set the CoAP timer to expire the specified time after the previous - * expiration time. If the new expiration time has already passed, the - * timer will expire as soon as possible. + * \brief Reset a CoAP timer to expire a specified time after the + * last expiration time. * - * If the timer has not yet expired when this function is called, the - * time until the timer expires will be extended by the specified time. + * This function sets the CoAP timer to expire the specified time + * after the previous expiration time. If the new expiration time + * has already passed, the timer will expire as soon as possible. + * + * If the timer has not yet expired when this function is called, + * the time until the timer expires will be extended by the + * specified time. + * + * \param timer A pointer to a CoAP timer. + * \param time The time after previous expiration the timer expires. */ void coap_timer_reset(coap_timer_t *timer, uint64_t time); /** - * Returns the time until next timer expires or 0 if there already - * exists expired timers that have not yet been processed. - * Returns a time in the future if there are no timers pending. + * Get the time until next CoAP timer expires or 0 if there already exists + * expired timers that have not yet been processed. This function is normally + * never called by application code. + * + * Returns the time to next CoAP timer expires or 0 if unprocessed expired + * timers exists. Returns a time in the future if there are no timers pending. */ uint64_t coap_timer_time_to_next_expiration(void); /** - * Must be called periodically to process any expired CoAP timers. + * This function must be called periodically by the CoAP timer driver to + * process any expired CoAP timers. This function is normally never called by + * application code. + * * Returns non-zero if it needs to run again to process more timers. */ int coap_timer_run(void); +/** + * This function initializes the CoAP timer library. It is automatically + * called at first use of a CoAP timer. This function is normally never called + * by application code. + */ void coap_timer_init(void); #endif /* COAP_TIMER_H_ */ +/** @} */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-transactions.c b/os/net/app-layer/coap/coap-transactions.c index b10d5a31a..652737b94 100644 --- a/os/net/app-layer/coap/coap-transactions.c +++ b/os/net/app-layer/coap/coap-transactions.c @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #include "coap-transactions.h" #include "coap-observe.h" #include "coap-timer.h" @@ -163,3 +168,4 @@ coap_get_transaction_by_mid(uint16_t mid) return NULL; } /*---------------------------------------------------------------------------*/ +/** @} */ diff --git a/os/net/app-layer/coap/coap-transactions.h b/os/net/app-layer/coap/coap-transactions.h index 497c5fc35..65334b4eb 100644 --- a/os/net/app-layer/coap/coap-transactions.h +++ b/os/net/app-layer/coap/coap-transactions.h @@ -36,6 +36,11 @@ * Matthias Kovatsch */ +/** + * \addtogroup coap + * @{ + */ + #ifndef COAP_TRANSACTIONS_H_ #define COAP_TRANSACTIONS_H_ @@ -75,3 +80,4 @@ void coap_clear_transaction(coap_transaction_t *t); coap_transaction_t *coap_get_transaction_by_mid(uint16_t mid); #endif /* COAP_TRANSACTIONS_H_ */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-transport.h b/os/net/app-layer/coap/coap-transport.h index 71d0ffae1..3de6f71dc 100644 --- a/os/net/app-layer/coap/coap-transport.h +++ b/os/net/app-layer/coap/coap-transport.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, SICS, Swedish ICT AB. + * Copyright (c) 2016-2018, SICS, Swedish ICT AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,16 +35,50 @@ * Joakim Eriksson */ +/** + * \addtogroup coap + * @{ + * + * \defgroup coap-transport CoAP transport API + * @{ + * + * The CoAP transport API defines a common interface for sending/receiving + * CoAP messages. + */ + #ifndef COAP_TRANSPORT_H_ #define COAP_TRANSPORT_H_ #include "coap-endpoint.h" -void coap_transport_init(void); +/** + * \brief Returns a common data buffer that can be used when + * generating CoAP messages for transmission. The buffer + * size is at least COAP_MAX_PACKET_SIZE bytes. + * + * In Contiki-NG, this corresponds to the uIP buffer. + * + * \return A pointer to a data buffer where a CoAP message can be stored. + */ +uint8_t *coap_databuf(void); +/** + * \brief Send a message to the specified CoAP endpoint + * \param ep A pointer to a CoAP endpoint + * \param data A pointer to data to send + * \param len The size of the data to send + * \return The number of bytes sent or negative if an error occurred. + */ int coap_sendto(const coap_endpoint_t *ep, const uint8_t *data, uint16_t len); -uint8_t *coap_databuf(void); -uint16_t coap_datalen(void); +/** + * \brief Initialize the CoAP transport. + * + * This function initializes the CoAP transport implementation and + * should only be called by the CoAP engine. + */ +void coap_transport_init(void); #endif /* COAP_TRANSPORT_H_ */ +/** @} */ +/** @} */ diff --git a/os/net/app-layer/coap/coap-uip.c b/os/net/app-layer/coap/coap-uip.c index 094cf794d..dd78f5d3b 100644 --- a/os/net/app-layer/coap/coap-uip.c +++ b/os/net/app-layer/coap/coap-uip.c @@ -35,6 +35,17 @@ * Joakim Eriksson */ +/** + * \addtogroup coap-transport + * @{ + * + * \defgroup coap-uip CoAP transport implementation for uIP + * @{ + * + * This is an implementation of CoAP transport and CoAP endpoint over uIP + * with DTLS support. + */ + #include "contiki.h" #include "net/ipv6/uip-udp-packet.h" #include "net/ipv6/uiplib.h" @@ -272,7 +283,8 @@ coap_endpoint_is_connected(const coap_endpoint_t *ep) /* only if handshake is done! */ LOG_DBG("DTLS peer state for "); LOG_DBG_COAP_EP(ep); - LOG_DBG_(" is %d %d\n", peer->state, dtls_peer_is_connected(peer)); + LOG_DBG_(" is %d (%sconnected)\n", peer->state, + dtls_peer_is_connected(peer) ? "" : "not "); return dtls_peer_is_connected(peer); } else { LOG_DBG("DTLS did not find peer "); @@ -328,12 +340,6 @@ coap_databuf(void) return uip_appdata; } /*---------------------------------------------------------------------------*/ -uint16_t -coap_datalen() -{ - return uip_datalen(); -} -/*---------------------------------------------------------------------------*/ void coap_transport_init(void) { @@ -503,7 +509,7 @@ output_to_peer(struct dtls_context_t *ctx, struct uip_udp_conn *udp_connection = dtls_get_app_data(ctx); LOG_DBG("output_to DTLS peer ["); LOG_DBG_6ADDR(&session->ipaddr); - LOG_DBG_("]:%u %d bytes\n", session->port, (int)len); + LOG_DBG_("]:%u %d bytes\n", uip_ntohs(session->port), (int)len); uip_udp_packet_sendto(udp_connection, data, len, &session->ipaddr, session->port); return len; @@ -605,3 +611,5 @@ static dtls_handler_t cb = { #endif /* WITH_DTLS */ /*---------------------------------------------------------------------------*/ +/** @} */ +/** @} */ diff --git a/os/net/app-layer/coap/coap.h b/os/net/app-layer/coap/coap.h index 5aa7631f3..8d9aed61c 100644 --- a/os/net/app-layer/coap/coap.h +++ b/os/net/app-layer/coap/coap.h @@ -31,19 +31,21 @@ /** * \file - * An implementation of the Constrained Application Protocol (RFC). + * An implementation of the Constrained Application Protocol (RFC 7252). * \author * Matthias Kovatsch */ /** - * \defgroup coap CoAP + * \addtogroup apps * @{ * - * The Constrained Application Protocol - RFC 7252 + * \defgroup coap An implementation of CoAP + * @{ + * + * This is an implementation of the Constrained Application Protocol */ - #ifndef COAP_H_ #define COAP_H_ @@ -298,5 +300,5 @@ int coap_get_payload(coap_message_t *message, const uint8_t **payload); int coap_set_payload(coap_message_t *message, const void *payload, size_t length); #endif /* COAP_H_ */ - +/** @} */ /** @} */ diff --git a/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h b/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h index b1dbacd7d..0e655ec2e 100644 --- a/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h +++ b/os/net/app-layer/coap/tinydtls-support/dtls-support-conf.h @@ -1,3 +1,41 @@ +/* + * Copyright (c) 2017, RISE SICS AB. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * \file + * DTLS support for CoAP + * \author + * Niclas Finne + * Joakim Eriksson + */ + #ifndef DTLS_SUPPORT_CONF_H_ #define DTLS_SUPPORT_CONF_H_ diff --git a/os/services/ipso-objects/ipso-objects.c b/os/services/ipso-objects/ipso-objects.c index 1e8243f94..b1138ca09 100644 --- a/os/services/ipso-objects/ipso-objects.c +++ b/os/services/ipso-objects/ipso-objects.c @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup ipso-objects * @{ */ diff --git a/os/services/ipso-objects/ipso-objects.h b/os/services/ipso-objects/ipso-objects.h index 6b8f5c2a6..92bdfd8de 100644 --- a/os/services/ipso-objects/ipso-objects.h +++ b/os/services/ipso-objects/ipso-objects.h @@ -37,8 +37,7 @@ * \defgroup ipso-objects An implementation of IPSO Objects * @{ * - * This application is an implementation of IPSO Objects for - * OMA Lightweight M2M. + * This is an implementation of IPSO Objects for OMA LWM2M. */ /** diff --git a/os/services/lwm2m/lwm2m-device.c b/os/services/lwm2m/lwm2m-device.c index 460e9426e..9e91b37fd 100644 --- a/os/services/lwm2m/lwm2m-device.c +++ b/os/services/lwm2m/lwm2m-device.c @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-device.h b/os/services/lwm2m/lwm2m-device.h index 2800038c8..d7389153c 100644 --- a/os/services/lwm2m/lwm2m-device.h +++ b/os/services/lwm2m/lwm2m-device.h @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ @@ -46,6 +46,22 @@ #include "contiki.h" +#define LWM2M_DEVICE_MANUFACTURER_ID 0 +#define LWM2M_DEVICE_MODEL_NUMBER_ID 1 +#define LWM2M_DEVICE_SERIAL_NUMBER_ID 2 +#define LWM2M_DEVICE_FIRMWARE_VERSION_ID 3 +#define LWM2M_DEVICE_REBOOT_ID 4 +#define LWM2M_DEVICE_FACTORY_DEFAULT_ID 5 +#define LWM2M_DEVICE_AVAILABLE_POWER_SOURCES 6 +/* These do have multiple instances */ +#define LWM2M_DEVICE_POWER_SOURCE_VOLTAGE 7 +#define LWM2M_DEVICE_POWER_SOURCE_CURRENT 8 +#define LWM2M_DEVICE_BATTERY_LEVEL 9 + +#define LWM2M_DEVICE_ERROR_CODE 11 +#define LWM2M_DEVICE_TIME_ID 13 +#define LWM2M_DEVICE_TYPE_ID 17 + #ifndef LWM2M_DEVICE_MODEL_NUMBER #ifdef BOARD_STRING #define LWM2M_DEVICE_MODEL_NUMBER BOARD_STRING diff --git a/os/services/lwm2m/lwm2m-engine.c b/os/services/lwm2m/lwm2m-engine.c index 1d7b8bff7..a36b4f7b1 100644 --- a/os/services/lwm2m/lwm2m-engine.c +++ b/os/services/lwm2m/lwm2m-engine.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ @@ -554,13 +554,13 @@ lwm2m_engine_init(void) #endif } /*---------------------------------------------------------------------------*/ -/** - * @brief Set the writer pointer to the proper writer based on the Accept: header +/* + * Set the writer pointer to the proper writer based on the Accept: header * - * @param[in] context LWM2M context to operate on - * @param[in] accept Accept type number from CoAP headers + * param[in] context LWM2M context to operate on + * param[in] accept Accept type number from CoAP headers * - * @return The content type of the response if the selected writer is used + * return The content type of the response if the selected writer is used */ static unsigned int lwm2m_engine_select_writer(lwm2m_context_t *context, unsigned int accept) @@ -590,11 +590,11 @@ lwm2m_engine_select_writer(lwm2m_context_t *context, unsigned int accept) return accept; } /*---------------------------------------------------------------------------*/ -/** - * @brief Set the reader pointer to the proper reader based on the Content-format: header +/* + * Set the reader pointer to the proper reader based on the Content-format: header * - * @param[in] context LWM2M context to operate on - * @param[in] content_format Content-type type number from CoAP headers + * param[in] context LWM2M context to operate on + * param[in] content_format Content-type type number from CoAP headers */ static void lwm2m_engine_select_reader(lwm2m_context_t *context, unsigned int content_format) @@ -1368,7 +1368,7 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response, if(offset != NULL) { context.offset = *offset; } - context.inbuf->size = coap_get_payload(request, (const uint8_t **) &context.inbuf->buffer); + context.inbuf->size = coap_get_payload(request, (const uint8_t **)&context.inbuf->buffer); context.inbuf->pos = 0; /* Maybe this should be part of CoAP itself - this seems not to be working @@ -1431,7 +1431,7 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response, } } - /** + /* * 1 => Object only * 2 => Object and Instance * 3 => Object and Instance and Resource diff --git a/os/services/lwm2m/lwm2m-engine.h b/os/services/lwm2m/lwm2m-engine.h index a819540ce..62a667e99 100644 --- a/os/services/lwm2m/lwm2m-engine.h +++ b/os/services/lwm2m/lwm2m-engine.h @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-json.c b/os/services/lwm2m/lwm2m-json.c index 2d623388c..ac02bab20 100644 --- a/os/services/lwm2m/lwm2m-json.c +++ b/os/services/lwm2m/lwm2m-json.c @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-json.h b/os/services/lwm2m/lwm2m-json.h index 0fd9a1a82..8267d0246 100644 --- a/os/services/lwm2m/lwm2m-json.h +++ b/os/services/lwm2m/lwm2m-json.h @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-object.h b/os/services/lwm2m/lwm2m-object.h index 858f99c7b..c6c582a35 100644 --- a/os/services/lwm2m/lwm2m-object.h +++ b/os/services/lwm2m/lwm2m-object.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,15 +34,15 @@ */ /** - * \defgroup oma-lwm2m An implementation of OMA LWM2M + * \defgroup lwm2m An implementation of LWM2M * @{ * - * This application is an implementation of OMA Lightweight M2M. + * This is an implementation of OMA Lightweight M2M (LWM2M). */ /** * \file - * Header file for the Contiki OMA LWM2M object API + * Header file for the LWM2M object API * \author * Joakim Eriksson * Niclas Finne @@ -70,7 +70,6 @@ typedef uint32_t lwm2m_resource_id_t; #define RW(x) (x | LWM2M_RESOURCE_READ | LWM2M_RESOURCE_WRITE) #define EX(x) (x | LWM2M_RESOURCE_EXECUTE) - #define LWM2M_OBJECT_SECURITY_ID 0 #define LWM2M_OBJECT_SERVER_ID 1 #define LWM2M_OBJECT_ACCESS_CONTROL_ID 2 @@ -80,45 +79,6 @@ typedef uint32_t lwm2m_resource_id_t; #define LWM2M_OBJECT_LOCATION_ID 6 #define LWM2M_OBJECT_CONNECTIVITY_STATISTICS_ID 7 -#define LWM2M_SECURITY_SERVER_URI_ID 0 -#define LWM2M_SECURITY_BOOTSTRAP_SERVER_ID 1 -#define LWM2M_SECURITY_MODE_ID 2 -#define LWM2M_SECURITY_CLIENT_PKI_ID 3 -#define LWM2M_SECURITY_SERVER_PKI_ID 4 -#define LWM2M_SECURITY_KEY_ID 5 -#define LWM2M_SECURITY_SHORT_SERVER_ID 10 - -#define LWM2M_SERVER_SHORT_SERVER_ID 0 -#define LWM2M_SERVER_LIFETIME_ID 1 -#define LWM2M_SERVER_BINDING_ID 7 -#define LWM2M_SERVER_REG_UPDATE_TRIGGER_ID 8 - -#define LWM2M_DEVICE_MANUFACTURER_ID 0 -#define LWM2M_DEVICE_MODEL_NUMBER_ID 1 -#define LWM2M_DEVICE_SERIAL_NUMBER_ID 2 -#define LWM2M_DEVICE_FIRMWARE_VERSION_ID 3 -#define LWM2M_DEVICE_REBOOT_ID 4 -#define LWM2M_DEVICE_FACTORY_DEFAULT_ID 5 -#define LWM2M_DEVICE_AVAILABLE_POWER_SOURCES 6 -/* These do have multiple instances */ -#define LWM2M_DEVICE_POWER_SOURCE_VOLTAGE 7 -#define LWM2M_DEVICE_POWER_SOURCE_CURRENT 8 -#define LWM2M_DEVICE_BATTERY_LEVEL 9 - -#define LWM2M_DEVICE_ERROR_CODE 11 -#define LWM2M_DEVICE_TIME_ID 13 -#define LWM2M_DEVICE_TYPE_ID 17 - - -/* Pre-shared key mode */ -#define LWM2M_SECURITY_MODE_PSK 0 -/* Raw Public Key mode */ -#define LWM2M_SECURITY_MODE_RPK 1 -/* Certificate mode */ -#define LWM2M_SECURITY_MODE_CERTIFICATE 2 -/* NoSec mode */ -#define LWM2M_SECURITY_MODE_NOSEC 3 - typedef enum { LWM2M_OP_NONE, LWM2M_OP_READ, diff --git a/os/services/lwm2m/lwm2m-plain-text.c b/os/services/lwm2m/lwm2m-plain-text.c index 4799fcaa6..bbd293aa0 100644 --- a/os/services/lwm2m/lwm2m-plain-text.c +++ b/os/services/lwm2m/lwm2m-plain-text.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-plain-text.h b/os/services/lwm2m/lwm2m-plain-text.h index bf12a118c..7922a8ce8 100644 --- a/os/services/lwm2m/lwm2m-plain-text.h +++ b/os/services/lwm2m/lwm2m-plain-text.h @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-rd-client.c b/os/services/lwm2m/lwm2m-rd-client.c index 12928001e..0f904ee4d 100644 --- a/os/services/lwm2m/lwm2m-rd-client.c +++ b/os/services/lwm2m/lwm2m-rd-client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ */ diff --git a/os/services/lwm2m/lwm2m-rd-client.h b/os/services/lwm2m/lwm2m-rd-client.h index 0707728f9..7fba7e0ae 100644 --- a/os/services/lwm2m/lwm2m-rd-client.h +++ b/os/services/lwm2m/lwm2m-rd-client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, SICS Swedish ICT AB. + * Copyright (c) 2016-2018, SICS Swedish ICT AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,6 +28,20 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/** + * \addtogroup lwm2m + * @{ + */ + +/** + * \file + * Header file for the Contiki OMA LWM2M Registration and Bootstrap + * Client. + * \author + * Joakim Eriksson + * Niclas Finne + */ + #ifndef LWM2M_RD_CLIENT_H_ #define LWM2M_RD_CLIENT_H_ @@ -61,7 +75,9 @@ void lwm2m_rd_client_init(const char *ep); void lwm2m_rd_client_set_session_callback(session_callback_t cb); +#ifndef LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN #define LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN 15 +#endif /* LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN */ /*---------------------------------------------------------------------------*/ /*- Server session-*Currently single session only*---------------------------*/ @@ -83,3 +99,4 @@ struct lwm2m_session_info { }; #endif /* LWM2M_RD_CLIENT_H_ */ +/** @} */ diff --git a/os/services/lwm2m/lwm2m-security.c b/os/services/lwm2m/lwm2m-security.c index a8b0801dc..d1b29a319 100644 --- a/os/services/lwm2m/lwm2m-security.c +++ b/os/services/lwm2m/lwm2m-security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ * */ diff --git a/os/services/lwm2m/lwm2m-security.h b/os/services/lwm2m/lwm2m-security.h index 941fafde3..9fb3df78f 100644 --- a/os/services/lwm2m/lwm2m-security.h +++ b/os/services/lwm2m/lwm2m-security.h @@ -36,6 +36,23 @@ #ifndef LWM2M_SECURITY_H #define LWM2M_SECURITY_H +#define LWM2M_SECURITY_SERVER_URI_ID 0 +#define LWM2M_SECURITY_BOOTSTRAP_SERVER_ID 1 +#define LWM2M_SECURITY_MODE_ID 2 +#define LWM2M_SECURITY_CLIENT_PKI_ID 3 +#define LWM2M_SECURITY_SERVER_PKI_ID 4 +#define LWM2M_SECURITY_KEY_ID 5 +#define LWM2M_SECURITY_SHORT_SERVER_ID 10 + +/* Pre-shared key mode */ +#define LWM2M_SECURITY_MODE_PSK 0 +/* Raw Public Key mode */ +#define LWM2M_SECURITY_MODE_RPK 1 +/* Certificate mode */ +#define LWM2M_SECURITY_MODE_CERTIFICATE 2 +/* NoSec mode */ +#define LWM2M_SECURITY_MODE_NOSEC 3 + #ifdef LWM2M_SECURITY_CONF_URI_SIZE #define LWM2M_SECURITY_URI_SIZE LWM2M_SECURITY_CONF_URI_SIZE #else /* LWM2M_SECURITY_CONF_URI_SIZE */ diff --git a/os/services/lwm2m/lwm2m-server.c b/os/services/lwm2m/lwm2m-server.c index 0378221c6..67b2c45ba 100644 --- a/os/services/lwm2m/lwm2m-server.c +++ b/os/services/lwm2m/lwm2m-server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ * */ diff --git a/os/services/lwm2m/lwm2m-server.h b/os/services/lwm2m/lwm2m-server.h index 92968d138..733b0889d 100644 --- a/os/services/lwm2m/lwm2m-server.h +++ b/os/services/lwm2m/lwm2m-server.h @@ -38,6 +38,11 @@ #include "contiki.h" +#define LWM2M_SERVER_SHORT_SERVER_ID 0 +#define LWM2M_SERVER_LIFETIME_ID 1 +#define LWM2M_SERVER_BINDING_ID 7 +#define LWM2M_SERVER_REG_UPDATE_TRIGGER_ID 8 + #ifdef LWM2M_SERVER_CONF_MAX_COUNT #define LWM2M_SERVER_MAX_COUNT LWM2M_SERVER_CONF_MAX_COUNT #else diff --git a/os/services/lwm2m/lwm2m-tlv-reader.c b/os/services/lwm2m/lwm2m-tlv-reader.c index f1d41d945..cbeed6bd2 100644 --- a/os/services/lwm2m/lwm2m-tlv-reader.c +++ b/os/services/lwm2m/lwm2m-tlv-reader.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ * */ diff --git a/os/services/lwm2m/lwm2m-tlv-reader.h b/os/services/lwm2m/lwm2m-tlv-reader.h index 5fe610511..15db7024d 100644 --- a/os/services/lwm2m/lwm2m-tlv-reader.h +++ b/os/services/lwm2m/lwm2m-tlv-reader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/** \addtogroup oma-lwm2m +/** \addtogroup lwm2m * @{ */ /** diff --git a/os/services/lwm2m/lwm2m-tlv-writer.c b/os/services/lwm2m/lwm2m-tlv-writer.c index 5d69fe733..6df16447e 100644 --- a/os/services/lwm2m/lwm2m-tlv-writer.c +++ b/os/services/lwm2m/lwm2m-tlv-writer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ * */ diff --git a/os/services/lwm2m/lwm2m-tlv-writer.h b/os/services/lwm2m/lwm2m-tlv-writer.h index 94f3e61bc..681ccf280 100644 --- a/os/services/lwm2m/lwm2m-tlv-writer.h +++ b/os/services/lwm2m/lwm2m-tlv-writer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/** \addtogroup oma-lwm2m +/** \addtogroup lwm2m * @{ */ /** diff --git a/os/services/lwm2m/lwm2m-tlv.c b/os/services/lwm2m/lwm2m-tlv.c index 37b1afc61..eb9941784 100644 --- a/os/services/lwm2m/lwm2m-tlv.c +++ b/os/services/lwm2m/lwm2m-tlv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ */ /** - * \addtogroup oma-lwm2m + * \addtogroup lwm2m * @{ * */ diff --git a/os/services/lwm2m/lwm2m-tlv.h b/os/services/lwm2m/lwm2m-tlv.h index 0cfef25ad..2766263fa 100644 --- a/os/services/lwm2m/lwm2m-tlv.h +++ b/os/services/lwm2m/lwm2m-tlv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Yanzi Networks AB. + * Copyright (c) 2015-2018, Yanzi Networks AB. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/** \addtogroup oma-lwm2m +/** \addtogroup lwm2m * @{ */ /**