Package netaddr :: Module strategy :: Class AddrStrategy
[frames] | no frames]

Class AddrStrategy

source code

object --+
         |
        AddrStrategy
Known Subclasses:

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.

Instance Methods
 
__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
 
valid_bits(self, bits)
Returns True if network address in readable binary form 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
 
description(self)
Returns description string detailing setup of this AddrStrategy instance.
source code

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

Properties

Inherited from object: __class__

Method Details

__init__(self, width, word_size, delimiter, word_fmt='%x', addr_type=0, hex_words=True, to_upper=False)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

description(self)

source code 

Returns description string detailing setup of this AddrStrategy instance. Useful for debugging.