wpa_supplicant / hostapd 2.0

ap_drv_ops.h

Go to the documentation of this file.
00001 
00010 #ifndef AP_DRV_OPS
00011 #define AP_DRV_OPS
00012 
00013 enum wpa_driver_if_type;
00014 struct wpa_bss_params;
00015 struct wpa_driver_scan_params;
00016 struct ieee80211_ht_capabilities;
00017 
00018 u32 hostapd_sta_flags_to_drv(u32 flags);
00019 int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
00020                                struct wpabuf **beacon,
00021                                struct wpabuf **proberesp,
00022                                struct wpabuf **assocresp);
00023 void hostapd_free_ap_extra_ies(struct hostapd_data *hapd, struct wpabuf *beacon,
00024                                struct wpabuf *proberesp,
00025                                struct wpabuf *assocresp);
00026 int hostapd_set_ap_wps_ie(struct hostapd_data *hapd);
00027 int hostapd_set_authorized(struct hostapd_data *hapd,
00028                            struct sta_info *sta, int authorized);
00029 int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta);
00030 int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
00031                               int enabled);
00032 int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname);
00033 int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname);
00034 int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid,
00035                         int val);
00036 int hostapd_sta_add(struct hostapd_data *hapd,
00037                     const u8 *addr, u16 aid, u16 capability,
00038                     const u8 *supp_rates, size_t supp_rates_len,
00039                     u16 listen_interval,
00040                     const struct ieee80211_ht_capabilities *ht_capab,
00041                     u32 flags, u8 qosinfo);
00042 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
00043 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
00044                              size_t elem_len);
00045 int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len);
00046 int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len);
00047 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
00048                    const char *ifname, const u8 *addr, void *bss_ctx,
00049                    void **drv_priv, char *force_ifname, u8 *if_addr,
00050                    const char *bridge);
00051 int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
00052                       const char *ifname);
00053 int hostapd_set_ieee8021x(struct hostapd_data *hapd,
00054                           struct wpa_bss_params *params);
00055 int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
00056                        const u8 *addr, int idx, u8 *seq);
00057 int hostapd_flush(struct hostapd_data *hapd);
00058 int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
00059                      int channel, int ht_enabled, int sec_channel_offset);
00060 int hostapd_set_rts(struct hostapd_data *hapd, int rts);
00061 int hostapd_set_frag(struct hostapd_data *hapd, int frag);
00062 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
00063                           int total_flags, int flags_or, int flags_and);
00064 int hostapd_set_country(struct hostapd_data *hapd, const char *country);
00065 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
00066                                 int cw_min, int cw_max, int burst_time);
00067 struct hostapd_hw_modes *
00068 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
00069                             u16 *flags);
00070 int hostapd_driver_commit(struct hostapd_data *hapd);
00071 int hostapd_drv_none(struct hostapd_data *hapd);
00072 int hostapd_driver_scan(struct hostapd_data *hapd,
00073                         struct wpa_driver_scan_params *params);
00074 struct wpa_scan_results * hostapd_driver_get_scan_results(
00075         struct hostapd_data *hapd);
00076 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
00077                            int duration);
00078 int hostapd_drv_set_key(const char *ifname,
00079                         struct hostapd_data *hapd,
00080                         enum wpa_alg alg, const u8 *addr,
00081                         int key_idx, int set_tx,
00082                         const u8 *seq, size_t seq_len,
00083                         const u8 *key, size_t key_len);
00084 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
00085                           const void *msg, size_t len, int noack);
00086 int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
00087                            const u8 *addr, int reason);
00088 int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
00089                              const u8 *addr, int reason);
00090 int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
00091                             unsigned int wait, const u8 *dst, const u8 *data,
00092                             size_t len);
00093 int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
00094                          u16 auth_alg);
00095 int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
00096                      u16 seq, u16 status, const u8 *ie, size_t len);
00097 int hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
00098                       int reassoc, u16 status, const u8 *ie, size_t len);
00099 int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
00100                       u8 *tspec_ie, size_t tspec_ielen);
00101 
00102 
00103 #include "drivers/driver.h"
00104 
00105 static inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd,
00106                                                   int enabled)
00107 {
00108         if (hapd->driver == NULL ||
00109             hapd->driver->hapd_set_countermeasures == NULL)
00110                 return 0;
00111         return hapd->driver->hapd_set_countermeasures(hapd->drv_priv, enabled);
00112 }
00113 
00114 static inline int hostapd_drv_set_sta_vlan(const char *ifname,
00115                                            struct hostapd_data *hapd,
00116                                            const u8 *addr, int vlan_id)
00117 {
00118         if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
00119                 return 0;
00120         return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
00121                                           vlan_id);
00122 }
00123 
00124 static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd,
00125                                             const u8 *addr)
00126 {
00127         if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
00128                 return 0;
00129         return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
00130 }
00131 
00132 static inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
00133                                          const u8 *addr)
00134 {
00135         if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
00136                 return 0;
00137         return hapd->driver->sta_remove(hapd->drv_priv, addr);
00138 }
00139 
00140 static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
00141                                               const u8 *addr, const u8 *data,
00142                                               size_t data_len, int encrypt,
00143                                               u32 flags)
00144 {
00145         if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
00146                 return 0;
00147         return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
00148                                              data_len, encrypt,
00149                                              hapd->own_addr, flags);
00150 }
00151 
00152 static inline int hostapd_drv_read_sta_data(
00153         struct hostapd_data *hapd, struct hostap_sta_driver_data *data,
00154         const u8 *addr)
00155 {
00156         if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
00157                 return -1;
00158         return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
00159 }
00160 
00161 static inline int hostapd_drv_sta_clear_stats(struct hostapd_data *hapd,
00162                                               const u8 *addr)
00163 {
00164         if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
00165                 return 0;
00166         return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
00167 }
00168 
00169 static inline int hostapd_drv_set_ap(struct hostapd_data *hapd,
00170                                      struct wpa_driver_ap_params *params)
00171 {
00172         if (hapd->driver == NULL || hapd->driver->set_ap == NULL)
00173                 return 0;
00174         return hapd->driver->set_ap(hapd->drv_priv, params);
00175 }
00176 
00177 static inline int hostapd_drv_set_radius_acl_auth(struct hostapd_data *hapd,
00178                                                   const u8 *mac, int accepted,
00179                                                   u32 session_timeout)
00180 {
00181         if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
00182                 return 0;
00183         return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
00184                                                  session_timeout);
00185 }
00186 
00187 static inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
00188                                                     const u8 *mac)
00189 {
00190         if (hapd->driver == NULL ||
00191             hapd->driver->set_radius_acl_expire == NULL)
00192                 return 0;
00193         return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
00194 }
00195 
00196 static inline int hostapd_drv_set_authmode(struct hostapd_data *hapd,
00197                                            int auth_algs)
00198 {
00199         if (hapd->driver == NULL || hapd->driver->set_authmode == NULL)
00200                 return 0;
00201         return hapd->driver->set_authmode(hapd->drv_priv, auth_algs);
00202 }
00203 
00204 static inline void hostapd_drv_poll_client(struct hostapd_data *hapd,
00205                                            const u8 *own_addr, const u8 *addr,
00206                                            int qos)
00207 {
00208         if (hapd->driver == NULL || hapd->driver->poll_client == NULL)
00209                 return;
00210         hapd->driver->poll_client(hapd->drv_priv, own_addr, addr, qos);
00211 }
00212 
00213 #endif /* AP_DRV_OPS */
00214 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines