Coverage Report

Created: 2026-07-16 07:03

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libcoap/include/coap3/coap_block.h
Line
Count
Source
1
/*
2
 * coap_block.h -- block transfer
3
 *
4
 * Copyright (C) 2010-2012,2014-2015 Olaf Bergmann <bergmann@tzi.org>
5
 * Copyright (C) 2022-2026           Jon Shallow <supjps-libcoap@jpshallow.com>
6
 *
7
 * SPDX-License-Identifier: BSD-2-Clause
8
 *
9
 * This file is part of the CoAP library libcoap. Please see README for terms
10
 * of use.
11
 */
12
13
/**
14
 * @file coap_block.h
15
 * @brief CoAP Block information
16
 */
17
18
#ifndef COAP_BLOCK_H_
19
#define COAP_BLOCK_H_
20
21
#include "coap_encode.h"
22
#include "coap_option.h"
23
#include "coap_pdu.h"
24
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
29
/**
30
 * @ingroup application_api
31
 * @defgroup block Block Transfer
32
 * API for handling PDUs using CoAP Block options (RFC7959)
33
 * @{
34
 */
35
36
#ifndef COAP_MAX_BLOCK_SZX
37
/**
38
 * The largest value for the SZX component in a Block option.
39
 */
40
#define COAP_MAX_BLOCK_SZX      6
41
#endif /* COAP_MAX_BLOCK_SZX */
42
43
/**
44
 * Structure of Block options.
45
 */
46
typedef struct {
47
  unsigned int num;       /**< block number */
48
  unsigned int m:1;       /**< 1 if more blocks follow, 0 otherwise */
49
  unsigned int szx:3;     /**< block size */
50
} coap_block_t;
51
52
/**
53
 * Structure of Block options with BERT support.
54
 */
55
typedef struct {
56
  unsigned int num;       /**< block number */
57
  unsigned int m:1;       /**< 1 if more blocks follow, 0 otherwise */
58
  unsigned int szx:3;     /**< block size (0-6) */
59
  unsigned int aszx:3;    /**< block size (0-7 including BERT */
60
  unsigned int defined:1; /**< Set if block found */
61
  unsigned int bert:1;    /**< Operating as BERT */
62
  uint32_t chunk_size;    /**< > 1024 if BERT */
63
} coap_block_b_t;
64
65
0
#define COAP_BLOCK_USE_LIBCOAP  0x01 /* Use libcoap to do block requests */
66
0
#define COAP_BLOCK_SINGLE_BODY  0x02 /* Deliver the data as a single body */
67
0
#define COAP_BLOCK_TRY_Q_BLOCK   0x04 /* Try Q-Block method */
68
0
#define COAP_BLOCK_USE_M_Q_BLOCK 0x08 /* Use M bit when recovering Q-Block2 */
69
0
#define COAP_BLOCK_NO_PREEMPTIVE_RTAG 0x10 /* (cl) Don't use pre-emptive Request-Tags */
70
0
#define COAP_BLOCK_STLESS_FETCH  0x20 /* (cl) Assume server supports stateless FETCH */
71
0
#define COAP_BLOCK_STLESS_BLOCK2 0x40 /* (svr)Server is stateless for handling Block2 */
72
0
#define COAP_BLOCK_NOT_RANDOM_BLOCK1 0x80 /* (svr)Disable server handling random order
73
                                             block1 */
74
2.46k
#define COAP_BLOCK_FORCE_Q_BLOCK  0x200 /* force Q-Block method without support check */
75
/* WARNING: Added defined values must not encroach into 0xff000000 which are defined elsewhere */
76
77
/**
78
 * Returns the value of the least significant byte of a Block option @p opt.
79
 * For zero-length options (i.e. num == m == szx == 0), COAP_OPT_BLOCK_LAST
80
 * returns @c NULL.
81
 */
82
#define COAP_OPT_BLOCK_LAST(opt) \
83
  (coap_opt_length(opt) ? (coap_opt_value(opt) + (coap_opt_length(opt)-1)) : 0)
84
85
/** Returns the value of the last byte of @p opt. */
86
#define COAP_OPT_BLOCK_END_BYTE(opt) \
87
0
  ((coap_opt_length(opt) && coap_opt_value(opt)) ? \
88
0
   *(coap_opt_value(opt) + (coap_opt_length(opt)-1)) : 0)
89
90
/** Returns the value of the More-bit of a Block option @p opt. */
91
#define COAP_OPT_BLOCK_MORE(opt) \
92
0
  (coap_opt_length(opt) ? (COAP_OPT_BLOCK_END_BYTE(opt) & 0x08) : 0)
93
94
/** Returns the value of the SZX-field of a Block option @p opt. */
95
#define COAP_OPT_BLOCK_SZX(opt)  \
96
0
  (coap_opt_length(opt) ? (COAP_OPT_BLOCK_END_BYTE(opt) & 0x07) : 0)
97
98
/**
99
 * Returns the value of field @c num in the given block option @p block_opt.
100
 */
101
unsigned int coap_opt_block_num(const coap_opt_t *block_opt);
102
103
/**
104
 * Checks if more than @p num blocks are required to deliver @p data_len
105
 * bytes of data for a block size of 1 << (@p szx + 4).
106
 */
107
COAP_STATIC_INLINE int
108
0
coap_more_blocks(size_t data_len, unsigned int num, uint16_t szx) {
109
0
  return ((num+1) << (szx + 4)) < data_len;
110
0
}
Unexecuted instantiation: persist_target.c:coap_more_blocks
Unexecuted instantiation: coap_address.c:coap_more_blocks
Unexecuted instantiation: coap_debug.c:coap_more_blocks
Unexecuted instantiation: coap_encode.c:coap_more_blocks
Unexecuted instantiation: coap_mem.c:coap_more_blocks
Unexecuted instantiation: coap_net.c:coap_more_blocks
Unexecuted instantiation: coap_netif.c:coap_more_blocks
Unexecuted instantiation: coap_openssl.c:coap_more_blocks
Unexecuted instantiation: coap_option.c:coap_more_blocks
Unexecuted instantiation: coap_oscore.c:coap_more_blocks
Unexecuted instantiation: coap_pdu.c:coap_more_blocks
Unexecuted instantiation: coap_proxy.c:coap_more_blocks
Unexecuted instantiation: coap_prng.c:coap_more_blocks
Unexecuted instantiation: coap_resource.c:coap_more_blocks
Unexecuted instantiation: coap_session.c:coap_more_blocks
Unexecuted instantiation: coap_str.c:coap_more_blocks
Unexecuted instantiation: coap_strm_posix.c:coap_more_blocks
Unexecuted instantiation: coap_subscribe.c:coap_more_blocks
Unexecuted instantiation: coap_time.c:coap_more_blocks
Unexecuted instantiation: coap_uri.c:coap_more_blocks
Unexecuted instantiation: coap_ws.c:coap_more_blocks
Unexecuted instantiation: oscore.c:coap_more_blocks
Unexecuted instantiation: oscore_cbor.c:coap_more_blocks
Unexecuted instantiation: oscore_context.c:coap_more_blocks
Unexecuted instantiation: oscore_cose.c:coap_more_blocks
Unexecuted instantiation: oscore_crypto.c:coap_more_blocks
Unexecuted instantiation: coap_async.c:coap_more_blocks
Unexecuted instantiation: coap_block.c:coap_more_blocks
Unexecuted instantiation: coap_cache.c:coap_more_blocks
Unexecuted instantiation: coap_dgrm_posix.c:coap_more_blocks
Unexecuted instantiation: coap_dtls.c:coap_more_blocks
Unexecuted instantiation: coap_io.c:coap_more_blocks
Unexecuted instantiation: coap_io_posix.c:coap_more_blocks
Unexecuted instantiation: coap_layers.c:coap_more_blocks
111
112
#if 0
113
/** Sets the More-bit in @p block_opt */
114
COAP_STATIC_INLINE void
115
coap_opt_block_set_m(coap_opt_t *block_opt, int m) {
116
  if (m)
117
    *(coap_opt_value(block_opt) + (coap_opt_length(block_opt) - 1)) |= 0x08;
118
  else
119
    *(coap_opt_value(block_opt) + (coap_opt_length(block_opt) - 1)) &= ~0x08;
120
}
121
#endif
122
123
/**
124
 * Initializes @p block from @p pdu. @p number must be either COAP_OPTION_BLOCK1
125
 * or COAP_OPTION_BLOCK2. When option @p number was found in @p pdu, @p block is
126
 * initialized with values from this option and the function returns the value
127
 * @c 1. Otherwise, @c 0 is returned.
128
 *
129
 * @param pdu    The pdu to search for option @p number.
130
 * @param number The option number to search for (must be COAP_OPTION_BLOCK1 or
131
 *               COAP_OPTION_BLOCK2).
132
 * @param block  The block structure to initialize.
133
 *
134
 * @return       @c 1 on success, @c 0 otherwise.
135
 */
136
int coap_get_block(const coap_pdu_t *pdu, coap_option_num_t number,
137
                   coap_block_t *block);
138
139
140
/**
141
 * Initializes @p block from @p pdu. @p number must be either COAP_OPTION_BLOCK1
142
 * or COAP_OPTION_BLOCK2. When option @p number was found in @p pdu, @p block is
143
 * initialized with values from this option and the function returns the value
144
 * @c 1. Otherwise, @c 0 is returned. BERT information is abstracted as
145
 * appropriate.
146
 *
147
 * @param session THe session that the pdu is associated with,
148
 * @param pdu    The pdu to search for option @p number.
149
 * @param number The option number to search for (must be COAP_OPTION_BLOCK1 or
150
 *               COAP_OPTION_BLOCK2).
151
 * @param block  The block structure to initialize.
152
 *
153
 * @return       @c 1 on success, @c 0 otherwise.
154
 */
155
int coap_get_block_b(const coap_session_t *session, const coap_pdu_t *pdu,
156
                     coap_option_num_t number, coap_block_b_t *block);
157
158
/**
159
 * Writes a block option of type @p number to message @p pdu. If the requested
160
 * block size is too large to fit in @p pdu, it is reduced accordingly. An
161
 * exception is made for the final block when less space is required. The actual
162
 * length of the resource is specified in @p data_length.
163
 *
164
 * This function may change *block to reflect the values written to @p pdu. As
165
 * the function takes into consideration the remaining space @p pdu, no more
166
 * options should be added after coap_write_block_opt() has returned.
167
 *
168
 * @param block       The block structure to use. On return, this object is
169
 *                    updated according to the values that have been written to
170
 *                    @p pdu.
171
 * @param number      COAP_OPTION_BLOCK1 or COAP_OPTION_BLOCK2.
172
 * @param pdu         The message where the block option should be written.
173
 * @param data_length The length of the actual data that will be added the @p
174
 *                    pdu by calling coap_add_block().
175
 *
176
 * @return            @c 1 on success, or a negative value on error.
177
 */
178
int coap_write_block_opt(coap_block_t *block,
179
                         coap_option_num_t number,
180
                         coap_pdu_t *pdu,
181
                         size_t data_length);
182
/**
183
 * Writes a block option of type @p number to message @p pdu. If the requested
184
 * block size is too large to fit in @p pdu, it is reduced accordingly. An
185
 * exception is made for the final block when less space is required. The actual
186
 * length of the resource is specified in @p data_length.
187
 *
188
 * This function may change *block to reflect the values written to @p pdu. As
189
 * the function takes into consideration the remaining space @p pdu, no more
190
 * options should be added after coap_write_block_opt() has returned.
191
 *
192
 * @param session     The CoAP session.
193
 * @param block       The block structure to use. On return, this object is
194
 *                    updated according to the values that have been written to
195
 *                    @p pdu.
196
 * @param number      COAP_OPTION_BLOCK1 or COAP_OPTION_BLOCK2.
197
 * @param pdu         The message where the block option should be written.
198
 * @param data_length The length of the actual data that will be added the @p
199
 *                    pdu by calling coap_add_block().
200
 *
201
 * @return            @c 1 on success, or a negative value on error.
202
 */
203
int coap_write_block_b_opt(coap_session_t *session,
204
                           coap_block_b_t *block,
205
                           coap_option_num_t number,
206
                           coap_pdu_t *pdu,
207
                           size_t data_length);
208
209
210
/**
211
 * Adds the @p block_num block of size 1 << (@p block_szx + 4) from source @p
212
 * data to @p pdu.
213
 *
214
 * @param pdu       The message to add the block.
215
 * @param len       The length of @p data.
216
 * @param data      The source data to fill the block with.
217
 * @param block_num The actual block number.
218
 * @param block_szx Encoded size of block @p block_number.
219
 *
220
 * @return          @c 1 on success, @c 0 otherwise.
221
 */
222
int coap_add_block(coap_pdu_t *pdu,
223
                   size_t len,
224
                   const uint8_t *data,
225
                   unsigned int block_num,
226
                   unsigned char block_szx);
227
228
/**
229
 * Adds the appropriate payload data of the body to the @p pdu.
230
 *
231
 * @param pdu       The message to add the block.
232
 * @param len       The length of @p data.
233
 * @param data      The source data to fill the block with.
234
 * @param block     The block information (including potentially BERT)
235
 *
236
 * @return          @c 1 on success, @c 0 otherwise.
237
 */
238
int coap_add_block_b_data(coap_pdu_t *pdu, size_t len, const uint8_t *data,
239
                          coap_block_b_t *block);
240
241
/**
242
 * Re-assemble payloads into a body
243
 *
244
 * @param body_data The pointer to the data for the body holding the
245
 *                  representation so far or NULL if the first time.
246
 * @param length    The length of @p data.
247
 * @param data      The payload data to update the body with.
248
 * @param offset    The offset of the @p data into the body.
249
 * @param total     The estimated total size of the body.
250
 *
251
 * @return          The current representation of the body or @c NULL if error.
252
 *                  If NULL, @p body_data will have been de-allocated.
253
 */
254
COAP_API coap_binary_t *coap_block_build_body(coap_binary_t *body_data, size_t length,
255
                                              const uint8_t *data, size_t offset, size_t total);
256
257
/**
258
 * Adds the appropriate part of @p data to the @p response pdu.  If blocks are
259
 * required, then the appropriate block will be added to the PDU and sent.
260
 * Adds a ETag option that is the hash of the entire data if the data is to be
261
 * split into blocks
262
 * Used by a request handler.
263
 *
264
 * Note: The application will get called for every packet of a large body to
265
 * process. Consider using coap_add_data_response_large() instead.
266
 *
267
 * @param request    The requesting pdu.
268
 * @param response   The response pdu.
269
 * @param media_type The format of the data.
270
 * @param maxage     The maxmimum life of the data. If @c -1, then there
271
 *                   is no maxage.
272
 * @param length     The total length of the data.
273
 * @param data       The entire data block to transmit.
274
 *
275
 */
276
void coap_add_data_blocked_response(const coap_pdu_t *request,
277
                                    coap_pdu_t *response,
278
                                    uint16_t media_type,
279
                                    int maxage,
280
                                    size_t length,
281
                                    const uint8_t *data);
282
283
/**
284
 * Callback handler for de-allocating the data based on @p app_ptr provided to
285
 * coap_add_data_large_*() functions following transmission of the supplied
286
 * data.
287
 *
288
 * @param session The session that this data is associated with.
289
 * @param app_ptr The application provided pointer provided to the
290
 *                coap_add_data_large_* functions.
291
 */
292
typedef void (*coap_release_large_data_t)(coap_session_t *session,
293
                                          void *app_ptr);
294
295
/**
296
 * Associates given data with the @p pdu that is passed as second parameter.
297
 *
298
 * This function will fail if data has already been added to the @p pdu.
299
 *
300
 * If all the data can be transmitted in a single PDU, this is functionally
301
 * the same as coap_add_data() except @p release_func (if not NULL) will get
302
 * invoked after data transmission.
303
 *
304
 * Used for a client request.
305
 *
306
 * If the data spans multiple PDUs, then the data will get transmitted using
307
 * (Q-)Block1 option with the addition of the Size1 and Request-Tag options.
308
 * The underlying library will handle the transmission of the individual blocks.
309
 * Once the body of data has been transmitted (or a failure occurred), then
310
 * @p release_func (if not NULL) will get called so the application can
311
 * de-allocate the @p data based on @p app_data. It is the responsibility of
312
 * the application not to change the contents of @p data until the data
313
 * transfer has completed.
314
 *
315
 * There is no need for the application to include the (Q-)Block1 option in the
316
 * @p pdu.
317
 *
318
 * coap_add_data_large_request() (or the alternative coap_add_data_large_*()
319
 * functions) must be called only once per PDU and must be the last PDU update
320
 * before the PDU is transmitted. The (potentially) initial data will get
321
 * transmitted when coap_send() is invoked.
322
 *
323
 * Note: COAP_BLOCK_USE_LIBCOAP must be set by coap_context_set_block_mode()
324
 * for libcoap to work correctly when using this function.
325
 *
326
 * @param session  The session to associate the data with.
327
 * @param pdu      The PDU to associate the data with.
328
 * @param length   The length of data to transmit.
329
 * @param data     The data to transmit.
330
 * @param release_func The function to call to de-allocate @p app_ptr or @c NULL
331
 *                 if the function is not required.
332
 * @param app_ptr  A Pointer that the application can provide for when
333
 *                 release_func() is called.
334
 *
335
 * @return @c 1 if addition is successful, else @c 0.
336
 */
337
COAP_API int coap_add_data_large_request(coap_session_t *session,
338
                                         coap_pdu_t *pdu,
339
                                         size_t length,
340
                                         const uint8_t *data,
341
                                         coap_release_large_data_t release_func,
342
                                         void *app_ptr);
343
344
/**
345
 * Callback handler for getting the data based on @p app_ptr provided to
346
 * coap_add_data_large_request_app() function for then sending the next block
347
 * of data.
348
 *
349
 * @param session The session that this data is associated with.
350
 * @param max     The maximum size of the data to be returned.
351
 * @param offset  The starting offset of the requested data.
352
 * @param data    Where to copy the data into.
353
 * @param length  Updated with the provided data length. This cannot be
354
 *                larger than @p max. This must be the same as @p max
355
 *                apart from the final block.
356
 * @param app_ptr The application provided pointer provided to the
357
 *                coap_add_data_large_request_app function.
358
 *
359
 * @return 1 if data provided, else 0.
360
 */
361
typedef int (*coap_get_large_data_t)(coap_session_t *session, size_t max,
362
                                     size_t offset,
363
                                     uint8_t *data, size_t *length,
364
                                     void *app_ptr);
365
/**
366
 * Associates given data callback with the @p pdu that is passed as second parameter.
367
 *
368
 * This function will fail if data has already been added to the @p pdu.
369
 *
370
 * Used for a client request.
371
 *
372
 * If the data spans multiple PDUs, then the data will get transmitted using
373
 * (Q-)Block1 option with the addition of the Size1 and Request-Tag options.
374
 * The underlying library will handle the transmission of the individual blocks.
375
 *
376
 * Each individual block of data will get requested by the use of a call-back
377
 * function @p get_func before transmission.
378
 *
379
 * There is no need for the application to include the (Q-)Block1 option in the
380
 * @p pdu.
381
 *
382
 * coap_add_data_large_request_app() (or the alternative coap_add_data_large_*()
383
 * functions) must be called only once per PDU and must be the last PDU update
384
 * before the PDU is transmitted. The (potentially) initial data will get
385
 * transmitted when coap_send() is invoked.
386
 *
387
 * Note: COAP_BLOCK_USE_LIBCOAP must be set by coap_context_set_block_mode()
388
 * for libcoap to work correctly when using this function.
389
 *
390
 * @param session  The session to associate the data with.
391
 * @param pdu      The PDU to associate the data with.
392
 * @param length   The length of data to transmit.
393
 * @param release_func The function to call to de-allocate @p app_ptr or @c NULL
394
 *                 if the function is not required.
395
 * @param get_func The function to call to get the next block of data
396
 *                 for transmission.
397
 * @param app_ptr  A Pointer that the application can provide for when
398
 *                 @p get_func is called.
399
 *
400
 * @return @c 1 if addition is successful, else @c 0.
401
 */
402
COAP_API int coap_add_data_large_request_app(coap_session_t *session,
403
                                             coap_pdu_t *pdu,
404
                                             size_t length,
405
                                             coap_release_large_data_t release_func,
406
                                             coap_get_large_data_t get_func,
407
                                             void *app_ptr);
408
409
/**
410
 * Associates given data with the @p response pdu that is passed as fourth
411
 * parameter.
412
 *
413
 * This function will fail if data has already been added to the @p pdu.
414
 *
415
 * If all the data can be transmitted in a single PDU, this is functionally
416
 * the same as coap_add_data() except @p release_func (if not NULL) will get
417
 * invoked after data transmission. The Content-Format, Max-Age and ETag
418
 * options may be added in as appropriate.
419
 *
420
 * Used by a server request handler to create the response.
421
 *
422
 * If the data spans multiple PDUs, then the data will get transmitted using
423
 * (Q-)Block2 (response) option with the addition of the Size2 and ETag
424
 * options. The underlying library will handle the transmission of the
425
 * individual blocks. Once the body of data has been transmitted (or a
426
 * failure occurred), then @p release_func (if not NULL) will get called so the
427
 * application can de-allocate the @p data based on @p app_data. It is the
428
 * responsibility of the application not to change the contents of @p data
429
 * until the data transfer has completed.
430
 *
431
 * There is no need for the application to include the (Q-)Block2 option in the
432
 * @p pdu.
433
 *
434
 * coap_add_data_large_response() (or the alternative coap_add_data_large_*()
435
 * functions) must be called only once per PDU and must be the last PDU update
436
 * before returning from the request handler function.
437
 *
438
 * Note: COAP_BLOCK_USE_LIBCOAP must be set by coap_context_set_block_mode()
439
 * for libcoap to work correctly when using this function.
440
 *
441
 * @param resource   The resource the data is associated with.
442
 * @param session    The coap session.
443
 * @param request    The requesting pdu.
444
 * @param response   The response pdu.
445
 * @param query      The query taken from the (original) requesting pdu.
446
 * @param media_type The content format of the data.
447
 * @param maxage     The maxmimum life of the data. If @c -1, then there
448
 *                   is no maxage.
449
 * @param etag       ETag to use if not 0.
450
 * @param length     The total length of the data.
451
 * @param data       The entire data block to transmit.
452
 * @param release_func The function to call to de-allocate @p app_ptr or NULL if
453
 *                   the function is not required.
454
 * @param app_ptr    A Pointer that the application can provide for when
455
 *                   release_func() is called.
456
 *
457
 * @return @c 1 if addition is successful, else @c 0.
458
 */
459
COAP_API int coap_add_data_large_response(coap_resource_t *resource,
460
                                          coap_session_t *session,
461
                                          const coap_pdu_t *request,
462
                                          coap_pdu_t *response,
463
                                          const coap_string_t *query,
464
                                          uint16_t media_type,
465
                                          int maxage,
466
                                          uint64_t etag,
467
                                          size_t length,
468
                                          const uint8_t *data,
469
                                          coap_release_large_data_t release_func,
470
                                          void *app_ptr);
471
472
/**
473
 * Set the context level CoAP block handling bits for handling RFC7959.
474
 * These bits flow down to a session when a session is created and if the peer
475
 * does not support something, an appropriate bit may get disabled in the
476
 * session block_mode.
477
 * The session block_mode then flows down into coap_crcv_t or coap_srcv_t where
478
 * again an appropriate bit may get disabled.
479
 *
480
 * Note: This function must be called before the session is set up.
481
 *
482
 * Note: COAP_BLOCK_USE_LIBCOAP must be set if libcoap is to do all the
483
 * block tracking and requesting, otherwise the application will have to do
484
 * all of this work (the default if coap_context_set_block_mode() is not
485
 * called).
486
 *
487
 * @param context        The coap_context_t object.
488
 * @param block_mode     Zero or more COAP_BLOCK_ or'd options
489
 */
490
COAP_API void coap_context_set_block_mode(coap_context_t *context,
491
                                          uint32_t block_mode);
492
493
/**
494
 * Set the context level maximum block size that the server supports when sending
495
 * or receiving packets with Block1 or Block2 options.
496
 * This maximum block size flows down to a session when a session is created.
497
 *
498
 * Note: This function must be called before the session is set up.
499
 *
500
 * Note: COAP_BLOCK_USE_LIBCOAP must be set using coap_context_set_block_mode()
501
 * if libcoap is to do this work.
502
 *
503
 * @param context        The coap_context_t object.
504
 * @param max_block_size The maximum block size a server supports.  Can be 0
505
 *                       (reset), or must be 16, 32, 64, 128, 256, 512 or 1024.
506
 */
507
COAP_API int coap_context_set_max_block_size(coap_context_t *context, size_t max_block_size);
508
509
/**@}*/
510
511
#ifdef __cplusplus
512
}
513
#endif
514
515
#endif /* COAP_BLOCK_H_ */