1*f829cebcSjob /* $OpenBSD: bgplg.h,v 1.17 2023/02/03 13:10:57 job Exp $ */ 2bc5366b8Sreyk 3bc5366b8Sreyk /* 49cf8e0eaSreyk * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org> 5bc5366b8Sreyk * 6bc5366b8Sreyk * Permission to use, copy, modify, and distribute this software for any 7bc5366b8Sreyk * purpose with or without fee is hereby granted, provided that the above 8bc5366b8Sreyk * copyright notice and this permission notice appear in all copies. 9bc5366b8Sreyk * 10bc5366b8Sreyk * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11bc5366b8Sreyk * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12bc5366b8Sreyk * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13bc5366b8Sreyk * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14bc5366b8Sreyk * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15bc5366b8Sreyk * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16bc5366b8Sreyk * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17bc5366b8Sreyk */ 18bc5366b8Sreyk 19bc5366b8Sreyk #ifndef _BGPLG_H 20bc5366b8Sreyk #define _BGPLG_H 21bc5366b8Sreyk 22bc5366b8Sreyk #define NAME "bgplg" 23bc5366b8Sreyk 24bc5366b8Sreyk #define BGPLG_TIMEOUT 60 /* 60 seconds */ 25bc5366b8Sreyk 26bc5366b8Sreyk struct cmd { 27bc5366b8Sreyk const char *name; 28bc5366b8Sreyk int minargs; 29bc5366b8Sreyk int maxargs; 30bc5366b8Sreyk const char *args; 31bc5366b8Sreyk char *earg[255]; 32bc5366b8Sreyk int (*func)(struct cmd *, char **); 33bc5366b8Sreyk }; 34bc5366b8Sreyk 35bc5366b8Sreyk #define CMDS { \ 36dd9373d5Shenning { "show ip bgp", 1, 1, "<prefix>", \ 37bc5366b8Sreyk { BGPCTL, "show", "ip", "bgp", NULL } }, \ 38bc5366b8Sreyk { "show ip bgp as", 1, 1, "<asnum>", \ 39bc5366b8Sreyk { BGPCTL, "show", "ip", "bgp", "as", NULL } }, \ 40bc5366b8Sreyk { "show ip bgp source-as", 1, 1, "<asnum>", \ 417e943a4cSclaudio { BGPCTL, "show", "ip", "bgp", "source-as", NULL } }, \ 42bc5366b8Sreyk { "show ip bgp transit-as", 1, 1, "<asnum>", \ 43bc5366b8Sreyk { BGPCTL, "show", "ip", "bgp", "transit-as", NULL } }, \ 44d025f34eSclaudio { "show ip bgp peer-as", 1, 1, "<asnum>", \ 45d025f34eSclaudio { BGPCTL, "show", "ip", "bgp", "peer-as", NULL } }, \ 46bc5366b8Sreyk { "show ip bgp empty-as", 0, 0, NULL, \ 47bc5366b8Sreyk { BGPCTL, "show", "ip", "bgp", "empty-as", NULL } }, \ 48bc5366b8Sreyk { "show ip bgp summary", 0, 0, NULL, \ 49bc5366b8Sreyk { BGPCTL, "show", "ip", "bgp", "summary", NULL } }, \ 50a4478c91Sjob { "show ip bgp community", 1, 1, "<community>", \ 51a4478c91Sjob { BGPCTL, "show","ip", "bgp", "community", NULL } }, \ 52a4478c91Sjob { "show ip bgp detail community", 1, 1, "<community>", \ 53a4478c91Sjob { BGPCTL, "show","ip", "bgp", "detail", "community", NULL } },\ 544b69d4deSdenis { "show ip bgp ext-community", 2, 2, "<ext-community>", \ 554b69d4deSdenis { BGPCTL, "show","ip", "bgp", "ext-community", NULL } }, \ 564b69d4deSdenis { "show ip bgp detail ext-community", 2, 2, "<ext-community>",\ 574b69d4deSdenis { BGPCTL, "show","ip", "bgp", "detail", "ext-community", NULL } },\ 58a4478c91Sjob { "show ip bgp large-community", 1, 1, "<large-community>",\ 59a4478c91Sjob { BGPCTL, "show","ip", "bgp", "large-community", NULL } }, \ 60a4478c91Sjob { "show ip bgp detail large-community", 1, 1, "<large-community>",\ 61a4478c91Sjob { BGPCTL, "show","ip", "bgp", "detail", "large-community", NULL } },\ 62dd9373d5Shenning { "show ip bgp detail", 1, 1, "<prefix>", \ 63bc5366b8Sreyk { BGPCTL, "show","ip", "bgp", "detail", NULL } }, \ 6431a0a388Sjob { "show ip bgp detail as", 1, 1, "<asnum>", \ 653a57eb32Sphessler { BGPCTL, "show","ip", "bgp", "detail", "as", NULL } }, \ 664ca2c842Sdenis { "show ip bgp in", 1, 1, "<neighbor>", \ 674ca2c842Sdenis { BGPCTL, "show","ip", "bgp", "in", "neighbor", NULL } }, \ 684ca2c842Sdenis { "show ip bgp out", 1, 1, "<neighbor>", \ 694ca2c842Sdenis { BGPCTL, "show","ip", "bgp", "out", "neighbor", NULL } }, \ 704b69d4deSdenis { "show ip bgp ovs", 1, 1, "<state>", \ 714b69d4deSdenis { BGPCTL, "show","ip", "bgp", "ovs", NULL } }, \ 72*f829cebcSjob { "show ip bgp avs", 1, 1, "<state>", \ 73*f829cebcSjob { BGPCTL, "show","ip", "bgp", "avs", NULL } }, \ 74bc5366b8Sreyk { "show ip bgp memory", 0, 0, NULL, \ 75bc5366b8Sreyk { BGPCTL, "show", "ip", "bgp", "memory", NULL } }, \ 76bc5366b8Sreyk { "show neighbor", 0, 1, NULL, \ 77bc5366b8Sreyk { BGPCTL, "show", "neighbor", NULL } }, \ 78bc5366b8Sreyk { "show nexthop", 0, 0, NULL, \ 79bc5366b8Sreyk { BGPCTL, "show", "nexthop", NULL } }, \ 80bc5366b8Sreyk { "traceroute", 1, 1, "<address>", \ 81d4ed8d8fSderaadt { TRACEROUTE, "-ASl", NULL } }, \ 82bc5366b8Sreyk { "ping", 1, 1, "<address>", \ 83bc5366b8Sreyk { PING, "-c4", "-w2", NULL } }, \ 84cc8d9beeSsthen { "traceroute6", 1, 1, "<address>", \ 85937029d2Sgsoares { TRACEROUTE6, "-Al", NULL } }, \ 86cc8d9beeSsthen { "ping6", 1, 1, "<address>", \ 87cc8d9beeSsthen { PING6, "-c4", "-i2", NULL } }, \ 889715db55Ssthen { "help", 0, 0, NULL, { NULL }, lg_help }, \ 89bc5366b8Sreyk { NULL } \ 90bc5366b8Sreyk } 91bc5366b8Sreyk 92bc5366b8Sreyk int lg_help(struct cmd *, char **); 93bc5366b8Sreyk int lg_exec(const char *, char **); 94bc5366b8Sreyk int lg_checkperm(struct cmd *); 95bc5366b8Sreyk void lg_sig_alarm(int); 96bc5366b8Sreyk ssize_t lg_strip(char *); 97bc5366b8Sreyk 98bc5366b8Sreyk #endif /* _BGPLG_H */ 99