Alex Bikfalvi
SimStream Documentation
Address.h
00001 #pragma once 00002 00003 #define ADDRESS_INVALID 0xFFFFFFFF 00004 #define ADDRESS_ANY 0xFFFFFFFE 00005 00006 #define ADDRESS_MCAST_ALL_SYSTEMS 0xE0000001 00007 #define ADDRESS_MCAST_ALL_ROUTERS 0xE0000002 00008 #define ADDRESS_MCAST_PIM_SM 0xE000000D 00009 00010 class CAddress 00011 { 00012 private: 00013 __uint32 address; 00014 00015 public: 00016 CAddress(); 00017 CAddress(__uint32 address); 00018 CAddress(__byte b0, __byte b1, __byte b2, __byte b3); 00019 00020 ~CAddress() { }; 00021 00022 inline __uint32 Address() { return this->address; } 00023 inline bool operator ==(CAddress address) const { return this->address == address.address; } 00024 inline bool operator ==(__uint32 address) const { return this->address == address; } 00025 inline bool operator !=(CAddress address) const { return this->address != address.address; } 00026 inline bool operator !=(__uint32 address) const { return this->address != address; } 00027 inline bool operator <(const CAddress address) const { return this->address < address.address; } 00028 inline bool operator <(const __uint32) const { return this->address < address; } 00029 00030 inline bool IsValid() { return this->address != ADDRESS_INVALID; } 00031 inline bool IsAny() { return this->address == ADDRESS_ANY; } 00032 00033 inline bool IsMulticast() { return (this->address >> 28) == 0xE; } 00034 inline bool IsMulticastGroup() { return (this->address >> 27) == 0x1D; } 00035 inline static __uint32 Multicast(__uint32 group) { return 0xE8000000 | group; } 00036 inline __uint32 MulticastGroup() { return 0x07FFFFFF & this->address; } 00037 00038 static inline CAddress Any() { return CAddress(ADDRESS_ANY); } 00039 };
Last updated: February 8, 2011