summaryrefslogtreecommitdiff
path: root/netfs/fuseConfig.cpp
blob: ec364cf007ce26743a878a68b7b7a273e90df4f5 (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
#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));
	}
}