Skip to content

Commit

Permalink
Merge pull request #819 from mrdeep1/coap_access_pdu
Browse files Browse the repository at this point in the history
coap_pdu_access.txt.in: Add in documentation for coap_get_uri_path()
  • Loading branch information
obgm authored Feb 7, 2022
2 parents 6504b66 + c02ca5f commit 0d6c7d6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ install-man: install-man3 install-man5 install-man7
@echo ".so man3/coap_pdu_access.3" > coap_pdu_get_mid.3
@echo ".so man3/coap_pdu_access.3" > coap_pdu_get_token.3
@echo ".so man3/coap_pdu_access.3" > coap_pdu_get_type.3
@echo ".so man3/coap_pdu_access.3" > coap_get_uri_path.3
@echo ".so man3/coap_pdu_setup.3" > coap_delete_optlist.3
@echo ".so man3/coap_pdu_setup.3" > coap_encode_var_safe.3
@echo ".so man3/coap_pdu_setup.3" > coap_encode_var_safe8.3
Expand Down
39 changes: 38 additions & 1 deletion man/coap_pdu_access.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ coap_option_next,
coap_pdu_get_code,
coap_pdu_get_mid,
coap_pdu_get_token,
coap_pdu_get_type
coap_pdu_get_type,
coap_get_uri_path
- Accessing CoAP PDUs

SYNOPSIS
Expand Down Expand Up @@ -71,6 +72,8 @@ coap_opt_iterator_t *_oi_, const coap_opt_filter_t *_filter_);*

*coap_pdu_type_t coap_pdu_get_type(const coap_pdu_t *_pdu_);*

*coap_string_t *coap_get_uri_path(const coap_pdu_t *_pdu_);*

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 @@ -250,6 +253,10 @@ long from _buf_ and _length_ into an unsigned 32bit number.
The *coap_decode_var_bytes*8() function will decode an option up to 8 bytes
long from _buf_ and _length_ into an unsigned 64bit number.

The *coap_get_uri_path*() function will abstract the uri path from the
specified _pdu_. The returned uri path will need to be freed off when no
longer required.

*Payload:*

The *coap_get_data*() function is used abstract from the _pdu_
Expand All @@ -259,6 +266,36 @@ data available, and _data_ with a pointer to where the data is located.
*NOTE:* This function has been updated by *coap_get_data_large*() when large
transfers may take place. See coap_block(3).

RETURN VALUES
-------------

*coap_check_option*() and *coap_option_next*() returns a coap_opt_t* or
NULL if not found.

*coap_decode_var_bytes*() and *coap_decode_var_bytes8*() return the decoded
value.

*coap_pdu_get_code*(), *coap_pdu_get_mid*(), *coap_pdu_get_type*() return
the appropriate value.

*coap_option_filter_set*(), *coap_option_filter_set*() and
*coap_option_filter_unset*() return 1 on success or 0 on failure.

*coap_get_data*() returns 1 if data, else 0.

*coap_opt_length*() returns the option length.

*coap_opt_value*() returns a pointer to the start of the option value or
NULL if error.

*coap_option_iterator_init*() returns ap pointer to the provided interator
or NULL on error.

*coap_pdu_get_token*() returns a pointer to the token in the pdu.

*coap_get_uri_path*() returns an allocated pointer to the uri path in the
pdu or NULL on error. This pointer will need to be freed off.

EXAMPLES
--------
*Abstract information from PDU*
Expand Down

0 comments on commit 0d6c7d6

Please sign in to comment.