]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
d62a17ae | 2 | /* |
65efcfce LB |
3 | * |
4 | * Copyright 2009-2016, LabN Consulting, L.L.C. | |
5 | * | |
65efcfce LB |
6 | */ |
7 | ||
8 | #ifndef RFAPI_VTY_H | |
9 | #define RFAPI_VTY_H | |
10 | ||
f8b6f499 | 11 | #include "lib/vty.h" |
65efcfce | 12 | |
d62a17ae | 13 | typedef enum { |
14 | SHOW_NVE_SUMMARY_ACTIVE_NVES, | |
15 | SHOW_NVE_SUMMARY_UNKNOWN_NVES, /* legacy */ | |
16 | SHOW_NVE_SUMMARY_REGISTERED, | |
17 | SHOW_NVE_SUMMARY_QUERIES, | |
18 | SHOW_NVE_SUMMARY_RESPONSES, | |
19 | SHOW_NVE_SUMMARY_MAX | |
65efcfce LB |
20 | } show_nve_summary_t; |
21 | ||
22 | #define VNC_SHOW_STR "VNC information\n" | |
23 | ||
d62a17ae | 24 | extern char *rfapiFormatSeconds(uint32_t seconds, char *buf, size_t len); |
65efcfce | 25 | |
d62a17ae | 26 | extern char *rfapiFormatAge(time_t age, char *buf, size_t len); |
65efcfce | 27 | |
d62a17ae | 28 | extern void rfapiRprefixApplyMask(struct rfapi_ip_prefix *rprefix); |
65efcfce | 29 | |
d62a17ae | 30 | extern int rfapiQprefix2Raddr(struct prefix *qprefix, |
31 | struct rfapi_ip_addr *raddr); | |
65efcfce | 32 | |
26a3ffd6 | 33 | extern void rfapiQprefix2Rprefix(const struct prefix *qprefix, |
d62a17ae | 34 | struct rfapi_ip_prefix *rprefix); |
65efcfce | 35 | |
d62a17ae | 36 | extern int rfapiRprefix2Qprefix(struct rfapi_ip_prefix *rprefix, |
37 | struct prefix *qprefix); | |
65efcfce | 38 | |
d62a17ae | 39 | extern int rfapiRaddr2Qprefix(struct rfapi_ip_addr *hia, struct prefix *pfx); |
65efcfce | 40 | |
d62a17ae | 41 | extern int rfapiRprefixSame(struct rfapi_ip_prefix *hp1, |
42 | struct rfapi_ip_prefix *hp2); | |
65efcfce | 43 | |
d62a17ae | 44 | extern void rfapiL2o2Qprefix(struct rfapi_l2address_option *l2o, |
45 | struct prefix *pfx); | |
65efcfce | 46 | |
d62a17ae | 47 | extern int rfapiStr2EthAddr(const char *str, struct ethaddr *ea); |
65efcfce | 48 | |
d62a17ae | 49 | extern const char *rfapi_ntop(int af, const void *src, char *buf, |
50 | socklen_t size); | |
65efcfce | 51 | |
e3a7fc50 DL |
52 | extern int rfapiDebugPrintf(void *dummy, const char *format, ...) |
53 | PRINTFRR(2, 3); | |
65efcfce | 54 | |
d62a17ae | 55 | extern int rfapiStream2Vty(void *stream, /* input */ |
56 | int (**fp)(void *, const char *, ...), /* output */ | |
57 | struct vty **vty, /* output */ | |
58 | void **outstream, /* output */ | |
59 | const char **vty_newline); /* output */ | |
65efcfce LB |
60 | |
61 | /*------------------------------------------ | |
62 | * rfapiRfapiIpAddr2Str | |
63 | * | |
64 | * UI helper: generate string from rfapi_ip_addr | |
65 | * | |
d62a17ae | 66 | * input: |
65efcfce LB |
67 | * a IP v4/v6 address |
68 | * | |
69 | * output | |
70 | * buf put string here | |
71 | * bufsize max space to write | |
72 | * | |
73 | * return value: | |
74 | * NULL conversion failed | |
75 | * non-NULL pointer to buf | |
76 | --------------------------------------------*/ | |
d62a17ae | 77 | extern const char *rfapiRfapiIpAddr2Str(struct rfapi_ip_addr *a, char *buf, |
78 | int bufsize); | |
65efcfce | 79 | |
d62a17ae | 80 | extern void rfapiPrintRfapiIpAddr(void *stream, struct rfapi_ip_addr *a); |
65efcfce | 81 | |
d62a17ae | 82 | extern void rfapiPrintRfapiIpPrefix(void *stream, struct rfapi_ip_prefix *p); |
65efcfce | 83 | |
d62a17ae | 84 | extern void rfapiPrintAdvertisedInfo(struct vty *vty, |
85 | struct rfapi_descriptor *rfd, safi_t safi, | |
86 | struct prefix *p); | |
65efcfce | 87 | |
d62a17ae | 88 | extern void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd); |
65efcfce | 89 | |
d62a17ae | 90 | extern void rfapiPrintMatchingDescriptors(struct vty *vty, |
91 | struct prefix *vn_prefix, | |
92 | struct prefix *un_prefix); | |
65efcfce | 93 | |
d62a17ae | 94 | extern void rfapiPrintAttrPtrs(void *stream, struct attr *attr); |
65efcfce LB |
95 | |
96 | /* | |
97 | * Parse an address and put into a struct prefix | |
98 | */ | |
d62a17ae | 99 | extern int rfapiCliGetPrefixAddr(struct vty *vty, const char *str, |
100 | struct prefix *p); | |
101 | ||
102 | extern int rfapiCliGetRfapiIpAddr(struct vty *vty, const char *str, | |
103 | struct rfapi_ip_addr *hai); | |
104 | ||
105 | extern void rfapiPrintNhl(void *stream, struct rfapi_next_hop_entry *next_hops); | |
106 | ||
107 | extern char *rfapiMonitorVpn2Str(struct rfapi_monitor_vpn *m, char *buf, | |
108 | int size); | |
109 | ||
110 | extern const char *rfapiRfapiIpPrefix2Str(struct rfapi_ip_prefix *p, char *buf, | |
111 | int bufsize); | |
112 | ||
fe08ba7e | 113 | extern void rfapiShowItNode(void *stream, struct agg_node *rn); |
d62a17ae | 114 | |
115 | extern char *rfapiEthAddr2Str(const struct ethaddr *ea, char *buf, int bufsize); | |
65efcfce LB |
116 | |
117 | /* install vty commands */ | |
d62a17ae | 118 | extern void rfapi_vty_init(void); |
65efcfce LB |
119 | |
120 | /*------------------------------------------ | |
121 | * rfapiShowRemoteRegistrations | |
122 | * | |
123 | * UI helper: produces the "remote" portion of the output | |
124 | * of "show vnc registrations". | |
125 | * | |
d62a17ae | 126 | * input: |
65efcfce LB |
127 | * stream pointer to output stream |
128 | * prefix_only pointer to prefix. If non-NULL, print only registrations | |
129 | * matching the specified prefix | |
130 | * show_expiring if non-zero, show expiring registrations | |
131 | * show_local if non-zero, show local registrations | |
132 | * show_imported if non-zero, show imported registrations | |
133 | * | |
134 | * return value: | |
135 | * 0 nothing printed | |
136 | * >0 something printed | |
137 | --------------------------------------------*/ | |
d62a17ae | 138 | extern int rfapiShowRemoteRegistrations(void *stream, |
139 | struct prefix *prefix_only, | |
140 | int show_expiring, int show_local, | |
141 | int show_remote, int show_imported); | |
65efcfce LB |
142 | |
143 | /*------------------------------------------ | |
144 | * rfapi_monitor_count | |
145 | * | |
146 | * UI helper: count number of active monitors | |
147 | * | |
d62a17ae | 148 | * input: |
65efcfce LB |
149 | * handle rfapi handle (NULL to count across |
150 | * all open handles) | |
151 | * | |
152 | * output | |
153 | * | |
154 | * return value: | |
155 | * count of monitors | |
156 | --------------------------------------------*/ | |
d62a17ae | 157 | extern uint32_t rfapi_monitor_count(rfapi_handle); |
65efcfce | 158 | |
d62a17ae | 159 | extern int rfapiShowVncQueries(void *stream, struct prefix *pfx_match); |
65efcfce LB |
160 | |
161 | ||
162 | #endif |