]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/rfapi/rfapi_vty.h
*: reindent
[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 SHOW_NVE_SUMMARY_ACTIVE_NVES,
28 SHOW_NVE_SUMMARY_UNKNOWN_NVES, /* legacy */
29 SHOW_NVE_SUMMARY_REGISTERED,
30 SHOW_NVE_SUMMARY_QUERIES,
31 SHOW_NVE_SUMMARY_RESPONSES,
32 SHOW_NVE_SUMMARY_MAX
33 } show_nve_summary_t;
34
35 #define VNC_SHOW_STR "VNC information\n"
36
37 extern char *rfapiFormatSeconds(uint32_t seconds, char *buf, size_t len);
38
39 extern char *rfapiFormatAge(time_t age, char *buf, size_t len);
40
41 extern void rfapiRprefixApplyMask(struct rfapi_ip_prefix *rprefix);
42
43 extern int rfapiQprefix2Raddr(struct prefix *qprefix,
44 struct rfapi_ip_addr *raddr);
45
46 extern void rfapiQprefix2Rprefix(struct prefix *qprefix,
47 struct rfapi_ip_prefix *rprefix);
48
49 extern int rfapiRprefix2Qprefix(struct rfapi_ip_prefix *rprefix,
50 struct prefix *qprefix);
51
52 extern int rfapiRaddr2Qprefix(struct rfapi_ip_addr *hia, struct prefix *pfx);
53
54 extern int rfapiRprefixSame(struct rfapi_ip_prefix *hp1,
55 struct rfapi_ip_prefix *hp2);
56
57 extern void rfapiL2o2Qprefix(struct rfapi_l2address_option *l2o,
58 struct prefix *pfx);
59
60 extern int rfapiStr2EthAddr(const char *str, struct ethaddr *ea);
61
62 extern const char *rfapi_ntop(int af, const void *src, char *buf,
63 socklen_t size);
64
65 extern int rfapiDebugPrintf(void *dummy, const char *format, ...);
66
67 extern int rfapiStream2Vty(void *stream, /* input */
68 int (**fp)(void *, const char *, ...), /* output */
69 struct vty **vty, /* output */
70 void **outstream, /* output */
71 const char **vty_newline); /* output */
72
73 /*------------------------------------------
74 * rfapiRfapiIpAddr2Str
75 *
76 * UI helper: generate string from rfapi_ip_addr
77 *
78 * input:
79 * a IP v4/v6 address
80 *
81 * output
82 * buf put string here
83 * bufsize max space to write
84 *
85 * return value:
86 * NULL conversion failed
87 * non-NULL pointer to buf
88 --------------------------------------------*/
89 extern const char *rfapiRfapiIpAddr2Str(struct rfapi_ip_addr *a, char *buf,
90 int bufsize);
91
92 extern void rfapiPrintRfapiIpAddr(void *stream, struct rfapi_ip_addr *a);
93
94 extern void rfapiPrintRfapiIpPrefix(void *stream, struct rfapi_ip_prefix *p);
95
96 void rfapiPrintRd(struct vty *vty, struct prefix_rd *prd);
97
98 extern void rfapiPrintAdvertisedInfo(struct vty *vty,
99 struct rfapi_descriptor *rfd, safi_t safi,
100 struct prefix *p);
101
102 extern void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd);
103
104 extern void rfapiPrintMatchingDescriptors(struct vty *vty,
105 struct prefix *vn_prefix,
106 struct prefix *un_prefix);
107
108 extern void rfapiPrintAttrPtrs(void *stream, struct attr *attr);
109
110 /*
111 * Parse an address and put into a struct prefix
112 */
113 extern int rfapiCliGetPrefixAddr(struct vty *vty, const char *str,
114 struct prefix *p);
115
116 extern int rfapiCliGetRfapiIpAddr(struct vty *vty, const char *str,
117 struct rfapi_ip_addr *hai);
118
119 extern void rfapiPrintNhl(void *stream, struct rfapi_next_hop_entry *next_hops);
120
121 extern char *rfapiMonitorVpn2Str(struct rfapi_monitor_vpn *m, char *buf,
122 int size);
123
124 extern const char *rfapiRfapiIpPrefix2Str(struct rfapi_ip_prefix *p, char *buf,
125 int bufsize);
126
127 extern void rfapiShowItNode(void *stream, struct route_node *rn);
128
129 extern char *rfapiEthAddr2Str(const struct ethaddr *ea, char *buf, int bufsize);
130
131 /* install vty commands */
132 extern void rfapi_vty_init(void);
133
134 /*------------------------------------------
135 * rfapiShowRemoteRegistrations
136 *
137 * UI helper: produces the "remote" portion of the output
138 * of "show vnc registrations".
139 *
140 * input:
141 * stream pointer to output stream
142 * prefix_only pointer to prefix. If non-NULL, print only registrations
143 * matching the specified prefix
144 * show_expiring if non-zero, show expiring registrations
145 * show_local if non-zero, show local registrations
146 * show_imported if non-zero, show imported registrations
147 *
148 * return value:
149 * 0 nothing printed
150 * >0 something printed
151 --------------------------------------------*/
152 extern int rfapiShowRemoteRegistrations(void *stream,
153 struct prefix *prefix_only,
154 int show_expiring, int show_local,
155 int show_remote, int show_imported);
156
157 /*------------------------------------------
158 * rfapi_monitor_count
159 *
160 * UI helper: count number of active monitors
161 *
162 * input:
163 * handle rfapi handle (NULL to count across
164 * all open handles)
165 *
166 * output
167 *
168 * return value:
169 * count of monitors
170 --------------------------------------------*/
171 extern uint32_t rfapi_monitor_count(rfapi_handle);
172
173 extern int rfapiShowVncQueries(void *stream, struct prefix *pfx_match);
174
175
176 #endif