|
static void | QCBOREncode_AddTagNumber (QCBOREncodeContext *pCtx, uint64_t uTagNumber) |
| Add a tag number.
|
|
static void | QCBOREncode_AddTDateEpoch (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, int64_t nDate) |
| Add an epoch-based date.
|
|
static void | QCBOREncode_AddTDateEpochToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, int64_t nDate) |
|
static void | QCBOREncode_AddTDateEpochToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, int64_t nDate) |
|
static void | QCBOREncode_AddTDaysEpoch (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, int64_t nDays) |
| Add an epoch-based day-count date.
|
|
static void | QCBOREncode_AddTDaysEpochToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, int64_t nDays) |
|
static void | QCBOREncode_AddTDaysEpochToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, int64_t nDays) |
|
static void | QCBOREncode_AddTBinaryUUID (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC UUID) |
| Add a binary UUID to the encoded output.
|
|
static void | QCBOREncode_AddTBinaryUUIDToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC UUID) |
|
static void | QCBOREncode_AddTBinaryUUIDToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC UUID) |
|
static void | QCBOREncode_AddTURI (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC URI) |
| Add a text URI to the encoded output.
|
|
static void | QCBOREncode_AddTURIToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC URI) |
|
static void | QCBOREncode_AddTURIToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC URI) |
|
static void | QCBOREncode_AddTB64Text (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC B64Text) |
| Add Base64-encoded text to encoded output.
|
|
static void | QCBOREncode_AddTB64TextToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddTB64TextToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddTB64URLText (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC B64Text) |
| Add base64url encoded data to encoded output.
|
|
static void | QCBOREncode_AddTB64URLTextToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddTB64URLTextToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddTRegex (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC Regex) |
| Add Perl Compatible Regular Expression.
|
|
static void | QCBOREncode_AddTRegexToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC Regex) |
|
static void | QCBOREncode_AddTRegexToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC Regex) |
|
static void | QCBOREncode_AddTMIMEData (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC MIMEData) |
| MIME encoded data to the encoded output.
|
|
static void | QCBOREncode_AddTMIMEDataToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC MIMEData) |
|
static void | QCBOREncode_AddTMIMEDataToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, UsefulBufC MIMEData) |
|
static void | QCBOREncode_AddTDateString (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, const char *szDate) |
| Add an RFC 3339 date string.
|
|
static void | QCBOREncode_AddTDateStringToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, const char *szDate) |
|
static void | QCBOREncode_AddTDateStringToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, const char *szDate) |
|
static void | QCBOREncode_AddTDaysString (QCBOREncodeContext *pCtx, enum QCBOREncodeTagReq uTagRequirement, const char *szDate) |
| Add a date-only string.
|
|
static void | QCBOREncode_AddTDaysStringToMapSZ (QCBOREncodeContext *pCtx, const char *szLabel, enum QCBOREncodeTagReq uTagRequirement, const char *szDate) |
|
static void | QCBOREncode_AddTDaysStringToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, enum QCBOREncodeTagReq uTagRequirement, const char *szDate) |
|
static void | QCBOREncode_AddDateEpoch (QCBOREncodeContext *pCtx, int64_t nDate) |
|
static void | QCBOREncode_AddDateEpochToMap (QCBOREncodeContext *pCtx, const char *szLabel, int64_t nDate) |
|
static void | QCBOREncode_AddDateEpochToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, int64_t nDate) |
|
static void | QCBOREncode_AddBinaryUUID (QCBOREncodeContext *pCtx, UsefulBufC UUID) |
|
static void | QCBOREncode_AddBinaryUUIDToMap (QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC UUID) |
|
static void | QCBOREncode_AddBinaryUUIDToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC UUID) |
|
static void | QCBOREncode_AddTag (QCBOREncodeContext *pCtx, uint64_t uTagNumber) |
|
static void | QCBOREncode_AddURI (QCBOREncodeContext *pCtx, UsefulBufC URI) |
|
static void | QCBOREncode_AddURIToMap (QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC URI) |
|
static void | QCBOREncode_AddURIToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC URI) |
|
static void | QCBOREncode_AddB64Text (QCBOREncodeContext *pCtx, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddB64TextToMap (QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddB64TextToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddB64URLText (QCBOREncodeContext *pCtx, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddB64URLTextToMap (QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddB64URLTextToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC B64Text) |
|
static void | QCBOREncode_AddRegex (QCBOREncodeContext *pCtx, UsefulBufC Regex) |
|
static void | QCBOREncode_AddRegexToMap (QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC Regex) |
|
static void | QCBOREncode_AddRegexToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC Regex) |
|
static void | QCBOREncode_AddMIMEData (QCBOREncodeContext *pCtx, UsefulBufC MIMEData) |
|
static void | QCBOREncode_AddMIMEDataToMap (QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC MIMEData) |
|
static void | QCBOREncode_AddMIMEDataToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC MIMEData) |
|
static void | QCBOREncode_AddDateString (QCBOREncodeContext *pCtx, const char *szDate) |
|
static void | QCBOREncode_AddDateStringToMap (QCBOREncodeContext *pCtx, const char *szLabel, const char *szDate) |
|
static void | QCBOREncode_AddDateStringToMapN (QCBOREncodeContext *pCtx, int64_t nLabel, const char *szDate) |
|
Tag Encoding
If you are unfamiliar with CBOR tags and related terminology, reviewing the CBORTags documentation.
QCBOR provides multiple ways to encode tags, some for standard tags that QCBOR supports directly and another that works for any tag.
Encoding Standardized Tags
For many standardized tags, QCBOR offers dedicated methods. For instance, the standard tag for an epoch date can be encoded using QCBOREncode_AddTDateEpoch(). These methods are easily identifiable by their names, which always begin with "QCBOREncode_AddT".
General Tag Encoding
To encode a any tag, you can use QCBOREncode_AddTagNumber() followed by other QCBOR encode methods to encode the tag content.
Tags can nest, so there might be sequential calls to QCBOREncode_AddTagNumber(). While deep nesting is rare and there is no limit for encoding, QCBOR decoding is limited to a depth of QCBOR_MAX_TAGS_PER_ITEM.
Borrowing Tag Content
As explained in AreTagsOptional, tag content for a specific tag is often encoded without including the tag number. This practice, known as "borrowing" tag content, is comparable to implicit tagging in ASN.1, where the type is inferred from the context.
All QCBOR APIs for encoding specific tags, such as QCBOREncode_AddTDaysEpoch(), include an argument of type QCBOREncodeTagReq. This argument determines whether the tag number should be included or omitted.
For tags for which QCBOR provides no API, outputting borrowed content amounts to just omitting the tag number.
For tags without dedicated QCBOR APIs, encoding borrowed content is straightforward: simply omit the tag number.
Add an epoch-based date.
- Parameters
-
As per RFC 8949 this is similar to UNIX/Linux/POSIX dates. This is the most compact way to specify a date and time in CBOR. Note that this is always UTC and does not include the time zone. Use QCBOREncode_AddDateString() if you want to include the time zone.
The preferred integer serialization rules apply here so the date will be encoded in a minimal number of bytes. Until about the year 2106 these dates will encode in 6 bytes – one byte for the tag, one byte for the type and 4 bytes for the integer. After that it will encode to 10 bytes.
Negative values are supported for dates before 1970.
If you care about leap-seconds and that level of accuracy, make sure the system you are running this code on does it correctly. This code just takes the value passed in.
This implementation cannot encode fractional seconds using float or double even though that is allowed by CBOR, but you can encode them if you want to by calling QCBOREncode_AddTagNumber() and QCBOREncode_AddDouble().
Error handling is the same as QCBOREncode_AddInt64().
See also QCBOREncode_AddTDaysEpoch().