Reading AP(Access Point) Table
Article Metadata
void ReadAPTable()
{
struct ifconf ifc;
int sockfd;
sockfd = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
ifc.ifc_len = sizeof(ifreq) * 20;
ifc.ifc_buf = (caddr_t)malloc( ifc.ifc_len );
// This will get the whole access points list
// Here, ifc.ifc_len will contain the size of the buffer
ret = ioctl(sockfd, SIOCGIFCONF, &ifc);
// count will contain the number of access points
count = ifc.ifc_len / sizeof(struct ifreq) ;
// This will get only the active connection list
ret = ioctl(sockfd, SIOCGIFACTIVECONF, &ifc);
close(sockfd);
free(ifc.ifc_buf);
return;
}
The above Open C code shows that, we can either read the whole access points details(SIOCGIFCONF ) or only read active access points details(SIOCGIFACTIVECONF ).


(no comments yet)