fix nvram build error
[openwrt.git] / openwrt / package / wiviz / src / channelhopper.c
1 /*
2 This file is part of Wi-viz (http://wiviz.natetrue.com).
3
4 Wi-viz is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License v2 as published by
6 the Free Software Foundation.
7
8 Wi-viz is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with Wi-viz; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17 #include <stdio.h>
18 #include <pcap.h>
19 #include <signal.h>
20 #include <sys/time.h>
21 #include "wl_access.h"
22 #include "channelhopper.h"
23 #include "structs.h"
24
25 void ch_sig_handler(int i) {
26
27 }
28
29 void channelHopper(wiviz_cfg * cfg) {
30 int hopPos;
31 int nc;
32
33 //Turn off signal handling from parent process
34 signal(SIGUSR1, &ch_sig_handler);
35 signal(SIGUSR2, &ch_sig_handler);
36
37 //Start hoppin'!
38 hopPos = 0;
39 while (1) {
40 nc = cfg->channelHopSeq[hopPos];
41 hopPos = (hopPos + 1) % cfg->channelHopSeqLen;
42 //Set the channel
43 fprintf(stderr, "It sets the channel to %i\n", nc);
44 wl_ioctl(WL_DEVICE, WLC_SET_CHANNEL, &nc, 4);
45 //Sleep
46 usleep(cfg->channelDwellTime * 1000);
47 }
48 }
This page took 0.050829 seconds and 5 git commands to generate.