From: Donald Sharp Date: Wed, 25 Jan 2017 14:37:13 +0000 (-0500) Subject: bgpd: Add some documentation for bgp_vty_find_and_parse_afi_safi_vrf X-Git-Tag: frr-3.0-branchpoint~71^2^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7eeee51e02e815ae79d6ed78f490fb45ea2ebae7;p=matthieu%2Ffrr.git bgpd: Add some documentation for bgp_vty_find_and_parse_afi_safi_vrf The use of this function was causing some confusion. As such let's add some documentation. Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fa19308cb1..e98c231064 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -197,6 +197,36 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t return ret; } +/* + * bgp_vty_find_and_parse_afi_safi_vrf + * + * For a given 'show ...' command, correctly parse the afi/safi/vrf out from it + * This function *assumes* that the calling function pre-sets the afi/safi/vrf + * to appropriate values for the calling function. This is to allow the + * calling function to make decisions appropriate for the show command + * that is being parsed. + * + * The show commands are generally of the form: + * "show [ip] bgp [ WORD] [ []] ..." + * + * Since we use argv_find if the show command in particular doesn't have: + * [ip] + * [ WORD] + * [ []] + * The command parsing should still be ok. + * + * vty -> The vty for the command so we can output some useful data in + * the event of a parse error in the vrf. + * argv -> The command tokens + * argc -> How many command tokens we have + * idx -> The current place in the command, generally should be 0 for this function + * afi -> The parsed afi if it was included in the show command, returned here + * safi -> The parsed safi if it was included in the show command, returned here + * vrf -> The parsed vrf id if it was included in the show command, returned here + * + * The function returns the correct location in the parse tree for the + * last token found. + */ int bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, int argc, int idx, afi_t *afi, safi_t *safi, vrf_id_t *vrf)