File: options.h

package info (click to toggle)
inetutils 2%3A2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,684 kB
  • sloc: ansic: 132,371; sh: 12,498; yacc: 1,651; makefile: 725; perl: 72
file content (98 lines) | stat: -rw-r--r-- 2,838 bytes parent folder | download | duplicates (3)
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
/*
  Copyright (C) 2001-2025 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/'. */

/* Written by Marcus Brinkmann.  */

#ifndef IFCONFIG_OPTIONS_H
# define IFCONFIG_OPTIONS_H

# include <sys/types.h>
# include <sys/socket.h>

struct ifconfig *parse_opt_new_ifs (char *name);

/* One per interface mentioned on the command line.  */
struct ifconfig
{
  char *name;
  int valid;
# define IF_VALID_SYSTEM	0x001
  struct system_ifconfig *system;
# define IF_VALID_FORMAT	0x002
  const char *format;
# define IF_VALID_AF		0x004
  sa_family_t af;
# define IF_VALID_ADDR		0x008
  char *address;
# define IF_VALID_NETMASK	0x010
  char *netmask;
# define IF_VALID_DSTADDR	0x020
  char *dstaddr;
# define IF_VALID_BRDADDR	0x040
  char *brdaddr;
# define IF_VALID_MTU		0x080
  int mtu;
# define IF_VALID_METRIC	0x100
  int metric;
# define IF_VALID_FLAGS		0x200
  int setflags;
  int clrflags;
# define IF_VALID_HWADDR	0x400
  char *hwaddr;
};

struct format
{
  const char *name;
  const char *docstr;
  const char *templ;
};

extern struct format formats[];
extern int all_option;
extern int ifs_cmdline;

/* Array of interfaces mentioned on the command line.  */
extern struct ifconfig *ifs;
extern int nifs;

/* List available interfaces.  */
extern int list_mode;

/* Be verbose about what we do.  */
extern int verbose;

void usage (int err);
struct format *format_find (const char *name);
void parse_opt_set_address (struct ifconfig *ifp, char *addr);
void parse_opt_set_brdaddr (struct ifconfig *ifp, char *addr);
void parse_opt_set_dstaddr (struct ifconfig *ifp, char *addr);
void parse_opt_set_netmask (struct ifconfig *ifp, char *addr);
void parse_opt_set_hwaddr (struct ifconfig *ifp, char *addr);
void parse_opt_set_mtu (struct ifconfig *ifp, char *addr);
void parse_opt_set_metric (struct ifconfig *ifp, char *addr);
void parse_opt_set_default_format (const char *format);
void parse_opt_set_flag (struct ifconfig *ifp, int flag, int rev);
void parse_opt_flag_list (struct ifconfig *ifp, const char *name);
void parse_opt_set_point_to_point (struct ifconfig *ifp, char *addr);

void parse_opt_finalize (struct ifconfig *ifp);

void parse_cmdline (int argc, char *argv[]);

#endif