Skip to content

Commit fb1b81a

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 e2c5480 commit fb1b81a

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
@@ -359,6 +359,23 @@ CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, C
359359
return preparse_value(it);
360360
}
361361

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

0 commit comments

Comments
 (0)