]>
git.proxmox.com Git - mirror_frr.git/blob - tools/cocci.h
1 /* some of this stuff doesn't seem to parse properly in coccinelle
4 #define DEFUN(funcname, cmdname, str, help) \
5 static int funcname(const struct cmd_element *self, struct vty *vty, \
6 int argc, struct cmd_token *argv[])
7 #define DEFUN_HIDDEN(funcname, cmdname, str, help) \
8 static int funcname(const struct cmd_element *self, struct vty *vty, \
9 int argc, struct cmd_token *argv[])
10 #define DEFUN_NOSH(funcname, cmdname, str, help) \
11 static int funcname(const struct cmd_element *self, struct vty *vty, \
12 int argc, struct cmd_token *argv[])
13 #define DEFPY(funcname, cmdname, str, help) \
14 static int funcname(const struct cmd_element *self, struct vty *vty, \
15 int argc, struct cmd_token *argv[])
16 #define DEFPY_HIDDEN(funcname, cmdname, str, help) \
17 static int funcname(const struct cmd_element *self, struct vty *vty, \
18 int argc, struct cmd_token *argv[])
19 #define DEFPY_NOSH(funcname, cmdname, str, help) \
20 static int funcname(const struct cmd_element *self, struct vty *vty, \
21 int argc, struct cmd_token *argv[])
23 #define ENABLE_BGP_VNC 1
24 #define ALL_LIST_ELEMENTS_RO(list, node, data) \
25 (node) = listhead(list), ((data) = NULL); \
26 (node) != NULL && ((data) = listgetdata(node)); \
27 (node) = listnextnode(node), ((data) = NULL)
28 #define ALL_LIST_ELEMENTS(list, node, nextnode, data) \
29 (node) = listhead(list), ((data) = NULL); \
31 && ((data) = listgetdata(node), (nextnode) = node->next); \
32 (node) = (nextnode), ((data) = NULL)
33 #define LIST_HEAD(name, type) \
35 struct type *lh_first; /* first element */ \
37 #define LIST_ENTRY(type) \
39 struct type *le_next; /* next element */ \
40 struct type **le_prev; /* address of previous next element */ \
43 #define STREAM_GETC(S, P) \
46 if (!stream_getc2((S), &_pval)) \
47 goto stream_failure; \
51 #define STREAM_GETW(S, P) \
54 if (!stream_getw2((S), &_pval)) \
55 goto stream_failure; \
59 #define STREAM_GETL(S, P) \
62 if (!stream_getl2((S), &_pval)) \
63 goto stream_failure; \
67 #define STREAM_GETF(S, P) \
73 if (stream_getl2((S), &_pval.d)) \
74 goto stream_failure; \
78 #define STREAM_GETQ(S, P) \
81 if (!stream_getq2((S), &_pval)) \
82 goto stream_failure; \
86 #define STREAM_GET(P, STR, SIZE) \
88 if (!stream_get2((P), (STR), (SIZE))) \
89 goto stream_failure; \
92 #define AF_FOREACH(af) for ((af) = BGP_AF_START; (af) < BGP_AF_MAX; (af)++)
94 #define FOREACH_AFI_SAFI(afi, safi) \
96 for (afi = AFI_IP; afi < AFI_MAX; afi++) \
97 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
99 #define FOREACH_SAFI(safi) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
101 #define frr_with_privs(p) \
102 for (int x = 1; x; x--)
103 #define frr_with_mutex(m) \
104 for (int x = 1; x; x--)
106 #define ALL_LSDB_TYPED_ADVRTR(lsdb, type, adv_router, lsa) \
107 const struct route_node *iterend = \
108 ospf6_lsdb_head(lsdb, 2, type, adv_router, &lsa); \
110 lsa = ospf6_lsdb_next(iterend, lsa)
112 #define ALL_LSDB_TYPED(lsdb, type, lsa) \
113 const struct route_node *iterend = \
114 ospf6_lsdb_head(lsdb, 1, type, 0, &lsa); \
116 lsa = ospf6_lsdb_next(iterend, lsa)
118 #define ALL_LSDB(lsdb, lsa) \
119 const struct route_node *iterend = \
120 ospf6_lsdb_head(lsdb, 0, 0, 0, &lsa); \
122 lsa = ospf6_lsdb_next(iterend, lsa)
124 #define QOBJ_FIELDS struct qobj_node qobj_node;