Table of Contents

Module: _rulesutils daxfi/_rulesutils.py

_rulesutils module (daxfi package).

This module provide utilities for the RuleBuilder and Rule classes.

Copyright 2001, 2002 Davide Alberani <alberanid@libero.it>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Imported modules   
from daxfi import iplib
from daxfi._exceptions import *
from daxfi._syslog import *
import imp
import os
import re
import socket
import types
from xml.dom import Node
from xml.dom.NodeFilter import NodeFilter
from xml.dom.NodeIterator import NodeIterator
Functions   
_compare_attrs
_compare_children
compare_dom
flat_print_attrs
get_C_module_name
import_C_module
modify_dom
set_dom_defaults
transf_fatal
transf_icmp
transf_ip
transf_normalize
transf_port
transf_proto
transf_remove
transf_remove_section
transf_sort
  _compare_attrs 
_compare_attrs ( a1,  a2 )

Compare two lists of attributes.

  _compare_children 
_compare_children ( c1,  c2 )

Compare two list of children nodes.

  compare_dom 
compare_dom ( a,  b )

Compare two DOMs.

Given two DOMs, return 0 if they are equals.

  flat_print_attrs 
flat_print_attrs ( opt )

Return a string that is a space sparated list of the attribute values in the given XML.

  get_C_module_name 
get_C_module_name ( n )

Return the expected name of the C module for the given firewall.

  import_C_module 
import_C_module ( modname )

Import a C module; if the module doesn't exists, a fake module is returned.

  modify_dom 
modify_dom (
        dom,
        convAttributes={},
        convSections={},
        forEveryAttribute=None,
        )

Modify a given DOM object. convAttributes is a dictionary used to modify the attributes, convSections is used to manage sections and forEveryAttribute is a function to be applied to every attribute.

  set_dom_defaults 
set_dom_defaults ( dom,  defaults )

Set given default values in a DOM.

  transf_fatal 
transf_fatal ( v )

Raise an exception because a rule with this option/extension cannot be built with the currently used firewall.

Exceptions   
CreateRulesError, 'Cannot insert a key in a rule for ' + 'this firewall'
  transf_icmp 
transf_icmp ( v )

Return a numeric representation of icmp type/code.

  transf_ip 
transf_ip ( v )

Manage IP address.

Return an IP in dotted notation with the right netmask.

Exceptions   
RemoveOptionError, 'remove the default value'
  transf_normalize 
transf_normalize ( v )

Check for a space after an exclamation mark.

  transf_port 
transf_port ( v )

Return the port number.

Given a port name, return the protocol number.

Exceptions   
RemoveOptionError, 'remove the default value'
  transf_proto 
transf_proto ( v )

Return the protocol number.

Given a protocol name, return the protocol number.

  transf_remove 
transf_remove ( v )

Simply remove an entry.

Exceptions   
RemoveOptionError, 'remove this option'
  transf_remove_section 
transf_remove_section ( d )

Raise an exception that force the modify_option function to completely discard the current section.

Exceptions   
RemoveSectionError, 'cannot use this extension with this firewall'
  transf_sort 
transf_sort ( v )

For options that need to be sorted.

Given a string with comma separated items, these items are sorted; if portions of the string are sparated by slashes, the order of these groups is preserved.

Classes   
NodeFilterByElementName

Filter for NodeIterator.


Table of Contents

This document was automatically generated on Tue Apr 16 19:50:50 2002 by HappyDoc version r1_5