mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-21 02:37:16 +01:00
data format version 7; auto-upgrade transformations
This commit is contained in:
parent
f1d1f493d7
commit
a50ddd5c87
2
VERSION
2
VERSION
@ -32,7 +32,7 @@ LIBFWBUILDER_SOLIB_SYMLINK2_VERSION=${LIBFWBUILDER_CURRENT}
|
||||
|
||||
|
||||
# Data format version
|
||||
FWBUILDER_XML_VERSION=6
|
||||
FWBUILDER_XML_VERSION=7
|
||||
|
||||
# RELEASE="1"
|
||||
RELEASE="b@BUILD_NUM@"
|
||||
|
||||
@ -83,7 +83,7 @@ TODO:
|
||||
<!ELEMENT FWObjectDatabase (Library*)>
|
||||
<!ATTLIST FWObjectDatabase
|
||||
xmlns CDATA #FIXED "http://www.fwbuilder.org/1.0/"
|
||||
version %STRING; #FIXED "6"
|
||||
version %STRING; #FIXED "7"
|
||||
lastModified %NUMBER; #IMPLIED
|
||||
id ID #REQUIRED
|
||||
>
|
||||
|
||||
@ -6,11 +6,6 @@
|
||||
Version: 1.0.0
|
||||
Description: translates fwbuilder object database from v4 to 5
|
||||
Adds attribute name to Policy, NAT and Routing.
|
||||
Move branch rule sets from under PolicyRule to under
|
||||
Firewall.
|
||||
Change name of the branch ruleset to be equal to its ID
|
||||
(it is too difficult to use the name
|
||||
which is stored as PolicyRuleOptions/Option)
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
@ -29,70 +24,6 @@
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:Firewall" mode="copy">
|
||||
<xsl:element name="Firewall" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:NAT" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Policy" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
|
||||
<xsl:for-each select="fwb:Policy/fwb:PolicyRule/fwb:Policy">
|
||||
<xsl:variable name="branch_name"
|
||||
select="../fwb:PolicyRuleOptions/fwb:Option[@name='branch_name']"/>
|
||||
<xsl:element name="Policy" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:attribute name="name"><xsl:value-of select="$branch_name"/></xsl:attribute>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
|
||||
<xsl:apply-templates select="fwb:Routing" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Interface" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Management" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:FirewallOptions" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:PolicyRule" mode="copy">
|
||||
<xsl:element name="PolicyRule" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Src|fwb:Dst|fwb:Srv|fwb:Itf|fwb:When" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:for-each select="fwb:PolicyRuleOptions">
|
||||
<xsl:element name="PolicyRuleOptions" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:apply-templates mode="copy"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:Policy" mode="copy">
|
||||
<xsl:element name="Policy" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
@ -123,6 +54,18 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:PolicyRule/fwb:Policy" mode="copy">
|
||||
<xsl:variable name="branch_name"
|
||||
select="../fwb:PolicyRuleOptions/fwb:Option[@name='branch_name']"/>
|
||||
<xsl:element name="Policy" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:attribute name="name"><xsl:value-of select="$branch_name"/></xsl:attribute>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*[attribute::id='root']">
|
||||
<FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:attribute name="version">5</xsl:attribute>
|
||||
|
||||
@ -5,7 +5,9 @@
|
||||
Last changed: 05/11/2008
|
||||
Version: 1.0.0
|
||||
Description: translates fwbuilder object database from v5 to 6
|
||||
Adds tree branch for the UserService objects
|
||||
Move branch rule sets from under PolicyRule to under
|
||||
Firewall.
|
||||
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
@ -24,25 +26,94 @@
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:ServiceGroup[local-name(parent::*)='Library']"
|
||||
mode="copy">
|
||||
<xsl:variable name="parent_id" select="@id"/>
|
||||
<xsl:element name="ServiceGroup" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:template match="fwb:Firewall" mode="copy">
|
||||
<xsl:element name="Firewall" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:NAT" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:element name="ServiceGroup" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:attribute name="id"><xsl:value-of select="$parent_id"/>_userservices</xsl:attribute>
|
||||
<xsl:attribute name="name">User</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Policy" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
|
||||
<xsl:for-each select="fwb:Policy/fwb:PolicyRule/fwb:Policy/fwb:PolicyRule/fwb:Policy">
|
||||
<xsl:element name="Policy" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
|
||||
<xsl:for-each select="fwb:Policy/fwb:PolicyRule/fwb:Policy">
|
||||
<xsl:element name="Policy" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
|
||||
<xsl:apply-templates select="fwb:Routing" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Interface" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Management" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:FirewallOptions" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:PolicyRule" mode="copy">
|
||||
<xsl:element name="PolicyRule" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="fwb:Src|fwb:Dst|fwb:Srv|fwb:Itf|fwb:When" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:for-each select="fwb:PolicyRuleOptions">
|
||||
<xsl:element name="PolicyRuleOptions" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:apply-templates mode="copy"/>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:Policy" mode="copy">
|
||||
<xsl:element name="Policy" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:attribute name="name">Policy</xsl:attribute>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="*[attribute::id='root']">
|
||||
<FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:attribute name="version">6</xsl:attribute>
|
||||
|
||||
64
migration/FWObjectDatabase_6.xslt
Normal file
64
migration/FWObjectDatabase_6.xslt
Normal file
@ -0,0 +1,64 @@
|
||||
<!--
|
||||
Filename: FWObjectDatabase_6.xslt
|
||||
Author: Vadim Kurland
|
||||
Build date: 05/11/2008
|
||||
Last changed: 05/11/2008
|
||||
Version: 1.0.0
|
||||
Description: translates fwbuilder object database from v6 to 7
|
||||
Adds tree branch for the UserService objects
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fwb="http://www.fwbuilder.org/1.0/"
|
||||
exclude-result-prefixes="fwb">
|
||||
|
||||
|
||||
<xsl:output method="xml" version="1.0"
|
||||
doctype-system="fwbuilder.dtd" indent="yes" encoding="utf-8"/>
|
||||
|
||||
<xsl:template match="*" mode="copy">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:apply-templates mode="copy"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fwb:ServiceGroup[local-name(parent::*)='Library']"
|
||||
mode="copy">
|
||||
<xsl:variable name="parent_id" select="@id"/>
|
||||
<xsl:element name="ServiceGroup" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:copy-of select="@*"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="fwb:ServiceGroup[@name='User']">
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:element name="ServiceGroup" namespace="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:attribute name="id"><xsl:value-of select="$parent_id"/>_userservices</xsl:attribute>
|
||||
<xsl:attribute name="name">User</xsl:attribute>
|
||||
</xsl:element>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*[attribute::id='root']">
|
||||
<FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/">
|
||||
<xsl:attribute name="version">7</xsl:attribute>
|
||||
<xsl:attribute name="id">root</xsl:attribute>
|
||||
<xsl:apply-templates select="*" mode="copy"/>
|
||||
</FWObjectDatabase>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
@ -75,7 +75,8 @@ target.files = FWObjectDatabase_0.8.7.xslt \
|
||||
FWObjectDatabase_2.1.99.xslt \
|
||||
FWObjectDatabase_3.xslt \
|
||||
FWObjectDatabase_4.xslt \
|
||||
FWObjectDatabase_5.xslt
|
||||
FWObjectDatabase_5.xslt \
|
||||
FWObjectDatabase_6.xslt
|
||||
|
||||
|
||||
#INSTALLS -= target
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#define LIBFWBUILDER_VERSION "3.0.0"
|
||||
#define LIBFWBUILDER_FORMAT_VERSION "6"
|
||||
#define LIBFWBUILDER_FORMAT_VERSION "7"
|
||||
|
||||
@ -213,7 +213,7 @@ string Compiler::createRuleLabel(const std::string &prefix,
|
||||
{
|
||||
ostringstream str;
|
||||
|
||||
str << prefix << " ";
|
||||
if (!prefix.empty()) str << prefix << " ";
|
||||
str << rule_num << " ";
|
||||
str << "(" << txt << ")";
|
||||
return str.str();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user