summaryrefslogtreecommitdiff
path: root/netfs/fuseConfig.cpp
blob: 4030738d48e31632e44803d48e9fbf755c5611a2 (plain)
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
#include "pchFuse.hpp"
#include "fuseConfig.h"
#include <string.h>

FuseConfigPtr
FuseConfig::Load(const std::string & path)
{
	xmlDoc * doc = xmlReadFile(path.c_str(), NULL, 0);
	FuseConfigPtr dc = new FuseConfig(doc->children);
	xmlFreeDoc(doc);
	return dc;
}

FuseConfig::FuseConfig(xmlNodePtr conf)
{
	foreachxml(exp, xmlGetNode(conf, "exports"), "export") {
		ExportPtr e = new Export(exp);
		exports[e->name] = e;
	}
}

FuseConfig::Export::Export(xmlNodePtr conf) :
	name(xmlGetNodeValue(conf, "name"))
{
	foreachxml(ep, xmlGetNode(conf, "endpoints"), "endpoint") {
		endpoints.insert(xmlGetNodeValue(ep));
	}
}