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

Module netutils

source code

miscellaneous network functions.


Version: $Rev: 7056 $

Classes [hide private]
  RoutingTable
Functions [hide private]
 
find_all_interface_names()
Find the names of all available network interfaces
source code
 
get_address_for_interface(ifname)
Get the IP address for an interface
source code
 
guess_public_ip()
Attempt to guess a public IP for this system.
source code
 
guess_public_hostname()
Attempt to guess a public hostname for this system.
source code
 
ipv4StringToInt(s) source code
 
ipv4IntToString(n) source code
 
countTrailingZeroes32(n) source code
 
addressGetHost(a)
Get the host name of an IPv4 address.
source code
 
addressGetPort(a)
Get the port number of an IPv4 address.
source code
integer or None
tryPort(port=0)
Checks if the given port is unused
source code
Function Details [hide private]

guess_public_ip()

source code 

Attempt to guess a public IP for this system. Returns "127.0.0.1" if it can't come up with anything better.

addressGetHost(a)

source code 

Get the host name of an IPv4 address.

Parameters:
  • a (twisted.internet.address.IPv4Address)

addressGetPort(a)

source code 

Get the port number of an IPv4 address.

Parameters:
  • a (twisted.internet.address.IPv4Address)

tryPort(port=0)

source code 

Checks if the given port is unused

Parameters:
  • port (integer) - the port number or 0 for a random port
Returns: integer or None
port number or None if in use