summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp31
-rw-r--r--libopie2/opienet/onetwork.h11
-rw-r--r--libopie2/opienet/opcap.cpp2
3 files changed, 25 insertions, 19 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 2dfff1d..6cef5cf 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -800,26 +800,26 @@ bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const
800 800
801bool OWirelessNetworkInterface::wioctl( int call ) const 801bool OWirelessNetworkInterface::wioctl( int call ) const
802{ 802{
803 strcpy( _iwr.ifr_name, name() ); 803 strcpy( _iwr.ifr_name, name() );
804 return wioctl( call, _iwr ); 804 return wioctl( call, _iwr );
805} 805}
806 806
807 807
808/*====================================================================================== 808/*======================================================================================
809 * OMonitoringInterface 809 * OMonitoringInterface
810 *======================================================================================*/ 810 *======================================================================================*/
811 811
812OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface ) 812OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
813 :_if( static_cast<OWirelessNetworkInterface*>( iface ) ) 813 :_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader )
814{ 814{
815} 815}
816 816
817 817
818OMonitoringInterface::~OMonitoringInterface() 818OMonitoringInterface::~OMonitoringInterface()
819{ 819{
820} 820}
821 821
822 822
823void OMonitoringInterface::setChannel( int c ) 823void OMonitoringInterface::setChannel( int c )
824{ 824{
825 // use standard WE channel switching protocol 825 // use standard WE channel switching protocol
@@ -836,26 +836,26 @@ bool OMonitoringInterface::enabled() const
836} 836}
837 837
838 838
839void OMonitoringInterface::setEnabled( bool b ) 839void OMonitoringInterface::setEnabled( bool b )
840{ 840{
841} 841}
842 842
843 843
844/*====================================================================================== 844/*======================================================================================
845 * OCiscoMonitoringInterface 845 * OCiscoMonitoringInterface
846 *======================================================================================*/ 846 *======================================================================================*/
847 847
848OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface ) 848OCiscoMonitoringInterface::OCiscoMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
849 :OMonitoringInterface( iface ) 849 :OMonitoringInterface( iface, prismHeader )
850{ 850{
851 iface->setMonitoring( this ); 851 iface->setMonitoring( this );
852} 852}
853 853
854 854
855OCiscoMonitoringInterface::~OCiscoMonitoringInterface() 855OCiscoMonitoringInterface::~OCiscoMonitoringInterface()
856{ 856{
857} 857}
858 858
859 859
860void OCiscoMonitoringInterface::setEnabled( bool b ) 860void OCiscoMonitoringInterface::setEnabled( bool b )
861{ 861{
@@ -884,117 +884,122 @@ QString OCiscoMonitoringInterface::name() const
884 884
885void OCiscoMonitoringInterface::setChannel( int ) 885void OCiscoMonitoringInterface::setChannel( int )
886{ 886{
887 // cisco devices automatically switch channels when in monitor mode 887 // cisco devices automatically switch channels when in monitor mode
888} 888}
889 889
890 890
891/*====================================================================================== 891/*======================================================================================
892 * OWlanNGMonitoringInterface 892 * OWlanNGMonitoringInterface
893 *======================================================================================*/ 893 *======================================================================================*/
894 894
895 895
896OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface ) 896OWlanNGMonitoringInterface::OWlanNGMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
897 :OMonitoringInterface( iface ) 897 :OMonitoringInterface( iface, prismHeader )
898{ 898{
899 iface->setMonitoring( this ); 899 iface->setMonitoring( this );
900} 900}
901 901
902 902
903OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface() 903OWlanNGMonitoringInterface::~OWlanNGMonitoringInterface()
904{ 904{
905} 905}
906 906
907 907
908void OWlanNGMonitoringInterface::setEnabled( bool b ) 908void OWlanNGMonitoringInterface::setEnabled( bool b )
909{ 909{
910 //FIXME: do nothing if its already in the same mode 910 //FIXME: do nothing if its already in the same mode
911 911
912 QString enable = b ? "true" : "false"; 912 QString enable = b ? "true" : "false";
913 QString prism = _prismHeader ? "true" : "false";
913 QString cmd; 914 QString cmd;
914 cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s", (const char*) _if->name(), 1, (const char*) enable ); 915 cmd.sprintf( "$(which wlanctl-ng) %s lnxreq_wlansniff channel=%d enable=%s prismheader=%s",
916 (const char*) _if->name(), 1, (const char*) enable, (const char*) prism );
915 system( cmd ); 917 system( cmd );
916} 918}
917 919
918 920
919QString OWlanNGMonitoringInterface::name() const 921QString OWlanNGMonitoringInterface::name() const
920{ 922{
921 return "wlan-ng"; 923 return "wlan-ng";
922} 924}
923 925
924 926
925void OWlanNGMonitoringInterface::setChannel( int ) 927void OWlanNGMonitoringInterface::setChannel( int )
926{ 928{
927 // wlan-ng devices automatically switch channels when in monitor mode 929 // wlan-ng devices automatically switch channels when in monitor mode
928} 930}
929 931
930 932
931/*====================================================================================== 933/*======================================================================================
932 * OHostAPMonitoringInterface 934 * OHostAPMonitoringInterface
933 *======================================================================================*/ 935 *======================================================================================*/
934 936
935OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface ) 937OHostAPMonitoringInterface::OHostAPMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
936 :OMonitoringInterface( iface ) 938 :OMonitoringInterface( iface, prismHeader )
937{ 939{
938 iface->setMonitoring( this ); 940 iface->setMonitoring( this );
939} 941}
940 942
941OHostAPMonitoringInterface::~OHostAPMonitoringInterface() 943OHostAPMonitoringInterface::~OHostAPMonitoringInterface()
942{ 944{
943} 945}
944 946
945void OHostAPMonitoringInterface::setEnabled( bool b ) 947void OHostAPMonitoringInterface::setEnabled( bool b )
946{ 948{
947 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15 949 // IW_MODE_MONITOR was introduced in Wireless Extensions Version 15
948 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring 950 // Wireless Extensions < Version 15 need iwpriv commandos for monitoring
949 951
950 //TODO: check wireless extensions version on runtime and use 952 //TODO: check wireless extensions version on runtime and use
951 //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15 953 //TODO: SIOCSIWMODE( IW_MODE_MONITOR ) if running on WE >= 15
952 954
955 int monitorCode = _prismHeader ? 1 : 2;
956
953 if ( b ) 957 if ( b )
954 { 958 {
955 _if->setPrivate( "monitor", 1, 2 ); 959 _if->setPrivate( "monitor", 1, monitorCode );
956 } 960 }
957 else 961 else
958 { 962 {
959 _if->setPrivate( "monitor", 1, 0 ); 963 _if->setPrivate( "monitor", 1, 0 );
960 } 964 }
961} 965}
962 966
963 967
964QString OHostAPMonitoringInterface::name() const 968QString OHostAPMonitoringInterface::name() const
965{ 969{
966 return "hostap"; 970 return "hostap";
967} 971}
968 972
969 973
970/*====================================================================================== 974/*======================================================================================
971 * OOrinocoNetworkInterface 975 * OOrinocoNetworkInterface
972 *======================================================================================*/ 976 *======================================================================================*/
973 977
974OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface ) 978OOrinocoMonitoringInterface::OOrinocoMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
975 :OMonitoringInterface( iface ) 979 :OMonitoringInterface( iface, prismHeader )
976{ 980{
977 iface->setMonitoring( this ); 981 iface->setMonitoring( this );
978} 982}
979 983
980 984
981OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface() 985OOrinocoMonitoringInterface::~OOrinocoMonitoringInterface()
982{ 986{
983} 987}
984 988
985 989
986void OOrinocoMonitoringInterface::setChannel( int c ) 990void OOrinocoMonitoringInterface::setChannel( int c )
987{ 991{
988 _if->setPrivate( "monitor", 2, 1, c ); 992 int monitorCode = _prismHeader ? 1 : 2;
993 _if->setPrivate( "monitor", 2, monitorCode, c );
989} 994}
990 995
991 996
992void OOrinocoMonitoringInterface::setEnabled( bool b ) 997void OOrinocoMonitoringInterface::setEnabled( bool b )
993{ 998{
994 if ( b ) 999 if ( b )
995 { 1000 {
996 setChannel( 1 ); 1001 setChannel( 1 );
997 } 1002 }
998 else 1003 else
999 { 1004 {
1000 _if->setPrivate( "monitor", 2, 0, 0 ); 1005 _if->setPrivate( "monitor", 2, 0, 0 );
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h
index 1b38d02..eb9d506 100644
--- a/libopie2/opienet/onetwork.h
+++ b/libopie2/opienet/onetwork.h
@@ -443,96 +443,97 @@ class OWirelessNetworkInterface : public ONetworkInterface
443}; 443};
444 444
445 445
446/*====================================================================================== 446/*======================================================================================
447 * OMonitoringInterface 447 * OMonitoringInterface
448 *======================================================================================*/ 448 *======================================================================================*/
449 449
450 450
451class OMonitoringInterface 451class OMonitoringInterface
452{ 452{
453 public: 453 public:
454 OMonitoringInterface(); 454 OMonitoringInterface();
455 OMonitoringInterface( ONetworkInterface* ); 455 OMonitoringInterface( ONetworkInterface*, bool _prismHeader );
456 virtual ~OMonitoringInterface(); 456 virtual ~OMonitoringInterface();
457 457
458 public: 458 public:
459 virtual void setEnabled( bool ); 459 virtual void setEnabled( bool );
460 virtual bool enabled() const; 460 virtual bool enabled() const;
461 virtual void setChannel( int ); 461 virtual void setChannel( int );
462 462
463 virtual QString name() const = 0; 463 virtual QString name() const = 0;
464 464
465 protected: 465 protected:
466 OWirelessNetworkInterface* _if; 466 OWirelessNetworkInterface* _if;
467 bool _prismHeader;
467 468
468}; 469};
469 470
470 471
471/*====================================================================================== 472/*======================================================================================
472 * OCiscoMonitoring 473 * OCiscoMonitoring
473 *======================================================================================*/ 474 *======================================================================================*/
474 475
475 476
476class OCiscoMonitoringInterface : public OMonitoringInterface 477class OCiscoMonitoringInterface : public OMonitoringInterface
477{ 478{
478 public: 479 public:
479 OCiscoMonitoringInterface( ONetworkInterface* ); 480 OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader );
480 virtual ~OCiscoMonitoringInterface(); 481 virtual ~OCiscoMonitoringInterface();
481 482
482 virtual void setEnabled( bool ); 483 virtual void setEnabled( bool );
483 virtual QString name() const; 484 virtual QString name() const;
484 virtual void setChannel( int ); 485 virtual void setChannel( int );
485 486
486}; 487};
487 488
488/*====================================================================================== 489/*======================================================================================
489 * OWlanNGMonitoringInterface 490 * OWlanNGMonitoringInterface
490 *======================================================================================*/ 491 *======================================================================================*/
491 492
492class OWlanNGMonitoringInterface : public OMonitoringInterface 493class OWlanNGMonitoringInterface : public OMonitoringInterface
493{ 494{
494 public: 495 public:
495 OWlanNGMonitoringInterface( ONetworkInterface* ); 496 OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader );
496 virtual ~OWlanNGMonitoringInterface(); 497 virtual ~OWlanNGMonitoringInterface();
497 498
498 public: 499 public:
499 virtual void setEnabled( bool ); 500 virtual void setEnabled( bool );
500 virtual QString name() const; 501 virtual QString name() const;
501 virtual void setChannel( int ); 502 virtual void setChannel( int );
502 503
503}; 504};
504 505
505/*====================================================================================== 506/*======================================================================================
506 * OHostAPMonitoringInterface 507 * OHostAPMonitoringInterface
507 *======================================================================================*/ 508 *======================================================================================*/
508 509
509class OHostAPMonitoringInterface : public OMonitoringInterface 510class OHostAPMonitoringInterface : public OMonitoringInterface
510{ 511{
511 public: 512 public:
512 OHostAPMonitoringInterface( ONetworkInterface* ); 513 OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader );
513 virtual ~OHostAPMonitoringInterface(); 514 virtual ~OHostAPMonitoringInterface();
514 515
515 public: 516 public:
516 virtual void setEnabled( bool ); 517 virtual void setEnabled( bool );
517 virtual QString name() const; 518 virtual QString name() const;
518 }; 519 };
519 520
520/*====================================================================================== 521/*======================================================================================
521 * OOrinocoMonitoringInterface 522 * OOrinocoMonitoringInterface
522 *======================================================================================*/ 523 *======================================================================================*/
523 524
524class OOrinocoMonitoringInterface : public OMonitoringInterface 525class OOrinocoMonitoringInterface : public OMonitoringInterface
525{ 526{
526 public: 527 public:
527 OOrinocoMonitoringInterface( ONetworkInterface* ); 528 OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader );
528 virtual ~OOrinocoMonitoringInterface(); 529 virtual ~OOrinocoMonitoringInterface();
529 530
530 public: 531 public:
531 virtual void setChannel( int ); 532 virtual void setChannel( int );
532 virtual void setEnabled( bool ); 533 virtual void setEnabled( bool );
533 virtual QString name() const; 534 virtual QString name() const;
534 535
535}; 536};
536 537
537#endif // ONETWORK_H 538#endif // ONETWORK_H
538 539
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index e2ab6d7..f6d05ea 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -62,25 +62,25 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
62 62
63 case DLT_IEEE802_11: 63 case DLT_IEEE802_11:
64 qDebug( "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" ); 64 qDebug( "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" );
65 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); 65 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this );
66 break; 66 break;
67 67
68 case DLT_PRISM_HEADER: 68 case DLT_PRISM_HEADER:
69 qDebug( "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" ); 69 qDebug( "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" );
70 new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this ); 70 new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this );
71 break; 71 break;
72 72
73 default: 73 default:
74 qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink '%s'!", datalink ); 74 qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink (type %d)!", datalink );
75 } 75 }
76} 76}
77 77
78 78
79OPacket::~OPacket() 79OPacket::~OPacket()
80{ 80{
81} 81}
82 82
83 83
84timevalstruct OPacket::timeval() const 84timevalstruct OPacket::timeval() const
85{ 85{
86 return _hdr.ts; 86 return _hdr.ts;