Replace src/ap/driver_i.h with non-inlined functions in ap_drv_ops.c
parent
8b06c1ed0d
commit
6e6e8c31ff
@ -1,206 +0,0 @@
|
|||||||
/*
|
|
||||||
* hostapd - internal driver interface wrappers
|
|
||||||
* Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* Alternatively, this software may be distributed under the terms of BSD
|
|
||||||
* license.
|
|
||||||
*
|
|
||||||
* See README and COPYING for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DRIVER_I_H
|
|
||||||
#define DRIVER_I_H
|
|
||||||
|
|
||||||
#include "drivers/driver.h"
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_ieee8021x(struct hostapd_data *hapd, struct wpa_bss_params *params)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
|
|
||||||
const u8 *addr, int idx, u8 *seq)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
|
|
||||||
seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_flush(struct hostapd_data *hapd)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->flush == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->flush(hapd->drv_priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int channel,
|
|
||||||
int ht_enabled, int sec_channel_offset)
|
|
||||||
{
|
|
||||||
struct hostapd_freq_params data;
|
|
||||||
if (hapd->driver == NULL)
|
|
||||||
return 0;
|
|
||||||
if (hapd->driver->set_freq == NULL)
|
|
||||||
return 0;
|
|
||||||
os_memset(&data, 0, sizeof(data));
|
|
||||||
data.mode = mode;
|
|
||||||
data.freq = freq;
|
|
||||||
data.channel = channel;
|
|
||||||
data.ht_enabled = ht_enabled;
|
|
||||||
data.sec_channel_offset = sec_channel_offset;
|
|
||||||
return hapd->driver->set_freq(hapd->drv_priv, &data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_rts(struct hostapd_data *hapd, int rts)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_rts(hapd->drv_priv, rts);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_frag(struct hostapd_data *hapd, int frag)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_frag(hapd->drv_priv, frag);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
|
|
||||||
int total_flags, int flags_or, int flags_and)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->sta_set_flags == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->sta_set_flags(hapd->drv_priv, addr, total_flags,
|
|
||||||
flags_or, flags_and);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_rate_sets(struct hostapd_data *hapd, int *supp_rates,
|
|
||||||
int *basic_rates, int mode)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_rate_sets == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_rate_sets(hapd->drv_priv, supp_rates,
|
|
||||||
basic_rates, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_country(struct hostapd_data *hapd, const char *country)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL ||
|
|
||||||
hapd->driver->set_country == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_country(hapd->drv_priv, country);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_cts_protect(struct hostapd_data *hapd, int value)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_cts_protect == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_cts_protect(hapd->drv_priv, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_preamble(struct hostapd_data *hapd, int value)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_preamble == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_preamble(hapd->drv_priv, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_short_slot_time(struct hostapd_data *hapd, int value)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_short_slot_time == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_short_slot_time(hapd->drv_priv, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
|
|
||||||
int cw_min, int cw_max, int burst_time)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_tx_queue_params(hapd->drv_priv, queue, aifs,
|
|
||||||
cw_min, cw_max, burst_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_valid_bss_mask(struct hostapd_data *hapd, const u8 *addr,
|
|
||||||
const u8 *mask)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->valid_bss_mask == NULL)
|
|
||||||
return 1;
|
|
||||||
return hapd->driver->valid_bss_mask(hapd->drv_priv, addr, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct hostapd_hw_modes *
|
|
||||||
hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
|
|
||||||
u16 *flags)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL ||
|
|
||||||
hapd->driver->get_hw_feature_data == NULL)
|
|
||||||
return NULL;
|
|
||||||
return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
|
|
||||||
flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_driver_commit(struct hostapd_data *hapd)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->commit == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->commit(hapd->drv_priv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_set_ht_params(const char *ifname, struct hostapd_data *hapd,
|
|
||||||
const u8 *ht_capab, size_t ht_capab_len,
|
|
||||||
const u8 *ht_oper, size_t ht_oper_len)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->set_ht_params == NULL ||
|
|
||||||
ht_capab == NULL || ht_oper == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->set_ht_params(
|
|
||||||
ifname, hapd->drv_priv, ht_capab, ht_capab_len,
|
|
||||||
ht_oper, ht_oper_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_drv_none(struct hostapd_data *hapd)
|
|
||||||
{
|
|
||||||
return hapd->driver && os_strcmp(hapd->driver->name, "none") == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int hostapd_driver_scan(struct hostapd_data *hapd,
|
|
||||||
struct wpa_driver_scan_params *params)
|
|
||||||
{
|
|
||||||
if (hapd->driver && hapd->driver->scan2)
|
|
||||||
return hapd->driver->scan2(hapd->drv_priv, params);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct wpa_scan_results * hostapd_driver_get_scan_results(
|
|
||||||
struct hostapd_data *hapd)
|
|
||||||
{
|
|
||||||
if (hapd->driver && hapd->driver->get_scan_results2)
|
|
||||||
return hapd->driver->get_scan_results2(hapd->drv_priv);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* DRIVER_I_H */
|
|
Loading…
Reference in New Issue