ifconfig.h (127649) | ifconfig.h (138593) |
---|---|
1/* 2 * Copyright (c) 1997 Peter Wemm. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * so there! 33 * | 1/* 2 * Copyright (c) 1997 Peter Wemm. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * so there! 33 * |
34 * $FreeBSD: head/sbin/ifconfig/ifconfig.h 127649 2004-03-30 22:59:22Z sam $ | 34 * $FreeBSD: head/sbin/ifconfig/ifconfig.h 138593 2004-12-08 19:18:07Z sam $ |
35 */ 36 | 35 */ 36 |
37extern struct ifreq ifr; | 37#define __constructor __attribute__((constructor)) |
38 | 38 |
39extern char name[IFNAMSIZ]; /* name of interface */ 40extern int allmedia; 41extern int supmedia; | |
42struct afswtch; | 39struct afswtch; |
40struct cmd; |
|
43 | 41 |
44extern void setmedia(const char *, int, int, const struct afswtch *rafp); 45extern void setmediamode(const char *, int, int, const struct afswtch *rafp); 46extern void setmediaopt(const char *, int, int, const struct afswtch *rafp); 47extern void unsetmediaopt(const char *, int, int, const struct afswtch *rafp); 48extern void media_status(int s, struct rt_addrinfo *); | 42typedef void c_func(const char *cmd, int arg, int s, const struct afswtch *afp); 43typedef void c_func2(const char *arg1, const char *arg2, int s, const struct afswtch *afp); |
49 | 44 |
50extern void setvlantag(const char *, int, int, const struct afswtch *rafp); 51extern void setvlandev(const char *, int, int, const struct afswtch *rafp); 52extern void unsetvlandev(const char *, int, int, const struct afswtch *rafp); 53extern void vlan_status(int s, struct rt_addrinfo *); | 45struct cmd { 46 const char *c_name; 47 int c_parameter; 48#define NEXTARG 0xffffff /* has following arg */ 49#define NEXTARG2 0xfffffe /* has 2 following args */ 50#define OPTARG 0xfffffd /* has optional following arg */ 51 union { 52 c_func *c_func; 53 c_func2 *c_func2; 54 }; 55 struct cmd *c_next; 56}; 57void cmd_register(struct cmd *); |
54 | 58 |
55extern void set80211ssid(const char *, int, int, const struct afswtch *rafp); 56extern void set80211stationname(const char *, int, int, const struct afswtch *rafp); 57extern void set80211channel(const char *, int, int, const struct afswtch *rafp); 58extern void set80211authmode(const char *, int, int, const struct afswtch *rafp); 59extern void set80211powersave(const char *, int, int, const struct afswtch *rafp); 60extern void set80211powersavemode(const char *, int, int, const struct afswtch *rafp); 61extern void set80211powersavesleep(const char *, int, int, const struct afswtch *rafp); 62extern void set80211wepmode(const char *, int, int, const struct afswtch *rafp); 63extern void set80211wep(const char *, int, int, const struct afswtch *rafp); 64extern void set80211weptxkey(const char *, int, int, const struct afswtch *rafp); 65extern void set80211wepkey(const char *, int, int, const struct afswtch *rafp); 66extern void set80211nwkey(const char *, int, int, const struct afswtch *rafp); 67extern void set80211rtsthreshold(const char *, int, int, const struct afswtch *rafp); 68extern void set80211protmode(const char *, int, int, const struct afswtch *rafp); 69extern void set80211txpower(const char *, int, int, const struct afswtch *rafp); 70extern void ieee80211_status(int s, struct rt_addrinfo *); 71extern void maclabel_status(int s, struct rt_addrinfo *); 72extern void setifmaclabel(const char *, int, int, const struct afswtch *rafp); | 59/* 60 * Macros for declaring command functions and initializing entries. 61 */ 62#define DECL_CMD_FUNC(name, cmd, arg) \ 63 void name(const char *cmd, int arg, int s, const struct afswtch *afp) 64#define DECL_CMD_FUNC2(name, arg1, arg2) \ 65 void name(const char *arg1, const char *arg2, int s, const struct afswtch *afp) 66 67#define DEF_CMD(name, param, func) { name, param, { .c_func = func } } 68#define DEF_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func } } 69#define DEF_CMD_OPTARG(name, func) { name, OPTARG, { .c_func = func } } 70#define DEF_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func } } 71 72struct rt_addrinfo; 73struct addrinfo; 74 75enum { 76 RIDADDR, 77 ADDR, 78 MASK, 79 DSTADDR, 80}; 81 82struct afswtch { 83 const char *af_name; /* as given on cmd line, e.g. "inet" */ 84 short af_af; /* AF_* */ 85 /* print status method */ 86 void (*af_status)(int, const struct rt_addrinfo *); 87 /* parse address method */ 88 void (*af_getaddr)(const char *, int); 89 /* parse prefix method (IPv6) */ 90 void (*af_getprefix)(const char *, int); 91 void (*af_postproc)(int s, const struct afswtch *); 92 u_long af_difaddr; /* set dst if address ioctl */ 93 u_long af_aifaddr; /* set if address ioctl */ 94 void *af_ridreq; /* */ 95 void *af_addreq; /* */ 96 struct afswtch *af_next; 97 98 /* XXX doesn't fit model */ 99 void (*af_status_tunnel)(int); 100 void (*af_settunnel)(int s, struct addrinfo *srcres, 101 struct addrinfo *dstres); 102}; 103void af_register(struct afswtch *); 104 105struct option { 106 const char *opt; 107 const char *opt_usage; 108 void (*cb)(const char *arg); 109 struct option *next; 110}; 111void opt_register(struct option *); 112 113extern struct ifreq ifr; 114extern char name[IFNAMSIZ]; /* name of interface */ 115extern int allmedia; 116extern int supmedia; 117extern int printname; 118extern int flags; 119extern int newaddr; 120extern int verbose; 121extern int setipdst; 122 123void setifcap(const char *, int value, int s, const struct afswtch *); 124 125void Perror(const char *cmd); 126void printb(const char *s, unsigned value, const char *bits); 127 128void ifmaybeload(char *name); 129 130void clone_create(void); |