author | mickeyl <mickeyl> | 2005-05-19 12:03:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-19 12:03:37 (UTC) |
commit | 743204c7f71fe785a1876d95c5d880cfdff44592 (patch) (unidiff) | |
tree | 62d207b30da8b3c4589e2a9b9a3fba640aa4f421 | |
parent | 50cc0698e54f1f69591cc89be34ffcb7e309380a (diff) | |
download | opie-743204c7f71fe785a1876d95c5d880cfdff44592.zip opie-743204c7f71fe785a1876d95c5d880cfdff44592.tar.gz opie-743204c7f71fe785a1876d95c5d880cfdff44592.tar.bz2 |
print out OPacketCapturer version
-rw-r--r-- | examples/opienet/miniwellenreiter/miniwellenreiter.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index ba9d2ca..284b35a 100644 --- a/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | |||
@@ -45,35 +45,35 @@ public: | |||
45 | printf( "Valid wireless interfaces (detected) are:\n" ); | 45 | printf( "Valid wireless interfaces (detected) are:\n" ); |
46 | 46 | ||
47 | ONetwork::InterfaceIterator it = net->iterator(); | 47 | ONetwork::InterfaceIterator it = net->iterator(); |
48 | while ( it.current() ) | 48 | while ( it.current() ) |
49 | { | 49 | { |
50 | if ( it.current()->isWireless() ) | 50 | if ( it.current()->isWireless() ) |
51 | { | 51 | { |
52 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), | 52 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), |
53 | (const char*) it.current()->macAddress().toString(), | 53 | (const char*) it.current()->macAddress().toString(), |
54 | (const char*) it.current()->ipV4Address().toString() ); | 54 | (const char*) it.current()->ipV4Address().toString() ); |
55 | } | 55 | } |
56 | ++it; | 56 | ++it; |
57 | } | 57 | } |
58 | exit( -1 ); | 58 | exit( -1 ); |
59 | } | 59 | } |
60 | 60 | ||
61 | printf( "*******************************************************************\n" ); | 61 | printf( "************************************************************************\n" ); |
62 | printf( "* Wellenreiter mini edition 1.0.0 (C) 2003 Michael 'Mickey' Lauer *\n" ); | 62 | printf( "* Wellenreiter mini edition 1.0.0 (C) 2003-2005 Michael 'Mickey' Lauer *\n" ); |
63 | printf( "*******************************************************************\n" ); | 63 | printf( "************************************************************************\n" ); |
64 | printf( "\n\n" ); | 64 | printf( "\n\n" ); |
65 | 65 | ||
66 | QString interface( argv[1] ); | 66 | QString interface( argv[1] ); |
67 | QString driver( argv[2] ); | 67 | QString driver( argv[2] ); |
68 | 68 | ||
69 | printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); | 69 | printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); |
70 | 70 | ||
71 | // sanity checks before downcasting | 71 | // sanity checks before downcasting |
72 | ONetworkInterface* iface = net->interface( interface ); | 72 | ONetworkInterface* iface = net->interface( interface ); |
73 | if ( !iface ) | 73 | if ( !iface ) |
74 | { | 74 | { |
75 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); | 75 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); |
76 | exit( -1 ); | 76 | exit( -1 ); |
77 | } | 77 | } |
78 | if ( !iface->isWireless() ) | 78 | if ( !iface->isWireless() ) |
79 | { | 79 | { |
@@ -111,32 +111,33 @@ public: | |||
111 | new OHostAPMonitoringInterface( wiface, false ); | 111 | new OHostAPMonitoringInterface( wiface, false ); |
112 | else | 112 | else |
113 | if ( driver == "wlan-ng" ) | 113 | if ( driver == "wlan-ng" ) |
114 | new OWlanNGMonitoringInterface( wiface, false ); | 114 | new OWlanNGMonitoringInterface( wiface, false ); |
115 | else | 115 | else |
116 | { | 116 | { |
117 | printf( "Unknown driver. Exiting\n" ); | 117 | printf( "Unknown driver. Exiting\n" ); |
118 | exit( -1 ); | 118 | exit( -1 ); |
119 | } | 119 | } |
120 | 120 | ||
121 | // enable monitoring mode | 121 | // enable monitoring mode |
122 | printf( "Enabling monitor mode...\n" ); | 122 | printf( "Enabling monitor mode...\n" ); |
123 | wiface->setMode( "monitor" ); | 123 | wiface->setMode( "monitor" ); |
124 | 124 | ||
125 | // open a packet capturer | 125 | // open a packet capturer |
126 | cap = new OPacketCapturer(); | 126 | cap = new OPacketCapturer(); |
127 | printf( "OPacketCapturer using libpcap %s", (const char*) cap->version() ); | ||
127 | cap->open( interface ); | 128 | cap->open( interface ); |
128 | if ( !cap->isOpen() ) | 129 | if ( !cap->isOpen() ) |
129 | { | 130 | { |
130 | printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); | 131 | printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); |
131 | exit( -1 ); | 132 | exit( -1 ); |
132 | } | 133 | } |
133 | 134 | ||
134 | // set capturer to non-blocking mode | 135 | // set capturer to non-blocking mode |
135 | cap->setBlocking( false ); | 136 | cap->setBlocking( false ); |
136 | 137 | ||
137 | // start channel hopper | 138 | // start channel hopper |
138 | //wiface->setChannelHopping( 1000 ); | 139 | //wiface->setChannelHopping( 1000 ); |
139 | 140 | ||
140 | // connect | 141 | // connect |
141 | connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 142 | connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
142 | // timer | 143 | // timer |