1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 // Copyright (C) 2018 Facebook
4 #ifndef _NETLINK_DUMPER_H_
5 #define _NETLINK_DUMPER_H_
7 #define NET_START_OBJECT \
10 jsonw_start_object(json_wtr); \
13 #define NET_START_OBJECT_NESTED(name) \
16 jsonw_name(json_wtr, name); \
17 jsonw_start_object(json_wtr); \
19 fprintf(stdout, "%s {", name); \
23 #define NET_START_OBJECT_NESTED2 \
26 jsonw_start_object(json_wtr); \
28 fprintf(stdout, "{"); \
31 #define NET_END_OBJECT_NESTED \
34 jsonw_end_object(json_wtr); \
36 fprintf(stdout, "}"); \
39 #define NET_END_OBJECT \
42 jsonw_end_object(json_wtr); \
45 #define NET_END_OBJECT_FINAL \
48 jsonw_end_object(json_wtr); \
50 fprintf(stdout, "\n"); \
53 #define NET_START_ARRAY(name, fmt_str) \
56 jsonw_name(json_wtr, name); \
57 jsonw_start_array(json_wtr); \
59 fprintf(stdout, fmt_str, name); \
63 #define NET_END_ARRAY(endstr) \
66 jsonw_end_array(json_wtr); \
68 fprintf(stdout, "%s", endstr); \
71 #define NET_DUMP_UINT(name, fmt_str, val) \
74 jsonw_uint_field(json_wtr, name, val); \
76 fprintf(stdout, fmt_str, val); \
79 #define NET_DUMP_STR(name, fmt_str, str) \
82 jsonw_string_field(json_wtr, name, str);\
84 fprintf(stdout, fmt_str, str); \
87 #define NET_DUMP_STR_ONLY(str) \
90 jsonw_string(json_wtr, str); \
92 fprintf(stdout, "%s ", str); \