summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 751d841..1f529d2 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -553,481 +553,482 @@ void OWirelessNetworkInterface::buildPrivateList()
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
575int OWirelessNetworkInterface::channel() const 575int 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
594void OWirelessNetworkInterface::setChannel( int c ) const 594void OWirelessNetworkInterface::setChannel( int c ) const
595{ 595{
596 if ( !_mon ) 596 if ( !_mon )
597 { 597 {
598 memset( &_iwr, 0, sizeof( struct iwreq ) ); 598 memset( &_iwr, 0, sizeof( struct iwreq ) );
599 _iwr.u.freq.m = c; 599 _iwr.u.freq.m = c;
600 _iwr.u.freq.e = 0; 600 _iwr.u.freq.e = 0;
601 wioctl( SIOCSIWFREQ ); 601 wioctl( SIOCSIWFREQ );
602 } 602 }
603 else 603 else
604 { 604 {
605 _mon->setChannel( c ); 605 _mon->setChannel( c );
606 } 606 }
607} 607}
608 608
609 609
610double OWirelessNetworkInterface::frequency() const 610double OWirelessNetworkInterface::frequency() const
611{ 611{
612 if ( !wioctl( SIOCGIWFREQ ) ) 612 if ( !wioctl( SIOCGIWFREQ ) )
613 { 613 {
614 return -1.0; 614 return -1.0;
615 } 615 }
616 else 616 else
617 { 617 {
618 return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0; 618 return double( _iwr.u.freq.m ) * pow( 10.0, _iwr.u.freq.e ) / 1000000000.0;
619 } 619 }
620} 620}
621 621
622 622
623int OWirelessNetworkInterface::channels() const 623int OWirelessNetworkInterface::channels() const
624{ 624{
625 return _channels.count(); 625 return _channels.count();
626} 626}
627 627
628 628
629void OWirelessNetworkInterface::setChannelHopping( int interval ) 629void OWirelessNetworkInterface::setChannelHopping( int interval )
630{ 630{
631 if ( !_hopper ) _hopper = new OChannelHopper( this ); 631 if ( !_hopper ) _hopper = new OChannelHopper( this );
632 _hopper->setInterval( interval ); 632 _hopper->setInterval( interval );
633 //FIXME: When and by whom will the channel hopper be deleted? 633 //FIXME: When and by whom will the channel hopper be deleted?
634 //TODO: rely on QObject hierarchy 634 //TODO: rely on QObject hierarchy
635} 635}
636 636
637 637
638int OWirelessNetworkInterface::channelHopping() const 638int OWirelessNetworkInterface::channelHopping() const
639{ 639{
640 return _hopper->interval(); 640 return _hopper->interval();
641} 641}
642 642
643 643
644OChannelHopper* OWirelessNetworkInterface::channelHopper() const 644OChannelHopper* OWirelessNetworkInterface::channelHopper() const
645{ 645{
646 return _hopper; 646 return _hopper;
647} 647}
648 648
649 649
650void OWirelessNetworkInterface::setMode( const QString& mode ) 650void OWirelessNetworkInterface::setMode( const QString& mode )
651{ 651{
652 if ( mode == "auto" ) _iwr.u.mode = IW_MODE_AUTO; 652 if ( mode == "auto" ) _iwr.u.mode = IW_MODE_AUTO;
653 else if ( mode == "adhoc" ) _iwr.u.mode = IW_MODE_ADHOC; 653 else if ( mode == "adhoc" ) _iwr.u.mode = IW_MODE_ADHOC;
654 else if ( mode == "managed" ) _iwr.u.mode = IW_MODE_INFRA; 654 else if ( mode == "managed" ) _iwr.u.mode = IW_MODE_INFRA;
655 else if ( mode == "master" ) _iwr.u.mode = IW_MODE_MASTER; 655 else if ( mode == "master" ) _iwr.u.mode = IW_MODE_MASTER;
656 else if ( mode == "repeater" ) _iwr.u.mode = IW_MODE_REPEAT; 656 else if ( mode == "repeater" ) _iwr.u.mode = IW_MODE_REPEAT;
657 else if ( mode == "secondary" ) _iwr.u.mode = IW_MODE_SECOND; 657 else if ( mode == "secondary" ) _iwr.u.mode = IW_MODE_SECOND;
658 #if WIRELESS_EXT > 14 658 #if WIRELESS_EXT > 14
659 else if ( mode == "monitor" ) _iwr.u.mode = IW_MODE_MONITOR; 659 else if ( mode == "monitor" ) _iwr.u.mode = IW_MODE_MONITOR;
660 #endif 660 #endif
661 else 661 else
662 { 662 {
663 qDebug( "ONetwork: Warning! Invalid IEEE 802.11 mode '%s' specified.", (const char*) mode ); 663 qDebug( "ONetwork: Warning! Invalid IEEE 802.11 mode '%s' specified.", (const char*) mode );
664 return; 664 return;
665 } 665 }
666 wioctl( SIOCSIWMODE ); 666 wioctl( SIOCSIWMODE );
667} 667}
668 668
669 669
670QString OWirelessNetworkInterface::mode() const 670QString OWirelessNetworkInterface::mode() const
671{ 671{
672 if ( !wioctl( SIOCGIWMODE ) ) 672 if ( !wioctl( SIOCGIWMODE ) )
673 { 673 {
674 return "<unknown>"; 674 return "<unknown>";
675 } 675 }
676 switch ( _iwr.u.mode ) 676 switch ( _iwr.u.mode )
677 { 677 {
678 case IW_MODE_AUTO: return "auto"; 678 case IW_MODE_AUTO: return "auto";
679 case IW_MODE_ADHOC: return "adhoc"; 679 case IW_MODE_ADHOC: return "adhoc";
680 case IW_MODE_INFRA: return "managed"; 680 case IW_MODE_INFRA: return "managed";
681 case IW_MODE_MASTER: return "master"; 681 case IW_MODE_MASTER: return "master";
682 case IW_MODE_REPEAT: return "repeater"; 682 case IW_MODE_REPEAT: return "repeater";
683 case IW_MODE_SECOND: return "secondary"; 683 case IW_MODE_SECOND: return "secondary";
684 #if WIRELESS_EXT > 14 684 #if WIRELESS_EXT > 14
685 case IW_MODE_MONITOR: return "monitor"; 685 case IW_MODE_MONITOR: return "monitor";
686 #endif 686 #endif
687 default: assert( 0 ); // shouldn't happen 687 default: assert( 0 ); // shouldn't happen
688 } 688 }
689} 689}
690 690
691 691
692void OWirelessNetworkInterface::setMonitorMode( bool b ) 692void OWirelessNetworkInterface::setMonitorMode( bool b )
693{ 693{
694 if ( _mon ) 694 if ( _mon )
695 _mon->setEnabled( b ); 695 _mon->setEnabled( b );
696 else 696 else
697 qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" ); 697 qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" );
698} 698}
699 699
700 700
701bool OWirelessNetworkInterface::monitorMode() const 701bool OWirelessNetworkInterface::monitorMode() const
702{ 702{
703 qDebug( "dataLinkType = %d", dataLinkType() ); 703 qDebug( "dataLinkType = %d", dataLinkType() );
704 return ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 ); 704 return ( dataLinkType() == ARPHRD_IEEE80211 || dataLinkType() == 802 );
705 // 802 is the header type for PRISM - Linux support for this is pending... 705 // 802 is the header type for PRISM - Linux support for this is pending...
706} 706}
707 707
708 708
709void OWirelessNetworkInterface::setNickName( const QString& nickname ) 709void OWirelessNetworkInterface::setNickName( const QString& nickname )
710{ 710{
711 _iwr.u.essid.pointer = const_cast<char*>( (const char*) nickname ); 711 _iwr.u.essid.pointer = const_cast<char*>( (const char*) nickname );
712 _iwr.u.essid.length = nickname.length(); 712 _iwr.u.essid.length = nickname.length();
713 wioctl( SIOCSIWNICKN ); 713 wioctl( SIOCSIWNICKN );
714} 714}
715 715
716 716
717QString OWirelessNetworkInterface::nickName() const 717QString OWirelessNetworkInterface::nickName() const
718{ 718{
719 char str[IW_ESSID_MAX_SIZE]; 719 char str[IW_ESSID_MAX_SIZE];
720 _iwr.u.data.pointer = &str[0]; 720 _iwr.u.data.pointer = &str[0];
721 _iwr.u.data.length = IW_ESSID_MAX_SIZE; 721 _iwr.u.data.length = IW_ESSID_MAX_SIZE;
722 if ( !wioctl( SIOCGIWNICKN ) ) 722 if ( !wioctl( SIOCGIWNICKN ) )
723 { 723 {
724 return "<unknown>"; 724 return "<unknown>";
725 } 725 }
726 else 726 else
727 { 727 {
728 str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string 728 str[_iwr.u.data.length] = 0x0; // some drivers (e.g. wlan-ng) don't zero-terminate the string
729 return str; 729 return str;
730 } 730 }
731} 731}
732 732
733 733
734void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) 734void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... )
735{ 735{
736 OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); 736 OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) );
737 if ( !priv ) 737 if ( !priv )
738 { 738 {
739 qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call ); 739 qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call );
740 return; 740 return;
741 } 741 }
742 if ( priv->numberSetArgs() != numargs ) 742 if ( priv->numberSetArgs() != numargs )
743 { 743 {
744 qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs ); 744 qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs );
745 return; 745 return;
746 } 746 }
747 747
748 qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() ); 748 qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() );
749 memset( &_iwr, 0, sizeof _iwr ); 749 memset( &_iwr, 0, sizeof _iwr );
750 va_list argp; 750 va_list argp;
751 va_start( argp, numargs ); 751 va_start( argp, numargs );
752 for ( int i = 0; i < numargs; ++i ) 752 for ( int i = 0; i < numargs; ++i )
753 { 753 {
754 priv->setParameter( i, va_arg( argp, int ) ); 754 priv->setParameter( i, va_arg( argp, int ) );
755 } 755 }
756 va_end( argp ); 756 va_end( argp );
757 priv->invoke(); 757 priv->invoke();
758} 758}
759 759
760 760
761void OWirelessNetworkInterface::getPrivate( const QString& call ) 761void OWirelessNetworkInterface::getPrivate( const QString& call )
762{ 762{
763 qWarning( "OWirelessNetworkInterface::getPrivate() is not implemented yet." ); 763 qWarning( "OWirelessNetworkInterface::getPrivate() is not implemented yet." );
764} 764}
765 765
766 766
767bool OWirelessNetworkInterface::hasPrivate( const QString& call ) 767bool OWirelessNetworkInterface::hasPrivate( const QString& call )
768{ 768{
769 return child( (const char*) call ); 769 return child( (const char*) call );
770} 770}
771 771
772 772
773QString OWirelessNetworkInterface::SSID() const 773QString OWirelessNetworkInterface::SSID() const
774{ 774{
775 char str[IW_ESSID_MAX_SIZE]; 775 char str[IW_ESSID_MAX_SIZE];
776 _iwr.u.essid.pointer = &str[0]; 776 _iwr.u.essid.pointer = &str[0];
777 _iwr.u.essid.length = IW_ESSID_MAX_SIZE; 777 _iwr.u.essid.length = IW_ESSID_MAX_SIZE;
778 if ( !wioctl( SIOCGIWESSID ) ) 778 if ( !wioctl( SIOCGIWESSID ) )
779 { 779 {
780 return "<unknown>"; 780 return "<unknown>";
781 } 781 }
782 else 782 else
783 { 783 {
784 return str; 784 return str;
785 } 785 }
786} 786}
787 787
788 788
789void OWirelessNetworkInterface::setSSID( const QString& ssid ) 789void OWirelessNetworkInterface::setSSID( const QString& ssid )
790{ 790{
791 _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid ); 791 _iwr.u.essid.pointer = const_cast<char*>( (const char*) ssid );
792 _iwr.u.essid.length = ssid.length(); 792 _iwr.u.essid.length = ssid.length();
793 wioctl( SIOCSIWESSID ); 793 wioctl( SIOCSIWESSID );
794} 794}
795 795
796 796
797bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const 797bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const
798{ 798{
799 int result = ::ioctl( _sfd, call, &iwreq ); 799 int result = ::ioctl( _sfd, call, &iwreq );
800 if ( result == -1 ) 800 if ( result == -1 )
801 qDebug( "ONetworkInterface::wioctl (%s) call %d - Status: Failed: %d (%s)", name(), call, result, strerror( errno ) ); 801 qDebug( "ONetworkInterface::wioctl (%s) call %d - Status: Failed: %d (%s)", name(), call, result, strerror( errno ) );
802 else 802 else
803 qDebug( "ONetworkInterface::wioctl (%s) call %d - Status: Ok.", name(), call ); 803 qDebug( "ONetworkInterface::wioctl (%s) call %d - Status: Ok.", name(), call );
804 return ( result != -1 ); 804 return ( result != -1 );
805} 805}
806 806
807 807
808bool OWirelessNetworkInterface::wioctl( int call ) const 808bool OWirelessNetworkInterface::wioctl( int call ) const
809{ 809{
810 strcpy( _iwr.ifr_name, name() ); 810 strcpy( _iwr.ifr_name, name() );
811 return wioctl( call, _iwr ); 811 return wioctl( call, _iwr );
812} 812}
813 813
814 814
815/*====================================================================================== 815/*======================================================================================
816 * OMonitoringInterface 816 * OMonitoringInterface
817 *======================================================================================*/ 817 *======================================================================================*/
818 818
819OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 819OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
820 :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader ) 820 :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader )
821{ 821{
822} 822}
823 823
824 824
825OMonitoringInterface::~OMonitoringInterface() 825OMonitoringInterface::~OMonitoringInterface()
826{ 826{
827} 827}
828 828
829 829
830void OMonitoringInterface::setChannel( int c ) 830void OMonitoringInterface::setChannel( int c )
831{ 831{
832 // use standard WE channel switching protocol 832 // use standard WE channel switching protocol
833 memset( &_if->_iwr, 0, sizeof( struct iwreq ) ); 833 memset( &_if->_iwr, 0, sizeof( struct iwreq ) );
834 _if->_iwr.u.freq.m = c; 834 _if->_iwr.u.freq.m = c;
835 _if->_iwr.u.freq.e = 0; 835 _if->_iwr.u.freq.e = 0;
836 _if->wioctl( SIOCSIWFREQ ); 836 _if->wioctl( SIOCSIWFREQ );
837} 837}
838 838
839 839
840bool OMonitoringInterface::enabled() const 840bool OMonitoringInterface::enabled() const
841{ 841{
842 return _if->monitorMode(); 842 return _if->monitorMode();
843} 843}
844 844
845 845
846void OMonitoringInterface::setEnabled( bool b ) 846void OMonitoringInterface::setEnabled( bool b )
847{ 847{
848} 848}
849 849
850 850
851/*====================================================================================== 851/*======================================================================================
852 * OCiscoMonitoringInterface 852 * OCiscoMonitoringInterface
853 *======================================================================================*/ 853 *======================================================================================*/
854 854
855OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 855OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
856 :OMonitoringInterface( iface, prismHeader ) 856 :OMonitoringInterface( iface, prismHeader )
857{ 857{
858 iface->setMonitoring( this ); 858 iface->setMonitoring( this );
859} 859}
860 860
861 861
862OCiscoMonitoringInterface::~OCiscoMonitoringInterface() 862OCiscoMonitoringInterface::~OCiscoMonitoringInterface()
863{ 863{
864} 864}
865 865
866 866
867void OCiscoMonitoringInterface::setEnabled( bool b ) 867void OCiscoMonitoringInterface::setEnabled( bool b )
868{ 868{
869 QString fname; 869 QString fname;
870 fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() ); 870 fname.sprintf( "/proc/driver/aironet/%s", (const char*) _if->name() );
871 QFile f( fname ); 871 QFile f( fname );
872 if ( !f.exists() ) return; 872 if ( !f.exists() ) return;
873 873
874 if ( f.open( IO_WriteOnly ) ) 874 if ( f.open( IO_WriteOnly ) )
875 { 875 {
876 QTextStream s( &f ); 876 QTextStream s( &f );
877 s << "Mode: r"; 877 s << "Mode: r";
878 s << "Mode: y"; 878 s << "Mode: y";
879 s << "XmitPower: 1"; 879 s << "XmitPower: 1";
880 } 880 }
881 881
882 // flushing and closing will be done automatically when f goes out of scope 882 // flushing and closing will be done automatically when f goes out of scope
883} 883}
884 884
885 885
886QString OCiscoMonitoringInterface::name() const 886QString OCiscoMonitoringInterface::name() const
887{ 887{
888 return "cisco"; 888 return "cisco";
889} 889}
890 890
891 891
892void OCiscoMonitoringInterface::setChannel( int ) 892void OCiscoMonitoringInterface::setChannel( int )
893{ 893{
894 // cisco devices automatically switch channels when in monitor mode 894 // cisco devices automatically switch channels when in monitor mode
895} 895}
896 896
897 897
898/*====================================================================================== 898/*======================================================================================
899 * OWlanNGMonitoringInterface 899 * OWlanNGMonitoringInterface
900 *======================================================================================*/ 900 *======================================================================================*/
901 901
902 902
903OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 903OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
904 :OMonitoringInterface( iface, prismHeader ) 904 :OMonitoringInterface( iface, prismHeader )
905{ 905{
906 iface->setMonitoring( this ); 906 iface->setMonitoring( this );
907} 907}
908 908
909 909
910OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() 910OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface()
911{ 911{
912} 912}
913 913
914 914
915void OWlanNGMonitoringInterface::setEnabled( bool b ) 915void OWlanNGMonitoringInterface::setEnabled( bool b )
916{ 916{
917 //FIXME: do nothing if its already in the same mode 917 //FIXME: do nothing if its already in the same mode
918 918
919 QString enable = b ? "true" : "false"; 919 QString enable = b ? "true" : "false";
920 QString prism = _prismHeader ? "true" : "false"; 920 QString prism = _prismHeader ? "true" : "false";
921 QString cmd; 921 QString cmd;
922 cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s", 922 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 ); 923 (const char*) _if->name(), 1, (const char*) enable, (const char*) prism );
924 system( cmd ); 924 system( cmd );
925} 925}
926 926
927 927
928QString OWlanNGMonitoringInterface::name() const 928QString OWlanNGMonitoringInterface::name() const
929{ 929{
930 return "wlan-ng"; 930 return "wlan-ng";
931} 931}
932 932
933 933
934void OWlanNGMonitoringInterface::setChannel( int ) 934void OWlanNGMonitoringInterface::setChannel( int )
935{ 935{
936 // wlan-ng devices automatically switch channels when in monitor mode 936 // wlan-ng devices automatically switch channels when in monitor mode
937 // NOTE: The above note no longer seems to be true for recent driver versions!
937} 938}
938 939
939 940
940/*====================================================================================== 941/*======================================================================================
941 * OHostAPMonitoringInterface 942 * OHostAPMonitoringInterface
942 *======================================================================================*/ 943 *======================================================================================*/
943 944
944OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 945OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
945 :OMonitoringInterface( iface, prismHeader ) 946 :OMonitoringInterface( iface, prismHeader )
946{ 947{
947 iface->setMonitoring( this ); 948 iface->setMonitoring( this );
948} 949}
949 950
950OHostAPMonitoringInterface::~OHostAPMonitoringInterface() 951OHostAPMonitoringInterface::~OHostAPMonitoringInterface()
951{ 952{
952} 953}
953 954
954void OHostAPMonitoringInterface::setEnabled( bool b ) 955void OHostAPMonitoringInterface::setEnabled( bool b )
955{ 956{
956 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 957 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15
957 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring 958 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring
958 959
959 #if WIRELESS_EXT > 14 960 #if WIRELESS_EXT > 14
960 if ( b ) 961 if ( b )
961 _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header 962 _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header
962 else 963 else
963 _if->setMode( "managed" ); 964 _if->setMode( "managed" );
964 #else 965 #else
965 int monitorCode = _prismHeader ? 1 : 2; 966 int monitorCode = _prismHeader ? 1 : 2;
966 if ( b ) 967 if ( b )
967 { 968 {
968 _if->setPrivate( "monitor", 1, monitorCode ); 969 _if->setPrivate( "monitor", 1, monitorCode );
969 } 970 }
970 else 971 else
971 { 972 {
972 _if->setPrivate( "monitor", 1, 0 ); 973 _if->setPrivate( "monitor", 1, 0 );
973 } 974 }
974 #endif 975 #endif
975} 976}
976 977
977 978
978QString OHostAPMonitoringInterface::name() const 979QString OHostAPMonitoringInterface::name() const
979{ 980{
980 return "hostap"; 981 return "hostap";
981} 982}
982 983
983 984
984/*====================================================================================== 985/*======================================================================================
985 * OOrinocoNetworkInterface 986 * OOrinocoNetworkInterface
986 *======================================================================================*/ 987 *======================================================================================*/
987 988
988OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader ) 989OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
989 :OMonitoringInterface( iface, prismHeader ) 990 :OMonitoringInterface( iface, prismHeader )
990{ 991{
991 iface->setMonitoring( this ); 992 iface->setMonitoring( this );
992} 993}
993 994
994 995
995OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() 996OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface()
996{ 997{
997} 998}
998 999
999 1000
1000void OOrinocoMonitoringInterface::setChannel( int c ) 1001void OOrinocoMonitoringInterface::setChannel( int c )
1001{ 1002{
1002 int monitorCode = _prismHeader ? 1 : 2; 1003 int monitorCode = _prismHeader ? 1 : 2;
1003 _if->setPrivate( "monitor", 2, monitorCode, c ); 1004 _if->setPrivate( "monitor", 2, monitorCode, c );
1004} 1005}
1005 1006
1006 1007
1007void OOrinocoMonitoringInterface::setEnabled( bool b ) 1008void OOrinocoMonitoringInterface::setEnabled( bool b )
1008{ 1009{
1009 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 1010 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15
1010 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring 1011 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring
1011 1012
1012 #if WIRELESS_EXT > 14 1013 #if WIRELESS_EXT > 14
1013 if ( b ) 1014 if ( b )
1014 _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header 1015 _if->setMode( "monitor" ); // IW_MODE_MONITOR doesn't support prism header
1015 else 1016 else
1016 _if->setMode( "managed" ); 1017 _if->setMode( "managed" );
1017 #else 1018 #else
1018 if ( b ) 1019 if ( b )
1019 { 1020 {
1020 setChannel( 1 ); 1021 setChannel( 1 );
1021 } 1022 }
1022 else 1023 else
1023 { 1024 {
1024 _if->setPrivate( "monitor", 2, 0, 0 ); 1025 _if->setPrivate( "monitor", 2, 0, 0 );
1025 } 1026 }
1026 #endif 1027 #endif
1027} 1028}
1028 1029
1029 1030
1030QString OOrinocoMonitoringInterface::name() const 1031QString OOrinocoMonitoringInterface::name() const
1031{ 1032{
1032 return "orinoco"; 1033 return "orinoco";
1033} 1034}