ucl_internal.h revision 290071
1262395Sbapt/* Copyright (c) 2013, Vsevolod Stakhov
2262395Sbapt * All rights reserved.
3262395Sbapt *
4262395Sbapt * Redistribution and use in source and binary forms, with or without
5262395Sbapt * modification, are permitted provided that the following conditions are met:
6262395Sbapt *       * Redistributions of source code must retain the above copyright
7262395Sbapt *         notice, this list of conditions and the following disclaimer.
8262395Sbapt *       * Redistributions in binary form must reproduce the above copyright
9262395Sbapt *         notice, this list of conditions and the following disclaimer in the
10262395Sbapt *         documentation and/or other materials provided with the distribution.
11262395Sbapt *
12262395Sbapt * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY
13262395Sbapt * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14262395Sbapt * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15262395Sbapt * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
16262395Sbapt * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17262395Sbapt * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18262395Sbapt * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19262395Sbapt * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20262395Sbapt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21262395Sbapt * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22262395Sbapt */
23262395Sbapt
24262395Sbapt#ifndef UCL_INTERNAL_H_
25262395Sbapt#define UCL_INTERNAL_H_
26262395Sbapt
27263648Sbapt#ifdef HAVE_CONFIG_H
28263648Sbapt#include "config.h"
29263648Sbapt#else
30263648Sbapt/* Help embedded builds */
31263648Sbapt#define HAVE_SYS_TYPES_H
32263648Sbapt#define HAVE_SYS_MMAN_H
33263648Sbapt#define HAVE_SYS_STAT_H
34263648Sbapt#define HAVE_SYS_PARAM_H
35263648Sbapt#define HAVE_LIMITS_H
36263648Sbapt#define HAVE_FCNTL_H
37263648Sbapt#define HAVE_ERRNO_H
38263648Sbapt#define HAVE_UNISTD_H
39263648Sbapt#define HAVE_CTYPE_H
40263648Sbapt#define HAVE_STDIO_H
41263648Sbapt#define HAVE_STRING_H
42263648Sbapt#define HAVE_FLOAT_H
43263648Sbapt#define HAVE_LIBGEN_H
44263648Sbapt#define HAVE_MATH_H
45263648Sbapt#define HAVE_STDBOOL_H
46263648Sbapt#define HAVE_STDINT_H
47263648Sbapt#define HAVE_STDARG_H
48264789Sbapt#ifndef _WIN32
49264789Sbapt# define HAVE_REGEX_H
50263648Sbapt#endif
51264789Sbapt#endif
52263648Sbapt
53263648Sbapt#ifdef HAVE_SYS_TYPES_H
54262395Sbapt#include <sys/types.h>
55262975Sbapt#endif
56263648Sbapt
57263648Sbapt#ifdef HAVE_SYS_MMAN_H
58263648Sbapt# ifndef _WIN32
59263648Sbapt#  include <sys/mman.h>
60263648Sbapt# endif
61263648Sbapt#endif
62263648Sbapt#ifdef HAVE_SYS_STAT_H
63262395Sbapt#include <sys/stat.h>
64263648Sbapt#endif
65263648Sbapt#ifdef HAVE_SYS_PARAM_H
66262395Sbapt#include <sys/param.h>
67263648Sbapt#endif
68262395Sbapt
69263648Sbapt#ifdef HAVE_LIMITS_H
70262395Sbapt#include <limits.h>
71263648Sbapt#endif
72263648Sbapt#ifdef HAVE_FCNTL_H
73262395Sbapt#include <fcntl.h>
74263648Sbapt#endif
75263648Sbapt#ifdef HAVE_ERRNO_H
76262395Sbapt#include <errno.h>
77263648Sbapt#endif
78263648Sbapt#ifdef HAVE_UNISTD_H
79262395Sbapt#include <unistd.h>
80263648Sbapt#endif
81263648Sbapt#ifdef HAVE_CTYPE_H
82262395Sbapt#include <ctype.h>
83263648Sbapt#endif
84263648Sbapt#ifdef HAVE_STDIO_H
85263648Sbapt#include <stdio.h>
86263648Sbapt#endif
87263648Sbapt#ifdef HAVE_STRING_H
88263648Sbapt#include <string.h>
89263648Sbapt#endif
90262395Sbapt
91262395Sbapt#include "utlist.h"
92262395Sbapt#include "utstring.h"
93262395Sbapt#include "uthash.h"
94262395Sbapt#include "ucl.h"
95262395Sbapt#include "ucl_hash.h"
96262395Sbapt#include "xxhash.h"
97262395Sbapt
98262395Sbapt#ifdef HAVE_OPENSSL
99262395Sbapt#include <openssl/evp.h>
100262395Sbapt#endif
101262395Sbapt
102264789Sbapt#ifndef __DECONST
103264789Sbapt#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
104264789Sbapt#endif
105264789Sbapt
106262395Sbapt/**
107262395Sbapt * @file rcl_internal.h
108262395Sbapt * Internal structures and functions of UCL library
109262395Sbapt */
110262395Sbapt
111262395Sbapt#define UCL_MAX_RECURSION 16
112262395Sbapt#define UCL_TRASH_KEY 0
113262395Sbapt#define UCL_TRASH_VALUE 1
114262395Sbapt
115262395Sbaptenum ucl_parser_state {
116262395Sbapt	UCL_STATE_INIT = 0,
117262395Sbapt	UCL_STATE_OBJECT,
118262395Sbapt	UCL_STATE_ARRAY,
119262395Sbapt	UCL_STATE_KEY,
120262395Sbapt	UCL_STATE_VALUE,
121262395Sbapt	UCL_STATE_AFTER_VALUE,
122262395Sbapt	UCL_STATE_ARRAY_VALUE,
123262395Sbapt	UCL_STATE_SCOMMENT,
124262395Sbapt	UCL_STATE_MCOMMENT,
125262395Sbapt	UCL_STATE_MACRO_NAME,
126262395Sbapt	UCL_STATE_MACRO,
127262395Sbapt	UCL_STATE_ERROR
128262395Sbapt};
129262395Sbapt
130262395Sbaptenum ucl_character_type {
131262395Sbapt	UCL_CHARACTER_DENIED = 0,
132262395Sbapt	UCL_CHARACTER_KEY = 1,
133262395Sbapt	UCL_CHARACTER_KEY_START = 1 << 1,
134262395Sbapt	UCL_CHARACTER_WHITESPACE = 1 << 2,
135262395Sbapt	UCL_CHARACTER_WHITESPACE_UNSAFE = 1 << 3,
136262395Sbapt	UCL_CHARACTER_VALUE_END = 1 << 4,
137262395Sbapt	UCL_CHARACTER_VALUE_STR = 1 << 5,
138262395Sbapt	UCL_CHARACTER_VALUE_DIGIT = 1 << 6,
139262395Sbapt	UCL_CHARACTER_VALUE_DIGIT_START = 1 << 7,
140262395Sbapt	UCL_CHARACTER_ESCAPE = 1 << 8,
141262395Sbapt	UCL_CHARACTER_KEY_SEP = 1 << 9,
142262395Sbapt	UCL_CHARACTER_JSON_UNSAFE = 1 << 10,
143262395Sbapt	UCL_CHARACTER_UCL_UNSAFE = 1 << 11
144262395Sbapt};
145262395Sbapt
146262395Sbaptstruct ucl_macro {
147262395Sbapt	char *name;
148290071Sbapt	union {
149290071Sbapt		ucl_macro_handler handler;
150290071Sbapt		ucl_context_macro_handler context_handler;
151290071Sbapt	} h;
152262395Sbapt	void* ud;
153290071Sbapt	bool is_context;
154262395Sbapt	UT_hash_handle hh;
155262395Sbapt};
156262395Sbapt
157262395Sbaptstruct ucl_stack {
158262395Sbapt	ucl_object_t *obj;
159262395Sbapt	struct ucl_stack *next;
160290071Sbapt	uint64_t level;
161262395Sbapt};
162262395Sbapt
163262395Sbaptstruct ucl_chunk {
164262395Sbapt	const unsigned char *begin;
165262395Sbapt	const unsigned char *end;
166262395Sbapt	const unsigned char *pos;
167262395Sbapt	size_t remain;
168262395Sbapt	unsigned int line;
169262395Sbapt	unsigned int column;
170275223Sbapt	unsigned priority;
171290071Sbapt	enum ucl_duplicate_strategy strategy;
172290071Sbapt	enum ucl_parse_type parse_type;
173262395Sbapt	struct ucl_chunk *next;
174262395Sbapt};
175262395Sbapt
176262395Sbapt#ifdef HAVE_OPENSSL
177262395Sbaptstruct ucl_pubkey {
178262395Sbapt	EVP_PKEY *key;
179262395Sbapt	struct ucl_pubkey *next;
180262395Sbapt};
181262395Sbapt#else
182262395Sbaptstruct ucl_pubkey {
183262395Sbapt	struct ucl_pubkey *next;
184262395Sbapt};
185262395Sbapt#endif
186262395Sbapt
187262395Sbaptstruct ucl_variable {
188262395Sbapt	char *var;
189262395Sbapt	char *value;
190262395Sbapt	size_t var_len;
191262395Sbapt	size_t value_len;
192275223Sbapt	struct ucl_variable *prev, *next;
193262395Sbapt};
194262395Sbapt
195262395Sbaptstruct ucl_parser {
196262395Sbapt	enum ucl_parser_state state;
197262395Sbapt	enum ucl_parser_state prev_state;
198262395Sbapt	unsigned int recursion;
199262395Sbapt	int flags;
200290071Sbapt	unsigned default_priority;
201290071Sbapt	int err_code;
202262395Sbapt	ucl_object_t *top_obj;
203262395Sbapt	ucl_object_t *cur_obj;
204290071Sbapt	ucl_object_t *trash_objs;
205290071Sbapt	ucl_object_t *includepaths;
206275223Sbapt	char *cur_file;
207262395Sbapt	struct ucl_macro *macroes;
208262395Sbapt	struct ucl_stack *stack;
209262395Sbapt	struct ucl_chunk *chunks;
210262395Sbapt	struct ucl_pubkey *keys;
211262395Sbapt	struct ucl_variable *variables;
212266636Sbapt	ucl_variable_handler var_handler;
213266636Sbapt	void *var_data;
214262395Sbapt	UT_string *err;
215262395Sbapt};
216262395Sbapt
217275223Sbaptstruct ucl_object_userdata {
218275223Sbapt	ucl_object_t obj;
219275223Sbapt	ucl_userdata_dtor dtor;
220275223Sbapt	ucl_userdata_emitter emitter;
221275223Sbapt};
222275223Sbapt
223262395Sbapt/**
224262395Sbapt * Unescape json string inplace
225262395Sbapt * @param str
226262395Sbapt */
227262395Sbaptsize_t ucl_unescape_json_string (char *str, size_t len);
228262395Sbapt
229262395Sbapt/**
230262395Sbapt * Handle include macro
231262395Sbapt * @param data include data
232262395Sbapt * @param len length of data
233290071Sbapt * @param args UCL object representing arguments to the macro
234262395Sbapt * @param ud user data
235262395Sbapt * @return
236262395Sbapt */
237275223Sbaptbool ucl_include_handler (const unsigned char *data, size_t len,
238275223Sbapt		const ucl_object_t *args, void* ud);
239262395Sbapt
240290071Sbapt/**
241290071Sbapt * Handle tryinclude macro
242290071Sbapt * @param data include data
243290071Sbapt * @param len length of data
244290071Sbapt * @param args UCL object representing arguments to the macro
245290071Sbapt * @param ud user data
246290071Sbapt * @return
247290071Sbapt */
248275223Sbaptbool ucl_try_include_handler (const unsigned char *data, size_t len,
249275223Sbapt		const ucl_object_t *args, void* ud);
250262395Sbapt
251262395Sbapt/**
252262395Sbapt * Handle includes macro
253262395Sbapt * @param data include data
254262395Sbapt * @param len length of data
255290071Sbapt * @param args UCL object representing arguments to the macro
256262395Sbapt * @param ud user data
257262395Sbapt * @return
258262395Sbapt */
259275223Sbaptbool ucl_includes_handler (const unsigned char *data, size_t len,
260275223Sbapt		const ucl_object_t *args, void* ud);
261262395Sbapt
262290071Sbapt/**
263290071Sbapt * Handle priority macro
264290071Sbapt * @param data include data
265290071Sbapt * @param len length of data
266290071Sbapt * @param args UCL object representing arguments to the macro
267290071Sbapt * @param ud user data
268290071Sbapt * @return
269290071Sbapt */
270290071Sbaptbool ucl_priority_handler (const unsigned char *data, size_t len,
271290071Sbapt		const ucl_object_t *args, void* ud);
272290071Sbapt
273290071Sbapt/**
274290071Sbapt * Handle load macro
275290071Sbapt * @param data include data
276290071Sbapt * @param len length of data
277290071Sbapt * @param args UCL object representing arguments to the macro
278290071Sbapt * @param ud user data
279290071Sbapt * @return
280290071Sbapt */
281290071Sbaptbool ucl_load_handler (const unsigned char *data, size_t len,
282290071Sbapt		const ucl_object_t *args, void* ud);
283290071Sbapt/**
284290071Sbapt * Handle inherit macro
285290071Sbapt * @param data include data
286290071Sbapt * @param len length of data
287290071Sbapt * @param args UCL object representing arguments to the macro
288290071Sbapt * @param ctx the current context object
289290071Sbapt * @param ud user data
290290071Sbapt * @return
291290071Sbapt */
292290071Sbaptbool ucl_inherit_handler (const unsigned char *data, size_t len,
293290071Sbapt		const ucl_object_t *args, const ucl_object_t *ctx, void* ud);
294290071Sbapt
295262395Sbaptsize_t ucl_strlcpy (char *dst, const char *src, size_t siz);
296262395Sbaptsize_t ucl_strlcpy_unsafe (char *dst, const char *src, size_t siz);
297262395Sbaptsize_t ucl_strlcpy_tolower (char *dst, const char *src, size_t siz);
298262395Sbapt
299290071Sbaptchar *ucl_strnstr (const char *s, const char *find, int len);
300290071Sbaptchar *ucl_strncasestr (const char *s, const char *find, int len);
301262395Sbapt
302262395Sbapt#ifdef __GNUC__
303262395Sbaptstatic inline void
304262395Sbaptucl_create_err (UT_string **err, const char *fmt, ...)
305262395Sbapt__attribute__ (( format( printf, 2, 3) ));
306262395Sbapt#endif
307262395Sbapt
308290071Sbapt#undef UCL_FATAL_ERRORS
309290071Sbapt
310262395Sbaptstatic inline void
311262395Sbaptucl_create_err (UT_string **err, const char *fmt, ...)
312262395Sbapt{
313262395Sbapt	if (*err == NULL) {
314262395Sbapt		utstring_new (*err);
315262395Sbapt		va_list ap;
316262395Sbapt		va_start (ap, fmt);
317262395Sbapt		utstring_printf_va (*err, fmt, ap);
318262395Sbapt		va_end (ap);
319262395Sbapt	}
320290071Sbapt
321290071Sbapt#ifdef UCL_FATAL_ERRORS
322290071Sbapt	assert (0);
323290071Sbapt#endif
324262395Sbapt}
325262395Sbapt
326262395Sbapt/**
327262395Sbapt * Check whether a given string contains a boolean value
328262395Sbapt * @param obj object to set
329262395Sbapt * @param start start of a string
330262395Sbapt * @param len length of a string
331262395Sbapt * @return true if a string is a boolean value
332262395Sbapt */
333262395Sbaptstatic inline bool
334262395Sbaptucl_maybe_parse_boolean (ucl_object_t *obj, const unsigned char *start, size_t len)
335262395Sbapt{
336275223Sbapt	const char *p = (const char *)start;
337262395Sbapt	bool ret = false, val = false;
338262395Sbapt
339262395Sbapt	if (len == 5) {
340262395Sbapt		if ((p[0] == 'f' || p[0] == 'F') && strncasecmp (p, "false", 5) == 0) {
341262395Sbapt			ret = true;
342262395Sbapt			val = false;
343262395Sbapt		}
344262395Sbapt	}
345262395Sbapt	else if (len == 4) {
346262395Sbapt		if ((p[0] == 't' || p[0] == 'T') && strncasecmp (p, "true", 4) == 0) {
347262395Sbapt			ret = true;
348262395Sbapt			val = true;
349262395Sbapt		}
350262395Sbapt	}
351262395Sbapt	else if (len == 3) {
352262395Sbapt		if ((p[0] == 'y' || p[0] == 'Y') && strncasecmp (p, "yes", 3) == 0) {
353262395Sbapt			ret = true;
354262395Sbapt			val = true;
355262395Sbapt		}
356262395Sbapt		else if ((p[0] == 'o' || p[0] == 'O') && strncasecmp (p, "off", 3) == 0) {
357262395Sbapt			ret = true;
358262395Sbapt			val = false;
359262395Sbapt		}
360262395Sbapt	}
361262395Sbapt	else if (len == 2) {
362262395Sbapt		if ((p[0] == 'n' || p[0] == 'N') && strncasecmp (p, "no", 2) == 0) {
363262395Sbapt			ret = true;
364262395Sbapt			val = false;
365262395Sbapt		}
366262395Sbapt		else if ((p[0] == 'o' || p[0] == 'O') && strncasecmp (p, "on", 2) == 0) {
367262395Sbapt			ret = true;
368262395Sbapt			val = true;
369262395Sbapt		}
370262395Sbapt	}
371262395Sbapt
372290071Sbapt	if (ret && obj != NULL) {
373262395Sbapt		obj->type = UCL_BOOLEAN;
374262395Sbapt		obj->value.iv = val;
375262395Sbapt	}
376262395Sbapt
377262395Sbapt	return ret;
378262395Sbapt}
379262395Sbapt
380262395Sbapt/**
381262395Sbapt * Check numeric string
382262395Sbapt * @param obj object to set if a string is numeric
383262395Sbapt * @param start start of string
384262395Sbapt * @param end end of string
385262395Sbapt * @param pos position where parsing has stopped
386262395Sbapt * @param allow_double allow parsing of floating point values
387262395Sbapt * @return 0 if string is numeric and error code (EINVAL or ERANGE) in case of conversion error
388262395Sbapt */
389262395Sbaptint ucl_maybe_parse_number (ucl_object_t *obj,
390263648Sbapt		const char *start, const char *end, const char **pos,
391263648Sbapt		bool allow_double, bool number_bytes, bool allow_time);
392262395Sbapt
393262395Sbapt
394264789Sbaptstatic inline const ucl_object_t *
395262395Sbaptucl_hash_search_obj (ucl_hash_t* hashlin, ucl_object_t *obj)
396262395Sbapt{
397264789Sbapt	return (const ucl_object_t *)ucl_hash_search (hashlin, obj->key, obj->keylen);
398262395Sbapt}
399262395Sbapt
400279549Sbaptstatic inline ucl_hash_t * ucl_hash_insert_object (ucl_hash_t *hashlin,
401279549Sbapt		const ucl_object_t *obj,
402279549Sbapt		bool ignore_case) UCL_WARN_UNUSED_RESULT;
403262395Sbapt
404262395Sbaptstatic inline ucl_hash_t *
405279549Sbaptucl_hash_insert_object (ucl_hash_t *hashlin,
406279549Sbapt		const ucl_object_t *obj,
407279549Sbapt		bool ignore_case)
408262395Sbapt{
409262395Sbapt	if (hashlin == NULL) {
410279549Sbapt		hashlin = ucl_hash_create (ignore_case);
411262395Sbapt	}
412262395Sbapt	ucl_hash_insert (hashlin, obj, obj->key, obj->keylen);
413262395Sbapt
414262395Sbapt	return hashlin;
415262395Sbapt}
416262395Sbapt
417262395Sbapt/**
418268831Sbapt * Get standard emitter context for a specified emit_type
419268831Sbapt * @param emit_type type of emitter
420268831Sbapt * @return context or NULL if input is invalid
421268831Sbapt */
422268831Sbaptconst struct ucl_emitter_context *
423268831Sbaptucl_emit_get_standard_context (enum ucl_emitter emit_type);
424268831Sbapt
425268831Sbapt/**
426275223Sbapt * Serialize string as JSON string
427268831Sbapt * @param str string to emit
428268831Sbapt * @param buf target buffer
429268831Sbapt */
430268831Sbaptvoid ucl_elt_string_write_json (const char *str, size_t size,
431268831Sbapt		struct ucl_emitter_context *ctx);
432268831Sbapt
433268831Sbapt/**
434275223Sbapt * Write multiline string using `EOD` as string terminator
435275223Sbapt * @param str
436275223Sbapt * @param size
437275223Sbapt * @param ctx
438275223Sbapt */
439275223Sbaptvoid ucl_elt_string_write_multiline (const char *str, size_t size,
440275223Sbapt		struct ucl_emitter_context *ctx);
441275223Sbapt
442275223Sbapt/**
443262395Sbapt * Emit a single object to string
444262395Sbapt * @param obj
445262395Sbapt * @return
446262395Sbapt */
447264789Sbaptunsigned char * ucl_object_emit_single_json (const ucl_object_t *obj);
448262395Sbapt
449275223Sbapt/**
450275223Sbapt * Check whether a specified string is long and should be likely printed in
451275223Sbapt * multiline mode
452275223Sbapt * @param obj
453275223Sbapt * @return
454275223Sbapt */
455275223Sbaptbool ucl_maybe_long_string (const ucl_object_t *obj);
456275223Sbapt
457290071Sbapt/**
458290071Sbapt * Print integer to the msgpack output
459290071Sbapt * @param ctx
460290071Sbapt * @param val
461290071Sbapt */
462290071Sbaptvoid ucl_emitter_print_int_msgpack (struct ucl_emitter_context *ctx,
463290071Sbapt		int64_t val);
464290071Sbapt/**
465290071Sbapt * Print integer to the msgpack output
466290071Sbapt * @param ctx
467290071Sbapt * @param val
468290071Sbapt */
469290071Sbaptvoid ucl_emitter_print_double_msgpack (struct ucl_emitter_context *ctx,
470290071Sbapt		double val);
471290071Sbapt/**
472290071Sbapt * Print double to the msgpack output
473290071Sbapt * @param ctx
474290071Sbapt * @param val
475290071Sbapt */
476290071Sbaptvoid ucl_emitter_print_bool_msgpack (struct ucl_emitter_context *ctx,
477290071Sbapt		bool val);
478290071Sbapt/**
479290071Sbapt * Print string to the msgpack output
480290071Sbapt * @param ctx
481290071Sbapt * @param s
482290071Sbapt * @param len
483290071Sbapt */
484290071Sbaptvoid ucl_emitter_print_string_msgpack (struct ucl_emitter_context *ctx,
485290071Sbapt		const char *s, size_t len);
486290071Sbapt
487290071Sbapt/**
488290071Sbapt * Print binary string to the msgpack output
489290071Sbapt * @param ctx
490290071Sbapt * @param s
491290071Sbapt * @param len
492290071Sbapt */
493290071Sbaptvoid ucl_emitter_print_binary_string_msgpack (struct ucl_emitter_context *ctx,
494290071Sbapt		const char *s, size_t len);
495290071Sbapt
496290071Sbapt/**
497290071Sbapt * Print array preamble for msgpack
498290071Sbapt * @param ctx
499290071Sbapt * @param len
500290071Sbapt */
501290071Sbaptvoid ucl_emitter_print_array_msgpack (struct ucl_emitter_context *ctx,
502290071Sbapt		size_t len);
503290071Sbapt
504290071Sbapt/**
505290071Sbapt * Print object preamble for msgpack
506290071Sbapt * @param ctx
507290071Sbapt * @param len
508290071Sbapt */
509290071Sbaptvoid ucl_emitter_print_object_msgpack (struct ucl_emitter_context *ctx,
510290071Sbapt		size_t len);
511290071Sbapt/**
512290071Sbapt * Print NULL to the msgpack output
513290071Sbapt * @param ctx
514290071Sbapt */
515290071Sbaptvoid ucl_emitter_print_null_msgpack (struct ucl_emitter_context *ctx);
516290071Sbapt/**
517290071Sbapt * Print object's key if needed to the msgpack output
518290071Sbapt * @param print_key
519290071Sbapt * @param ctx
520290071Sbapt * @param obj
521290071Sbapt */
522290071Sbaptvoid ucl_emitter_print_key_msgpack (bool print_key,
523290071Sbapt		struct ucl_emitter_context *ctx,
524290071Sbapt		const ucl_object_t *obj);
525290071Sbapt
526290071Sbapt/**
527290071Sbapt * Add new element to an object using the current merge strategy and priority
528290071Sbapt * @param parser
529290071Sbapt * @param nobj
530290071Sbapt * @return
531290071Sbapt */
532290071Sbaptbool ucl_parser_process_object_element (struct ucl_parser *parser,
533290071Sbapt		ucl_object_t *nobj);
534290071Sbapt
535290071Sbapt/**
536290071Sbapt * Parse msgpack chunk
537290071Sbapt * @param parser
538290071Sbapt * @return
539290071Sbapt */
540290071Sbaptbool ucl_parse_msgpack (struct ucl_parser *parser);
541290071Sbapt
542262395Sbapt#endif /* UCL_INTERNAL_H_ */
543