summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetutils.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp
index 0fb21ff..2485f30 100644
--- a/libopie2/opienet/onetutils.cpp
+++ b/libopie2/opienet/onetutils.cpp
@@ -54,67 +54,67 @@ using namespace std;
54// static initializer for broadcast and unknown MAC Adresses 54// static initializer for broadcast and unknown MAC Adresses
55const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 55const unsigned char __broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
56const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast ); 56const OMacAddress& OMacAddress::broadcast = OMacAddress( __broadcast );
57const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }; 57const unsigned char __unknown[6] = { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 };
58const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown ); 58const OMacAddress& OMacAddress::unknown = OMacAddress( __unknown );
59 59
60 60
61//TODO: Incorporate Ethernet Manufacturer database here! 61//TODO: Incorporate Ethernet Manufacturer database here!
62 62
63OMacAddress::OMacAddress( unsigned char* p ) 63OMacAddress::OMacAddress( unsigned char* p )
64{ 64{
65 memcpy( _bytes, p, 6 ); 65 memcpy( _bytes, p, 6 );
66} 66}
67 67
68 68
69OMacAddress::OMacAddress( const unsigned char* p ) 69OMacAddress::OMacAddress( const unsigned char* p )
70{ 70{
71 memcpy( _bytes, p, 6 ); 71 memcpy( _bytes, p, 6 );
72} 72}
73 73
74 74
75OMacAddress::OMacAddress( struct ifreq& ifr ) 75OMacAddress::OMacAddress( struct ifreq& ifr )
76{ 76{
77 memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 ); 77 memcpy( _bytes, ifr.ifr_hwaddr.sa_data, 6 );
78} 78}
79 79
80 80
81OMacAddress::~OMacAddress() 81OMacAddress::~OMacAddress()
82{ 82{
83} 83}
84 84
85 85
86#ifdef QT_NO_DEBUG 86//#ifdef QT_NO_DEBUG
87inline 87//inline
88#endif 88//#endif
89const unsigned char* OMacAddress::native() const 89const unsigned char* OMacAddress::native() const
90{ 90{
91 return (const unsigned char*) &_bytes; 91 return (const unsigned char*) &_bytes;
92} 92}
93 93
94 94
95OMacAddress OMacAddress::fromString( const QString& str ) 95OMacAddress OMacAddress::fromString( const QString& str )
96{ 96{
97 QString addr( str ); 97 QString addr( str );
98 unsigned char buf[6]; 98 unsigned char buf[6];
99 bool ok = true; 99 bool ok = true;
100 int index = 14; 100 int index = 14;
101 for ( int i = 5; i >= 0; --i ) 101 for ( int i = 5; i >= 0; --i )
102 { 102 {
103 buf[i] = addr.right( 2 ).toUShort( &ok, 16 ); 103 buf[i] = addr.right( 2 ).toUShort( &ok, 16 );
104 if ( !ok ) return OMacAddress::unknown; 104 if ( !ok ) return OMacAddress::unknown;
105 addr.truncate( index ); 105 addr.truncate( index );
106 index -= 3; 106 index -= 3;
107 } 107 }
108 return (const unsigned char*) &buf; 108 return (const unsigned char*) &buf;
109} 109}
110 110
111 111
112QString OMacAddress::toString() const 112QString OMacAddress::toString() const
113{ 113{
114 QString s; 114 QString s;
115 s.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", 115 s.sprintf( "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
116 _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff, 116 _bytes[0]&0xff, _bytes[1]&0xff, _bytes[2]&0xff,
117 _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff ); 117 _bytes[3]&0xff, _bytes[4]&0xff, _bytes[5]&0xff );
118 return s; 118 return s;
119} 119}
120 120