T
tomlong76
Hi,
First of all, I am not to sure if this is where i am suppose to post
this kind of question. I am currently trying to convert a wireless
application, that runs a wireless card using the linux-wlan-ng drivers.
My goal is to make this application run with the newest hostAP drivers,
but I am having trouble accomplishing this task. Here is the code that
currently runs with the linux-wlan-ng drivers..
//Original code //
//--------------------------------------------------------------------
#define LINUX_WLAN_NG 0x89f1 /*used by linux-wlan */
#define LENGTH 16 /* Max length of a device name */
request_t req; /* The formal request to the ioctl
//Fill in the request
req.len = MSGSIZE;
req.data = msg;
req.result = 0;
req.magic = MAGIC;
strncpy(req.name, name, LENGTH);
//Open the socket to the prism2 card
s = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == s)
{
perror("Could not open socket");
ret = ERR;
}
//Perform the ioctl call
if(0 == ret)
{
if(ioctl(s, LINUX_WLAN_NG , &req) == -1)
{
perror("Bad ioctl request");
ret = ERR;
}
}
return ret;
}
Now my problem is I am really not to sure how I would go about
modifying this code so that it does the same (communicate), using the
hostAP drivers. Here is what I have so far..
/*----------------------------------------------------------------------------------------------*/
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
strncpy(iwr.ifr_name, name, LENGTH);
iwr.u.data.pointer = msg;
iwr.u.data.length = MSGSIZE;
s = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == s)
{
perror("Could not open socket");
ret = ERR;
}
if(0 == ret)
{
if (ioctl(s, /*NOT SURE WHAT HEX GOES HERE*/, &iwr) ==
-1)
{
perror("Bad ioctl request");
ret = ERR;
}
}
return ret;
}
This code compiles correctly, when I actually place a hex value in for
the second aurgument of my ioctl call, but doesn't seem to communicate
with the hostAP drivers correctly. I think my second aurgument in the
ioctl call is incorrect.
Any help will be appreciated, I have been working on this problem for
some time now, and I am looking for some ideas/help.
Thank You,
Tom
First of all, I am not to sure if this is where i am suppose to post
this kind of question. I am currently trying to convert a wireless
application, that runs a wireless card using the linux-wlan-ng drivers.
My goal is to make this application run with the newest hostAP drivers,
but I am having trouble accomplishing this task. Here is the code that
currently runs with the linux-wlan-ng drivers..
//Original code //
//--------------------------------------------------------------------
#define LINUX_WLAN_NG 0x89f1 /*used by linux-wlan */
#define LENGTH 16 /* Max length of a device name */
request_t req; /* The formal request to the ioctl
//Fill in the request
req.len = MSGSIZE;
req.data = msg;
req.result = 0;
req.magic = MAGIC;
strncpy(req.name, name, LENGTH);
//Open the socket to the prism2 card
s = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == s)
{
perror("Could not open socket");
ret = ERR;
}
//Perform the ioctl call
if(0 == ret)
{
if(ioctl(s, LINUX_WLAN_NG , &req) == -1)
{
perror("Bad ioctl request");
ret = ERR;
}
}
return ret;
}
Now my problem is I am really not to sure how I would go about
modifying this code so that it does the same (communicate), using the
hostAP drivers. Here is what I have so far..
/*----------------------------------------------------------------------------------------------*/
struct iwreq iwr;
memset(&iwr, 0, sizeof(iwr));
strncpy(iwr.ifr_name, name, LENGTH);
iwr.u.data.pointer = msg;
iwr.u.data.length = MSGSIZE;
s = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == s)
{
perror("Could not open socket");
ret = ERR;
}
if(0 == ret)
{
if (ioctl(s, /*NOT SURE WHAT HEX GOES HERE*/, &iwr) ==
-1)
{
perror("Bad ioctl request");
ret = ERR;
}
}
return ret;
}
This code compiles correctly, when I actually place a hex value in for
the second aurgument of my ioctl call, but doesn't seem to communicate
with the hostAP drivers correctly. I think my second aurgument in the
ioctl call is incorrect.
Any help will be appreciated, I have been working on this problem for
some time now, and I am looking for some ideas/help.
Thank You,
Tom