config.h

Go to the documentation of this file.
00001 
00016 #ifndef CONFIG_H
00017 #define CONFIG_H
00018 
00019 #include "config_types.h"
00020 
00021 typedef u8 macaddr[ETH_ALEN];
00022 
00023 struct hostapd_radius_servers;
00024 
00025 #define HOSTAPD_MAX_SSID_LEN 32
00026 
00027 #define NUM_WEP_KEYS 4
00028 struct hostapd_wep_keys {
00029         u8 idx;
00030         u8 *key[NUM_WEP_KEYS];
00031         size_t len[NUM_WEP_KEYS];
00032         int keys_set;
00033         size_t default_len; /* key length used for dynamic key generation */
00034 };
00035 
00036 typedef enum hostap_security_policy {
00037         SECURITY_PLAINTEXT = 0,
00038         SECURITY_STATIC_WEP = 1,
00039         SECURITY_IEEE_802_1X = 2,
00040         SECURITY_WPA_PSK = 3,
00041         SECURITY_WPA = 4
00042 } secpolicy;
00043 
00044 struct hostapd_ssid {
00045         char ssid[HOSTAPD_MAX_SSID_LEN + 1];
00046         size_t ssid_len;
00047         int ssid_set;
00048 
00049         char vlan[IFNAMSIZ + 1];
00050         secpolicy security_policy;
00051 
00052         struct hostapd_wpa_psk *wpa_psk;
00053         char *wpa_passphrase;
00054         char *wpa_psk_file;
00055 
00056         struct hostapd_wep_keys wep;
00057 
00058 #define DYNAMIC_VLAN_DISABLED 0
00059 #define DYNAMIC_VLAN_OPTIONAL 1
00060 #define DYNAMIC_VLAN_REQUIRED 2
00061         int dynamic_vlan;
00062 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00063         char *vlan_tagged_interface;
00064 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
00065         struct hostapd_wep_keys **dyn_vlan_keys;
00066         size_t max_dyn_vlan_keys;
00067 };
00068 
00069 
00070 #define VLAN_ID_WILDCARD -1
00071 
00072 struct hostapd_vlan {
00073         struct hostapd_vlan *next;
00074         int vlan_id; /* VLAN ID or -1 (VLAN_ID_WILDCARD) for wildcard entry */
00075         char ifname[IFNAMSIZ + 1];
00076         int dynamic_vlan;
00077 #ifdef CONFIG_FULL_DYNAMIC_VLAN
00078 
00079 #define DVLAN_CLEAN_BR  0x1
00080 #define DVLAN_CLEAN_VLAN        0x2
00081 #define DVLAN_CLEAN_VLAN_PORT   0x4
00082 #define DVLAN_CLEAN_WLAN_PORT   0x8
00083         int clean;
00084 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
00085 };
00086 
00087 #define PMK_LEN 32
00088 struct hostapd_wpa_psk {
00089         struct hostapd_wpa_psk *next;
00090         int group;
00091         u8 psk[PMK_LEN];
00092         u8 addr[ETH_ALEN];
00093 };
00094 
00095 #define EAP_USER_MAX_METHODS 8
00096 struct hostapd_eap_user {
00097         struct hostapd_eap_user *next;
00098         u8 *identity;
00099         size_t identity_len;
00100         struct {
00101                 int vendor;
00102                 u32 method;
00103         } methods[EAP_USER_MAX_METHODS];
00104         u8 *password;
00105         size_t password_len;
00106         int phase2;
00107         int force_version;
00108         unsigned int wildcard_prefix:1;
00109         unsigned int password_hash:1; /* whether password is hashed with
00110                                        * nt_password_hash() */
00111 };
00112 
00113 
00114 #define NUM_TX_QUEUES 8
00115 
00116 struct hostapd_tx_queue_params {
00117         int aifs;
00118         int cwmin;
00119         int cwmax;
00120         int burst; /* maximum burst time in 0.1 ms, i.e., 10 = 1 ms */
00121         int configured;
00122 };
00123 
00124 struct hostapd_wme_ac_params {
00125         int cwmin;
00126         int cwmax;
00127         int aifs;
00128         int txopLimit; /* in units of 32us */
00129         int admission_control_mandatory;
00130 };
00131 
00132 
00137 struct hostapd_bss_config {
00138         char iface[IFNAMSIZ + 1];
00139         char bridge[IFNAMSIZ + 1];
00140 
00141         enum {
00142                 HOSTAPD_LEVEL_DEBUG_VERBOSE = 0,
00143                 HOSTAPD_LEVEL_DEBUG = 1,
00144                 HOSTAPD_LEVEL_INFO = 2,
00145                 HOSTAPD_LEVEL_NOTICE = 3,
00146                 HOSTAPD_LEVEL_WARNING = 4
00147         } logger_syslog_level, logger_stdout_level;
00148 
00149 #define HOSTAPD_MODULE_IEEE80211 BIT(0)
00150 #define HOSTAPD_MODULE_IEEE8021X BIT(1)
00151 #define HOSTAPD_MODULE_RADIUS BIT(2)
00152 #define HOSTAPD_MODULE_WPA BIT(3)
00153 #define HOSTAPD_MODULE_DRIVER BIT(4)
00154 #define HOSTAPD_MODULE_IAPP BIT(5)
00155 #define HOSTAPD_MODULE_MLME BIT(6)
00156         unsigned int logger_syslog; /* module bitfield */
00157         unsigned int logger_stdout; /* module bitfield */
00158 
00159         enum { HOSTAPD_DEBUG_NO = 0, HOSTAPD_DEBUG_MINIMAL = 1,
00160                HOSTAPD_DEBUG_VERBOSE = 2,
00161                HOSTAPD_DEBUG_MSGDUMPS = 3,
00162                HOSTAPD_DEBUG_EXCESSIVE = 4 } debug; /* debug verbosity level */
00163         char *dump_log_name; /* file name for state dump (SIGUSR1) */
00164 
00165         int max_num_sta; /* maximum number of STAs in station table */
00166 
00167         int dtim_period;
00168 
00169         int ieee802_1x; /* use IEEE 802.1X */
00170         int eapol_version;
00171         int eap_server; /* Use internal EAP server instead of external
00172                          * RADIUS server */
00173         struct hostapd_eap_user *eap_user;
00174         char *eap_sim_db;
00175         struct hostapd_ip_addr own_ip_addr;
00176         char *nas_identifier;
00177         struct hostapd_radius_servers *radius;
00178 
00179         struct hostapd_ssid ssid;
00180 
00181         char *eap_req_id_text; /* optional displayable message sent with
00182                                 * EAP Request-Identity */
00183         size_t eap_req_id_text_len;
00184         int eapol_key_index_workaround;
00185 
00186         size_t default_wep_key_len;
00187         int individual_wep_key_len;
00188         int wep_rekeying_period;
00189         int broadcast_key_idx_min, broadcast_key_idx_max;
00190         int eap_reauth_period;
00191 
00192         int ieee802_11f; /* use IEEE 802.11f (IAPP) */
00193         char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
00194                                         * frames */
00195 
00196         u8 assoc_ap_addr[ETH_ALEN];
00197         int assoc_ap; /* whether assoc_ap_addr is set */
00198 
00199         enum {
00200                 ACCEPT_UNLESS_DENIED = 0,
00201                 DENY_UNLESS_ACCEPTED = 1,
00202                 USE_EXTERNAL_RADIUS_AUTH = 2
00203         } macaddr_acl;
00204         macaddr *accept_mac;
00205         int num_accept_mac;
00206         macaddr *deny_mac;
00207         int num_deny_mac;
00208 
00209 #define HOSTAPD_AUTH_OPEN BIT(0)
00210 #define HOSTAPD_AUTH_SHARED_KEY BIT(1)
00211         int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
00212                         * algorithms */
00213 
00214 #define HOSTAPD_WPA_VERSION_WPA BIT(0)
00215 #define HOSTAPD_WPA_VERSION_WPA2 BIT(1)
00216         int wpa;
00217 #define WPA_KEY_MGMT_IEEE8021X BIT(0)
00218 #define WPA_KEY_MGMT_PSK BIT(1)
00219         int wpa_key_mgmt;
00220 #define WPA_CIPHER_NONE BIT(0)
00221 #define WPA_CIPHER_WEP40 BIT(1)
00222 #define WPA_CIPHER_WEP104 BIT(2)
00223 #define WPA_CIPHER_TKIP BIT(3)
00224 #define WPA_CIPHER_CCMP BIT(4)
00225 #ifdef CONFIG_IEEE80211W
00226 #define WPA_CIPHER_AES_128_CMAC BIT(5)
00227         enum {
00228                 NO_IEEE80211W = 0,
00229                 IEEE80211W_OPTIONAL = 1,
00230                 IEEE80211W_REQUIRED = 2
00231         } ieee80211w;
00232 #endif /* CONFIG_IEEE80211W */
00233         int wpa_pairwise;
00234         int wpa_group;
00235         int wpa_group_rekey;
00236         int wpa_strict_rekey;
00237         int wpa_gmk_rekey;
00238         int rsn_preauth;
00239         char *rsn_preauth_interfaces;
00240         int peerkey;
00241 
00242         char *ctrl_interface; /* directory for UNIX domain sockets */
00243         gid_t ctrl_interface_gid;
00244         int ctrl_interface_gid_set;
00245 
00246         char *ca_cert;
00247         char *server_cert;
00248         char *private_key;
00249         char *private_key_passwd;
00250         int check_crl;
00251 
00252         char *radius_server_clients;
00253         int radius_server_auth_port;
00254         int radius_server_ipv6;
00255 
00256         char *test_socket; /* UNIX domain socket path for driver_test */
00257 
00258         int use_pae_group_addr; /* Whether to send EAPOL frames to PAE group
00259                                  * address instead of individual address
00260                                  * (for driver_wired.c).
00261                                  */
00262 
00263         int ap_max_inactivity;
00264         int ignore_broadcast_ssid;
00265 
00266         int wme_enabled;
00267 
00268         struct hostapd_vlan *vlan, *vlan_tail;
00269 
00270         macaddr bssid;
00271 };
00272 
00273 
00274 typedef enum {
00275         HOSTAPD_MODE_IEEE80211B,
00276         HOSTAPD_MODE_IEEE80211G,
00277         HOSTAPD_MODE_IEEE80211A,
00278         NUM_HOSTAPD_MODES
00279 } hostapd_hw_mode;
00280 
00281 
00286 struct hostapd_config {
00287         struct hostapd_bss_config *bss, *last_bss;
00288         struct hostapd_radius_servers *radius;
00289         size_t num_bss;
00290 
00291         u16 beacon_int;
00292         int rts_threshold;
00293         int fragm_threshold;
00294         u8 send_probe_response;
00295         u8 channel;
00296         hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
00297         enum {
00298                 LONG_PREAMBLE = 0,
00299                 SHORT_PREAMBLE = 1
00300         } preamble;
00301         enum {
00302                 CTS_PROTECTION_AUTOMATIC = 0,
00303                 CTS_PROTECTION_FORCE_ENABLED = 1,
00304                 CTS_PROTECTION_FORCE_DISABLED = 2,
00305                 CTS_PROTECTION_AUTOMATIC_NO_OLBC = 3,
00306         } cts_protection_type;
00307 
00308         int *supported_rates;
00309         int *basic_rates;
00310 
00311         const struct driver_ops *driver;
00312 
00313         int passive_scan_interval; /* seconds, 0 = disabled */
00314         int passive_scan_listen; /* usec */
00315         int passive_scan_mode;
00316         int ap_table_max_size;
00317         int ap_table_expiration_time;
00318 
00319         char country[3]; /* first two octets: country code as described in
00320                           * ISO/IEC 3166-1. Third octet:
00321                           * ' ' (ascii 32): all environments
00322                           * 'O': Outdoor environemnt only
00323                           * 'I': Indoor environment only
00324                           */
00325 
00326         int ieee80211d;
00327         unsigned int ieee80211h; /* Enable/Disable 80211h */
00328 
00329         struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
00330 
00331         /*
00332          * WME AC parameters, in same order as 802.1D, i.e.
00333          * 0 = BE (best effort)
00334          * 1 = BK (background)
00335          * 2 = VI (video)
00336          * 3 = VO (voice)
00337          */
00338         struct hostapd_wme_ac_params wme_ac_params[4];
00339 
00340         enum {
00341                 INTERNAL_BRIDGE_DO_NOT_CONTROL = -1,
00342                 INTERNAL_BRIDGE_DISABLED = 0,
00343                 INTERNAL_BRIDGE_ENABLED = 1
00344         } bridge_packets;
00345 };
00346 
00347 
00348 int hostapd_mac_comp(const void *a, const void *b);
00349 int hostapd_mac_comp_empty(const void *a);
00350 struct hostapd_config * hostapd_config_read(const char *fname);
00351 void hostapd_config_free(struct hostapd_config *conf);
00352 int hostapd_maclist_found(macaddr *list, int num_entries, const u8 *addr);
00353 int hostapd_rate_found(int *list, int rate);
00354 int hostapd_wep_key_cmp(struct hostapd_wep_keys *a,
00355                         struct hostapd_wep_keys *b);
00356 const u8 * hostapd_get_psk(const struct hostapd_bss_config *conf,
00357                            const u8 *addr, const u8 *prev_psk);
00358 int hostapd_setup_wpa_psk(struct hostapd_bss_config *conf);
00359 const char * hostapd_get_vlan_id_ifname(struct hostapd_vlan *vlan,
00360                                         int vlan_id);
00361 const struct hostapd_eap_user *
00362 hostapd_get_eap_user(const struct hostapd_bss_config *conf, const u8 *identity,
00363                      size_t identity_len, int phase2);
00364 
00365 #endif /* CONFIG_H */
00366 

Generated on Sun Dec 31 13:43:25 2006 for hostapd by  doxygen 1.4.2