]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/ifconfig/regdomain.h
This commit was generated by cvs2svn to compensate for changes in r179191,
[FreeBSD/FreeBSD.git] / sbin / ifconfig / regdomain.h
1 /*-
2  * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting
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
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * $FreeBSD$
26  */
27 #ifndef _LIB80211_H_
28 #define _LIB80211_H_
29
30 #include <sys/cdefs.h>
31 #include <sys/queue.h>
32
33 #include <net80211/ieee80211_regdomain.h>
34
35 __BEGIN_DECLS
36
37 struct freqband {
38         uint16_t        freqStart;      /* starting frequency (MHz) */
39         uint16_t        freqEnd;        /* ending frequency (MHz) */
40         uint8_t         chanWidth;      /* channel width (MHz) */
41         uint8_t         chanSep;        /* channel sepaaration (MHz) */
42         uint32_t        flags;          /* common operational constraints */
43
44         const void      *id;
45         LIST_ENTRY(freqband) next;
46 };
47
48 struct netband {
49         const struct freqband *band;    /* channel list description */
50         uint8_t         maxPower;       /* regulatory cap on tx power (dBm) */
51         uint8_t         maxPowerDFS;    /* regulatory cap w/ DFS (dBm) */
52         uint32_t        flags;          /* net80211 channel flags */
53
54         LIST_ENTRY(netband) next;
55 };
56 typedef LIST_HEAD(, netband) netband_head;
57
58 struct country;
59
60 struct regdomain {
61         enum RegdomainCode      sku;    /* regdomain code/SKU */
62         const char              *name;  /* printable name */ 
63         const struct country    *cc;    /* country code for 1-1/default map */
64
65         netband_head     bands_11b;     /* 11b operation */
66         netband_head     bands_11g;     /* 11g operation */
67         netband_head     bands_11a;     /* 11a operation */
68         netband_head     bands_11ng;/* 11ng operation */
69         netband_head     bands_11na;/* 11na operation */
70
71         LIST_ENTRY(regdomain)   next;
72 };
73
74 struct country {
75         enum ISOCountryCode     code;      
76         const struct regdomain  *rd;
77         const char*             isoname;
78         const char*             name;
79
80         LIST_ENTRY(country)     next;
81 };
82
83 struct ident;
84
85 struct regdata {
86         LIST_HEAD(, country)    countries;      /* country code table */
87         LIST_HEAD(, regdomain)  domains;        /* regulatory domains */
88         LIST_HEAD(, freqband)   freqbands;      /* frequency band table */
89         struct ident            *ident;         /* identifier table */
90 };
91
92 #define _PATH_REGDOMAIN "/etc/regdomain.xml"
93
94 struct regdata *lib80211_alloc_regdata(void);
95 void    lib80211_free_regdata(struct regdata *);
96
97 int     lib80211_regdomain_readconfig(struct regdata *, const void *, size_t);
98 void    lib80211_regdomain_cleanup(struct regdata *);
99
100 const struct regdomain *lib80211_regdomain_findbysku(const struct regdata *,
101         enum RegdomainCode);
102 const struct regdomain *lib80211_regdomain_findbyname(const struct regdata *,
103         const char *);
104
105 const struct country *lib80211_country_findbycc(const struct regdata *,
106         enum ISOCountryCode);
107 const struct country *lib80211_country_findbyname(const struct regdata *,
108         const char *);
109
110 __END_DECLS
111
112 #endif /* _LIB80211_H_ */