Debian Codegraph @

ifconfig/system.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 /* Written by Marcus Brinkmann. */
20
21 #ifndef IFCONFIG_SYSTEM_H
22 # define IFCONFIG_SYSTEM_H
23
24
25 /* Option parsing. */
26
27 extern struct argp_child system_argp_child;
28
29 /* Define this if ifconfig supports parsing the remaining non-option
30 arguments on the command line (see system_parse_opt_rest) to a string
31 usable in the help info. Like " <addr> [ netmask <mask> ]" */
32 extern const char *system_help;
33
34 /* Hooked into a struct ifconfig (setting the flag IF_VALID_SYSTEM),
35 to store system specific configurations from the command line
36 arguments. */
37 /* struct system_ifconfig; */
38
39 /* Parse option OPTION, with argument OPTARG (may be NULL), and store
40 it in IFP. You may create a new struct ifconfig if appropriate,
41 and store its pointer in IFP to make it the current one.
42 Return 0 if option was not recognized, otherwise 1. */
43 extern int system_parse_opt (struct ifconfig **ifp, char option,
44 char *optarg);
45
46 /* Parse remaining ARGC arguments ARGV on the command line. IFP has
47 the same meaning as in system_parse_opt. (There is some
48 post-processing, so you are not relieved from setting IPF is
49 appropriate.)
50 Return 0 if all options were not recognized, otherwise 1. */
51 extern int system_parse_opt_rest (struct ifconfig **ifp, int argc,
52 char *argv[]);
53
54
55 /* Output format support. */
56
57 /* Define this if you want to set a system specific default output
58 format. Possible value is a string with the same meaning as an
59 argument to the --format option, e.g. `"gnu"', or `"${name}:"'. */
60 extern const char *system_default_format;
61
62 /* Define this to a list of struct format_handler items. Add a
63 trailing comma, too. */
64 # undef SYSTEM_FORMAT_HANDLER
65
66
67 int system_preconfigure (int sfd, struct ifreq *ifr);
68 int system_configure (int sfd, struct ifreq *ifr,
69 struct system_ifconfig *__ifs);
70
71
72
73 /* For systems which loose. */
74
75 # ifndef HAVE_STRUCT_IFREQ_IFR_INDEX
76 # define ifr_index ifr_ifindex
77 # endif
78
79 # ifndef HAVE_STRUCT_IFREQ_IFR_NETMASK
80 # define ifr_netmask ifr_addr
81 # endif
82
83 # ifndef HAVE_STRUCT_IFREQ_IFR_BROADADDR
84 # define ifr_broadaddr ifr_addr
85 # endif
86
87
88 extern struct if_nameindex *(*system_if_nameindex) (void);
89
90 # if defined __linux__
91 # include "system/linux.h"
92 # elif defined __sun
93 # include "system/solaris.h"
94 # elif defined __QNX__
95 # include "system/qnx.h"
96 # elif defined __DragonFly__ || defined __FreeBSD__ || \
97 defined __FreeBSD_kernel__ || \
98 defined __NetBSD__ || defined __OpenBSD__
99 # include "system/bsd.h"
100 # elif defined __GNU__
101 # include "system/hurd.h"
102 # else
103 # include "system/generic.h"
104 # endif
105
106 #endif