summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/contrib/orinoco_hopper
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/contrib/orinoco_hopper') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore4
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in101
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c118
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.obin0 -> 35856 bytes
-rw-r--r--noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro11
5 files changed, 234 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore b/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore
new file mode 100644
index 0000000..0e45b67
--- a/dev/null
+++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore
@@ -0,0 +1,4 @@
1*.o
2*~
3moc_*
4Makefile.*
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in b/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in
new file mode 100644
index 0000000..c542a59
--- a/dev/null
+++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in
@@ -0,0 +1,101 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS)
9 INCPATH =
10 LFLAGS =$(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = $(OPIEDIR)/bin/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= orinoco_hopper
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =
27 SOURCES =orinoco_hopper.c
28 OBJECTS =orinoco_hopper.o
29INTERFACES =
30UICDECLS =
31UICIMPLS =
32 SRCMOC =
33 OBJMOC =
34
35
36####### Implicit rules
37
38.SUFFIXES: .cpp .cxx .cc .C .c
39
40.cpp.o:
41 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
42
43.cxx.o:
44 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
45
46.cc.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.C.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.c.o:
53 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
54
55####### Build rules
56
57
58all: $(DESTDIR)$(TARGET)
59
60$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
61 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
62
63moc: $(SRCMOC)
64
65tmake:
66 tmake orinoco_hopper.pro
67
68clean:
69 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
70 -rm -f *~ core
71 -rm -f allmoc.cpp
72
73####### Extension Modules
74
75listpromodules:
76 @echo
77
78listallmodules:
79 @echo
80
81listaddonpromodules:
82 @echo
83
84listaddonentmodules:
85 @echo
86
87
88REQUIRES=
89
90####### Sub-libraries
91
92
93###### Combined headers
94
95
96
97####### Compile
98
99orinoco_hopper.o: orinoco_hopper.c
100
101
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c
new file mode 100644
index 0000000..78f0299
--- a/dev/null
+++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c
@@ -0,0 +1,118 @@
1/* orinoco_hopper.c
2 * orinoco wireless nic channel scanning utility
3 *
4 * By Snax <snax@shmoo.com>
5 * Copyright (c) 2002 Snax
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * For a copy of the GNU General Public License write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <sys/time.h>
24#include <signal.h>
25#include <string.h>
26#include <sys/ioctl.h>
27#include <sys/socket.h>
28#include <linux/wireless.h>
29#include <unistd.h>
30#include <getopt.h>
31
32#ifndef SIOCIWFIRSTPRIV
33#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
34#endif
35
36void changeChannel(int);
37int setChannel( unsigned char channel );
38
39int max = 11;
40int mode = 2;
41char dev[32];
42
43void changeChannel(int x) {
44 static int chan = 0;
45 chan = (chan % max) + 1;
46 setChannel(chan);
47}
48
49int setChannel( unsigned char channel )
50{
51 int result = 0;
52 int fd;
53 struct iwreq ireq; //for Orinoco
54 int *ptr;
55
56 /* get a socket */
57 fd = socket(AF_INET, SOCK_STREAM, 0);
58
59 if ( fd == -1 ) {
60 return -1;
61 }
62 ptr = (int *) ireq.u.name;
63 ptr[0] = mode;
64 ptr[1] = channel;
65 strcpy(ireq.ifr_ifrn.ifrn_name, dev);
66 result = ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq);
67 close(fd);
68 return result;
69}
70
71void usage(char *cmd) {
72 fprintf(stderr,
73 "Usage: %s <iface> [-p] [-i <interval millisec>] [-n]\n -n = international channels\n -p = keep prism headers\n", cmd);
74 exit(1);
75}
76
77int main (int argc, char *argv[])
78{
79 struct itimerval tval;
80 int ms, r;
81
82 //this will be the channel scanning interval, currently 0.2 sec
83 struct timeval interval = {0, 200000};
84
85 if (argc < 2) usage(argv[0]);
86 strncpy(dev, argv[1], 32);
87 dev[31] = 0;
88
89 while (1) {
90 r = getopt(argc,argv,"i:np");
91 if (r < 0) break;
92 switch (r) {
93 case 'n':
94 max = 14;
95 break;
96 case 'p':
97 mode = 1;
98 break;
99 case 'i':
100 ms = atoi(optarg);
101 interval.tv_sec = ms / 1000;
102 interval.tv_usec = (ms % 1000) * 1000;
103 break;
104 default:
105 usage(argv[0]);
106 }
107 }
108
109 //this sets up the kchannel scanning stuff
110 signal(SIGALRM, changeChannel);
111 tval.it_interval = interval;
112 tval.it_value = interval;
113 setitimer(ITIMER_REAL, &tval, NULL);
114 while (1) pause();
115
116 return 0;
117}
118
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o
new file mode 100644
index 0000000..dd90c62
--- a/dev/null
+++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o
Binary files differ
diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro
new file mode 100644
index 0000000..a85520c
--- a/dev/null
+++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro
@@ -0,0 +1,11 @@
1DESTDIR = $(OPIEDIR)/bin
2TEMPLATE = app
3CONFIG = warn_on debug
4#CONFIG = warn_on release
5HEADERS =
6SOURCES = orinoco_hopper.c
7INCLUDEPATH +=
8DEPENDPATH +=
9LIBS +=
10INTERFACES =
11TARGET = orinoco_hopper