Config XML parser in Delphi/FreePascal
Ive developed a parser for Config.XML (Actually a generic XML parser) that is quite easy to use.
You parse the XML file with some calls, the result is a tree.
You find data by DOM :
node := MyParsedXMLFile.FindByDOM('pfsense.interfaces.wan');
returns a pointer to the wan section of configuration etc.
Text is returned/changed by
node.text := 'something';
myparsedxmlfile.findbydom('pfsense.interfaces.wan.ipaddr') := '192.168.1.2';
you can save the XML back using myparsedxmlfile.asxml (returns a xml file as a big string wich you can use anywhere you want)
i'm using it to develop a tool that connects to pfsense box, downloads the configuration file, configures the load balancer, uploads the configuration file back to pfsense and then reboots it.
if anyone is interested, contact me.
i can use this to develop console tools for pfsense, if needed.
for one i can replace interface configurator with one that can take load balancing into account, etc.
my current project is able to detect non-lan interfaces (potential wans), setup nat rules, setup load balance pools, setup firewall load balancing rules for each client (ip by ip) etc, distributing each client according to a weight given to each wan (if each client consumes 128kb, then a link with 1mb can handle more clients than a link with 512kb… etc).
Rules are based on failover, ie: If all links are up, client A goes thru link 1, else fails over to link 2 etc.