View | Details | Raw Unified | Return to bug 901
Collapse All | Expand All

(-)a/src/node/mac48-address.cc (-30 lines)
 Lines 221-256    Link Here 
221
  return etherAddr;
221
  return etherAddr;
222
}
222
}
223
223
224
bool operator == (const Mac48Address &a, const Mac48Address &b)
225
{
226
  return memcmp (a.m_address, b.m_address, 6) == 0;
227
}
228
bool operator != (const Mac48Address &a, const Mac48Address &b)
229
{
230
  return ! (a == b);
231
}
232
233
bool operator < (const Mac48Address &a, const Mac48Address &b)
234
{
235
  uint8_t aP[6];
236
  uint8_t bP[6];
237
  a.CopyTo (aP);
238
  b.CopyTo (bP);
239
  for (uint8_t i = 0; i < 6; i++) 
240
    {
241
       if (a.m_address[i] < b.m_address[i]) 
242
        {
243
          return true;
244
        } 
245
       else if (a.m_address[i] > b.m_address[i]) 
246
        {
247
          return false;
248
        }
249
    }
250
  return false;
251
}
252
253
254
std::ostream& operator<< (std::ostream& os, const Mac48Address & address)
224
std::ostream& operator<< (std::ostream& os, const Mac48Address & address)
255
{
225
{
256
  uint8_t ad[6];
226
  uint8_t ad[6];
(-)a/src/node/mac48-address.h (-3 / +14 lines)
 Lines 135-140    Link Here 
135
  static uint8_t GetType (void);
135
  static uint8_t GetType (void);
136
  friend bool operator < (const Mac48Address &a, const Mac48Address &b);
136
  friend bool operator < (const Mac48Address &a, const Mac48Address &b);
137
  friend bool operator == (const Mac48Address &a, const Mac48Address &b);
137
  friend bool operator == (const Mac48Address &a, const Mac48Address &b);
138
  friend bool operator != (const Mac48Address &a, const Mac48Address &b);
138
  friend std::istream& operator>> (std::istream& is, Mac48Address & address);
139
  friend std::istream& operator>> (std::istream& is, Mac48Address & address);
139
140
140
  uint8_t m_address[6];
141
  uint8_t m_address[6];
 Lines 147-155    Link Here 
147
148
148
ATTRIBUTE_HELPER_HEADER (Mac48Address);
149
ATTRIBUTE_HELPER_HEADER (Mac48Address);
149
150
150
bool operator == (const Mac48Address &a, const Mac48Address &b);
151
inline bool operator == (const Mac48Address &a, const Mac48Address &b)
151
bool operator != (const Mac48Address &a, const Mac48Address &b);
152
{
152
bool operator < (const Mac48Address &a, const Mac48Address &b);
153
  return memcmp (a.m_address, b.m_address, 6) == 0;
154
}
155
inline bool operator != (const Mac48Address &a, const Mac48Address &b)
156
{
157
  return memcmp (a.m_address, b.m_address, 6) != 0;
158
}
159
inline bool operator < (const Mac48Address &a, const Mac48Address &b)
160
{
161
  return memcmp (a.m_address, b.m_address, 6) < 0;
162
}
163
153
std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
164
std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
154
std::istream& operator>> (std::istream& is, Mac48Address & address);
165
std::istream& operator>> (std::istream& is, Mac48Address & address);
155
166

Return to bug 901