src/network/utils/mac64-address.h
changeset 9946 df4a7e93c13d
parent 7385 10beb0e53130
child 10416 b22e9f50a0da
equal deleted inserted replaced
9945:9a867fd76097 9946:df4a7e93c13d
    20 #ifndef MAC64_ADDRESS_H
    20 #ifndef MAC64_ADDRESS_H
    21 #define MAC64_ADDRESS_H
    21 #define MAC64_ADDRESS_H
    22 
    22 
    23 #include <stdint.h>
    23 #include <stdint.h>
    24 #include <ostream>
    24 #include <ostream>
       
    25 #include "ns3/attribute.h"
       
    26 #include "ns3/attribute-helper.h"
       
    27 #include "ipv4-address.h"
       
    28 #include "ipv6-address.h"
    25 
    29 
    26 namespace ns3 {
    30 namespace ns3 {
    27 
    31 
    28 class Address;
    32 class Address;
    29 
    33 
    87    *
    91    *
    88    * Convert an instance of this class to a polymorphic Address instance.
    92    * Convert an instance of this class to a polymorphic Address instance.
    89    */
    93    */
    90   Address ConvertTo (void) const;
    94   Address ConvertTo (void) const;
    91   static uint8_t GetType (void);
    95   static uint8_t GetType (void);
       
    96   friend bool operator < (const Mac64Address &a, const Mac64Address &b);
       
    97   friend bool operator == (const Mac64Address &a, const Mac64Address &b);
       
    98   friend bool operator != (const Mac64Address &a, const Mac64Address &b);
       
    99   friend std::istream& operator>> (std::istream& is, Mac64Address & address);
       
   100 
    92   uint8_t m_address[8];
   101   uint8_t m_address[8];
    93 };
   102 };
    94 
   103 
    95 bool operator == (const Mac64Address &a, const Mac64Address &b);
   104 /**
    96 bool operator != (const Mac64Address &a, const Mac64Address &b);
   105  * \class ns3::Mac64AddressValue
       
   106  * \brief hold objects of type ns3::Mac64Address
       
   107  */
       
   108 
       
   109 ATTRIBUTE_HELPER_HEADER (Mac64Address);
       
   110 
       
   111 inline bool operator == (const Mac64Address &a, const Mac64Address &b)
       
   112 {
       
   113   return memcmp (a.m_address, b.m_address, 8) == 0;
       
   114 }
       
   115 inline bool operator != (const Mac64Address &a, const Mac64Address &b)
       
   116 {
       
   117   return memcmp (a.m_address, b.m_address, 8) != 0;
       
   118 }
       
   119 inline bool operator < (const Mac64Address &a, const Mac64Address &b)
       
   120 {
       
   121   return memcmp (a.m_address, b.m_address, 8) < 0;
       
   122 }
       
   123 
    97 std::ostream& operator<< (std::ostream& os, const Mac64Address & address);
   124 std::ostream& operator<< (std::ostream& os, const Mac64Address & address);
       
   125 std::istream& operator>> (std::istream& is, Mac64Address & address);
    98 
   126 
    99 } // namespace ns3
   127 } // namespace ns3
   100 
   128 
   101 #endif /* MAC64_ADDRESS_H */
   129 #endif /* MAC64_ADDRESS_H */