Skip to content

Commit 8ac0d37

Browse files
committed
cborparser: Document cbor_parser_init_reader.
Describe the input parameters for the function and how they are used as best we understand from on-paper analysis of the C code.
1 parent e13ef42 commit 8ac0d37

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cborparser.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,23 @@ CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, C
360360
return preparse_value(it);
361361
}
362362

363+
/**
364+
* Initializes the CBOR parser for parsing a document that is read by an
365+
* abstract reader interface defined by \a ops. The iterator to the first
366+
* element is returned in \a it.
367+
*
368+
* The \a parser structure needs to remain valid throughout the decoding
369+
* process. It is not thread-safe to share one CborParser among multiple
370+
* threads iterating at the same time, but the object can be copied so multiple
371+
* threads can iterate.
372+
*
373+
* The \a ops structure defines functions that implement the read process from
374+
* the buffer given, see \ref CborParserOperations for further details.
375+
*
376+
* The \a token is passed as the first argument to all
377+
* \ref CborParserOperations methods, and may be used to pass additional
378+
* context information to the reader implementation.
379+
*/
363380
CborError cbor_parser_init_reader(const struct CborParserOperations *ops, CborParser *parser, CborValue *it, void *token)
364381
{
365382
cbor_parser_init_common(parser, it);

0 commit comments

Comments
 (0)