/* * Execute a private command on the interface */ static inline int set_private(int skfd, /* Socket */ char * args[], /* Command line args */ int count, /* Args count */ char * ifname) /* Dev name */ { iwprivargs * priv; int number; /* Max of private ioctl */ int ret; /* Read the private ioctls */ number = iw_get_priv_info(skfd, ifname, &priv); /* Is there any ? */ if(number <= 0) { /* Should I skip this message ? */ fprintf(stderr, "%-8.16s no private ioctls.\n\n", ifname); if(priv) free(priv); return(-1); } /* Do it */ ret = set_private_cmd(skfd, args + 1, count - 1, ifname, args[0], priv, number); free(priv); return(ret); }
/* * Print on the screen in a neat fashion all the info we have collected * on a device. */ static int print_priv_all(int skfd, char * ifname, char * args[], int count) { int k; iwprivargs priv[IW_MAX_PRIV_DEF]; int n; /* Avoid "Unused parameter" warning */ args = args; count = count; /* Read the private ioctls */ n = iw_get_priv_info(skfd, ifname, priv, IW_MAX_PRIV_DEF); /* Is there any ? */ if(n <= 0) { /* Could skip this message ? */ fprintf(stderr, "%-8.8s no private ioctls.\n\n", ifname); } else { printf("%-8.8s Available read-only private ioctl :\n", ifname); /* Print them all */ for(k = 0; k < n; k++) /* We call all ioctl that don't have a null name, don't require * args and return some (avoid triggering "reset" commands) */ if((priv[k].name[0] != '\0') && (priv[k].set_args == 0) && (priv[k].get_args != 0)) set_private_cmd(skfd, NULL, 0, ifname, priv[k].name, priv, n); printf("\n"); } #if 0 // Debug printf("struct ifreq = %d ; struct iwreq = %d ; IFNAMSIZ = %d\n", sizeof(struct ifreq), sizeof(struct iwreq), IFNAMSIZ); printf("struct iw_freq = %d ; struct sockaddr = %d\n", sizeof(struct iw_freq), sizeof(struct sockaddr)); #endif return(0); }
/* * Print on the screen in a neat fashion the list of private GET ioctl * data for the device and data returned by those. */ static int print_priv_all(int skfd, char * ifname, char * args[], int count) { int k; iwprivargs * priv; int n; /* Avoid "Unused parameter" warning */ args = args; count = count; /* Read the private ioctls */ n = iw_get_priv_info(skfd, ifname, &priv); /* Is there any ? */ if(n <= 0) { /* Should I skip this message ? */ fprintf(stderr, "%-8.16s no private ioctls.\n\n", ifname); } else { printf("%-8.16s Available read-only private ioctl :\n", ifname); /* Print them all */ for(k = 0; k < n; k++) /* We call all ioctls that don't have a null name, don't require * args and return some (avoid triggering "reset" commands) */ if((priv[k].name[0] != '\0') && (priv[k].set_args == 0) && (priv[k].get_args != 0)) set_private_cmd(skfd, NULL, 0, ifname, priv[k].name, priv, n); printf("\n"); } /* Cleanup */ if(priv) free(priv); return(0); }
/* * Execute a private command on the interface */ static inline int set_private(int skfd, /* Socket */ char * args[], /* Command line args */ int count, /* Args count */ char * ifname) /* Dev name */ { iwprivargs priv[IW_MAX_PRIV_DEF]; int number; /* Max of private ioctl */ /* Read the private ioctls */ number = iw_get_priv_info(skfd, ifname, priv, IW_MAX_PRIV_DEF); /* Is there any ? */ if(number <= 0) { /* Could skip this message ? */ fprintf(stderr, "%-8.8s no private ioctls.\n\n", ifname); return(-1); } return(set_private_cmd(skfd, args + 1, count - 1, ifname, args[0], priv, number)); }