Move net80211 and agr(4) syntax out of ifconfig.c and into ieee80211.c

and agr.c, respectively.
This commit is contained in:
dyoung 2008-05-07 19:55:24 +00:00
parent e4942eb316
commit ad19851f11
5 changed files with 49 additions and 35 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: agr.c,v 1.8 2008/05/07 01:13:51 yamt Exp $ */ /* $NetBSD: agr.c,v 1.9 2008/05/07 19:55:24 dyoung Exp $ */
/*- /*-
* Copyright (c)2005 YAMAMOTO Takashi, * Copyright (c)2005 YAMAMOTO Takashi,
@ -28,7 +28,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if !defined(lint) #if !defined(lint)
__RCSID("$NetBSD: agr.c,v 1.8 2008/05/07 01:13:51 yamt Exp $"); __RCSID("$NetBSD: agr.c,v 1.9 2008/05/07 19:55:24 dyoung Exp $");
#endif /* !defined(lint) */ #endif /* !defined(lint) */
#include <sys/param.h> #include <sys/param.h>
@ -53,6 +53,15 @@ __RCSID("$NetBSD: agr.c,v 1.8 2008/05/07 01:13:51 yamt Exp $");
static int checkifname(const char *); static int checkifname(const char *);
static void assertifname(const char *); static void assertifname(const char *);
static const struct kwinst agrkw[] = {
{.k_word = "agrport", .k_type = KW_T_NUM, .k_neg = true,
.k_num = AGRCMD_ADDPORT, .k_negnum = AGRCMD_REMPORT,
.k_exec = agrsetport}
};
struct pkw agr = PKW_INITIALIZER(&agr, "agr", NULL, NULL,
agrkw, __arraycount(agrkw), NULL);
static int static int
checkifname(const char *ifname) checkifname(const char *ifname)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: agr.h,v 1.3 2008/05/06 17:29:04 dyoung Exp $ */ /* $NetBSD: agr.h,v 1.4 2008/05/07 19:55:24 dyoung Exp $ */
/*- /*-
* Copyright (c)2005 YAMAMOTO Takashi, * Copyright (c)2005 YAMAMOTO Takashi,
@ -27,5 +27,7 @@
*/ */
#include "parse.h" #include "parse.h"
extern struct pkw agr;
int agrsetport(prop_dictionary_t, prop_dictionary_t); int agrsetport(prop_dictionary_t, prop_dictionary_t);
void agr_status(prop_dictionary_t, prop_dictionary_t); void agr_status(prop_dictionary_t, prop_dictionary_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211.c,v 1.15 2008/05/06 21:18:17 dyoung Exp $ */ /* $NetBSD: ieee80211.c,v 1.16 2008/05/07 19:55:24 dyoung Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: ieee80211.c,v 1.15 2008/05/06 21:18:17 dyoung Exp $"); __RCSID("$NetBSD: ieee80211.c,v 1.16 2008/05/07 19:55:24 dyoung Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -95,7 +95,7 @@ static const char * iename(int);
extern int vflag; extern int vflag;
struct kwinst ieee80211boolkw[] = { static const struct kwinst ieee80211boolkw[] = {
{.k_word = "hidessid", .k_key = "hidessid", .k_neg = true, {.k_word = "hidessid", .k_key = "hidessid", .k_neg = true,
.k_type = KW_T_BOOL, .k_bool = true, .k_negbool = false, .k_type = KW_T_BOOL, .k_bool = true, .k_negbool = false,
.k_exec = sethidessid} .k_exec = sethidessid}
@ -107,6 +107,30 @@ struct kwinst ieee80211boolkw[] = {
.k_exec = setifpowersave} .k_exec = setifpowersave}
}; };
static const struct kwinst kw80211kw[] = {
{.k_word = "bssid", .k_nextparser = &parse_bssid.ps_parser}
, {.k_word = "-bssid", .k_exec = unsetifbssid,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "chan", .k_nextparser = &parse_chan.pi_parser}
, {.k_word = "-chan", .k_key = "chan", .k_type = KW_T_NUM,
.k_num = IEEE80211_CHAN_ANY, .k_exec = setifchan,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "frag", .k_nextparser = &parse_frag.pi_parser}
, {.k_word = "-frag", .k_key = "frag", .k_type = KW_T_NUM,
.k_num = IEEE80211_FRAG_MAX, .k_exec = setiffrag,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "nwid", .k_nextparser = &parse_ssid.ps_parser}
, {.k_word = "nwkey", .k_nextparser = &parse_nwkey.ps_parser}
, {.k_word = "-nwkey", .k_exec = unsetifnwkey,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "ssid", .k_nextparser = &parse_ssid.ps_parser}
, {.k_word = "powersavesleep",
.k_nextparser = &parse_powersavesleep.pi_parser}
};
struct pkw kw80211 = PKW_INITIALIZER(&kw80211, "802.11 keywords", NULL, NULL,
kw80211kw, __arraycount(kw80211kw), NULL);
struct pkw ieee80211bool = PKW_INITIALIZER(&ieee80211bool, "ieee80211 boolean", struct pkw ieee80211bool = PKW_INITIALIZER(&ieee80211bool, "ieee80211 boolean",
NULL, NULL, ieee80211boolkw, __arraycount(ieee80211boolkw), NULL, NULL, ieee80211boolkw, __arraycount(ieee80211boolkw),
&command_root.pb_parser); &command_root.pb_parser);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211.h,v 1.6 2008/05/06 17:29:04 dyoung Exp $ */ /* $NetBSD: ieee80211.h,v 1.7 2008/05/07 19:55:24 dyoung Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -32,6 +32,7 @@
#include "parse.h" #include "parse.h"
extern struct pinteger parse_chan, parse_frag; extern struct pinteger parse_chan, parse_frag;
extern struct pkw kw80211;
extern struct pkw ieee80211bool; extern struct pkw ieee80211bool;
extern struct pstr parse_bssid, parse_ssid, parse_nwkey; extern struct pstr parse_bssid, parse_ssid, parse_nwkey;
extern struct pinteger parse_powersavesleep; extern struct pinteger parse_powersavesleep;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ifconfig.c,v 1.194 2008/05/07 18:08:30 dyoung Exp $ */ /* $NetBSD: ifconfig.c,v 1.195 2008/05/07 19:55:24 dyoung Exp $ */
/*- /*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else #else
__RCSID("$NetBSD: ifconfig.c,v 1.194 2008/05/07 18:08:30 dyoung Exp $"); __RCSID("$NetBSD: ifconfig.c,v 1.195 2008/05/07 19:55:24 dyoung Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -83,9 +83,6 @@ __RCSID("$NetBSD: ifconfig.c,v 1.194 2008/05/07 18:08:30 dyoung Exp $");
#include <net/if_ether.h> #include <net/if_ether.h>
#include <netinet/in.h> /* XXX */ #include <netinet/in.h> /* XXX */
#include <netinet/in_var.h> /* XXX */ #include <netinet/in_var.h> /* XXX */
#include <net/agr/if_agrioctl.h>
#include <net80211/ieee80211_ioctl.h>
#include <netdb.h> #include <netdb.h>
@ -248,7 +245,7 @@ extern struct pbranch command_root;
extern struct pbranch opt_command; extern struct pbranch opt_command;
extern struct pbranch opt_family, opt_silent_family; extern struct pbranch opt_family, opt_silent_family;
extern struct pkw cloning, silent_family, family, ia6flags, ia6lifetime, extern struct pkw cloning, silent_family, family, ia6flags, ia6lifetime,
ieee80211bool, ifcaps, ifflags, lists, misc; ifcaps, ifflags, lists, misc;
struct pinteger parse_metric = PINTEGER_INITIALIZER(&parse_metric, "metric", 10, struct pinteger parse_metric = PINTEGER_INITIALIZER(&parse_metric, "metric", 10,
setifmetric, "metric", &command_root.pb_parser); setifmetric, "metric", &command_root.pb_parser);
@ -286,30 +283,16 @@ struct pstr media = PSTR_INITIALIZER(&media, "media",
setmedia, "media", &command_root.pb_parser); setmedia, "media", &command_root.pb_parser);
struct kwinst misckw[] = { struct kwinst misckw[] = {
{.k_word = "agrport", .k_type = KW_T_NUM, .k_neg = true, {.k_word = "alias", .k_key = "alias", .k_deact = "alias",
.k_num = AGRCMD_ADDPORT, .k_negnum = AGRCMD_REMPORT,
.k_exec = agrsetport}
, {.k_word = "alias", .k_key = "alias", .k_deact = "alias",
.k_type = KW_T_BOOL, .k_neg = true, .k_type = KW_T_BOOL, .k_neg = true,
.k_bool = true, .k_negbool = false, .k_bool = true, .k_negbool = false,
.k_exec = notealias, .k_nextparser = &command_root.pb_parser} .k_exec = notealias, .k_nextparser = &command_root.pb_parser}
, {.k_word = "bssid", .k_nextparser = &parse_bssid.ps_parser}
, {.k_word = "-bssid", .k_exec = unsetifbssid,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "broadcast", .k_nextparser = &parse_broadcast.pa_parser} , {.k_word = "broadcast", .k_nextparser = &parse_broadcast.pa_parser}
, {.k_word = "chan", .k_nextparser = &parse_chan.pi_parser}
, {.k_word = "-chan", .k_key = "chan", .k_type = KW_T_NUM,
.k_num = IEEE80211_CHAN_ANY, .k_exec = setifchan,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "delete", .k_key = "alias", .k_deact = "alias", , {.k_word = "delete", .k_key = "alias", .k_deact = "alias",
.k_type = KW_T_BOOL, .k_bool = false, .k_exec = notealias, .k_type = KW_T_BOOL, .k_bool = false, .k_exec = notealias,
.k_nextparser = &command_root.pb_parser} .k_nextparser = &command_root.pb_parser}
, {.k_word = "deletetunnel", .k_exec = deletetunnel, , {.k_word = "deletetunnel", .k_exec = deletetunnel,
.k_nextparser = &command_root.pb_parser} .k_nextparser = &command_root.pb_parser}
, {.k_word = "frag", .k_nextparser = &parse_frag.pi_parser}
, {.k_word = "-frag", .k_key = "frag", .k_type = KW_T_NUM,
.k_num = IEEE80211_FRAG_MAX, .k_exec = setiffrag,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "instance", .k_key = "anymedia", .k_type = KW_T_BOOL, , {.k_word = "instance", .k_key = "anymedia", .k_type = KW_T_BOOL,
.k_bool = true, .k_act = "media", .k_deact = "mediainst", .k_bool = true, .k_act = "media", .k_deact = "mediainst",
.k_nextparser = &mediainst.pi_parser} .k_nextparser = &mediainst.pi_parser}
@ -332,16 +315,9 @@ struct kwinst misckw[] = {
, {.k_word = "metric", .k_nextparser = &parse_metric.pi_parser} , {.k_word = "metric", .k_nextparser = &parse_metric.pi_parser}
, {.k_word = "mtu", .k_nextparser = &parse_mtu.pi_parser} , {.k_word = "mtu", .k_nextparser = &parse_mtu.pi_parser}
, {.k_word = "netmask", .k_nextparser = &parse_netmask.pa_parser} , {.k_word = "netmask", .k_nextparser = &parse_netmask.pa_parser}
, {.k_word = "nwid", .k_nextparser = &parse_ssid.ps_parser}
, {.k_word = "nwkey", .k_nextparser = &parse_nwkey.ps_parser}
, {.k_word = "-nwkey", .k_exec = unsetifnwkey,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "preference", .k_act = "address", , {.k_word = "preference", .k_act = "address",
.k_nextparser = &parse_preference.pi_parser} .k_nextparser = &parse_preference.pi_parser}
, {.k_word = "prefixlen", .k_nextparser = &parse_prefixlen.pi_parser} , {.k_word = "prefixlen", .k_nextparser = &parse_prefixlen.pi_parser}
, {.k_word = "ssid", .k_nextparser = &parse_ssid.ps_parser}
, {.k_word = "powersavesleep",
.k_nextparser = &parse_powersavesleep.pi_parser}
, {.k_word = "trailers", .k_neg = true, , {.k_word = "trailers", .k_neg = true,
.k_exec = notrailers, .k_nextparser = &command_root.pb_parser} .k_exec = notrailers, .k_nextparser = &command_root.pb_parser}
, {.k_word = "tunnel", .k_nextparser = &tunsrc.pa_parser} , {.k_word = "tunnel", .k_nextparser = &tunsrc.pa_parser}
@ -436,6 +412,8 @@ struct branch opt_clone_brs[] = {
, {.b_nextparser = &ia6lifetime.pk_parser} , {.b_nextparser = &ia6lifetime.pk_parser}
#endif /*INET6*/ #endif /*INET6*/
, {.b_nextparser = &misc.pk_parser} , {.b_nextparser = &misc.pk_parser}
, {.b_nextparser = &agr.pk_parser}
, {.b_nextparser = &kw80211.pk_parser}
, {.b_nextparser = &address.pa_parser} , {.b_nextparser = &address.pa_parser}
, {.b_nextparser = &dstormask.pa_parser} , {.b_nextparser = &dstormask.pa_parser}
, {.b_nextparser = &broadcast.pa_parser} , {.b_nextparser = &broadcast.pa_parser}