summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-09-26 20:44:41 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-09-26 20:45:27 (GMT)
commit4b61e7363dbc0e8bf595da06840db4175e3b86c3 (patch)
treed33f51dec98251cf581da4ced909d07ebb2ecd24 /Swiften/Network/NetworkInterface.h
parentdf957dbaaa42330ff888e42fe6f2d31c01d8129d (diff)
downloadswift-contrib-4b61e7363dbc0e8bf595da06840db4175e3b86c3.zip
swift-contrib-4b61e7363dbc0e8bf595da06840db4175e3b86c3.tar.bz2
Refactoring NetworkEnvironments.
Diffstat (limited to 'Swiften/Network/NetworkInterface.h')
-rw-r--r--Swiften/Network/NetworkInterface.h55
1 files changed, 35 insertions, 20 deletions
diff --git a/Swiften/Network/NetworkInterface.h b/Swiften/Network/NetworkInterface.h
index 062e1f9..6395758 100644
--- a/Swiften/Network/NetworkInterface.h
+++ b/Swiften/Network/NetworkInterface.h
@@ -7,29 +7,44 @@
#pragma once
#include <vector>
-#include <boost/shared_ptr.hpp>
#include <Swiften/Network/HostAddress.h>
namespace Swift {
-
-class NetworkInterface {
-public:
- typedef boost::shared_ptr<NetworkInterface> ref;
-
-public:
- enum InterfaceType {
- WLAN,
- Ethernet,
- Mobile,
- VPN,
+ class NetworkInterface {
+ public:
+ enum Type {
+ Unknown,
+ WLAN,
+ Ethernet,
+ Mobile,
+ VPN,
+ };
+
+ public:
+ NetworkInterface(const std::string& name, bool loopback, Type type = Unknown) : name(name), loopback(loopback), type(type) {
+ }
+
+ void addAddress(const HostAddress& address) {
+ addresses.push_back(address);
+ }
+
+ const std::vector<HostAddress>& getAddresses() const {
+ return addresses;
+ }
+
+ const std::string& getName() const {
+ return name;
+ }
+
+ bool isLoopback() const {
+ return loopback;
+ }
+
+ private:
+ std::string name;
+ bool loopback;
+ Type type;
+ std::vector<HostAddress> addresses;
};
-
-public:
- virtual ~NetworkInterface() {};
- virtual std::vector<HostAddress> getAddresses() = 0;
- virtual std::string getName() = 0;
- virtual bool isLoopback() = 0;
-};
-
}