xref: /openbsd-src/usr.sbin/bgpctl/json.h (revision 56bc7cf339ccc310345d2b4c771ec0fa7005bcc8)
1*56bc7cf3Sclaudio /*	$OpenBSD: json.h,v 1.8 2023/06/05 16:24:05 claudio Exp $ */
20c7a5c38Sclaudio 
314178ff0Sclaudio /*
414178ff0Sclaudio  * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
514178ff0Sclaudio  *
614178ff0Sclaudio  * Permission to use, copy, modify, and distribute this software for any
714178ff0Sclaudio  * purpose with or without fee is hereby granted, provided that the above
814178ff0Sclaudio  * copyright notice and this permission notice appear in all copies.
914178ff0Sclaudio  *
1014178ff0Sclaudio  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1114178ff0Sclaudio  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1214178ff0Sclaudio  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1314178ff0Sclaudio  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1414178ff0Sclaudio  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1514178ff0Sclaudio  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1614178ff0Sclaudio  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1714178ff0Sclaudio  */
1814178ff0Sclaudio 
1914178ff0Sclaudio #include <stdarg.h>
20644f9c42Sclaudio #include <stdio.h>
2114178ff0Sclaudio 
22644f9c42Sclaudio void	json_do_start(FILE *);
23db68842dSclaudio int	json_do_finish(void);
2414178ff0Sclaudio void	json_do_array(const char *);
25*56bc7cf3Sclaudio void	json_do_object(const char *, int);
2614178ff0Sclaudio void	json_do_end(void);
2714178ff0Sclaudio void	json_do_printf(const char *, const char *, ...)
2814178ff0Sclaudio 	    __attribute__((__format__ (printf, 2, 3)));
29a32a1b0fSclaudio void	json_do_string(const char *, const char *);
3014178ff0Sclaudio void	json_do_hexdump(const char *, void *, size_t);
3114178ff0Sclaudio void	json_do_bool(const char *, int);
32df3045caSclaudio void	json_do_uint(const char *, unsigned long long);
33df3045caSclaudio void	json_do_int(const char *, long long);
3414178ff0Sclaudio void	json_do_double(const char *, double);
35