0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00
openvpn3/openvpn/common/mode.hpp
James Yonan 7371bd8e14 First working version of cli that can be entirely driven from config
file.  Currently limited to UDP, runs only on Linux, and supports
pushed redirect-gateway but not route directives.
2011-12-18 10:50:08 +00:00

48 lines
780 B
C++

#ifndef OPENVPN_COMMON_MODE_H
#define OPENVPN_COMMON_MODE_H
namespace openvpn {
class Mode
{
public:
enum Type {
CLIENT,
SERVER,
};
Mode() : type_(CLIENT) {}
explicit Mode(const Type t) : type_(t) {}
bool is_server() const { return type_ == SERVER; }
bool is_client() const { return type_ == CLIENT; }
bool operator==(const Mode& other)
{
return type_ == other.type_;
}
bool operator!=(const Mode& other)
{
return type_ != other.type_;
}
const char *str() const
{
switch (type_)
{
case CLIENT:
return "CLIENT";
case SERVER:
return "SERVER";
default:
return "UNDEF_MODE";
}
}
private:
Type type_;
};
} // namespace openvpn
#endif // OPENVPN_COMMON_MODE_H