xref: /openbsd-src/usr.sbin/rpki-client/json.h (revision a09a319138073774985f6c6e2b7c5117a3a98bf4)
1*a09a3191Sclaudio /*	$OpenBSD: json.h,v 1.3 2023/06/05 14:19:13 claudio Exp $ */
215797777Sclaudio 
315797777Sclaudio /*
415797777Sclaudio  * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
515797777Sclaudio  *
615797777Sclaudio  * Permission to use, copy, modify, and distribute this software for any
715797777Sclaudio  * purpose with or without fee is hereby granted, provided that the above
815797777Sclaudio  * copyright notice and this permission notice appear in all copies.
915797777Sclaudio  *
1015797777Sclaudio  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1115797777Sclaudio  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1215797777Sclaudio  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1315797777Sclaudio  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1415797777Sclaudio  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1515797777Sclaudio  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1615797777Sclaudio  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1715797777Sclaudio  */
1815797777Sclaudio 
1915797777Sclaudio #include <stdarg.h>
2015797777Sclaudio #include <stdio.h>
2115797777Sclaudio 
2215797777Sclaudio void	json_do_start(FILE *);
2315797777Sclaudio int	json_do_finish(void);
2415797777Sclaudio void	json_do_array(const char *);
25*a09a3191Sclaudio void	json_do_object(const char *, int);
2615797777Sclaudio void	json_do_end(void);
2715797777Sclaudio void	json_do_printf(const char *, const char *, ...)
2815797777Sclaudio 	    __attribute__((__format__ (printf, 2, 3)));
29b42288f9Sclaudio void	json_do_string(const char *, const char *);
3015797777Sclaudio void	json_do_hexdump(const char *, void *, size_t);
3115797777Sclaudio void	json_do_bool(const char *, int);
3215797777Sclaudio void	json_do_uint(const char *, unsigned long long);
3315797777Sclaudio void	json_do_int(const char *, long long);
3415797777Sclaudio void	json_do_double(const char *, double);
35