2011-09-13 21:26:12 +02:00
|
|
|
// ndppd - NDP Proxy Daemon
|
2012-01-26 11:21:07 +01:00
|
|
|
// Copyright (C) 2011 Daniel Adolfsson <daniel@priv.nu>
|
2011-09-13 21:26:12 +02:00
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2012-01-31 20:17:19 +01:00
|
|
|
#pragma once
|
2011-09-13 21:26:12 +02:00
|
|
|
|
|
|
|
#include <string>
|
2012-01-31 23:53:45 +01:00
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2011-09-13 21:26:12 +02:00
|
|
|
#include <cstdarg>
|
|
|
|
|
|
|
|
#include "ndppd.h"
|
|
|
|
|
2012-01-31 20:17:19 +01:00
|
|
|
NDPPD_NS_BEGIN
|
2011-09-13 21:26:12 +02:00
|
|
|
|
|
|
|
class conf
|
|
|
|
{
|
2012-01-31 23:53:45 +01:00
|
|
|
public:
|
|
|
|
|
2011-09-13 21:26:12 +02:00
|
|
|
private:
|
2012-01-31 23:53:45 +01:00
|
|
|
std::string _value;
|
|
|
|
|
|
|
|
bool _is_block;
|
|
|
|
|
|
|
|
std::multimap<std::string, std::shared_ptr<conf> > _map;
|
|
|
|
|
|
|
|
void dump(logger &l, int level) const;
|
|
|
|
|
|
|
|
static const char *skip(const char *str, bool all = true);
|
|
|
|
|
|
|
|
bool parse_block(const char **str);
|
|
|
|
|
|
|
|
bool parse(const char **str);
|
|
|
|
|
2011-09-13 21:26:12 +02:00
|
|
|
public:
|
2012-01-31 23:53:45 +01:00
|
|
|
conf();
|
|
|
|
|
|
|
|
const std::string &value() const;
|
|
|
|
|
|
|
|
bool bool_value() const;
|
|
|
|
|
|
|
|
int int_value() const;
|
|
|
|
|
|
|
|
void value(const std::string &value);
|
|
|
|
|
|
|
|
static std::shared_ptr<conf> load(const std::string &path);
|
|
|
|
|
|
|
|
bool is_block() const;
|
|
|
|
|
|
|
|
std::shared_ptr<conf> operator[](const std::string &name) const;
|
|
|
|
std::vector<std::shared_ptr<conf> > find(const std::string &name) const;
|
|
|
|
|
|
|
|
void dump() const;
|
|
|
|
|
|
|
|
operator const std::string&();
|
|
|
|
|
2011-09-13 21:26:12 +02:00
|
|
|
};
|
|
|
|
|
2012-01-31 20:17:19 +01:00
|
|
|
NDPPD_NS_END
|