Annotation of src/usr.bin/bgplg/bgplg.h, Revision 1.2
1.2 ! claudio 1: /* $OpenBSD: bgplg.h,v 1.1 2006/12/11 23:10:10 reyk 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 { \
38: { "show ip bgp", 0, 1, NULL, \
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 } }, \
46: { "show ip bgp empty-as", 0, 0, NULL, \
47: { BGPCTL, "show", "ip", "bgp", "empty-as", NULL } }, \
48: { "show ip bgp summary", 0, 0, NULL, \
49: { BGPCTL, "show", "ip", "bgp", "summary", NULL } }, \
50: { "show ip bgp detail", 0, 1, NULL, \
51: { BGPCTL, "show","ip", "bgp", "detail", NULL } }, \
52: { "show ip bgp in", 0, 1, NULL, \
53: { BGPCTL, "show","ip", "bgp", "in", NULL } }, \
54: { "show ip bgp out", 0, 1, NULL, \
55: { BGPCTL, "show","ip", "bgp", "out", NULL } }, \
56: { "show ip bgp memory", 0, 0, NULL, \
57: { BGPCTL, "show", "ip", "bgp", "memory", NULL } }, \
58: { "show neighbor", 0, 1, NULL, \
59: { BGPCTL, "show", "neighbor", NULL } }, \
60: { "show nexthop", 0, 0, NULL, \
61: { BGPCTL, "show", "nexthop", NULL } }, \
62: { "show version", 0, 0, NULL, { NULL }, lg_show_version }, \
63: { "traceroute", 1, 1, "<address>", \
64: { TRACEROUTE, "-Sl", NULL } }, \
65: { "ping", 1, 1, "<address>", \
66: { PING, "-c4", "-w2", NULL } }, \
67: { "?", 0, 0, NULL, { NULL }, lg_help }, \
68: { NULL } \
69: }
70:
71: int lg_show_version(struct cmd *, char **);
72: int lg_help(struct cmd *, char **);
73: int lg_exec(const char *, char **);
74: int lg_checkperm(struct cmd *);
75: void lg_sig_alarm(int);
76: ssize_t lg_strip(char *);
77:
78: #endif /* _BGPLG_H */