Package flumotion :: Package common :: Module netutils :: Class RoutingTable
[hide private]

Class RoutingTable

source code

object --+
         |
        RoutingTable

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getRouteNames(self) source code
 
_parseSubnet(self, ipv4String, maskBits) source code
 
addSubnet(self, route, ipv4String, maskBits=32) source code
 
removeSubnet(self, route, ipv4String, maskBits=32) source code
 
__iter__(self) source code
 
iterHumanReadable(self) source code
 
__len__(self) source code
 
route(self, ip)
Return the preferred route for this IP.
source code
 
route_iter(self, ip)
Return an iterator yielding routes in order of preference.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods [hide private]
 
fromFile(klass, f, requireNames=True, defaultRouteName='*default*')
Make a new routing table, populated from entries in an open file object.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

fromFile(klass, f, requireNames=True, defaultRouteName='*default*')
Class Method

source code 

Make a new routing table, populated from entries in an open file object.

The entries are expected to have the form: IP-ADDRESS/MASK-BITS ROUTE-NAME

The `#' character denotes a comment. Empty lines are allowed.

Parameters:
  • f (open file object) - file from whence to read a routing table
  • requireNames (boolean, default to True) - whether to require route names in the file
  • defaultRouteName (anything, defaults to '*default*') - default name to give to a route if it does not have a name in the file; only used if requireNames is False

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

route(self, ip)

source code 

Return the preferred route for this IP.

Parameters:
  • ip (An integer or string representing an IPv4 address) - The IP to use for routing decisions.

route_iter(self, ip)

source code 

Return an iterator yielding routes in order of preference.

Parameters:
  • ip (An integer or string representing an IPv4 address) - The IP to use for routing decisions.