0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00

Added LoadMode enum on Listen::List constructor that supports

empty construction via AllowEmpty.
This commit is contained in:
James Yonan 2015-09-02 03:20:12 -07:00
parent 3e4078c9a1
commit e0a51ad181

View File

@ -60,6 +60,12 @@ namespace openvpn {
class List : public std::vector<Item>
{
public:
enum LoadMode {
Nominal,
AllowDefault,
AllowEmpty
};
List() {}
List(const Item& item)
@ -74,7 +80,7 @@ namespace openvpn {
List(const OptionList& opt,
const std::string& directive,
const bool allow_default,
const LoadMode load_mode,
const unsigned int n_cores)
{
size_t n_listen = 0;
@ -136,7 +142,7 @@ namespace openvpn {
}
}
}
else if (allow_default)
else if (load_mode == AllowDefault)
{
Item e;
@ -183,7 +189,7 @@ namespace openvpn {
push_back(std::move(e));
}
else
else if (load_mode != AllowEmpty)
OPENVPN_THROW(option_error, "no " << directive << " directives found");
}