diff options
Diffstat (limited to 'lib/if.h')
| -rw-r--r-- | lib/if.h | 116 |
1 files changed, 47 insertions, 69 deletions
@@ -1,22 +1,22 @@ /* Interface related header. - Copyright (C) 1997, 98, 99 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published -by the Free Software Foundation; either version 2, or (at your -option) any later version. - -GNU Zebra is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * GNU Zebra is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef _ZEBRA_IF_H #define _ZEBRA_IF_H @@ -146,9 +146,13 @@ struct if_stats #define MAX_CLASS_TYPE 8 #define MAX_PKT_LOSS 50.331642 -/* Link Parameters Status: 0: unset, 1: set, */ +/* + * Link Parameters Status: + * equal to 0: unset + * different from 0: set + */ #define LP_UNSET 0x0000 -#define LP_TE 0x0001 +#define LP_TE_METRIC 0x0001 #define LP_MAX_BW 0x0002 #define LP_MAX_RSV_BW 0x0004 #define LP_UNRSV_BW 0x0008 @@ -161,7 +165,6 @@ struct if_stats #define LP_RES_BW 0x0400 #define LP_AVA_BW 0x0800 #define LP_USE_BW 0x1000 -#define LP_TE_METRIC 0x2000 #define IS_PARAM_UNSET(lp, st) !(lp->lp_status & st) #define IS_PARAM_SET(lp, st) (lp->lp_status & st) @@ -224,7 +227,10 @@ struct interface uint64_t flags; /* Interface metric */ - int metric; + uint32_t metric; + + /* Interface Speed in Mb/s */ + uint32_t speed; /* Interface MTU. */ unsigned int mtu; /* IPv4 MTU */ @@ -386,45 +392,33 @@ struct nbr_connected /* Prototypes. */ extern int if_cmp_name_func (char *, char *); -extern struct interface *if_create (const char *name, int namelen); -extern struct interface *if_lookup_by_index (ifindex_t); -extern struct interface *if_lookup_exact_address (void *matchaddr, int family); -extern struct connected *if_lookup_address (void *matchaddr, int family); -extern struct interface *if_lookup_prefix (struct prefix *prefix); -extern void if_update_vrf (struct interface *, const char *name, int namelen, - vrf_id_t vrf_id); -extern struct interface *if_create_vrf (const char *name, int namelen, - vrf_id_t vrf_id); -extern struct interface *if_lookup_by_index_vrf (ifindex_t, vrf_id_t vrf_id); -extern struct interface *if_lookup_exact_address_vrf (void *matchaddr, int family, - vrf_id_t vrf_id); -extern struct connected *if_lookup_address_vrf (void *matchaddr, int family, - vrf_id_t vrf_id); -extern struct interface *if_lookup_prefix_vrf (struct prefix *prefix, +extern void if_update (struct interface *, const char *name, int namelen, + vrf_id_t vrf_id); +extern struct interface *if_create (const char *name, int namelen, + vrf_id_t vrf_id); +extern struct interface *if_lookup_by_index (ifindex_t, vrf_id_t vrf_id); +extern struct interface *if_lookup_exact_address (void *matchaddr, int family, + vrf_id_t vrf_id); +extern struct connected *if_lookup_address (void *matchaddr, int family, + vrf_id_t vrf_id); +extern struct interface *if_lookup_prefix (struct prefix *prefix, vrf_id_t vrf_id); -/* These 2 functions are to be used when the ifname argument is terminated +/* These 3 functions are to be used when the ifname argument is terminated by a '\0' character: */ -extern struct interface *if_lookup_by_name (const char *ifname); -extern struct interface *if_get_by_name (const char *ifname); - extern struct interface *if_lookup_by_name_all_vrf (const char *ifname); -extern struct interface *if_lookup_by_name_vrf (const char *ifname, - vrf_id_t vrf_id); -extern struct interface *if_get_by_name_vrf (const char *ifname, +extern struct interface *if_lookup_by_name (const char *ifname, + vrf_id_t vrf_id); +extern struct interface *if_get_by_name (const char *ifname, vrf_id_t vrf_id); /* For these 2 functions, the namelen argument should be the precise length of the ifname string (not counting any optional trailing '\0' character). In most cases, strnlen should be used to calculate the namelen value. */ extern struct interface *if_lookup_by_name_len(const char *ifname, - size_t namelen); -extern struct interface *if_get_by_name_len(const char *ifname,size_t namelen); - -extern struct interface *if_lookup_by_name_len_vrf(const char *ifname, - size_t namelen, vrf_id_t vrf_id); -extern struct interface *if_get_by_name_len_vrf(const char *ifname, + size_t namelen, vrf_id_t vrf_id); +extern struct interface *if_get_by_name_len(const char *ifname, size_t namelen, vrf_id_t vrf_id, int vty); @@ -447,6 +441,7 @@ extern int if_is_pointopoint (struct interface *); extern int if_is_multicast (struct interface *); extern void if_add_hook (int, int (*)(struct interface *)); extern void if_init (struct list **); +extern void if_cmd_init (void); extern void if_terminate (struct list **); extern void if_dump_all (void); extern const char *if_flag_dump(unsigned long); @@ -455,14 +450,12 @@ extern const char *if_link_type_str (enum zebra_link_type); /* Please use ifindex2ifname instead of if_indextoname where possible; ifindex2ifname uses internal interface info, whereas if_indextoname must make a system call. */ -extern const char *ifindex2ifname (ifindex_t); -extern const char *ifindex2ifname_vrf (ifindex_t, vrf_id_t vrf_id); +extern const char *ifindex2ifname (ifindex_t, vrf_id_t vrf_id); /* Please use ifname2ifindex instead of if_nametoindex where possible; ifname2ifindex uses internal interface info, whereas if_nametoindex must make a system call. */ -extern ifindex_t ifname2ifindex(const char *ifname); -extern ifindex_t ifname2ifindex_vrf(const char *ifname, vrf_id_t vrf_id); +extern ifindex_t ifname2ifindex(const char *ifname, vrf_id_t vrf_id); /* Connected address functions. */ extern struct connected *connected_new (void); @@ -485,19 +478,4 @@ struct nbr_connected *nbr_connected_check (struct interface *, struct prefix *); struct if_link_params *if_link_params_get (struct interface *); void if_link_params_free (struct interface *); -/* Exported variables. */ -extern struct cmd_element interface_desc_cmd; -extern struct cmd_element no_interface_desc_cmd; -extern struct cmd_element interface_cmd; -extern struct cmd_element no_interface_cmd; -extern struct cmd_element interface_vrf_cmd; -extern struct cmd_element no_interface_vrf_cmd; -extern struct cmd_element interface_pseudo_cmd; -extern struct cmd_element no_interface_pseudo_cmd; -extern struct cmd_element show_address_cmd; -extern struct cmd_element show_address_vrf_cmd; -extern struct cmd_element show_address_vrf_all_cmd; -extern struct cmd_element vrf_cmd; -extern struct cmd_element no_vrf_cmd; - #endif /* _ZEBRA_IF_H */ |
