blob: 65bfd0558ce15b0827d5070aeb07ca967f2eacaf [file] [log] [blame]
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -07001#ifndef __NET_WIRELESS_REG_H
2#define __NET_WIRELESS_REG_H
3
Luis R. Rodriguezf1303472009-01-30 09:26:42 -08004extern const struct ieee80211_regdomain *cfg80211_regdomain;
5
Johannes Berga3d2eaf2008-09-15 11:10:52 +02006bool is_world_regdom(const char *alpha2);
7bool reg_is_valid_request(const char *alpha2);
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -07008
Luis R. Rodriguezfe33eb32009-02-21 00:04:30 -05009int regulatory_hint_user(const char *alpha2);
10
Luis R. Rodriguez3f2355c2008-11-12 14:22:02 -080011void reg_device_remove(struct wiphy *wiphy);
12
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -070013int regulatory_init(void);
14void regulatory_exit(void);
15
Johannes Berga3d2eaf2008-09-15 11:10:52 +020016int set_regdom(const struct ieee80211_regdomain *rd);
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -070017
Johannes Bergcf032682008-10-21 09:42:38 +020018/**
19 * __regulatory_hint - hint to the wireless core a regulatory domain
Johannes Bergbe3d4812008-10-24 20:32:21 +020020 * @wiphy: if the hint comes from country information from an AP, this
21 * is required to be set to the wiphy that received the information
Johannes Bergcf032682008-10-21 09:42:38 +020022 * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
Johannes Bergbe3d4812008-10-24 20:32:21 +020023 * should be in.
Luis R. Rodriguez3f2355c2008-11-12 14:22:02 -080024 * @country_ie_checksum: checksum of processed country IE, set this to 0
25 * if the hint did not come from a country IE
26 * @country_ie_env: the environment the IE told us we are in, %ENVIRON_*
Johannes Bergcf032682008-10-21 09:42:38 +020027 *
28 * The Wireless subsystem can use this function to hint to the wireless core
Luis R. Rodriguez3f2355c2008-11-12 14:22:02 -080029 * what it believes should be the current regulatory domain by giving it an
30 * ISO/IEC 3166 alpha2 country code it knows its regulatory domain should be
31 * in.
Johannes Bergcf032682008-10-21 09:42:38 +020032 *
Johannes Bergbe3d4812008-10-24 20:32:21 +020033 * Returns zero if all went fine, %-EALREADY if a regulatory domain had
34 * already been set or other standard error codes.
Johannes Bergcf032682008-10-21 09:42:38 +020035 *
36 */
37extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
Luis R. Rodriguez3f2355c2008-11-12 14:22:02 -080038 const char *alpha2, u32 country_ie_checksum,
39 enum environment_cap country_ie_env);
Johannes Bergcf032682008-10-21 09:42:38 +020040
Luis R. Rodrigueze38f8a72009-02-21 00:20:39 -050041/**
42 * regulatory_hint_found_beacon - hints a beacon was found on a channel
43 * @wiphy: the wireless device where the beacon was found on
44 * @beacon_chan: the channel on which the beacon was found on
45 * @gfp: context flags
46 *
47 * This informs the wireless core that a beacon from an AP was found on
48 * the channel provided. This allows the wireless core to make educated
49 * guesses on regulatory to help with world roaming. This is only used for
50 * world roaming -- when we do not know our current location. This is
51 * only useful on channels 12, 13 and 14 on the 2 GHz band as channels
52 * 1-11 are already enabled by the world regulatory domain; and on
53 * non-radar 5 GHz channels.
54 *
55 * Drivers do not need to call this, cfg80211 will do it for after a scan
56 * on a newly found BSS.
57 */
58int regulatory_hint_found_beacon(struct wiphy *wiphy,
59 struct ieee80211_channel *beacon_chan,
60 gfp_t gfp);
61
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -070062#endif /* __NET_WIRELESS_REG_H */