]>
Commit | Line | Data |
---|---|---|
d62a17ae | 1 | /* |
65efcfce LB |
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 | * | |
896014f4 DL |
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 | |
65efcfce LB |
19 | */ |
20 | ||
21 | #ifndef RFAPI_VTY_H | |
22 | #define RFAPI_VTY_H | |
23 | ||
f8b6f499 | 24 | #include "lib/vty.h" |
65efcfce | 25 | |
d62a17ae | 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 | |
65efcfce LB |
33 | } show_nve_summary_t; |
34 | ||
35 | #define VNC_SHOW_STR "VNC information\n" | |
36 | ||
d62a17ae | 37 | extern char *rfapiFormatSeconds(uint32_t seconds, char *buf, size_t len); |
65efcfce | 38 | |
d62a17ae | 39 | extern char *rfapiFormatAge(time_t age, char *buf, size_t len); |
65efcfce | 40 | |
d62a17ae | 41 | extern void rfapiRprefixApplyMask(struct rfapi_ip_prefix *rprefix); |
65efcfce | 42 | |
d62a17ae | 43 | extern int rfapiQprefix2Raddr(struct prefix *qprefix, |
44 | struct rfapi_ip_addr *raddr); | |
65efcfce | 45 | |
d62a17ae | 46 | extern void rfapiQprefix2Rprefix(struct prefix *qprefix, |
47 | struct rfapi_ip_prefix *rprefix); | |
65efcfce | 48 | |
d62a17ae | 49 | extern int rfapiRprefix2Qprefix(struct rfapi_ip_prefix *rprefix, |
50 | struct prefix *qprefix); | |
65efcfce | 51 | |
d62a17ae | 52 | extern int rfapiRaddr2Qprefix(struct rfapi_ip_addr *hia, struct prefix *pfx); |
65efcfce | 53 | |
d62a17ae | 54 | extern int rfapiRprefixSame(struct rfapi_ip_prefix *hp1, |
55 | struct rfapi_ip_prefix *hp2); | |
65efcfce | 56 | |
d62a17ae | 57 | extern void rfapiL2o2Qprefix(struct rfapi_l2address_option *l2o, |
58 | struct prefix *pfx); | |
65efcfce | 59 | |
d62a17ae | 60 | extern int rfapiStr2EthAddr(const char *str, struct ethaddr *ea); |
65efcfce | 61 | |
d62a17ae | 62 | extern const char *rfapi_ntop(int af, const void *src, char *buf, |
63 | socklen_t size); | |
65efcfce | 64 | |
d62a17ae | 65 | extern int rfapiDebugPrintf(void *dummy, const char *format, ...); |
65efcfce | 66 | |
d62a17ae | 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 */ | |
65efcfce LB |
72 | |
73 | /*------------------------------------------ | |
74 | * rfapiRfapiIpAddr2Str | |
75 | * | |
76 | * UI helper: generate string from rfapi_ip_addr | |
77 | * | |
d62a17ae | 78 | * input: |
65efcfce LB |
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 | --------------------------------------------*/ | |
d62a17ae | 89 | extern const char *rfapiRfapiIpAddr2Str(struct rfapi_ip_addr *a, char *buf, |
90 | int bufsize); | |
65efcfce | 91 | |
d62a17ae | 92 | extern void rfapiPrintRfapiIpAddr(void *stream, struct rfapi_ip_addr *a); |
65efcfce | 93 | |
d62a17ae | 94 | extern void rfapiPrintRfapiIpPrefix(void *stream, struct rfapi_ip_prefix *p); |
65efcfce | 95 | |
d62a17ae | 96 | void rfapiPrintRd(struct vty *vty, struct prefix_rd *prd); |
65efcfce | 97 | |
d62a17ae | 98 | extern void rfapiPrintAdvertisedInfo(struct vty *vty, |
99 | struct rfapi_descriptor *rfd, safi_t safi, | |
100 | struct prefix *p); | |
65efcfce | 101 | |
d62a17ae | 102 | extern void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd); |
65efcfce | 103 | |
d62a17ae | 104 | extern void rfapiPrintMatchingDescriptors(struct vty *vty, |
105 | struct prefix *vn_prefix, | |
106 | struct prefix *un_prefix); | |
65efcfce | 107 | |
d62a17ae | 108 | extern void rfapiPrintAttrPtrs(void *stream, struct attr *attr); |
65efcfce LB |
109 | |
110 | /* | |
111 | * Parse an address and put into a struct prefix | |
112 | */ | |
d62a17ae | 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 | ||
fe08ba7e | 127 | extern void rfapiShowItNode(void *stream, struct agg_node *rn); |
d62a17ae | 128 | |
129 | extern char *rfapiEthAddr2Str(const struct ethaddr *ea, char *buf, int bufsize); | |
65efcfce LB |
130 | |
131 | /* install vty commands */ | |
d62a17ae | 132 | extern void rfapi_vty_init(void); |
65efcfce LB |
133 | |
134 | /*------------------------------------------ | |
135 | * rfapiShowRemoteRegistrations | |
136 | * | |
137 | * UI helper: produces the "remote" portion of the output | |
138 | * of "show vnc registrations". | |
139 | * | |
d62a17ae | 140 | * input: |
65efcfce LB |
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 | --------------------------------------------*/ | |
d62a17ae | 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); | |
65efcfce LB |
156 | |
157 | /*------------------------------------------ | |
158 | * rfapi_monitor_count | |
159 | * | |
160 | * UI helper: count number of active monitors | |
161 | * | |
d62a17ae | 162 | * input: |
65efcfce LB |
163 | * handle rfapi handle (NULL to count across |
164 | * all open handles) | |
165 | * | |
166 | * output | |
167 | * | |
168 | * return value: | |
169 | * count of monitors | |
170 | --------------------------------------------*/ | |
d62a17ae | 171 | extern uint32_t rfapi_monitor_count(rfapi_handle); |
65efcfce | 172 | |
d62a17ae | 173 | extern int rfapiShowVncQueries(void *stream, struct prefix *pfx_match); |
65efcfce LB |
174 | |
175 | ||
176 | #endif |