diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-13 17:05:19 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-13 17:05:19 +0100 |
commit | bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a (patch) | |
tree | a6329d843da8a15acf844e4d91101ed2e920f620 /contrib/libucl/ucl.h | |
parent | 9aac6193c2265ea954fbddd5b3a98ebf0026101f (diff) | |
download | rspamd-bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a.tar.gz rspamd-bb4a6a9ae9a22fa3a9d5d6d80f8db6f1fd345c0a.zip |
Sync with libucl.
Diffstat (limited to 'contrib/libucl/ucl.h')
-rw-r--r-- | contrib/libucl/ucl.h | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/contrib/libucl/ucl.h b/contrib/libucl/ucl.h index 2e0183671..bd209295b 100644 --- a/contrib/libucl/ucl.h +++ b/contrib/libucl/ucl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, Vsevolod Stakhov +/* Copyright (c) 2013-2015, Vsevolod Stakhov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -182,10 +182,30 @@ typedef enum ucl_object_flags { UCL_OBJECT_EPHEMERAL = (1 << 3), /**< Temporary object that does not need to be freed really */ UCL_OBJECT_MULTILINE = (1 << 4), /**< String should be displayed as multiline string */ UCL_OBJECT_MULTIVALUE = (1 << 5), /**< Object is a key with multiple values */ - UCL_OBJECT_INHERITED = (1 << 6) /**< Object has been inherited from another */ + UCL_OBJECT_INHERITED = (1 << 6), /**< Object has been inherited from another */ + UCL_OBJECT_BINARY = (1 << 7) /**< Object contains raw binary data */ } ucl_object_flags_t; /** + * Duplicate policy types + */ +enum ucl_duplicate_strategy { + UCL_DUPLICATE_APPEND = 0, /**< Default policy to merge based on priorities */ + UCL_DUPLICATE_MERGE, /**< Merge new object with old one */ + UCL_DUPLICATE_REWRITE, /**< Rewrite old keys */ + UCL_DUPLICATE_ERROR /**< Stop parsing on duplicate found */ +}; + +/** + * Input format type + */ +enum ucl_parse_type { + UCL_PARSE_UCL = 0, /**< Default ucl format */ + UCL_PARSE_MSGPACK, /**< Message pack input format */ + UCL_PARSE_CSEXP /**< Canonical S-expressions */ +}; + +/** * UCL object structure. Please mention that the most of fields should not be touched by * UCL users. In future, this structure may be converted to private one. */ @@ -195,7 +215,7 @@ typedef struct ucl_object_s { */ union { int64_t iv; /**< Int value of an object */ - const char *sv; /**< String value of an object */ + const char *sv; /**< String value of an object */ double dv; /**< Double value of an object */ void *av; /**< Array */ void *ov; /**< Object */ @@ -917,6 +937,21 @@ UCL_EXTERN bool ucl_parser_add_chunk_priority (struct ucl_parser *parser, const unsigned char *data, size_t len, unsigned priority); /** + * Full version of ucl_add_chunk with priority and duplicate strategy + * @param parser parser structure + * @param data the pointer to the beginning of a chunk + * @param len the length of a chunk + * @param priority the desired priority of a chunk (only 4 least significant bits + * are considered for this parameter) + * @param strat duplicates merging strategy + * @param parse_type input format + * @return true if chunk has been added and false in case of error + */ +UCL_EXTERN bool ucl_parser_add_chunk_full (struct ucl_parser *parser, + const unsigned char *data, size_t len, unsigned priority, + enum ucl_duplicate_strategy strat, enum ucl_parse_type parse_type); + +/** * Load ucl object from a string * @param parser parser structure * @param data the pointer to the string |