Debian Codegraph @

ifconfig/system/bsd.h

raw
1 /*
2 Copyright (C) 2001-2026 Free Software Foundation, Inc.
3
4 This file is part of GNU Inetutils.
5
6 GNU Inetutils is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or (at
9 your option) any later version.
10
11 GNU Inetutils is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see `http://www.gnu.org/licenses/'. */
18
19 #ifndef IFCONFIG_SYSTEM_BSD_H
20 # define IFCONFIG_SYSTEM_BSD_H
21 # include "../printif.h"
22 # include "../options.h"
23 # include <sys/sockio.h>
24
25 /* BSD variant chooser. */
26 # if defined __DragonFly__
27 # define IU_BSD_TYPE "dragonfly"
28 # elif defined __FreeBSD__
29 # define IU_BSD_TYPE "freebsd"
30 # elif defined __FreeBSD_kernel__
31 # define IU_BSD_TYPE "GNU/kFreeBSD"
32 # elif defined __NetBSD__
33 # define IU_BSD_TYPE "netbsd"
34 # elif defined __OpenBSD__
35 # define IU_BSD_TYPE "openbsd"
36 # define ETHERNAME "lladdr"
37 # else/* Exotic BSD versions. */
38 # define IU_BSD_TYPE "unknownbsd"
39 # endif
40
41 # ifndef ETHERNAME
42 # define ETHERNAME "ether"
43 # endif
44
45
46 /* Option support. */
47
48 # undef SYSTEM_SHORT_OPTIONS
49 # undef SYSTEM_LONG_OPTIONS
50
51 struct system_ifconfig
52 {
53 int valid;
54 };
55
56
57 /* Output format support. */
58
59 # define _IU_CAT2(a, b) a ## b
60 # define _IU_DCL(name, fld) \
61 {#name, _IU_CAT2(system_fh_, fld) }
62 # define _IU_EXTRN(fld) \
63 extern void _IU_CAT2(system_fh_, fld) (format_data_t, int, char *[]); \
64
65 # define SYSTEM_FORMAT_HANDLER \
66 {"bsd", fh_nothing}, \
67 {IU_BSD_TYPE, fh_nothing}, \
68 {"brdaddr?", system_fh_brdaddr_query}, \
69 {"brdaddr", system_fh_brdaddr}, \
70 {"hwaddr?", system_fh_hwaddr_query}, \
71 {"hwaddr", system_fh_hwaddr}, \
72 {"hwtype?", system_fh_hwtype_query}, \
73 {"hwtype", system_fh_hwtype}, \
74 {"media?", system_fh_media_query}, \
75 {"media", system_fh_media}, \
76 {"netmask?", system_fh_netmask_query}, \
77 {"netmask", system_fh_netmask}, \
78 {"status?", system_fh_status_query}, \
79 {"status", system_fh_status}, \
80 {"tunnel?", system_fh_tunnel_query}, \
81 {"tundst", system_fh_tundst}, \
82 {"tunsrc", system_fh_tunsrc}, \
83 {"ifstat?", system_fh_ifstat_query}, \
84 _IU_DCL (collisions, collisions), \
85 _IU_DCL (rxbytes, rx_bytes), \
86 _IU_DCL (rxdropped, rx_dropped), \
87 _IU_DCL (rxerrors, rx_errors), \
88 {"rxfifoerr", system_fh_missing_stat}, \
89 {"rxframeerr", system_fh_missing_stat}, \
90 _IU_DCL (rxpackets, rx_packets), \
91 _IU_DCL (txbytes, tx_bytes), \
92 {"txcarrier", system_fh_missing_stat}, \
93 _IU_DCL (txdropped, tx_dropped), \
94 _IU_DCL (txerrors, tx_errors), \
95 {"txfifoerr", system_fh_missing_stat}, \
96 _IU_DCL (txpackets, tx_packets),
97
98 void system_fh_brdaddr_query (format_data_t form, int argc, char *argv[]);
99 void system_fh_brdaddr (format_data_t form, int argc, char *argv[]);
100 void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
101 void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
102 void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
103 void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
104 void system_fh_media_query (format_data_t form, int argc, char *argv[]);
105 void system_fh_media (format_data_t form, int argc, char *argv[]);
106 void system_fh_netmask_query (format_data_t form, int argc, char *argv[]);
107 void system_fh_netmask (format_data_t form, int argc, char *argv[]);
108 void system_fh_status_query (format_data_t form, int argc, char *argv[]);
109 void system_fh_status (format_data_t form, int argc, char *argv[]);
110 void system_fh_tunnel_query (format_data_t form, int argc, char *argv[]);
111 void system_fh_tundst (format_data_t form, int argc, char *argv[]);
112 void system_fh_tunsrc (format_data_t form, int argc, char *argv[]);
113
114 void system_fh_ifstat_query (format_data_t form, int argc, char *argv[]);
115 void system_fh_missing_stat (format_data_t form, int argc, char *argv[]);
116
117 _IU_EXTRN (rx_bytes)
118 _IU_EXTRN (tx_bytes)
119 _IU_EXTRN (rx_dropped)
120 _IU_EXTRN (tx_dropped)
121 _IU_EXTRN (rx_errors)
122 _IU_EXTRN (tx_errors)
123 _IU_EXTRN (rx_packets) _IU_EXTRN (tx_packets) _IU_EXTRN (collisions)
124 #endif /* IFCONFIG_SYSTEM_BSD_H */