author | mickeyl <mickeyl> | 2003-10-09 16:01:08 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-09 16:01:08 (UTC) |
commit | 802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f (patch) (unidiff) | |
tree | c6a33ab027752ca04d0d98a2e71a238aa954978d | |
parent | c5c5c9f9fc6cab574f35f8be21076ac81f8c0369 (diff) | |
download | opie-802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f.zip opie-802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f.tar.gz opie-802c9ab6b89fd10f709aa012e8ff075e9b4a5d7f.tar.bz2 |
- fix monitor mode on orinoco. Although WE > 14 define the standard mode
"MONITOR", the orinoco monitor patch for 0.13e still does not use that...
- add documentation, a warning, and a runtime check for setChannel(0)
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 12 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 45ee4c0..767651e 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -532,128 +532,134 @@ void OWirelessNetworkInterface::buildChannelList() | |||
532 | } | 532 | } |
533 | // </check if the driver overwrites stuff> | 533 | // </check if the driver overwrites stuff> |
534 | 534 | ||
535 | struct iw_range range; | 535 | struct iw_range range; |
536 | memcpy( &range, buffer, sizeof range ); | 536 | memcpy( &range, buffer, sizeof range ); |
537 | 537 | ||
538 | qDebug( "OWirelessNetworkInterface::buildChannelList(): Interface %s reported to have %d channels.", name(), range.num_frequency ); | 538 | qDebug( "OWirelessNetworkInterface::buildChannelList(): Interface %s reported to have %d channels.", name(), range.num_frequency ); |
539 | for ( int i = 0; i < range.num_frequency; ++i ) | 539 | for ( int i = 0; i < range.num_frequency; ++i ) |
540 | { | 540 | { |
541 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); | 541 | int freq = (int) ( double( range.freq[i].m ) * pow( 10.0, range.freq[i].e ) / 1000000.0 ); |
542 | _channels.insert( freq, i+1 ); | 542 | _channels.insert( freq, i+1 ); |
543 | } | 543 | } |
544 | } | 544 | } |
545 | 545 | ||
546 | qDebug( "OWirelessNetworkInterface::buildChannelList(): Channel list constructed." ); | 546 | qDebug( "OWirelessNetworkInterface::buildChannelList(): Channel list constructed." ); |
547 | free(buffer); | 547 | free(buffer); |
548 | } | 548 | } |
549 | 549 | ||
550 | 550 | ||
551 | void OWirelessNetworkInterface::buildPrivateList() | 551 | void OWirelessNetworkInterface::buildPrivateList() |
552 | { | 552 | { |
553 | qDebug( "OWirelessNetworkInterface::buildPrivateList()" ); | 553 | qDebug( "OWirelessNetworkInterface::buildPrivateList()" ); |
554 | 554 | ||
555 | struct iw_priv_args priv[IW_MAX_PRIV_DEF]; | 555 | struct iw_priv_args priv[IW_MAX_PRIV_DEF]; |
556 | 556 | ||
557 | _iwr.u.data.pointer = (char*) &priv; | 557 | _iwr.u.data.pointer = (char*) &priv; |
558 | _iwr.u.data.length = IW_MAX_PRIV_DEF; // length in terms of number of (sizeof iw_priv_args), not (sizeof iw_priv_args) itself | 558 | _iwr.u.data.length = IW_MAX_PRIV_DEF; // length in terms of number of (sizeof iw_priv_args), not (sizeof iw_priv_args) itself |
559 | _iwr.u.data.flags = 0; | 559 | _iwr.u.data.flags = 0; |
560 | 560 | ||
561 | if ( !wioctl( SIOCGIWPRIV ) ) | 561 | if ( !wioctl( SIOCGIWPRIV ) ) |
562 | { | 562 | { |
563 | qDebug( "OWirelessNetworkInterface::buildPrivateList(): SIOCGIWPRIV failed (%s) - can't get private ioctl information.", strerror( errno ) ); | 563 | qDebug( "OWirelessNetworkInterface::buildPrivateList(): SIOCGIWPRIV failed (%s) - can't get private ioctl information.", strerror( errno ) ); |
564 | return; | 564 | return; |
565 | } | 565 | } |
566 | 566 | ||
567 | for ( int i = 0; i < _iwr.u.data.length; ++i ) | 567 | for ( int i = 0; i < _iwr.u.data.length; ++i ) |
568 | { | 568 | { |
569 | new OPrivateIOCTL( this, priv[i].name, priv[i].cmd, priv[i].get_args, priv[i].set_args ); | 569 | new OPrivateIOCTL( this, priv[i].name, priv[i].cmd, priv[i].get_args, priv[i].set_args ); |
570 | } | 570 | } |
571 | qDebug( "OWirelessNetworkInterface::buildPrivateList(): Private IOCTL list constructed." ); | 571 | qDebug( "OWirelessNetworkInterface::buildPrivateList(): Private IOCTL list constructed." ); |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | int OWirelessNetworkInterface::channel() const | 575 | int OWirelessNetworkInterface::channel() const |
576 | { | 576 | { |
577 | //FIXME: When monitoring enabled, then use it | 577 | //FIXME: When monitoring enabled, then use it |
578 | //FIXME: to gather the current RF channel | 578 | //FIXME: to gather the current RF channel |
579 | //FIXME: Until then, get active channel from hopper. | 579 | //FIXME: Until then, get active channel from hopper. |
580 | if ( _hopper && _hopper->isActive() ) | 580 | if ( _hopper && _hopper->isActive() ) |
581 | return _hopper->channel(); | 581 | return _hopper->channel(); |
582 | 582 | ||
583 | if ( !wioctl( SIOCGIWFREQ ) ) | 583 | if ( !wioctl( SIOCGIWFREQ ) ) |
584 | { | 584 | { |
585 | return -1; | 585 | return -1; |
586 | } | 586 | } |
587 | else | 587 | else |
588 | { | 588 | { |
589 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; | 589 | return _channels[ static_cast<int>(double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000) ]; |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | 593 | ||
594 | void OWirelessNetworkInterface::setChannel( int c ) const | 594 | void OWirelessNetworkInterface::setChannel( int c ) const |
595 | { | 595 | { |
596 | if ( c ) | ||
597 | { | ||
598 | qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" ); | ||
599 | return; | ||
600 | } | ||
601 | |||
596 | if ( !_mon ) | 602 | if ( !_mon ) |
597 | { | 603 | { |
598 | memset( &_iwr, 0, sizeof( struct iwreq ) ); | 604 | memset( &_iwr, 0, sizeof( struct iwreq ) ); |
599 | _iwr.u.freq.m = c; | 605 | _iwr.u.freq.m = c; |
600 | _iwr.u.freq.e = 0; | 606 | _iwr.u.freq.e = 0; |
601 | wioctl( SIOCSIWFREQ ); | 607 | wioctl( SIOCSIWFREQ ); |
602 | } | 608 | } |
603 | else | 609 | else |
604 | { | 610 | { |
605 | _mon->setChannel( c ); | 611 | _mon->setChannel( c ); |
606 | } | 612 | } |
607 | } | 613 | } |
608 | 614 | ||
609 | 615 | ||
610 | double OWirelessNetworkInterface::frequency() const | 616 | double OWirelessNetworkInterface::frequency() const |
611 | { | 617 | { |
612 | if ( !wioctl( SIOCGIWFREQ ) ) | 618 | if ( !wioctl( SIOCGIWFREQ ) ) |
613 | { | 619 | { |
614 | return -1.0; | 620 | return -1.0; |
615 | } | 621 | } |
616 | else | 622 | else |
617 | { | 623 | { |
618 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; | 624 | return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; |
619 | } | 625 | } |
620 | } | 626 | } |
621 | 627 | ||
622 | 628 | ||
623 | int OWirelessNetworkInterface::channels() const | 629 | int OWirelessNetworkInterface::channels() const |
624 | { | 630 | { |
625 | return _channels.count(); | 631 | return _channels.count(); |
626 | } | 632 | } |
627 | 633 | ||
628 | 634 | ||
629 | void OWirelessNetworkInterface::setChannelHopping( int interval ) | 635 | void OWirelessNetworkInterface::setChannelHopping( int interval ) |
630 | { | 636 | { |
631 | if ( !_hopper ) _hopper = new OChannelHopper( this ); | 637 | if ( !_hopper ) _hopper = new OChannelHopper( this ); |
632 | _hopper->setInterval( interval ); | 638 | _hopper->setInterval( interval ); |
633 | //FIXME: When and by whom will the channel hopper be deleted? | 639 | //FIXME: When and by whom will the channel hopper be deleted? |
634 | //TODO: rely on QObject hierarchy | 640 | //TODO: rely on QObject hierarchy |
635 | } | 641 | } |
636 | 642 | ||
637 | 643 | ||
638 | int OWirelessNetworkInterface::channelHopping() const | 644 | int OWirelessNetworkInterface::channelHopping() const |
639 | { | 645 | { |
640 | return _hopper->interval(); | 646 | return _hopper->interval(); |
641 | } | 647 | } |
642 | 648 | ||
643 | 649 | ||
644 | OChannelHopper* OWirelessNetworkInterface::channelHopper() const | 650 | OChannelHopper* OWirelessNetworkInterface::channelHopper() const |
645 | { | 651 | { |
646 | return _hopper; | 652 | return _hopper; |
647 | } | 653 | } |
648 | 654 | ||
649 | 655 | ||
650 | void OWirelessNetworkInterface::setMode( const QString& mode ) | 656 | void OWirelessNetworkInterface::setMode( const QString& mode ) |
651 | { | 657 | { |
652 | if ( mode == "auto" ) _iwr.u.mode = IW_MODE_AUTO; | 658 | if ( mode == "auto" ) _iwr.u.mode = IW_MODE_AUTO; |
653 | else if ( mode == "adhoc" ) _iwr.u.mode = IW_MODE_ADHOC; | 659 | else if ( mode == "adhoc" ) _iwr.u.mode = IW_MODE_ADHOC; |
654 | else if ( mode == "managed" ) _iwr.u.mode = IW_MODE_INFRA; | 660 | else if ( mode == "managed" ) _iwr.u.mode = IW_MODE_INFRA; |
655 | else if ( mode == "master" ) _iwr.u.mode = IW_MODE_MASTER; | 661 | else if ( mode == "master" ) _iwr.u.mode = IW_MODE_MASTER; |
656 | else if ( mode == "repeater" ) _iwr.u.mode = IW_MODE_REPEAT; | 662 | else if ( mode == "repeater" ) _iwr.u.mode = IW_MODE_REPEAT; |
657 | else if ( mode == "secondary" ) _iwr.u.mode = IW_MODE_SECOND; | 663 | else if ( mode == "secondary" ) _iwr.u.mode = IW_MODE_SECOND; |
658 | #if WIRELESS_EXT > 14 | 664 | #if WIRELESS_EXT > 14 |
659 | else if ( mode == "monitor" ) _iwr.u.mode = IW_MODE_MONITOR; | 665 | else if ( mode == "monitor" ) _iwr.u.mode = IW_MODE_MONITOR; |
@@ -878,163 +884,165 @@ void OCiscoMonitoringInterface::setEnabled( bool b ) | |||
878 | s << "Mode: y"; | 884 | s << "Mode: y"; |
879 | s << "XmitPower: 1"; | 885 | s << "XmitPower: 1"; |
880 | } | 886 | } |
881 | 887 | ||
882 | // flushing and closing will be done automatically when f goes out of scope | 888 | // flushing and closing will be done automatically when f goes out of scope |
883 | } | 889 | } |
884 | 890 | ||
885 | 891 | ||
886 | QString OCiscoMonitoringInterface::name() const | 892 | QString OCiscoMonitoringInterface::name() const |
887 | { | 893 | { |
888 | return "cisco"; | 894 | return "cisco"; |
889 | } | 895 | } |
890 | 896 | ||
891 | 897 | ||
892 | void OCiscoMonitoringInterface::setChannel( int ) | 898 | void OCiscoMonitoringInterface::setChannel( int ) |
893 | { | 899 | { |
894 | // cisco devices automatically switch channels when in monitor mode | 900 | // cisco devices automatically switch channels when in monitor mode |
895 | } | 901 | } |
896 | 902 | ||
897 | 903 | ||
898 | /*====================================================================================== | 904 | /*====================================================================================== |
899 | * OWlanNGMonitoringInterface | 905 | * OWlanNGMonitoringInterface |
900 | *======================================================================================*/ | 906 | *======================================================================================*/ |
901 | 907 | ||
902 | 908 | ||
903 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 909 | OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
904 | :OMonitoringInterface( iface, prismHeader ) | 910 | :OMonitoringInterface( iface, prismHeader ) |
905 | { | 911 | { |
906 | iface->setMonitoring( this ); | 912 | iface->setMonitoring( this ); |
907 | } | 913 | } |
908 | 914 | ||
909 | 915 | ||
910 | OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() | 916 | OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() |
911 | { | 917 | { |
912 | } | 918 | } |
913 | 919 | ||
914 | 920 | ||
915 | void OWlanNGMonitoringInterface::setEnabled( bool b ) | 921 | void OWlanNGMonitoringInterface::setEnabled( bool b ) |
916 | { | 922 | { |
917 | //FIXME: do nothing if its already in the same mode | 923 | //FIXME: do nothing if its already in the same mode |
918 | 924 | ||
919 | QString enable = b ? "true" : "false"; | 925 | QString enable = b ? "true" : "false"; |
920 | QString prism = _prismHeader ? "true" : "false"; | 926 | QString prism = _prismHeader ? "true" : "false"; |
921 | QString cmd; | 927 | QString cmd; |
922 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", | 928 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
923 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); | 929 | (const char*) _if->name(), 1, (const char*) enable, (const char*) prism ); |
924 | system( cmd ); | 930 | system( cmd ); |
925 | } | 931 | } |
926 | 932 | ||
927 | 933 | ||
928 | QString OWlanNGMonitoringInterface::name() const | 934 | QString OWlanNGMonitoringInterface::name() const |
929 | { | 935 | { |
930 | return "wlan-ng"; | 936 | return "wlan-ng"; |
931 | } | 937 | } |
932 | 938 | ||
933 | 939 | ||
934 | void OWlanNGMonitoringInterface::setChannel( int c ) | 940 | void OWlanNGMonitoringInterface::setChannel( int c ) |
935 | { | 941 | { |
936 | //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. | 942 | //NOTE: Older wlan-ng drivers automatically hopped channels while lnxreq_wlansniff=true. Newer ones don't. |
937 | 943 | ||
938 | QString enable = "true"; //_if->monitorMode() ? "true" : "false"; | 944 | QString enable = "true"; //_if->monitorMode() ? "true" : "false"; |
939 | QString prism = _prismHeader ? "true" : "false"; | 945 | QString prism = _prismHeader ? "true" : "false"; |
940 | QString cmd; | 946 | QString cmd; |
941 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", | 947 | cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", |
942 | (const char*) _if->name(), c+1, (const char*) enable, (const char*) prism ); | 948 | (const char*) _if->name(), c, (const char*) enable, (const char*) prism ); |
943 | system( cmd ); | 949 | system( cmd ); |
944 | } | 950 | } |
945 | 951 | ||
946 | 952 | ||
947 | /*====================================================================================== | 953 | /*====================================================================================== |
948 | * OHostAPMonitoringInterface | 954 | * OHostAPMonitoringInterface |
949 | *======================================================================================*/ | 955 | *======================================================================================*/ |
950 | 956 | ||
951 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 957 | OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
952 | :OMonitoringInterface( iface, prismHeader ) | 958 | :OMonitoringInterface( iface, prismHeader ) |
953 | { | 959 | { |
954 | iface->setMonitoring( this ); | 960 | iface->setMonitoring( this ); |
955 | } | 961 | } |
956 | 962 | ||
957 | OHostAPMonitoringInterface::~OHostAPMonitoringInterface() | 963 | OHostAPMonitoringInterface::~OHostAPMonitoringInterface() |
958 | { | 964 | { |
959 | } | 965 | } |
960 | 966 | ||
961 | void OHostAPMonitoringInterface::setEnabled( bool b ) | 967 | void OHostAPMonitoringInterface::setEnabled( bool b ) |
962 | { | 968 | { |
963 | // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 | 969 | // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 |
964 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring | 970 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring |
965 | 971 | ||
966 | #if WIRELESS_EXT > 14 | 972 | #if WIRELESS_EXT > 14 |
967 | if ( b ) | 973 | if ( b ) |
968 | _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header | 974 | _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header |
969 | else | 975 | else |
970 | _if->setMode( "managed" ); | 976 | _if->setMode( "managed" ); |
971 | #else | 977 | #else |
972 | int monitorCode = _prismHeader ? 1 : 2; | 978 | int monitorCode = _prismHeader ? 1 : 2; |
973 | if ( b ) | 979 | if ( b ) |
974 | { | 980 | { |
975 | _if->setPrivate( "monitor", 1, monitorCode ); | 981 | _if->setPrivate( "monitor", 1, monitorCode ); |
976 | } | 982 | } |
977 | else | 983 | else |
978 | { | 984 | { |
979 | _if->setPrivate( "monitor", 1, 0 ); | 985 | _if->setPrivate( "monitor", 1, 0 ); |
980 | } | 986 | } |
981 | #endif | 987 | #endif |
982 | } | 988 | } |
983 | 989 | ||
984 | 990 | ||
985 | QString OHostAPMonitoringInterface::name() const | 991 | QString OHostAPMonitoringInterface::name() const |
986 | { | 992 | { |
987 | return "hostap"; | 993 | return "hostap"; |
988 | } | 994 | } |
989 | 995 | ||
990 | 996 | ||
991 | /*====================================================================================== | 997 | /*====================================================================================== |
992 | * OOrinocoNetworkInterface | 998 | * OOrinocoNetworkInterface |
993 | *======================================================================================*/ | 999 | *======================================================================================*/ |
994 | 1000 | ||
995 | OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) | 1001 | OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) |
996 | :OMonitoringInterface( iface, prismHeader ) | 1002 | :OMonitoringInterface( iface, prismHeader ) |
997 | { | 1003 | { |
998 | iface->setMonitoring( this ); | 1004 | iface->setMonitoring( this ); |
999 | } | 1005 | } |
1000 | 1006 | ||
1001 | 1007 | ||
1002 | OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() | 1008 | OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() |
1003 | { | 1009 | { |
1004 | } | 1010 | } |
1005 | 1011 | ||
1006 | 1012 | ||
1007 | void OOrinocoMonitoringInterface::setChannel( int c ) | 1013 | void OOrinocoMonitoringInterface::setChannel( int c ) |
1008 | { | 1014 | { |
1009 | int monitorCode = _prismHeader ? 1 : 2; | 1015 | int monitorCode = _prismHeader ? 1 : 2; |
1010 | _if->setPrivate( "monitor", 2, monitorCode, c ); | 1016 | _if->setPrivate( "monitor", 2, monitorCode, c ); |
1011 | } | 1017 | } |
1012 | 1018 | ||
1013 | 1019 | ||
1014 | void OOrinocoMonitoringInterface::setEnabled( bool b ) | 1020 | void OOrinocoMonitoringInterface::setEnabled( bool b ) |
1015 | { | 1021 | { |
1016 | // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 | 1022 | // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 |
1017 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring | 1023 | // Wireless Extensions < Version 15 need iwpriv commandos for monitoring |
1024 | // However, as of recent orinoco drivers, IW_MODE_MONITOR is still not supported | ||
1018 | 1025 | ||
1019 | #if WIRELESS_EXT > 14 | 1026 | #if 0 |
1027 | //#if WIRELESS_EXT > 14 | ||
1020 | if ( b ) | 1028 | if ( b ) |
1021 | _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header | 1029 | _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header |
1022 | else | 1030 | else |
1023 | _if->setMode( "managed" ); | 1031 | _if->setMode( "managed" ); |
1024 | #else | 1032 | #else |
1025 | if ( b ) | 1033 | if ( b ) |
1026 | { | 1034 | { |
1027 | setChannel( 1 ); | 1035 | setChannel( 1 ); |
1028 | } | 1036 | } |
1029 | else | 1037 | else |
1030 | { | 1038 | { |
1031 | _if->setPrivate( "monitor", 2, 0, 0 ); | 1039 | _if->setPrivate( "monitor", 2, 0, 0 ); |
1032 | } | 1040 | } |
1033 | #endif | 1041 | #endif |
1034 | } | 1042 | } |
1035 | 1043 | ||
1036 | 1044 | ||
1037 | QString OOrinocoMonitoringInterface::name() const | 1045 | QString OOrinocoMonitoringInterface::name() const |
1038 | { | 1046 | { |
1039 | return "orinoco"; | 1047 | return "orinoco"; |
1040 | } | 1048 | } |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index 2553a61..00d1ebb 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -275,128 +275,130 @@ class OChannelHopper : public QObject | |||
275 | * @returns the last hopped channel | 275 | * @returns the last hopped channel |
276 | */ | 276 | */ |
277 | int channel() const; | 277 | int channel() const; |
278 | /** | 278 | /** |
279 | * Set the channel hopping @a interval. | 279 | * Set the channel hopping @a interval. |
280 | * An interval of 0 deactivates the channel hopper. | 280 | * An interval of 0 deactivates the channel hopper. |
281 | */ | 281 | */ |
282 | void setInterval( int interval ); | 282 | void setInterval( int interval ); |
283 | /** | 283 | /** |
284 | * @returns the channel hopping interval | 284 | * @returns the channel hopping interval |
285 | */ | 285 | */ |
286 | int interval() const; | 286 | int interval() const; |
287 | 287 | ||
288 | signals: | 288 | signals: |
289 | /** | 289 | /** |
290 | * This signal is emitted right after the channel hopper performed a hop | 290 | * This signal is emitted right after the channel hopper performed a hop |
291 | */ | 291 | */ |
292 | void hopped( int ); | 292 | void hopped( int ); |
293 | 293 | ||
294 | protected: | 294 | protected: |
295 | virtual void timerEvent( QTimerEvent* ); | 295 | virtual void timerEvent( QTimerEvent* ); |
296 | 296 | ||
297 | private: | 297 | private: |
298 | OWirelessNetworkInterface* _iface; | 298 | OWirelessNetworkInterface* _iface; |
299 | int _interval; | 299 | int _interval; |
300 | int _tid; | 300 | int _tid; |
301 | QValueList<int> _channels; | 301 | QValueList<int> _channels; |
302 | QValueList<int>::Iterator _channel; | 302 | QValueList<int>::Iterator _channel; |
303 | }; | 303 | }; |
304 | 304 | ||
305 | 305 | ||
306 | /*====================================================================================== | 306 | /*====================================================================================== |
307 | * OWirelessNetworkInterface | 307 | * OWirelessNetworkInterface |
308 | *======================================================================================*/ | 308 | *======================================================================================*/ |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. | 311 | * @brief A network interface wrapper for interfaces supporting the wireless extensions protocol. |
312 | * | 312 | * |
313 | * This class provides a high-level encapsulation of the Linux wireless extension API. | 313 | * This class provides a high-level encapsulation of the Linux wireless extension API. |
314 | * | 314 | * |
315 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 315 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
316 | */ | 316 | */ |
317 | class OWirelessNetworkInterface : public ONetworkInterface | 317 | class OWirelessNetworkInterface : public ONetworkInterface |
318 | { | 318 | { |
319 | friend class OMonitoringInterface; | 319 | friend class OMonitoringInterface; |
320 | friend class OCiscoMonitoringInterface; | 320 | friend class OCiscoMonitoringInterface; |
321 | friend class OWlanNGMonitoringInterface; | 321 | friend class OWlanNGMonitoringInterface; |
322 | friend class OHostAPMonitoringInterface; | 322 | friend class OHostAPMonitoringInterface; |
323 | friend class OOrinocoMonitoringInterface; | 323 | friend class OOrinocoMonitoringInterface; |
324 | 324 | ||
325 | friend class OPrivateIOCTL; | 325 | friend class OPrivateIOCTL; |
326 | 326 | ||
327 | public: | 327 | public: |
328 | /** | 328 | /** |
329 | * Constructor. | 329 | * Constructor. |
330 | */ | 330 | */ |
331 | OWirelessNetworkInterface( QObject* parent, const char* name ); | 331 | OWirelessNetworkInterface( QObject* parent, const char* name ); |
332 | /** | 332 | /** |
333 | * Destructor. | 333 | * Destructor. |
334 | */ | 334 | */ |
335 | virtual ~OWirelessNetworkInterface(); | 335 | virtual ~OWirelessNetworkInterface(); |
336 | /** | 336 | /** |
337 | * Setting the @a channel of the interface changes the radio frequency (RF) | 337 | * Setting the @a channel of the interface changes the radio frequency (RF) |
338 | * of the corresponding wireless network device. | 338 | * of the corresponding wireless network device. |
339 | * @note Common channel range is within [1-14]. A value of 0 is not allowed. | ||
340 | * @see channels() | ||
339 | */ | 341 | */ |
340 | virtual void setChannel( int channel ) const; | 342 | virtual void setChannel( int channel ) const; |
341 | /** | 343 | /** |
342 | * @returns the channel index of the current radio frequency. | 344 | * @returns the channel index of the current radio frequency. |
343 | */ | 345 | */ |
344 | virtual int channel() const; | 346 | virtual int channel() const; |
345 | /** | 347 | /** |
346 | * @returns the current radio frequency (in MHz). | 348 | * @returns the current radio frequency (in MHz). |
347 | */ | 349 | */ |
348 | virtual double frequency() const; | 350 | virtual double frequency() const; |
349 | /** | 351 | /** |
350 | * @returns the number of radio frequency channels for the | 352 | * @returns the number of radio frequency channels for the |
351 | * corresponding wireless network device. | 353 | * corresponding wireless network device. |
352 | * @note European devices usually have 14 channels, while American typically feature 11 channels. | 354 | * @note European devices usually have 14 channels, while American typically feature 11 channels. |
353 | */ | 355 | */ |
354 | virtual int channels() const; | 356 | virtual int channels() const; |
355 | /** | 357 | /** |
356 | * Set the IEEE 802.11 operation @a mode. | 358 | * Set the IEEE 802.11 operation @a mode. |
357 | * Valid values are <ul><li>adhoc<li>managed<li>monitor<li>master | 359 | * Valid values are <ul><li>adhoc<li>managed<li>monitor<li>master |
358 | * @warning Not all drivers support the all modes. | 360 | * @warning Not all drivers support the all modes. |
359 | * @note You might have to change the SSID to get the operation mode change into effect. | 361 | * @note You might have to change the SSID to get the operation mode change into effect. |
360 | */ | 362 | */ |
361 | virtual void setMode( const QString& mode ); | 363 | virtual void setMode( const QString& mode ); |
362 | /** | 364 | /** |
363 | * @returns the current IEEE 802.11 operation mode. | 365 | * @returns the current IEEE 802.11 operation mode. |
364 | * Possible values are <ul><li>adhoc<li>managed<li>monitor<li>master or <li>unknown | 366 | * Possible values are <ul><li>adhoc<li>managed<li>monitor<li>master or <li>unknown |
365 | */ | 367 | */ |
366 | virtual QString mode() const; | 368 | virtual QString mode() const; |
367 | /** | 369 | /** |
368 | * Setting the monitor mode on a wireless network interface enables | 370 | * Setting the monitor mode on a wireless network interface enables |
369 | * listening to IEEE 802.11 data and management frames which normally | 371 | * listening to IEEE 802.11 data and management frames which normally |
370 | * are handled by the device firmware. This can be used to detect | 372 | * are handled by the device firmware. This can be used to detect |
371 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. | 373 | * other wireless network devices, e.g. Access Points or Ad-hoc stations. |
372 | * @warning Standard wireless network drives don't support the monitor mode. | 374 | * @warning Standard wireless network drives don't support the monitor mode. |
373 | * @warning You need a patched driver for this to work. | 375 | * @warning You need a patched driver for this to work. |
374 | * @note Enabling the monitor mode is highly driver dependent and requires | 376 | * @note Enabling the monitor mode is highly driver dependent and requires |
375 | * the proper @ref OMonitoringInterface to be associated with the interface. | 377 | * the proper @ref OMonitoringInterface to be associated with the interface. |
376 | * @see OMonitoringInterface | 378 | * @see OMonitoringInterface |
377 | */ | 379 | */ |
378 | virtual void setMonitorMode( bool ); //FIXME: ==> setMode( "monitor" ); | 380 | virtual void setMonitorMode( bool ); //FIXME: ==> setMode( "monitor" ); |
379 | /** | 381 | /** |
380 | * @returns true if the device is listening in IEEE 802.11 monitor mode | 382 | * @returns true if the device is listening in IEEE 802.11 monitor mode |
381 | */ | 383 | */ |
382 | virtual bool monitorMode() const; //FIXME: ==> mode() | 384 | virtual bool monitorMode() const; //FIXME: ==> mode() |
383 | /** | 385 | /** |
384 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. | 386 | * Set the channel hopping @a interval. An @a interval of 0 disables channel hopping. |
385 | * @see OChannelHopper | 387 | * @see OChannelHopper |
386 | */ | 388 | */ |
387 | virtual void setChannelHopping( int interval = 0 ); | 389 | virtual void setChannelHopping( int interval = 0 ); |
388 | /** | 390 | /** |
389 | * @returns the channel hopping interval or 0, if channel hopping is disabled. | 391 | * @returns the channel hopping interval or 0, if channel hopping is disabled. |
390 | */ | 392 | */ |
391 | virtual int channelHopping() const; | 393 | virtual int channelHopping() const; |
392 | /** | 394 | /** |
393 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before | 395 | * @returns the @ref OChannelHopper of this interface or 0, if channel hopping has not been activated before |
394 | */ | 396 | */ |
395 | virtual OChannelHopper* channelHopper() const; | 397 | virtual OChannelHopper* channelHopper() const; |
396 | /** | 398 | /** |
397 | * Set the station @a nickname. | 399 | * Set the station @a nickname. |
398 | */ | 400 | */ |
399 | virtual void setNickName( const QString& nickname ); | 401 | virtual void setNickName( const QString& nickname ); |
400 | /** | 402 | /** |
401 | * @returns the current station nickname. | 403 | * @returns the current station nickname. |
402 | */ | 404 | */ |