00001 /* 00002 * File: NetInterface.h 00003 * Author: morgenro 00004 * 00005 * Created on 12. November 2009, 14:57 00006 */ 00007 00008 #ifndef IBRCOMMON_NETINTERFACE_H 00009 #define IBRCOMMON_NETINTERFACE_H 00010 00011 #include <netinet/in.h> 00012 #include <iostream> 00013 00014 /* Move to a better place */ 00015 #include "ibrcommon/net/ieee802154.h" 00016 #include "ibrcommon/net/nl802154.h" 00017 00018 namespace ibrcommon 00019 { 00020 class NetInterface 00021 { 00022 public: 00023 NetInterface(std::string interface); 00024 virtual ~NetInterface(); 00025 00026 std::string getInterface() const; 00027 std::string getAddress() const; 00028 std::string getBroadcast() const; 00029 00030 void getAddress(struct in_addr *ret) const; 00031 void getAddress(struct ieee802154_addr *ret) const; 00032 00033 void getBroadcast(struct in_addr *ret) const; 00034 00035 bool operator<(const NetInterface&) const; 00036 bool operator==(const NetInterface&) const; 00037 00038 private: 00039 static void getAddress(std::string interface, struct in_addr *ret); 00040 static void getAddress(std::string interface, struct ieee802154_addr *ret); 00041 static void getBroadcast(std::string interface, struct in_addr *ret); 00042 00043 static std::string getAddress(std::string interface); 00044 static std::string getBroadcast(std::string interface); 00045 00046 std::string _interface; 00047 }; 00048 } 00049 00050 #endif /* _NETINTERFACE_H */ 00051
1.6.3