libcoap  4.2.0
encode.c File Reference
#include <stdio.h>
#include "coap_config.h"
#include "coap.h"
#include "mem.h"
#include "encode.h"
+ Include dependency graph for encode.c:

Go to the source code of this file.

Functions

int coap_fls (unsigned int i)
 
int coap_flsll (long long i)
 
unsigned int coap_decode_var_bytes (const uint8_t *buf, unsigned int len)
 Decodes multiple-length byte sequences. More...
 
unsigned int coap_encode_var_safe (uint8_t *buf, size_t length, unsigned int val)
 Encodes multiple-length byte sequences. More...
 

Function Documentation

◆ coap_decode_var_bytes()

unsigned int coap_decode_var_bytes ( const uint8_t buf,
unsigned int  length 
)

Decodes multiple-length byte sequences.

buf points to an input byte sequence of length length. Returns the decoded value.

Parameters
bufThe input byte sequence to decode from
lengthThe length of the input byte sequence
Returns
The decoded value

Definition at line 36 of file encode.c.

+ Here is the caller graph for this function:

◆ coap_encode_var_safe()

unsigned int coap_encode_var_safe ( uint8_t buf,
size_t  length,
unsigned int  value 
)

Encodes multiple-length byte sequences.

buf points to an output buffer of sufficient length to store the encoded bytes. value is the value to encode. Returns the number of bytes used to encode value or 0 on error.

Parameters
bufThe output buffer to decode into
lengthThe output buffer size to encode into (must be sufficient)
valueThe value to encode into the buffer
Returns
The number of bytes used to encode value or 0 on error.

Definition at line 45 of file encode.c.

+ Here is the caller graph for this function:

◆ coap_fls()

int coap_fls ( unsigned int  i)

Definition at line 20 of file encode.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ coap_flsll()

int coap_flsll ( long long  i)

Definition at line 26 of file encode.c.

+ Here is the caller graph for this function: