• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Config XML parser in Delphi/FreePascal

Scheduled Pinned Locked Moved Development
1 Posts 1 Posters 3.6k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    JorgeAldoBR
    last edited by Oct 8, 2010, 12:31 PM Oct 8, 2010, 12:24 PM

    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';

    or directly

    myparsedxmlfile.findbydom('pfsense.interfaces.wan.ipaddr') := '192.168.1.2';

    etc

    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.

    1 Reply Last reply Reply Quote 0
    1 out of 1
    • First post
      1/1
      Last post
    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
      This community forum collects and processes your personal information.
      consent.not_received