]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0-or-later | |
2 | /* | |
3 | * | |
4 | * Copyright 2009-2016, LabN Consulting, L.L.C. | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef RFAPI_VTY_H | |
9 | #define RFAPI_VTY_H | |
10 | ||
11 | #include "lib/vty.h" | |
12 | ||
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 | |
20 | } show_nve_summary_t; | |
21 | ||
22 | #define VNC_SHOW_STR "VNC information\n" | |
23 | ||
24 | extern char *rfapiFormatSeconds(uint32_t seconds, char *buf, size_t len); | |
25 | ||
26 | extern char *rfapiFormatAge(time_t age, char *buf, size_t len); | |
27 | ||
28 | extern void rfapiRprefixApplyMask(struct rfapi_ip_prefix *rprefix); | |
29 | ||
30 | extern int rfapiQprefix2Raddr(struct prefix *qprefix, | |
31 | struct rfapi_ip_addr *raddr); | |
32 | ||
33 | extern void rfapiQprefix2Rprefix(const struct prefix *qprefix, | |
34 | struct rfapi_ip_prefix *rprefix); | |
35 | ||
36 | extern int rfapiRprefix2Qprefix(struct rfapi_ip_prefix *rprefix, | |
37 | struct prefix *qprefix); | |
38 | ||
39 | extern int rfapiRaddr2Qprefix(struct rfapi_ip_addr *hia, struct prefix *pfx); | |
40 | ||
41 | extern int rfapiRprefixSame(struct rfapi_ip_prefix *hp1, | |
42 | struct rfapi_ip_prefix *hp2); | |
43 | ||
44 | extern void rfapiL2o2Qprefix(struct rfapi_l2address_option *l2o, | |
45 | struct prefix *pfx); | |
46 | ||
47 | extern int rfapiStr2EthAddr(const char *str, struct ethaddr *ea); | |
48 | ||
49 | extern const char *rfapi_ntop(int af, const void *src, char *buf, | |
50 | socklen_t size); | |
51 | ||
52 | extern int rfapiDebugPrintf(void *dummy, const char *format, ...) | |
53 | PRINTFRR(2, 3); | |
54 | ||
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 */ | |
60 | ||
61 | /*------------------------------------------ | |
62 | * rfapiRfapiIpAddr2Str | |
63 | * | |
64 | * UI helper: generate string from rfapi_ip_addr | |
65 | * | |
66 | * input: | |
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 | --------------------------------------------*/ | |
77 | extern const char *rfapiRfapiIpAddr2Str(struct rfapi_ip_addr *a, char *buf, | |
78 | int bufsize); | |
79 | ||
80 | extern void rfapiPrintRfapiIpAddr(void *stream, struct rfapi_ip_addr *a); | |
81 | ||
82 | extern void rfapiPrintRfapiIpPrefix(void *stream, struct rfapi_ip_prefix *p); | |
83 | ||
84 | extern void rfapiPrintAdvertisedInfo(struct vty *vty, | |
85 | struct rfapi_descriptor *rfd, safi_t safi, | |
86 | struct prefix *p); | |
87 | ||
88 | extern void rfapiPrintDescriptor(struct vty *vty, struct rfapi_descriptor *rfd); | |
89 | ||
90 | extern void rfapiPrintMatchingDescriptors(struct vty *vty, | |
91 | struct prefix *vn_prefix, | |
92 | struct prefix *un_prefix); | |
93 | ||
94 | extern void rfapiPrintAttrPtrs(void *stream, struct attr *attr); | |
95 | ||
96 | /* | |
97 | * Parse an address and put into a struct prefix | |
98 | */ | |
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 | ||
113 | extern void rfapiShowItNode(void *stream, struct agg_node *rn); | |
114 | ||
115 | extern char *rfapiEthAddr2Str(const struct ethaddr *ea, char *buf, int bufsize); | |
116 | ||
117 | /* install vty commands */ | |
118 | extern void rfapi_vty_init(void); | |
119 | ||
120 | /*------------------------------------------ | |
121 | * rfapiShowRemoteRegistrations | |
122 | * | |
123 | * UI helper: produces the "remote" portion of the output | |
124 | * of "show vnc registrations". | |
125 | * | |
126 | * input: | |
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 | --------------------------------------------*/ | |
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); | |
142 | ||
143 | /*------------------------------------------ | |
144 | * rfapi_monitor_count | |
145 | * | |
146 | * UI helper: count number of active monitors | |
147 | * | |
148 | * input: | |
149 | * handle rfapi handle (NULL to count across | |
150 | * all open handles) | |
151 | * | |
152 | * output | |
153 | * | |
154 | * return value: | |
155 | * count of monitors | |
156 | --------------------------------------------*/ | |
157 | extern uint32_t rfapi_monitor_count(rfapi_handle); | |
158 | ||
159 | extern int rfapiShowVncQueries(void *stream, struct prefix *pfx_match); | |
160 | ||
161 | ||
162 | #endif |