-
Notifications
You must be signed in to change notification settings - Fork 3
/
SpaConfig.hpp
42 lines (31 loc) · 1.3 KB
/
SpaConfig.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef RKNOCKD_SPACONFIG_HPP
#define RKNOCLD_SPACONFIG_HPP
#include <libxml++/libxml++.h>
#include "Config.hpp"
namespace Rknockd
{
typedef std::vector<uint8_t> SpaRequestString;
struct SpaRequestPrinter
{
void operator() (std::ostream& os, const SpaRequestString& req) const;
};
struct SpaRequestParser
{
void operator() (SpaRequestString& req, const std::string& str, const Config*) const THROW((ConfigException));
};
class SpaConfig; // forward declaration
typedef Request<SpaRequestString, SpaRequestPrinter, SpaRequestParser, SpaConfig> SpaRequest;
class SpaConfig : public Config
{
public:
SpaConfig(const std::string& filename) THROW((ConfigException));
virtual ~SpaConfig();
const std::vector<SpaRequest>& getRequests() const;
void printConfig(std::ostream& os) const;
private:
void parseRknockdAttrs(const xmlpp::Element* elmt) THROW((ConfigException));
void addRequest(const xmlpp::Element* elmt) THROW((ConfigException));
std::vector<SpaRequest> requests;
};
} // namespace Rknockd
#endif /* RKNOCKD_SPACONFIG_HPP */