1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
/*
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Inetutils.
GNU Inetutils 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 3 of the License, or (at
your option) any later version.
GNU Inetutils 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. If not, see `http://www.gnu.org/licenses/'. */
#ifndef IFCONFIG_SYSTEM_BSD_H
# define IFCONFIG_SYSTEM_BSD_H
# include "../printif.h"
# include "../options.h"
# include <sys/sockio.h>
/* BSD variant chooser. */
# if defined __DragonFly__
# define IU_BSD_TYPE "dragonfly"
# elif defined __FreeBSD__
# define IU_BSD_TYPE "freebsd"
# elif defined __FreeBSD_kernel__
# define IU_BSD_TYPE "GNU/kFreeBSD"
# elif defined __NetBSD__
# define IU_BSD_TYPE "netbsd"
# elif defined __OpenBSD__
# define IU_BSD_TYPE "openbsd"
# define ETHERNAME "lladdr"
# else /* Exotic BSD versions. */
# define IU_BSD_TYPE "unknownbsd"
# endif
# ifndef ETHERNAME
# define ETHERNAME "ether"
# endif
/* Option support. */
# undef SYSTEM_SHORT_OPTIONS
# undef SYSTEM_LONG_OPTIONS
struct system_ifconfig
{
int valid;
};
/* Output format support. */
# define _IU_CAT2(a, b) a ## b
# define _IU_DCL(name, fld) \
{#name, _IU_CAT2(system_fh_, fld) }
# define _IU_EXTRN(fld) \
extern void _IU_CAT2(system_fh_, fld) (format_data_t, int, char *[]); \
# define SYSTEM_FORMAT_HANDLER \
{"bsd", fh_nothing}, \
{IU_BSD_TYPE, fh_nothing}, \
{"brdaddr?", system_fh_brdaddr_query}, \
{"brdaddr", system_fh_brdaddr}, \
{"hwaddr?", system_fh_hwaddr_query}, \
{"hwaddr", system_fh_hwaddr}, \
{"hwtype?", system_fh_hwtype_query}, \
{"hwtype", system_fh_hwtype}, \
{"media?", system_fh_media_query}, \
{"media", system_fh_media}, \
{"netmask?", system_fh_netmask_query}, \
{"netmask", system_fh_netmask}, \
{"status?", system_fh_status_query}, \
{"status", system_fh_status}, \
{"tunnel?", system_fh_tunnel_query}, \
{"tundst", system_fh_tundst}, \
{"tunsrc", system_fh_tunsrc}, \
{"ifstat?", system_fh_ifstat_query}, \
_IU_DCL (collisions, collisions), \
_IU_DCL (rxbytes, rx_bytes), \
_IU_DCL (rxdropped, rx_dropped), \
_IU_DCL (rxerrors, rx_errors), \
{"rxfifoerr", system_fh_missing_stat}, \
{"rxframeerr", system_fh_missing_stat}, \
_IU_DCL (rxpackets, rx_packets), \
_IU_DCL (txbytes, tx_bytes), \
{"txcarrier", system_fh_missing_stat}, \
_IU_DCL (txdropped, tx_dropped), \
_IU_DCL (txerrors, tx_errors), \
{"txfifoerr", system_fh_missing_stat}, \
_IU_DCL (txpackets, tx_packets),
void system_fh_brdaddr_query (format_data_t form, int argc, char *argv[]);
void system_fh_brdaddr (format_data_t form, int argc, char *argv[]);
void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
void system_fh_media_query (format_data_t form, int argc, char *argv[]);
void system_fh_media (format_data_t form, int argc, char *argv[]);
void system_fh_netmask_query (format_data_t form, int argc, char *argv[]);
void system_fh_netmask (format_data_t form, int argc, char *argv[]);
void system_fh_status_query (format_data_t form, int argc, char *argv[]);
void system_fh_status (format_data_t form, int argc, char *argv[]);
void system_fh_tunnel_query (format_data_t form, int argc, char *argv[]);
void system_fh_tundst (format_data_t form, int argc, char *argv[]);
void system_fh_tunsrc (format_data_t form, int argc, char *argv[]);
void system_fh_ifstat_query (format_data_t form, int argc, char *argv[]);
void system_fh_missing_stat (format_data_t form, int argc, char *argv[]);
_IU_EXTRN (rx_bytes)
_IU_EXTRN (tx_bytes)
_IU_EXTRN (rx_dropped)
_IU_EXTRN (tx_dropped)
_IU_EXTRN (rx_errors)
_IU_EXTRN (tx_errors)
_IU_EXTRN (rx_packets)
_IU_EXTRN (tx_packets)
_IU_EXTRN (collisions)
#endif /* IFCONFIG_SYSTEM_BSD_H */
|