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