Annotation of src/usr.bin/bgplg/bgplg.h, Revision 1.13
1.13 ! job 1: /* $OpenBSD: bgplg.h,v 1.12 2017/12/17 18:41:17 job Exp $ */
1.1 reyk 2:
3: /*
1.10 reyk 4: * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
1.1 reyk 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:
24: #define BGPLG_TIMEOUT 60 /* 60 seconds */
25:
26: struct cmd {
27: const char *name;
28: int minargs;
29: int maxargs;
30: const char *args;
31: char *earg[255];
32: int (*func)(struct cmd *, char **);
33: };
34:
35: #define CMDS { \
1.4 claudio 36: { "show ip bgp", 1, 1, "<prefix>", \
1.1 reyk 37: { BGPCTL, "show", "ip", "bgp", NULL } }, \
38: { "show ip bgp as", 1, 1, "<asnum>", \
39: { BGPCTL, "show", "ip", "bgp", "as", NULL } }, \
40: { "show ip bgp source-as", 1, 1, "<asnum>", \
1.2 claudio 41: { BGPCTL, "show", "ip", "bgp", "source-as", NULL } }, \
1.1 reyk 42: { "show ip bgp transit-as", 1, 1, "<asnum>", \
43: { BGPCTL, "show", "ip", "bgp", "transit-as", NULL } }, \
1.7 claudio 44: { "show ip bgp peer-as", 1, 1, "<asnum>", \
45: { BGPCTL, "show", "ip", "bgp", "peer-as", NULL } }, \
1.1 reyk 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 } }, \
1.12 job 50: { "show ip bgp community", 1, 1, "<community>", \
51: { BGPCTL, "show","ip", "bgp", "community", NULL } }, \
52: { "show ip bgp detail community", 1, 1, "<community>", \
53: { BGPCTL, "show","ip", "bgp", "detail", "community", NULL } },\
54: { "show ip bgp large-community", 1, 1, "<large-community>",\
55: { BGPCTL, "show","ip", "bgp", "large-community", NULL } }, \
56: { "show ip bgp detail large-community", 1, 1, "<large-community>",\
57: { BGPCTL, "show","ip", "bgp", "detail", "large-community", NULL } },\
1.4 claudio 58: { "show ip bgp detail", 1, 1, "<prefix>", \
1.1 reyk 59: { BGPCTL, "show","ip", "bgp", "detail", NULL } }, \
1.11 phessler 60: { "show ip bgp detail as", 1, 1, "<prefix>", \
61: { BGPCTL, "show","ip", "bgp", "detail", "as", NULL } }, \
1.4 claudio 62: { "show ip bgp in", 1, 1, "<prefix>", \
1.1 reyk 63: { BGPCTL, "show","ip", "bgp", "in", NULL } }, \
1.4 claudio 64: { "show ip bgp out", 1, 1, "<prefix>", \
1.1 reyk 65: { BGPCTL, "show","ip", "bgp", "out", NULL } }, \
66: { "show ip bgp memory", 0, 0, NULL, \
67: { BGPCTL, "show", "ip", "bgp", "memory", NULL } }, \
68: { "show neighbor", 0, 1, NULL, \
69: { BGPCTL, "show", "neighbor", NULL } }, \
70: { "show nexthop", 0, 0, NULL, \
71: { BGPCTL, "show", "nexthop", NULL } }, \
72: { "traceroute", 1, 1, "<address>", \
1.8 deraadt 73: { TRACEROUTE, "-ASl", NULL } }, \
1.1 reyk 74: { "ping", 1, 1, "<address>", \
75: { PING, "-c4", "-w2", NULL } }, \
1.6 sthen 76: { "traceroute6", 1, 1, "<address>", \
1.9 gsoares 77: { TRACEROUTE6, "-Al", NULL } }, \
1.6 sthen 78: { "ping6", 1, 1, "<address>", \
79: { PING6, "-c4", "-i2", NULL } }, \
1.5 sthen 80: { "help", 0, 0, NULL, { NULL }, lg_help }, \
1.1 reyk 81: { NULL } \
82: }
83:
84: int lg_help(struct cmd *, char **);
85: int lg_exec(const char *, char **);
86: int lg_checkperm(struct cmd *);
87: void lg_sig_alarm(int);
88: ssize_t lg_strip(char *);
89:
90: #endif /* _BGPLG_H */