2 * hostapd - internal driver interface wrappers
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "drivers/driver.h"
21 hostapd_set_ieee8021x(struct hostapd_data
*hapd
, struct wpa_bss_params
*params
)
23 if (hapd
->driver
== NULL
|| hapd
->driver
->set_ieee8021x
== NULL
)
25 return hapd
->driver
->set_ieee8021x(hapd
->drv_priv
, params
);
29 hostapd_get_seqnum(const char *ifname
, struct hostapd_data
*hapd
,
30 const u8
*addr
, int idx
, u8
*seq
)
32 if (hapd
->driver
== NULL
|| hapd
->driver
->get_seqnum
== NULL
)
34 return hapd
->driver
->get_seqnum(ifname
, hapd
->drv_priv
, addr
, idx
,
39 hostapd_flush(struct hostapd_data
*hapd
)
41 if (hapd
->driver
== NULL
|| hapd
->driver
->flush
== NULL
)
43 return hapd
->driver
->flush(hapd
->drv_priv
);
47 hostapd_set_freq(struct hostapd_data
*hapd
, int mode
, int freq
, int channel
,
48 int ht_enabled
, int sec_channel_offset
)
50 struct hostapd_freq_params data
;
51 if (hapd
->driver
== NULL
)
53 if (hapd
->driver
->set_freq
== NULL
)
55 os_memset(&data
, 0, sizeof(data
));
58 data
.channel
= channel
;
59 data
.ht_enabled
= ht_enabled
;
60 data
.sec_channel_offset
= sec_channel_offset
;
61 return hapd
->driver
->set_freq(hapd
->drv_priv
, &data
);
65 hostapd_set_rts(struct hostapd_data
*hapd
, int rts
)
67 if (hapd
->driver
== NULL
|| hapd
->driver
->set_rts
== NULL
)
69 return hapd
->driver
->set_rts(hapd
->drv_priv
, rts
);
73 hostapd_set_frag(struct hostapd_data
*hapd
, int frag
)
75 if (hapd
->driver
== NULL
|| hapd
->driver
->set_frag
== NULL
)
77 return hapd
->driver
->set_frag(hapd
->drv_priv
, frag
);
81 hostapd_sta_set_flags(struct hostapd_data
*hapd
, u8
*addr
,
82 int total_flags
, int flags_or
, int flags_and
)
84 if (hapd
->driver
== NULL
|| hapd
->driver
->sta_set_flags
== NULL
)
86 return hapd
->driver
->sta_set_flags(hapd
->drv_priv
, addr
, total_flags
,
91 hostapd_set_rate_sets(struct hostapd_data
*hapd
, int *supp_rates
,
92 int *basic_rates
, int mode
)
94 if (hapd
->driver
== NULL
|| hapd
->driver
->set_rate_sets
== NULL
)
96 return hapd
->driver
->set_rate_sets(hapd
->drv_priv
, supp_rates
,
101 hostapd_set_country(struct hostapd_data
*hapd
, const char *country
)
103 if (hapd
->driver
== NULL
||
104 hapd
->driver
->set_country
== NULL
)
106 return hapd
->driver
->set_country(hapd
->drv_priv
, country
);
110 hostapd_set_cts_protect(struct hostapd_data
*hapd
, int value
)
112 if (hapd
->driver
== NULL
|| hapd
->driver
->set_cts_protect
== NULL
)
114 return hapd
->driver
->set_cts_protect(hapd
->drv_priv
, value
);
118 hostapd_set_preamble(struct hostapd_data
*hapd
, int value
)
120 if (hapd
->driver
== NULL
|| hapd
->driver
->set_preamble
== NULL
)
122 return hapd
->driver
->set_preamble(hapd
->drv_priv
, value
);
126 hostapd_set_short_slot_time(struct hostapd_data
*hapd
, int value
)
128 if (hapd
->driver
== NULL
|| hapd
->driver
->set_short_slot_time
== NULL
)
130 return hapd
->driver
->set_short_slot_time(hapd
->drv_priv
, value
);
134 hostapd_set_tx_queue_params(struct hostapd_data
*hapd
, int queue
, int aifs
,
135 int cw_min
, int cw_max
, int burst_time
)
137 if (hapd
->driver
== NULL
|| hapd
->driver
->set_tx_queue_params
== NULL
)
139 return hapd
->driver
->set_tx_queue_params(hapd
->drv_priv
, queue
, aifs
,
140 cw_min
, cw_max
, burst_time
);
144 hostapd_valid_bss_mask(struct hostapd_data
*hapd
, const u8
*addr
,
147 if (hapd
->driver
== NULL
|| hapd
->driver
->valid_bss_mask
== NULL
)
149 return hapd
->driver
->valid_bss_mask(hapd
->drv_priv
, addr
, mask
);
152 static inline struct hostapd_hw_modes
*
153 hostapd_get_hw_feature_data(struct hostapd_data
*hapd
, u16
*num_modes
,
156 if (hapd
->driver
== NULL
||
157 hapd
->driver
->get_hw_feature_data
== NULL
)
159 return hapd
->driver
->get_hw_feature_data(hapd
->drv_priv
, num_modes
,
164 hostapd_driver_commit(struct hostapd_data
*hapd
)
166 if (hapd
->driver
== NULL
|| hapd
->driver
->commit
== NULL
)
168 return hapd
->driver
->commit(hapd
->drv_priv
);
172 hostapd_set_ht_params(const char *ifname
, struct hostapd_data
*hapd
,
173 const u8
*ht_capab
, size_t ht_capab_len
,
174 const u8
*ht_oper
, size_t ht_oper_len
)
176 if (hapd
->driver
== NULL
|| hapd
->driver
->set_ht_params
== NULL
||
177 ht_capab
== NULL
|| ht_oper
== NULL
)
179 return hapd
->driver
->set_ht_params(
180 ifname
, hapd
->drv_priv
, ht_capab
, ht_capab_len
,
181 ht_oper
, ht_oper_len
);
185 hostapd_drv_none(struct hostapd_data
*hapd
)
187 return hapd
->driver
&& os_strcmp(hapd
->driver
->name
, "none") == 0;
190 static inline int hostapd_driver_scan(struct hostapd_data
*hapd
,
191 struct wpa_driver_scan_params
*params
)
193 if (hapd
->driver
&& hapd
->driver
->scan2
)
194 return hapd
->driver
->scan2(hapd
->drv_priv
, params
);
198 static inline struct wpa_scan_results
* hostapd_driver_get_scan_results(
199 struct hostapd_data
*hapd
)
201 if (hapd
->driver
&& hapd
->driver
->get_scan_results2
)
202 return hapd
->driver
->get_scan_results2(hapd
->drv_priv
);
206 #endif /* DRIVER_I_H */