Annotation of src/usr.bin/bgplg/bgplg.h, Revision 1.9
1.9 ! gsoares 1: /* $OpenBSD: bgplg.h,v 1.8 2011/11/08 12:21:29 deraadt Exp $ */
1.1 reyk 2:
3: /*
4: * Copyright (c) 2005, 2006 Reyk Floeter <reyk@vantronix.net>
5: *
6: * Permission to use, copy, modify, and distribute this software for any
7: * purpose with or without fee is hereby granted, provided that the above
8: * copyright notice and this permission notice appear in all copies.
9: *
10: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17: */
18:
19: #ifndef _BGPLG_H
20: #define _BGPLG_H
21:
22: #define NAME "bgplg"
23: #define BRIEF "a looking glass for OpenBGPD"
24: #define COPYRIGHT "2005, 2006 Reyk Floeter (reyk@vantronix.net)"
25:
26: #define BGPLG_TIMEOUT 60 /* 60 seconds */
27:
28: struct cmd {
29: const char *name;
30: int minargs;
31: int maxargs;
32: const char *args;
33: char *earg[255];
34: int (*func)(struct cmd *, char **);
35: };
36:
37: #define CMDS { \
1.4 claudio 38: { "show ip bgp", 1, 1, "<prefix>", \
1.1 reyk 39: { BGPCTL, "show", "ip", "bgp", NULL } }, \
40: { "show ip bgp as", 1, 1, "<asnum>", \
41: { BGPCTL, "show", "ip", "bgp", "as", NULL } }, \
42: { "show ip bgp source-as", 1, 1, "<asnum>", \
1.2 claudio 43: { BGPCTL, "show", "ip", "bgp", "source-as", NULL } }, \
1.1 reyk 44: { "show ip bgp transit-as", 1, 1, "<asnum>", \
45: { BGPCTL, "show", "ip", "bgp", "transit-as", NULL } }, \
1.7 claudio 46: { "show ip bgp peer-as", 1, 1, "<asnum>", \
47: { BGPCTL, "show", "ip", "bgp", "peer-as", NULL } }, \
1.1 reyk 48: { "show ip bgp empty-as", 0, 0, NULL, \
49: { BGPCTL, "show", "ip", "bgp", "empty-as", NULL } }, \
50: { "show ip bgp summary", 0, 0, NULL, \
51: { BGPCTL, "show", "ip", "bgp", "summary", NULL } }, \
1.4 claudio 52: { "show ip bgp detail", 1, 1, "<prefix>", \
1.1 reyk 53: { BGPCTL, "show","ip", "bgp", "detail", NULL } }, \
1.4 claudio 54: { "show ip bgp in", 1, 1, "<prefix>", \
1.1 reyk 55: { BGPCTL, "show","ip", "bgp", "in", NULL } }, \
1.4 claudio 56: { "show ip bgp out", 1, 1, "<prefix>", \
1.1 reyk 57: { BGPCTL, "show","ip", "bgp", "out", NULL } }, \
58: { "show ip bgp memory", 0, 0, NULL, \
59: { BGPCTL, "show", "ip", "bgp", "memory", NULL } }, \
60: { "show neighbor", 0, 1, NULL, \
61: { BGPCTL, "show", "neighbor", NULL } }, \
62: { "show nexthop", 0, 0, NULL, \
63: { BGPCTL, "show", "nexthop", NULL } }, \
64: { "show version", 0, 0, NULL, { NULL }, lg_show_version }, \
65: { "traceroute", 1, 1, "<address>", \
1.8 deraadt 66: { TRACEROUTE, "-ASl", NULL } }, \
1.1 reyk 67: { "ping", 1, 1, "<address>", \
68: { PING, "-c4", "-w2", NULL } }, \
1.6 sthen 69: { "traceroute6", 1, 1, "<address>", \
1.9 ! gsoares 70: { TRACEROUTE6, "-Al", NULL } }, \
1.6 sthen 71: { "ping6", 1, 1, "<address>", \
72: { PING6, "-c4", "-i2", NULL } }, \
1.5 sthen 73: { "help", 0, 0, NULL, { NULL }, lg_help }, \
1.1 reyk 74: { NULL } \
75: }
76:
77: int lg_show_version(struct cmd *, char **);
78: int lg_help(struct cmd *, char **);
79: int lg_exec(const char *, char **);
80: int lg_checkperm(struct cmd *);
81: void lg_sig_alarm(int);
82: ssize_t lg_strip(char *);
83:
84: #endif /* _BGPLG_H */