Package nattraverso :: Module utils
[show private | hide private]
[frames | no frames]

Module nattraverso.utils

Various utility functions used in the nattraverso package.

Version: 0.1.0

Author: Raphael Slinckx

Contact: raphael@slinckx.net

Copyright: Copyright 2005

License: LGPL

Function Summary
  is_bogus_ip(ip)
Checks if the given ip address is bogus, i.e.
  is_rfc1918_ip(ip)
Checks if the given ip address is a rfc1918 one.
  _ip_to_number(ipstr)
Translate a string ip address to a packed number.

Variable Summary
str __revision__ = '$id'
list _nets = [(2130706432L, 4278190080L), (3232235520L, 42949...
list _rfc1918_networks = [('127', 8), ('192.168', 16), ('10',...

Function Details

is_bogus_ip(ip)

Checks if the given ip address is bogus, i.e. 0.0.0.0 or 127.0.0.1.
Parameters:
ip - The ip address to test
           (type=a string "x.x.x.x")
Returns:
True if it's bogus, False otherwise

is_rfc1918_ip(ip)

Checks if the given ip address is a rfc1918 one.
Parameters:
ip - The ip address to test
           (type=a string "x.x.x.x")
Returns:
True if it's a LAN address, False otherwise

_ip_to_number(ipstr)

Translate a string ip address to a packed number.
Parameters:
ipstr - the ip address to transform
           (type=a string "x.x.x.x")
Returns:
an int32 number representing the ip address

Variable Details

__revision__

Type:
str
Value:
'$id'                                                                  

_nets

Type:
list
Value:
[(2130706432L, 4278190080L),
 (3232235520L, 4294901760L),
 (167772160L, 4278190080L),
 (2886729728L, 4293918720L)]                                           

_rfc1918_networks

Type:
list
Value:
[('127', 8), ('192.168', 16), ('10', 8), ('172.16', 12)]               

Generated by Epydoc 2.1 on Tue Aug 30 14:56:47 2005 http://epydoc.sf.net