iwpriv工具通过ioctl动态获取相应无线网卡驱动的private_args所有扩展参数

  • 格式:txt
  • 大小:15.44 KB
  • 文档页数:6
"getdataavg"
"getrxant"
"gettxant"
"gettsf"
"wpssession"
"deepsleep"
"adhocstop"
"radioon"
"radiooff"
"rmaeskey"
"scantime"
"sysclock"
"txcontrol"
"hscfg"
"hssetpara"
"inactoext"
"dbgscfg"
"drvdbg"
"drvdelaymax"
"crypto_test"
"reasso-on"
"reasso-off"
"wlanidle-on"
"wlanidle-off"
"sleepparams"
"requesttpc"
"powercap"
"measreq"
handler = get_handler(dev, cmd);//获取
if (handler) {
/* Standard and private are not the same */
if (cmd < SIOCIWFIRSTPRIV)
return ioctl_standard_call(dev, ifr, cmd, handler);
"scanprobes"
"ledgpio"
"sleeppd"
"rateadapt"
"getSNR"
"getrate"
"getrxinfo"
"atimwindow"
"bcninterval"
"sdiopullctrl"
"bca-ts"
"scanmode"
"getadhocstatus"
"setgenie"
"getgenie"
"qstatus"
"ts_status"
"setaeskey"
"getaeskey"
iw_handler handler)
{
...
/* Call the handler */
ret = handler(dev, &info, &(iwr->u), extra);
if (user_length < iwr->u.data.length) {
dev_ioctl
=>wext_handle_ioctl
=>wireless_process_ioctl
if (cmd == SIOCGIWPRIV && dev->wireless_handlers)
return ioctl_standard_call(dev, ifr, cmd,
"enable11d"
"adhocgrate"
"sdioclock"
"wmm"
"uapsdnullgen"
"setcoalescing"
"adhocgprot"
"setpowercons"
"wmm_qosinfo"
return dev->do_ioctl(dev, ifr, cmd);
static iw_handler get_handler(struct net_device *dev, unsigned int cmd)
{
/* Don't "optimise" the following variable, it will crash */
kfree(extra);
ห้องสมุดไป่ตู้ return -E2BIG;
//通知iwpriv,本wifi网卡对应的private命令还没有完,还有,这样iwpriv将会继续
//maxpriv默认为16,即将以16个为一组,一组一组的从wifi网卡驱动读取该网卡所能支持的所有private_args参数
//newpriv = realloc(priv, maxpriv * sizeof(priv[0]));继续申请,继续拷贝,知道将wifi网卡自定义的wlan_private_args参数全部
//传出到iwpriv为止.
}
...
}
/* New driver API : try to find the handler */
iwpriv工具通过ioctl动态获取相应无线网卡驱动的private_args所有扩展参数
iwpriv是处理下面的wlan_private_args的所有扩展命令,iwpriv的实现上,是这样的,
=>main
=>set_private
=>iw_get_priv_info获取wireless网卡所能处理的所有wlan_private_args类型.
unsigned int index; /* *MUST* be unsigned */
/* Check if we have some wireless handlers defined */
if (dev->wireless_handlers == NULL)
"regrdwr"
"sdcmd52rw"
"sdcmd53rw"
"setgetconf"
"getcis"
"scantype"
"deauth"
"getNF"
"getRSSI"
"bgscan"
/* Not found */
return NULL;
}
下面wlan_private_args为本wifi网卡驱动的所能支持的所有命令,也就是iwpriv命令所能支持的所有命令
struct iw_handler_def wlan_handler_def = {
num_standard:sizeof(wlan_handler) / sizeof(iw_handler),
"lolisteninter"
"fwwakeupmethod"
"psnullinterval"
"bcnmisto"
"adhocawakepd"
"moduletype"
"autodeepsleep"
"enhanceps"
/* Try as a private command */
index = cmd - SIOCIWFIRSTPRIV;//
if (index < dev->wireless_handlers->num_private)
return dev->wireless_handlers->private[index];//该private命令的handler.
&iw_handler_get_private);
static int ioctl_standard_call(struct net_device * dev,
struct ifreq * ifr,
unsigned int cmd,
num_private:sizeof(wlan_private_handler) / sizeof(iw_handler),
num_private_args:sizeof(wlan_private_args) / sizeof(struct iw_priv_args),
standard:(iw_handler *) wlan_handler,
private:(iw_handler *) wlan_private_handler,
private_args:(struct iw_priv_args *) wlan_private_args,
#if WIRELESS_EXT > 20
get_wireless_stats:wlan_get_wireless_stats,
"version"
"verext"
"setwpaie"
"setband"
"setadhocch"
"chanswann"
"getband"
"getadhocch"

下载文档原格式

  / 6