Basically this implement the routines to read an netcf XML definition
and build the associated internal data structures. It does the checking
of the input XML up to making sure all the needed informations are
availble in the right place, but does not check for extra data. It
should support the full format as defined by interface.rng as of netcf
version 0.1.0, both for input and output.
This is rather repetitive and boring code, so I tried to factorize
things following patterms similar to the one used in the grammar,
the code reflects to a large extent the definition blocks there.
The main data structure is virInterfaceDef, it defines the most
common and shared attributes of all interfaces, the protocol definition
allowed in the schemas is only ipv4 at the moment but with the expected
extension to allow ipv6 in parallel I made a separate structure
(currently embedded in the main one). There is a enum discriminating the
specific structures needed for vlan, bride and bonding, and for the two
last ones, a dynamically allocated array of bare interfaces (which can
be of vlan or ethernet type, merged into a single structure).
This passes valgrind, but since I'm not testing agaisnt misformed
XML input I afraid of potential leaks on exit paths, otherwise this
should be fine.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/