lwm2m: moved LWM2M object resource IDs to each object header file.

Added Doxygen groups in CoAP and LWM2M.
This commit is contained in:
Niclas Finne 2017-12-21 18:54:28 +01:00
parent 811a62d8db
commit ee65ba289e
55 changed files with 567 additions and 131 deletions

View File

@ -36,6 +36,11 @@
* Lars Schmertmann <SmallLars@t-online.de>
*/
/**
* \addtogroup coap
* @{
*/
#include <string.h>
#include <inttypes.h>
@ -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;
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Lars Schmertmann <SmallLars@t-online.de>
*/
/**
* \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_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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);
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -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_ */
/** @} */

View File

@ -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);
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -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_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \addtogroup coap
* @{
*/
#ifndef COAP_CONF_H_
#define COAP_CONF_H_
@ -99,3 +104,4 @@
#endif /* COAP_OBSERVE_REFRESH_INTERVAL */
#endif /* COAP_CONF_H_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \addtogroup coap
* @{
*/
#ifndef COAP_CONSTANTS_H_
#define COAP_CONSTANTS_H_
@ -184,3 +189,4 @@ typedef enum {
} coap_resource_flags_t;
#endif /* COAP_CONSTANTS_H_ */
/** @} */

View File

@ -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 <joakime@sics.se>
*/
/**
* \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_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \addtogroup coap
* @{
*/
#include "coap-engine.h"
#include "sys/cc.h"
#include "lib/list.h"
@ -506,3 +511,4 @@ process_callback(coap_timer_t *t)
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \addtogroup coap-keystore
* @{
*/
#include "coap-endpoint.h"
#include "coap-keystore.h"
#include <string.h>
@ -89,3 +94,4 @@ coap_keystore_simple_init(void)
#endif /* WITH_DTLS */
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,17 +36,27 @@
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \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_ */
/** @} */

View File

@ -29,12 +29,33 @@
*
*/
/**
* \file
* API for CoAP keystore
* \author
* Niclas Finne <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \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_ */
/** @} */
/** @} */

View File

@ -36,6 +36,11 @@
* Joakim Eriksson <joakim.eriksson@ri.se>
*/
/**
* \addtogroup coap
* @{
*/
#include "coap-log.h"
/*---------------------------------------------------------------------------*/
void
@ -52,3 +57,4 @@ coap_log_string(const char *text, size_t len)
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Joakim Eriksson <joakim.eriksson@ri.se>
*/
/**
* \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_ */
/** @} */

View File

@ -37,6 +37,11 @@
* Daniele Alessandrelli <daniele.alessandrelli@gmail.com>
*/
/**
* \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 */
/** @} */

View File

@ -37,6 +37,11 @@
* Daniele Alessandrelli <daniele.alessandrelli@gmail.com>
*/
/**
* \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_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \addtogroup coap
* @{
*/
#include <stdio.h>
#include <string.h>
#include "coap-observe.h"
@ -335,3 +340,4 @@ coap_observe_handler(coap_resource_t *resource, coap_message_t *coap_req,
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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_ */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \addtogroup coap
* @{
*/
#include "coap-engine.h"
#include <string.h>
#include <stdio.h>
@ -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);
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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,
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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_ */
/** @} */

View File

@ -35,6 +35,16 @@
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \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,
};
/*---------------------------------------------------------------------------*/
/** @} */
/** @} */

View File

@ -35,18 +35,20 @@
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \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)
}
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -35,6 +35,16 @@
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \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_ */
/** @} */
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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;
}
/*---------------------------------------------------------------------------*/
/** @} */

View File

@ -36,6 +36,11 @@
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
*/
/**
* \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_ */
/** @} */

View File

@ -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 <joakime@sics.se>
*/
/**
* \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_ */
/** @} */
/** @} */

View File

@ -35,6 +35,17 @@
* Joakim Eriksson <joakime@sics.se>
*/
/**
* \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 */
/*---------------------------------------------------------------------------*/
/** @} */
/** @} */

View File

@ -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 <kovatsch@inf.ethz.ch>
*/
/**
* \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_ */
/** @} */
/** @} */

View File

@ -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 <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
#ifndef DTLS_SUPPORT_CONF_H_
#define DTLS_SUPPORT_CONF_H_

View File

@ -29,7 +29,7 @@
*/
/**
* \addtogroup oma-lwm2m
* \addtogroup ipso-objects
* @{
*/

View File

@ -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.
*/
/**

View File

@ -29,7 +29,7 @@
*/
/**
* \addtogroup oma-lwm2m
* \addtogroup lwm2m
* @{
*/

View File

@ -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

View File

@ -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

View File

@ -29,7 +29,7 @@
*/
/**
* \addtogroup oma-lwm2m
* \addtogroup lwm2m
* @{
*/

View File

@ -29,7 +29,7 @@
*/
/**
* \addtogroup oma-lwm2m
* \addtogroup lwm2m
* @{
*/

View File

@ -29,7 +29,7 @@
*/
/**
* \addtogroup oma-lwm2m
* \addtogroup lwm2m
* @{
*/

View File

@ -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 <joakime@sics.se>
* Niclas Finne <nfi@sics.se>
@ -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,

View File

@ -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
* @{
*/

View File

@ -29,7 +29,7 @@
*/
/**
* \addtogroup oma-lwm2m
* \addtogroup lwm2m
* @{
*/

View File

@ -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
* @{
*/

View File

@ -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 <joakime@sics.se>
* Niclas Finne <nfi@sics.se>
*/
#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_ */
/** @} */

View File

@ -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
* @{
*
*/

View File

@ -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 */

View File

@ -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
* @{
*
*/

View File

@ -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

View File

@ -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
* @{
*
*/

View File

@ -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
* @{ */
/**

View File

@ -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
* @{
*
*/

View File

@ -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
* @{ */
/**

View File

@ -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
* @{
*
*/

View File

@ -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
* @{ */
/**