|
libschc
|
Functions | |
| uint8_t | pcoap_get_coap_offset (pcoap_pdu *pdu) |
| Finds the length of the CoAP header. More... | |
| pcoap_error | pcoap_validate_pkt (pcoap_pdu *pdu) |
| Validate Packet. More... | |
| uint8_t | pcoap_get_token (pcoap_pdu *pdu, uint8_t *ptr) |
| Get Message Token. More... | |
| pcoap_option | pcoap_get_option (pcoap_pdu *pdu, pcoap_option *last) |
| Get Option. More... | |
| pcoap_option | pcoap_get_option_by_num (pcoap_pdu *pdu, pcoap_option_number num, uint8_t occ) |
| Get Option by Option Number. More... | |
| pcoap_error | pcoap_decode_option (uint8_t *pkt_ptr, size_t pkt_len, uint16_t *option_number, size_t *option_length, uint8_t **value) |
| Internal Method. More... | |
| pcoap_payload | pcoap_get_payload (pcoap_pdu *pdu) |
| Get Option. More... | |
| pcoap_error | pcoap_init_pdu (pcoap_pdu *pdu) |
| Initialize Packet. More... | |
| pcoap_error | pcoap_set_version (pcoap_pdu *pdu, pcoap_version ver) |
| Set Version. More... | |
| pcoap_error | pcoap_set_type (pcoap_pdu *pdu, pcoap_type mtype) |
| Set Message Type. More... | |
| pcoap_error | pcoap_set_code (pcoap_pdu *pdu, pcoap_code code) |
| Set Message Code. More... | |
| pcoap_error | pcoap_set_mid (pcoap_pdu *pdu, uint16_t mid) |
| Set Message ID. More... | |
| pcoap_error | pcoap_set_token (pcoap_pdu *pdu, uint8_t *token, uint8_t tkl) |
| Set Message Token. More... | |
| pcoap_error | pcoap_add_option (pcoap_pdu *pdu, int32_t opt_num, uint8_t *value, uint16_t opt_len) |
| Add Message Option. More... | |
| pcoap_error | pcoap_set_payload (pcoap_pdu *pdu, uint8_t *payload, size_t payload_len) |
| Add Message Option. More... | |
| pcoap_error | pcoap_adjust_option_deltas (uint8_t *opts_start, size_t *opts_len, size_t max_len, int32_t offset) |
| Internal Method. More... | |
| int8_t | pcoap_build_option_header (uint8_t *buf, size_t max_len, int32_t opt_delta, int32_t opt_len) |
| Internal Method. More... | |
| int8_t | pcoap_compute_option_header_len (int32_t opt_delta, int32_t opt_len) |
| Internal Method. More... | |
| pcoap_error pcoap_add_option | ( | pcoap_pdu * | pdu, |
| int32_t | opt_num, | ||
| uint8_t * | value, | ||
| uint16_t | opt_len | ||
| ) |
Add Message Option.
Adds an option to the existing message. Options SHOULD be added in order of option number. In the case of multiple options of the same type, they are sorted in the order that they are added.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | opt | option container. |
| pcoap_error pcoap_adjust_option_deltas | ( | uint8_t * | opts_start, |
| size_t * | opts_len, | ||
| size_t | max_len, | ||
| int32_t | offset | ||
| ) |
Internal Method.
| int8_t pcoap_build_option_header | ( | uint8_t * | buf, |
| size_t | max_len, | ||
| int32_t | opt_delta, | ||
| int32_t | opt_len | ||
| ) |
Internal Method.
| int8_t pcoap_compute_option_header_len | ( | int32_t | opt_delta, |
| int32_t | opt_len | ||
| ) |
Internal Method.
| pcoap_error pcoap_decode_option | ( | uint8_t * | pkt_ptr, |
| size_t | pkt_len, | ||
| uint16_t * | option_number, | ||
| size_t * | option_length, | ||
| uint8_t ** | value | ||
| ) |
Internal Method.
| uint8_t pcoap_get_coap_offset | ( | pcoap_pdu * | pdu | ) |
Finds the length of the CoAP header.
| pdu | the CoAP pdu, containing the header and payload |
| pcoap_option pcoap_get_option | ( | pcoap_pdu * | pdu, |
| pcoap_option * | last | ||
| ) |
Get Option.
Iterates over the options in the given message.
| [in] | pdu | pointer to the coap message struct. |
| [in,out] | pointer | to the last/next option, pass 0 for the first option. |
| pcoap_option pcoap_get_option_by_num | ( | pcoap_pdu * | pdu, |
| pcoap_option_number | num, | ||
| uint8_t | occ | ||
| ) |
Get Option by Option Number.
Gets a single specified by the option number and index of which occurrence of that option number you'd like.
| [in] | pdu | pointer to the coap message struct. |
| [in] | num | option number to get. |
| [in] | occ | occurrence of to get (0th, 1st, 2nd, etc) 0 for the first option. |
| pcoap_payload pcoap_get_payload | ( | pcoap_pdu * | pdu | ) |
Get Option.
Extracts the option with the given index in the given message.
| [in] | pdu | pointer to the coap message struct. |
| uint8_t pcoap_get_token | ( | pcoap_pdu * | pdu, |
| uint8_t * | ptr | ||
| ) |
Get Message Token.
Extracts the token from the given message.
| [in] | pdu | pointer to the coap message struct. |
| pcoap_error pcoap_init_pdu | ( | pcoap_pdu * | pdu | ) |
Initialize Packet.
Initializes on an empty buffer for creating new CoAP packets. This function (or coap_validate for parsing packets) must be called and must return CE_NONE before you can use any of the getters or setter. The packet is initialized to a CoAP Ping.
| [in,out] | pdu | pointer to the coap message struct. |
| pcoap_error pcoap_set_code | ( | pcoap_pdu * | pdu, |
| pcoap_code | code | ||
| ) |
Set Message Code.
Sets the message type header field.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | code | code to set. |
| pcoap_error pcoap_set_mid | ( | pcoap_pdu * | pdu, |
| uint16_t | mid | ||
| ) |
Set Message ID.
Sets the message ID header field.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | mid | message ID to set. |
| pcoap_error pcoap_set_payload | ( | pcoap_pdu * | pdu, |
| uint8_t * | payload, | ||
| size_t | payload_len | ||
| ) |
Add Message Option.
Sets the payload of the given message to the value in payload.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | pl | payload container. |
| pcoap_error pcoap_set_token | ( | pcoap_pdu * | pdu, |
| uint8_t * | token, | ||
| uint8_t | tkl | ||
| ) |
Set Message Token.
Sets the message token header field.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | token | pointer to the token array to set. |
| pcoap_error pcoap_set_type | ( | pcoap_pdu * | pdu, |
| pcoap_type | mtype | ||
| ) |
Set Message Type.
Sets the message type header field.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | mtype | type to set. |
| pcoap_error pcoap_set_version | ( | pcoap_pdu * | pdu, |
| pcoap_version | ver | ||
| ) |
Set Version.
Sets the version number header field.
| [in,out] | pdu | pointer to the coap message struct. |
| [in] | ver | version to set. Must be COAP_V1. |
| pcoap_error pcoap_validate_pkt | ( | pcoap_pdu * | pdu | ) |
Validate Packet.
Parses the given packet to check if it is a valid CoAP message. This function (or coap_init_pdu for creating new packets) must be called and must return CE_NONE before you can use any of the getters or setter.
| [in] | pdu | pointer to the coap message struct. |
1.8.17