diff options
Diffstat (limited to 'Swiften/Network/UnixNetworkEnvironment.h')
-rw-r--r-- | Swiften/Network/UnixNetworkEnvironment.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Swiften/Network/UnixNetworkEnvironment.h b/Swiften/Network/UnixNetworkEnvironment.h new file mode 100644 index 0000000..e4b2f37 --- /dev/null +++ b/Swiften/Network/UnixNetworkEnvironment.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <vector> + +#include <Swiften/Base/boost_bsignals.h> + +#include <Swiften/Network/NetworkEnvironment.h> +#include <Swiften/Network/NetworkInterface.h> + +namespace Swift { + +class UnixNetworkEnvironment : public NetworkEnvironment { + class UnixNetworkInterface : public NetworkInterface { + public: + typedef boost::shared_ptr<UnixNetworkInterface> ref; + + public: + UnixNetworkInterface(std::string name) : name(name), loopback(false) { } + + std::vector<HostAddress> getAddresses() { + return addresses; + } + + std::string getName() { + return name; + } + + bool isLoopback() { + return loopback; + } + + private: + void addHostAddress(HostAddress address) { + addresses.push_back(address); + } + + void setLoopback(bool loopback) { + this->loopback = loopback; + } + + private: + friend class UnixNetworkEnvironment; + std::vector<HostAddress> addresses; + std::string name; + InterfaceType type; + bool loopback; + }; + +public: + std::vector<NetworkInterface::ref> getNetworkInterfaces(); +}; + +} |