]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/rfapi/rfapi_vty.h
*: make consistent & update GPLv2 file headers
[mirror_frr.git] / bgpd / rfapi / rfapi_vty.h
1 /*
2 *
3 * Copyright 2009-2016, LabN Consulting, L.L.C.
4 *
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef RFAPI_VTY_H
22 #define RFAPI_VTY_H
23
24 #include "lib/vty.h"
25
26 typedef enum
27 {
28 SHOW_NVE_SUMMARY_ACTIVE_NVES,
29 SHOW_NVE_SUMMARY_UNKNOWN_NVES, /* legacy */
30 SHOW_NVE_SUMMARY_REGISTERED,
31 SHOW_NVE_SUMMARY_QUERIES,
32 SHOW_NVE_SUMMARY_RESPONSES,
33 SHOW_NVE_SUMMARY_MAX
34 } show_nve_summary_t;
35
36 #define VNC_SHOW_STR "VNC information\n"
37
38 extern char *
39 rfapiFormatSeconds (uint32_t seconds, char *buf, size_t len);
40
41 extern char *
42 rfapiFormatAge (time_t age, char *buf, size_t len);
43
44 extern void
45 rfapiRprefixApplyMask (struct rfapi_ip_prefix *rprefix);
46
47 extern int
48 rfapiQprefix2Raddr (struct prefix *qprefix, struct rfapi_ip_addr *raddr);
49
50 extern void
51 rfapiQprefix2Rprefix (struct prefix *qprefix,
52 struct rfapi_ip_prefix *rprefix);
53
54 extern int
55 rfapiRprefix2Qprefix (struct rfapi_ip_prefix *rprefix,
56 struct prefix *qprefix);
57
58 extern int
59 rfapiRaddr2Qprefix (struct rfapi_ip_addr *hia, struct prefix *pfx);
60
61 extern int
62 rfapiRprefixSame (struct rfapi_ip_prefix *hp1, struct rfapi_ip_prefix *hp2);
63
64 extern void
65 rfapiL2o2Qprefix (struct rfapi_l2address_option *l2o, struct prefix *pfx);
66
67 extern int
68 rfapiStr2EthAddr (const char *str, struct ethaddr *ea);
69
70 extern const char *
71 rfapi_ntop (
72 int af,
73 const void *src,
74 char *buf,
75 socklen_t size);
76
77 extern int
78 rfapiDebugPrintf (void *dummy, const char *format, ...);
79
80 extern int
81 rfapiStream2Vty (
82 void *stream, /* input */
83 int (**fp) (void *, const char *, ...), /* output */
84 struct vty **vty, /* output */
85 void **outstream, /* output */
86 const char **vty_newline); /* output */
87
88 /*------------------------------------------
89 * rfapiRfapiIpAddr2Str
90 *
91 * UI helper: generate string from rfapi_ip_addr
92 *
93 * input:
94 * a IP v4/v6 address
95 *
96 * output
97 * buf put string here
98 * bufsize max space to write
99 *
100 * return value:
101 * NULL conversion failed
102 * non-NULL pointer to buf
103 --------------------------------------------*/
104 extern const char *
105 rfapiRfapiIpAddr2Str (struct rfapi_ip_addr *a, char *buf, int bufsize);
106
107 extern void
108 rfapiPrintRfapiIpAddr (void *stream, struct rfapi_ip_addr *a);
109
110 extern void
111 rfapiPrintRfapiIpPrefix (void *stream, struct rfapi_ip_prefix *p);
112
113 void
114 rfapiPrintRd (struct vty *vty, struct prefix_rd *prd);
115
116 extern void
117 rfapiPrintAdvertisedInfo (
118 struct vty *vty,
119 struct rfapi_descriptor *rfd,
120 safi_t safi,
121 struct prefix *p);
122
123 extern void
124 rfapiPrintDescriptor (struct vty *vty, struct rfapi_descriptor *rfd);
125
126 extern void
127 rfapiPrintMatchingDescriptors (struct vty *vty,
128 struct prefix *vn_prefix,
129 struct prefix *un_prefix);
130
131 extern void
132 rfapiPrintAttrPtrs (void *stream, struct attr *attr);
133
134 /*
135 * Parse an address and put into a struct prefix
136 */
137 extern int
138 rfapiCliGetPrefixAddr (struct vty *vty, const char *str, struct prefix *p);
139
140 extern int
141 rfapiCliGetRfapiIpAddr (
142 struct vty *vty,
143 const char *str,
144 struct rfapi_ip_addr *hai);
145
146 extern void
147 rfapiPrintNhl (void *stream, struct rfapi_next_hop_entry *next_hops);
148
149 extern char *
150 rfapiMonitorVpn2Str (
151 struct rfapi_monitor_vpn *m,
152 char *buf,
153 int size);
154
155 extern const char *
156 rfapiRfapiIpPrefix2Str (
157 struct rfapi_ip_prefix *p,
158 char *buf,
159 int bufsize);
160
161 extern void
162 rfapiShowItNode (void *stream, struct route_node *rn);
163
164 extern char *
165 rfapiEthAddr2Str (
166 const struct ethaddr *ea,
167 char *buf,
168 int bufsize);
169
170 /* install vty commands */
171 extern void
172 rfapi_vty_init (void);
173
174 /*------------------------------------------
175 * rfapiShowRemoteRegistrations
176 *
177 * UI helper: produces the "remote" portion of the output
178 * of "show vnc registrations".
179 *
180 * input:
181 * stream pointer to output stream
182 * prefix_only pointer to prefix. If non-NULL, print only registrations
183 * matching the specified prefix
184 * show_expiring if non-zero, show expiring registrations
185 * show_local if non-zero, show local registrations
186 * show_imported if non-zero, show imported registrations
187 *
188 * return value:
189 * 0 nothing printed
190 * >0 something printed
191 --------------------------------------------*/
192 extern int
193 rfapiShowRemoteRegistrations (
194 void *stream,
195 struct prefix *prefix_only,
196 int show_expiring,
197 int show_local,
198 int show_remote,
199 int show_imported);
200
201 /*------------------------------------------
202 * rfapi_monitor_count
203 *
204 * UI helper: count number of active monitors
205 *
206 * input:
207 * handle rfapi handle (NULL to count across
208 * all open handles)
209 *
210 * output
211 *
212 * return value:
213 * count of monitors
214 --------------------------------------------*/
215 extern uint32_t
216 rfapi_monitor_count (rfapi_handle);
217
218 extern int
219 rfapiShowVncQueries (void *stream, struct prefix *pfx_match);
220
221
222 #endif