Package netaddr :: Package strategy :: Module ipv6
[hide private]
[frames] | no frames]

Module ipv6

IPv6 address logic.

Classes [hide private]
  ipv6_compact
An IPv6 dialect class - compact form.
  ipv6_full
An IPv6 dialect class - 'all zeroes' form.
  ipv6_verbose
An IPv6 dialect class - extra wide 'all zeroes' form.
Functions [hide private]
 
valid_str(addr, flags=0)
Returns: True if IPv6 address is valid, False otherwise.
 
str_to_int(addr, flags=0)
Returns: The equivalent unsigned integer for a given IPv6 address.
 
int_to_str(int_val, dialect=None)
Returns: The IPv6 presentation (string) format address equivalent to the unsigned integer provided.
 
int_to_arpa(int_val)
Returns: The reverse DNS lookup for an IPv6 address in network byte order integer form.
 
int_to_packed(int_val)
Returns: a packed string that is equivalent to value represented by an unsigned integer.
 
packed_to_int(packed_int)
Returns: An unsigned integer equivalent to value of network address represented by packed binary string.
 
valid_words(words)
 
int_to_words(int_val, num_words=None, word_size=None)
 
words_to_int(words)
 
valid_bits(bits)
 
bits_to_int(bits)
 
int_to_bits(int_val, word_sep=None)
 
valid_bin(bin_val)
 
int_to_bin(int_val)
 
bin_to_int(bin_val)
Variables [hide private]
  OPT_IMPORTS = True
  width = 128
  word_size = 16
  word_sep = ':'
  family = 23
  family_name = 'IPv6'
  version = 6
  word_base = 16
  max_int = 340282366920938463463374607431768211455
  num_words = 8
  max_word = 65535
  prefix_to_netmask = {0: 0, 1: 17014118346046923173168730371588...
  netmask_to_prefix = {0: 0, 17014118346046923173168730371588410...
  prefix_to_hostmask = {0: 3402823669209384634633746074317682114...
  hostmask_to_prefix = {0: 128, 1: 127, 3: 126, 7: 125, 15: 124,...
  __package__ = 'netaddr.strategy'
  i = 128
Function Details [hide private]

valid_str(addr, flags=0)

 
Parameters:
  • addr - An IPv6 address in presentation (string) format.
  • flags - decides which rules are applied to the interpretation of the addr value. Future use - currently has no effect.
Returns:
True if IPv6 address is valid, False otherwise.

str_to_int(addr, flags=0)

 
Parameters:
  • addr - An IPv6 address in string form.
  • flags - decides which rules are applied to the interpretation of the addr value. Future use - currently has no effect.
Returns:
The equivalent unsigned integer for a given IPv6 address.

int_to_str(int_val, dialect=None)

 
Parameters:
  • int_val - An unsigned integer.
  • dialect - (optional) a Python class defining formatting options.
Returns:
The IPv6 presentation (string) format address equivalent to the unsigned integer provided.

int_to_arpa(int_val)

 
Parameters:
  • int_val - An unsigned integer.
Returns:
The reverse DNS lookup for an IPv6 address in network byte order integer form.

int_to_packed(int_val)

 
Parameters:
  • int_val - the integer to be packed.
Returns:
a packed string that is equivalent to value represented by an unsigned integer.

packed_to_int(packed_int)

 
Parameters:
  • packed_int - a packed string containing an unsigned integer. It is assumed that string is packed in network byte order.
Returns:
An unsigned integer equivalent to value of network address represented by packed binary string.

Variables Details [hide private]

prefix_to_netmask

Value:
{0: 0,
 1: 170141183460469231731687303715884105728,
 2: 255211775190703847597530955573826158592,
 3: 297747071055821155530452781502797185024,
 4: 319014718988379809496913694467282698240,
 5: 329648542954659136480144150949525454848,
 6: 334965454937798799971759379190646833152,
 7: 337623910929368631717566993311207522304,
...

netmask_to_prefix

Value:
{0: 0,
 170141183460469231731687303715884105728: 1,
 255211775190703847597530955573826158592: 2,
 297747071055821155530452781502797185024: 3,
 319014718988379809496913694467282698240: 4,
 329648542954659136480144150949525454848: 5,
 334965454937798799971759379190646833152: 6,
 337623910929368631717566993311207522304: 7,
...

prefix_to_hostmask

Value:
{0: 340282366920938463463374607431768211455,
 1: 170141183460469231731687303715884105727,
 2: 85070591730234615865843651857942052863,
 3: 42535295865117307932921825928971026431,
 4: 21267647932558653966460912964485513215,
 5: 10633823966279326983230456482242756607,
 6: 5316911983139663491615228241121378303,
 7: 2658455991569831745807614120560689151,
...

hostmask_to_prefix

Value:
{0: 128,
 1: 127,
 3: 126,
 7: 125,
 15: 124,
 31: 123,
 63: 122,
 127: 121,
...