Skip to content

Commit

Permalink
Nits: Tidy up code
Browse files Browse the repository at this point in the history
Add documentation for coap_get_resource_from_uri_path().

Remove duplicate coap_get_resource_from_uri_path() definition.

Better fix for scan-build issue.

Update RIOT libcoap base version.
  • Loading branch information
mrdeep1 committed May 14, 2024
1 parent 5234f41 commit 41ed5aa
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion examples/riot/pkg_libcoap/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PKG_NAME=libcoap
PKG_URL=https://github.com/obgm/libcoap
PKG_VERSION=e599e25d6e2b0d0e7b29dc2710f2f15e0b7e5e51
PKG_VERSION=e521eab58bbd15de7b9878551e979ce5c442d9b8
PKG_LICENSE=BSD-2-Clause

LIBCOAP_BUILD_DIR=$(BINDIR)/pkg/$(PKG_NAME)
Expand Down
12 changes: 0 additions & 12 deletions include/coap3/coap_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,18 +491,6 @@ coap_print_status_t coap_print_link(const coap_resource_t *resource,

/** @} */

/**
* Returns the resource identified by the unique string @p uri_path. If no
* resource was found, this function returns @c NULL.
*
* @param context The context to look for this resource.
* @param uri_path The unique string uri of the resource.
*
* @return A pointer to the resource or @c NULL if not found.
*/
coap_resource_t *coap_get_resource_from_uri_path(coap_context_t *context,
coap_str_const_t *uri_path);

/**
* @deprecated use coap_resource_notify_observers() instead.
*/
Expand Down
1 change: 1 addition & 0 deletions man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ install-man: install-man3 install-man5 install-man7
@echo ".so man3/coap_resource.3" > coap_resource_get_userdata.3
@echo ".so man3/coap_resource.3" > coap_resource_release_userdata_handler.3
@echo ".so man3/coap_resource.3" > coap_resource_get_uri_path.3
@echo ".so man3/coap_resource.3" > coap_get_resource_from_uri_path.3
@echo ".so man3/coap_session.3" > coap_session_get_addr_remote.3
@echo ".so man3/coap_session.3" > coap_session_get_context.3
@echo ".so man3/coap_session.3" > coap_session_get_ifindex.3
Expand Down
15 changes: 14 additions & 1 deletion man/coap_resource.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ coap_resource_set_mode,
coap_resource_set_userdata,
coap_resource_get_userdata,
coap_resource_release_userdata_handler,
coap_resource_get_uri_path
coap_resource_get_uri_path,
coap_get_resource_from_uri_path
- Work with CoAP resources

SYNOPSIS
Expand Down Expand Up @@ -62,6 +63,9 @@ coap_resource_release_userdata_handler_t _callback_);*

*coap_str_const_t *coap_resource_get_uri_path(coap_resource_t *_resource_);*

*coap_resource_t *coap_get_resource_from_uri_path(coap_context_t *_context_,
coap_str_const_t *_uri_path_);*

For specific (D)TLS library support, link with
*-lcoap-@LIBCOAP_API_VERSION@-notls*, *-lcoap-@LIBCOAP_API_VERSION@-gnutls*,
*-lcoap-@LIBCOAP_API_VERSION@-openssl*, *-lcoap-@LIBCOAP_API_VERSION@-mbedtls*,
Expand Down Expand Up @@ -283,6 +287,12 @@ needs to be freed off.
The *coap_resource_get_uri_path*() function is used to obtain the UriPath of
the _resource_ definion.

*Function: coap_get_resource_from_uri_path()*

The *coap_get_resource_from_uri_path*() function is used to return the resource
identified by the unique string _uri_path_ associated with _context_.


RETURN VALUES
-------------
*coap_resource_init*(), *coap_resource_unknown_init*(),
Expand All @@ -299,6 +309,9 @@ by the *coap_resource_set_userdata*() function or NULL.
*coap_resource_get_uri_path*() returns the uri_path or NULL if
there was a failure.

*coap_get_resource_from_uri_path*() returns the resource or NULL
if not found.

EXAMPLES
--------
*Fixed Resources Set Up*
Expand Down
4 changes: 1 addition & 3 deletions src/oscore/oscore_cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,9 @@ oscore_cbor_get_next_element(const uint8_t **buffer, size_t *buf_len) {

size_t
oscore_cbor_get_element_size(const uint8_t **buffer, size_t *buf_len) {
uint8_t control = get_byte(buffer, buf_len) & 0x1f;
uint8_t control = get_byte_inc(buffer, buf_len) & 0x1f;
size_t size;

/* Move to data payload, or extended count */
get_byte_inc(buffer, buf_len);
if (control < 0x18) {
size = (uint64_t)control;
} else {
Expand Down

0 comments on commit 41ed5aa

Please sign in to comment.