summaryrefslogtreecommitdiff
authormax <max>2003-02-12 20:49:39 (UTC)
committer max <max>2003-02-12 20:49:39 (UTC)
commitdc326e87d4a958ee49210fff9d03967f8a183242 (patch) (side-by-side diff)
tree618a8c9757ad4ed6108963ba06dedd30d8c41588
parent421f7d634a3b5d343834cfa1410d674ff78cf5b8 (diff)
downloadopie-dc326e87d4a958ee49210fff9d03967f8a183242.zip
opie-dc326e87d4a958ee49210fff9d03967f8a183242.tar.gz
opie-dc326e87d4a958ee49210fff9d03967f8a183242.tar.bz2
fix const char
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index cf50d8c..626b28c 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -39,92 +39,92 @@ int card_into_monitormode (pcap_t **orighandle, const char *device, int cardtype
return 0;
}
fputs ("Mode: r",CISCO_CONFIG_FILE);
fputs ("Mode: y",CISCO_CONFIG_FILE);
fputs ("XmitPower: 1",CISCO_CONFIG_FILE);
fclose(CISCO_CONFIG_FILE);
}
else if (cardtype == CARD_TYPE_NG)
{
char wlanngcmd[80];
snprintf(wlanngcmd, sizeof(wlanngcmd) - 1, "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=true", device, 1);
if (system(wlanngcmd) != 0)
{
wl_logerr("Could not set %s in raw mode, check cardtype", device);
return 0;
}
}
else if (cardtype == CARD_TYPE_HOSTAP)
{
int skfd;
skfd = socket(AF_INET, SOCK_STREAM, 0);
struct iwreq wrq;
wrq.u.mode = IW_MODE_MONITOR;
- if(iw_set_ext(skfd,device,SIOCSIWMODE,&wrq)<0)
+ if(iw_set_ext(skfd,(char *) device,SIOCSIWMODE,&wrq)<0)
{
wl_logerr("Could not set hostap card %s to raw mode, check cardtype", device);
return 0;
}
else
{
wl_loginfo("Successfully set hostap card %s into raw mode",device);
return 1;
}
return 1;
}
else if (cardtype == CARD_TYPE_ORINOCCO )
{
if (!card_set_channel (device, 1, CARD_TYPE_ORINOCCO))
{
wl_logerr("Could not set %s in raw mode, check cardtype", device);
return 0;
}
else
{
wl_loginfo("Successfully set %s into raw mode",device);
}
}
/* Setting the promiscous and up flag to the interface */
if (!card_check_rfmon_datalink(device))
{
wl_logerr("Cannot set interface to rfmon mode");
return 0;
}
else
{
wl_loginfo("Interface set to rfmon mode");
}
return 1;
}
/* Check card is in the rfmon mode */
int card_check_rfmon_datalink (const char *device)
{
int datalinktype=0;
pcap_t *phandle;
- phandle = pcap_open_live(device, 65,0,0,NULL);
+ phandle = pcap_open_live((char *)device, 65,0,0,NULL);
datalinktype = pcap_datalink (phandle);
pcap_close(phandle);
if (datalinktype != DLT_IEEE802_11) /* Rawmode is IEEE802_11 */
{
return 0;
}
else
{
wl_loginfo("Your successfully listen on %s in 802.11 raw mode", device);
return 1;
}
}
/* Set card into promisc mode */
int card_set_promisc_up (const char *device)
{
int err;
/* First generate a socket to use with iocalls */
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
{
/* In case of an error */
perror("socket");
@@ -195,49 +195,49 @@ int card_set_channel (const char *device, int channel, int cardtype)
strcpy(ireq.ifr_ifrn.ifrn_name, device);
if (ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq)==0)
{
/* All was fine... */
close(fd);
wl_loginfo("Set channel %d on interface %s",channel, device);
return 1;
}
else
{
/* iocall does not work */
close(fd);
wl_logerr("Could not set channel %d on %s, check cardtype",channel, device);
return 0;
}
}
/* when it is an hostap card you need another iocall for channel switching */
else if (cardtype == CARD_TYPE_HOSTAP)
{
int skfd;
skfd = socket(AF_INET, SOCK_STREAM, 0);
struct iwreq wrq;
iw_float2freq((double) channel, &wrq.u.freq);
- if(iw_set_ext(skfd,device,SIOCSIWFREQ,&wrq)<0)
+ if(iw_set_ext(skfd,(char *) device,SIOCSIWFREQ,&wrq)<0)
{
wl_logerr("Could not set hostap card %s to channel %d", device, channel);
return 0;
}
else
{
wl_loginfo("Successfully set hostap card %s to channel %d", device, channel);
return 1;
}
}
/* For undefined situations */
return 0;
}
int card_detect_channels (char * device)
{
int skfd;
skfd = socket(AF_INET, SOCK_STREAM, 0);
struct iw_range range;
/* Get list of frequencies / channels */
printf ("\n hostap card get the frequencies");
/* Get list of frequencies / channels */
if(iw_get_range_info(skfd, device, &range) < 0)
@@ -248,49 +248,49 @@ int card_detect_channels (char * device)
{
if(range.num_frequency > 0)
{
return range.num_frequency;
}
else
{ /* We are failsave asume only 11 channels */
return 11;
}
}
} /* End of card_detect_channels */
int iw_get_range_info(int skfd, const char * ifname, iw_range * range)
{
struct iwreq wrq2;
char buffer[sizeof(iw_range) * 2]; /* Large enough */
/* Cleanup */
memset(buffer, 0, sizeof(buffer));
wrq2.u.data.pointer = (caddr_t) buffer;
wrq2.u.data.length = sizeof(buffer);
wrq2.u.data.flags = 0;
- if(iw_get_ext(skfd, ifname, SIOCGIWRANGE, &wrq2) < 0)
+ if(iw_get_ext(skfd, (char *)ifname, SIOCGIWRANGE, &wrq2) < 0)
{
wl_logerr("Could not get the range from the interface");
return(-1);
}
else
{
/* Copy stuff at the right place, ignore extra */
memcpy((char *) range, buffer, sizeof(iw_range));
return 0;
}
}
/*------------------------------------------------------------------*/
/*
* Convert our internal representation of frequencies to a floating point.
*/
double iw_freq2float(iw_freq * in)
{
int i;
double res = (double) in->m;
for(i = 0; i < in->e; i++)
res *= 10;
return(res);
}