Very basic support for all common operations performed on each network
type.
There are usually subclasses for each address type that over-ride
methods implemented here to optimise their performance and add additional
features.
|
__init__(self,
width,
word_size,
delimiter,
word_fmt=' %x ' ,
addr_type=0,
hex_words=True,
to_upper=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
__repr__(self)
Returns:
An executable Python statement that can recreate an object with an
equivalent state. |
source code
|
|
|
valid_bits(self,
bits)
Returns:
True if network address is valid for this address type,
False otherwise. |
source code
|
|
|
bits_to_int(self,
bits)
Returns:
A network byte order integer that is equivalent to value represented
by network address in readable binary form. |
source code
|
|
|
bits_to_str(self,
bits)
Returns:
A network address in string form that is equivalent to value
represented by network address in readable binary form. |
source code
|
|
|
bits_to_words(self,
bits)
Returns:
An integer word sequence that is equivalent to value represented by
network address in readable binary form. |
source code
|
|
|
valid_int(self,
int_val)
Returns:
True if network byte order integer falls within the
boundaries of this address type, False otherwise. |
source code
|
|
|
int_to_str(self,
int_val)
Returns:
A network address in string form that is equivalent to value
represented by a network byte order integer. |
source code
|
|
|
int_to_bits(self,
int_val)
Returns:
A network address in readable binary form that is equivalent to value
represented by a network byte order integer. |
source code
|
|
|
int_to_words(self,
int_val)
Returns:
An integer word sequence that is equivalent to value represented by a
network byte order integer. |
source code
|
|
|
valid_str(self,
addr)
Returns:
True if network address in string form is valid for this
address type, False otherwise. |
source code
|
|
|
str_to_int(self,
addr)
Returns:
A network byte order integer that is equivalent to value represented
by network address in string form. |
source code
|
|
|
str_to_bits(self,
addr)
Returns:
A network address in readable binary form that is equivalent to value
represented by network address in string form. |
source code
|
|
|
str_to_words(self,
addr)
Returns:
An integer word sequence that is equivalent in value to the network
address in string form. |
source code
|
|
|
valid_words(self,
words)
Returns:
True if word sequence is valid for this address type,
False otherwise. |
source code
|
|
|
words_to_int(self,
words)
Returns:
A network byte order integer that is equivalent to value represented
by word sequence. |
source code
|
|
|
words_to_str(self,
words)
Returns:
A network address in string form that is equivalent to value
represented by word sequence. |
source code
|
|
|
words_to_bits(self,
words)
Returns:
A network address in readable binary form that is equivalent to value
represented by word sequence. |
source code
|
|
|
word_to_bits(self,
int_val)
Returns:
An integer word value for this address type in a fixed width readable
binary form. |
source code
|
|
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__str__
|