IBR-DTNSuite
0.8
|
00001 /* 00002 * vinterface.cpp 00003 * 00004 * Created on: 14.12.2010 00005 * Author: morgenro 00006 */ 00007 00008 #include "ibrcommon/config.h" 00009 #include "ibrcommon/net/vinterface.h" 00010 #include "ibrcommon/net/vsocket.h" 00011 #include "ibrcommon/net/LinkManager.h" 00012 00013 namespace ibrcommon 00014 { 00015 vinterface::vinterface() 00016 : _name() 00017 { 00018 } 00019 00020 vinterface::vinterface(std::string name) 00021 : _name(name) 00022 { 00023 } 00024 00025 vinterface::~vinterface() 00026 { 00027 } 00028 00029 const std::string vinterface::toString() const 00030 { 00031 if (_name.length() == 0) return "<any>"; 00032 return _name; 00033 } 00034 00035 const std::list<vaddress> vinterface::getAddresses(const vaddress::Family f) const 00036 { 00037 if (empty()) throw interface_not_set(); 00038 return ibrcommon::LinkManager::getInstance().getAddressList(*this, f); 00039 } 00040 00041 bool vinterface::operator<(const vinterface &obj) const 00042 { 00043 return (_name < obj._name); 00044 } 00045 00046 bool vinterface::operator==(const vinterface &obj) const 00047 { 00048 return (obj._name == _name); 00049 } 00050 00051 bool vinterface::empty() const 00052 { 00053 return (_name.length() == 0); 00054 } 00055 }