Move tunnel syntax into tunnel.c. Move net80211 'list' command

syntax into ieee80211.c.
This commit is contained in:
dyoung 2008-05-07 20:03:27 +00:00
parent ad19851f11
commit 8bc06077c3
4 changed files with 27 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211.c,v 1.16 2008/05/07 19:55:24 dyoung Exp $ */
/* $NetBSD: ieee80211.c,v 1.17 2008/05/07 20:03:27 dyoung Exp $ */
/*
* Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ieee80211.c,v 1.16 2008/05/07 19:55:24 dyoung Exp $");
__RCSID("$NetBSD: ieee80211.c,v 1.17 2008/05/07 20:03:27 dyoung Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -107,6 +107,13 @@ static const struct kwinst ieee80211boolkw[] = {
.k_exec = setifpowersave}
};
static const struct kwinst listskw[] = {
{.k_word = "scan", .k_exec = scan_exec}
};
static struct pkw lists = PKW_INITIALIZER(&lists, "ieee80211 lists", NULL,
"list", listskw, __arraycount(listskw), &command_root.pb_parser);
static const struct kwinst kw80211kw[] = {
{.k_word = "bssid", .k_nextparser = &parse_bssid.ps_parser}
, {.k_word = "-bssid", .k_exec = unsetifbssid,
@ -119,6 +126,7 @@ static const struct kwinst kw80211kw[] = {
, {.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 = "list", .k_nextparser = &lists.pk_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,
@ -145,13 +153,6 @@ struct pinteger parse_frag = PINTEGER_INITIALIZER1(&parse_frag, "frag",
struct pstr parse_ssid = PSTR_INITIALIZER(&parse_pass, "ssid", setifssid,
"ssid", &command_root.pb_parser);
struct kwinst listskw[] = {
{.k_word = "scan", .k_exec = scan_exec}
};
struct pkw lists = PKW_INITIALIZER(&lists, "lists", NULL, "list", listskw,
__arraycount(listskw), &command_root.pb_parser);
struct pinteger parse_powersavesleep =
PINTEGER_INITIALIZER1(&parse_powersavesleep, "powersavesleep",
0, INT_MAX, 10, setifpowersavesleep, "powersavesleep",

View File

@ -1,4 +1,4 @@
/* $NetBSD: ifconfig.c,v 1.195 2008/05/07 19:55:24 dyoung Exp $ */
/* $NetBSD: ifconfig.c,v 1.196 2008/05/07 20:03:27 dyoung Exp $ */
/*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else
__RCSID("$NetBSD: ifconfig.c,v 1.195 2008/05/07 19:55:24 dyoung Exp $");
__RCSID("$NetBSD: ifconfig.c,v 1.196 2008/05/07 20:03:27 dyoung Exp $");
#endif
#endif /* not lint */
@ -245,7 +245,7 @@ extern struct pbranch command_root;
extern struct pbranch opt_command;
extern struct pbranch opt_family, opt_silent_family;
extern struct pkw cloning, silent_family, family, ia6flags, ia6lifetime,
ifcaps, ifflags, lists, misc;
ifcaps, ifflags, misc;
struct pinteger parse_metric = PINTEGER_INITIALIZER(&parse_metric, "metric", 10,
setifmetric, "metric", &command_root.pb_parser);
@ -291,15 +291,12 @@ struct kwinst misckw[] = {
, {.k_word = "delete", .k_key = "alias", .k_deact = "alias",
.k_type = KW_T_BOOL, .k_bool = false, .k_exec = notealias,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "deletetunnel", .k_exec = deletetunnel,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "instance", .k_key = "anymedia", .k_type = KW_T_BOOL,
.k_bool = true, .k_act = "media", .k_deact = "mediainst",
.k_nextparser = &mediainst.pi_parser}
, {.k_word = "inst", .k_key = "anymedia", .k_type = KW_T_BOOL,
.k_bool = true, .k_act = "media", .k_deact = "mediainst",
.k_nextparser = &mediainst.pi_parser}
, {.k_word = "list", .k_nextparser = &lists.pk_parser}
, {.k_word = "media", .k_key = "anymedia", .k_type = KW_T_BOOL,
.k_bool = true, .k_deact = "media", .k_altdeact = "anymedia",
.k_nextparser = &media.ps_parser}
@ -320,7 +317,6 @@ struct kwinst misckw[] = {
, {.k_word = "prefixlen", .k_nextparser = &parse_prefixlen.pi_parser}
, {.k_word = "trailers", .k_neg = true,
.k_exec = notrailers, .k_nextparser = &command_root.pb_parser}
, {.k_word = "tunnel", .k_nextparser = &tunsrc.pa_parser}
, {.k_word = "vlan", .k_nextparser = &vlan.pi_parser}
, {.k_word = "vlanif", .k_act = "vlan",
.k_nextparser = &vlanif.pif_parser}
@ -412,6 +408,7 @@ struct branch opt_clone_brs[] = {
, {.b_nextparser = &ia6lifetime.pk_parser}
#endif /*INET6*/
, {.b_nextparser = &misc.pk_parser}
, {.b_nextparser = &tunnel.pk_parser}
, {.b_nextparser = &agr.pk_parser}
, {.b_nextparser = &kw80211.pk_parser}
, {.b_nextparser = &address.pa_parser}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tunnel.c,v 1.11 2008/05/06 17:29:04 dyoung Exp $ */
/* $NetBSD: tunnel.c,v 1.12 2008/05/07 20:03:27 dyoung Exp $ */
/*
* Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: tunnel.c,v 1.11 2008/05/06 17:29:04 dyoung Exp $");
__RCSID("$NetBSD: tunnel.c,v 1.12 2008/05/07 20:03:27 dyoung Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -68,6 +68,15 @@ struct paddr tundst = PADDR_INITIALIZER(&tundst, "tundst", settunnel,
struct paddr tunsrc = PADDR_INITIALIZER(&tunsrc, "tunsrc", NULL,
"tunsrc", NULL, NULL, NULL, &tundst.pa_parser);
static const struct kwinst tunnelkw[] = {
{.k_word = "deletetunnel", .k_exec = deletetunnel,
.k_nextparser = &command_root.pb_parser}
, {.k_word = "tunnel", .k_nextparser = &tunsrc.pa_parser}
};
struct pkw tunnel = PKW_INITIALIZER(&tunnel, "tunnel", NULL, NULL,
tunnelkw, __arraycount(tunnelkw), NULL);
int
settunnel(prop_dictionary_t env, prop_dictionary_t xenv)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: tunnel.h,v 1.3 2008/05/06 17:29:04 dyoung Exp $ */
/* $NetBSD: tunnel.h,v 1.4 2008/05/07 20:03:27 dyoung Exp $ */
/*
* Copyright (c) 1983, 1993
@ -31,6 +31,7 @@
#include "parse.h"
extern struct paddr tundst, tunsrc;
extern struct pkw tunnel;
int settunnel(prop_dictionary_t, prop_dictionary_t);
int deletetunnel(prop_dictionary_t, prop_dictionary_t);