libcoap
4.3.5
Toggle main menu visibility
Loading...
Searching...
No Matches
coap_encode.h
Go to the documentation of this file.
1
/*
2
* encode.h -- encoding and decoding of CoAP data types
3
*
4
* Copyright (C) 2010-2012,2023-2024 Olaf Bergmann <bergmann@tzi.org>
5
*
6
* SPDX-License-Identifier: BSD-2-Clause
7
*
8
* This file is part of the CoAP library libcoap. Please see README for terms
9
* of use.
10
*/
11
16
17
#ifndef COAP_ENCODE_H_
18
#define COAP_ENCODE_H_
19
20
#if (BSD >= 199103) || defined(_WIN32)
21
# include <string.h>
22
#else
23
# include <strings.h>
24
#endif
25
26
#include <stdint.h>
27
28
#ifndef HAVE_FLS
29
/* include this only if fls() is not available */
30
extern
int
coap_fls
(
unsigned
int
i);
31
#else
32
#define coap_fls(i) fls(i)
33
#endif
34
35
#ifndef HAVE_FLSLL
36
/* include this only if flsll() is not available */
37
extern
int
coap_flsll
(
long
long
i);
38
#else
39
#define coap_flsll(i) flsll(i)
40
#endif
41
48
58
unsigned
int
coap_decode_var_bytes
(
const
uint8_t *buf,
size_t
length);
59
69
uint64_t
coap_decode_var_bytes8
(
const
uint8_t *buf,
size_t
length);
70
84
unsigned
int
coap_encode_var_safe
(uint8_t *buf,
85
size_t
length,
86
unsigned
int
value);
87
101
unsigned
int
coap_encode_var_safe8
(uint8_t *buf,
102
size_t
length,
103
uint64_t value);
104
106
122
COAP_STATIC_INLINE
COAP_DEPRECATED
int
123
coap_encode_var_bytes
(uint8_t *buf,
unsigned
int
value) {
124
return
(
int
)
coap_encode_var_safe
(buf,
sizeof
(value), value);
125
}
126
127
#endif
/* COAP_ENCODE_H_ */
coap_flsll
int coap_flsll(long long i)
Definition
coap_encode.c:28
coap_fls
int coap_fls(unsigned int i)
Definition
coap_encode.c:21
coap_encode_var_bytes
COAP_STATIC_INLINE COAP_DEPRECATED int coap_encode_var_bytes(uint8_t *buf, unsigned int value)
Definition
coap_encode.h:123
coap_encode_var_safe
unsigned int coap_encode_var_safe(uint8_t *buf, size_t length, unsigned int value)
Encodes multiple-length byte sequences.
Definition
coap_encode.c:47
coap_decode_var_bytes
unsigned int coap_decode_var_bytes(const uint8_t *buf, size_t length)
Decodes multiple-length byte sequences.
Definition
coap_encode.c:38
coap_decode_var_bytes8
uint64_t coap_decode_var_bytes8(const uint8_t *buf, size_t length)
Decodes multiple-length byte sequences.
Definition
coap_encode.c:67
coap_encode_var_safe8
unsigned int coap_encode_var_safe8(uint8_t *buf, size_t length, uint64_t value)
Encodes multiple-length byte sequences.
Definition
coap_encode.c:77
COAP_DEPRECATED
#define COAP_DEPRECATED
Definition
libcoap.h:62
COAP_STATIC_INLINE
#define COAP_STATIC_INLINE
Definition
libcoap.h:53
include
coap3
coap_encode.h
Generated on
for libcoap by
1.17.0