Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 #----------------------------------------------------------------------------- 3 # Copyright (c) 2008, David P. D. Moss. All rights reserved. 4 # 5 # Released under the BSD license. See the LICENSE file for details. 6 #----------------------------------------------------------------------------- 7 """ 8 network address manipulation, done Pythonically 9 """ 10 __version__ = '0.5.2' 11 12 import struct as _struct 13 14 #----------------------------------------------------------------------------- 15 # Constants. 16 #----------------------------------------------------------------------------- 17 18 #: True if platform is natively big endian, False otherwise. 19 BIG_ENDIAN_PLATFORM = _struct.pack('=h', 1) == _struct.pack('>h', 1) 20 21 AT_UNSPEC = 0x0 #: unspecified address type constant. 22 AT_INET = 0x4 #: IPv4 address type constant. 23 AT_INET6 = 0x6 #: IPv6 address type constant. 24 AT_LINK = 0x30 #: MAC/EUI-48 address type constant. 25 AT_EUI64 = 0x40 #: EUI-64 address type constant. 26 27 #: Address type to address description lookup dictionary. 28 AT_NAMES = { 29 # Address Type : Descriptive Name. 30 AT_UNSPEC : 'unspecified', 31 AT_INET : 'IPv4', 32 AT_INET6 : 'IPv6', 33 AT_LINK : 'MAC', 34 AT_EUI64 : 'EUI-64', 35 } 36 37 #----------------------------------------------------------------------------- 38 # Custom exceptions. 39 #----------------------------------------------------------------------------- 40 46 52 53 #----------------------------------------------------------------------------- 54 # Public interface and exports. 55 #----------------------------------------------------------------------------- 56 57 from netaddr.address import Addr, AddrRange, nrange, IP, CIDR, Wildcard, EUI 58 59 from netaddr.strategy import ST_IPV4, ST_IPV6, ST_EUI48, ST_EUI64 60 61 __all__ = [ 62 'Addr', 'AddrRange', 'nrange', # generic functionality 63 'AddrFormatError', 'AddrConversionError', # custom exceptions 64 'IP', 'CIDR', 'Wildcard', 'EUI', # general purpose classes 65 'ST_IPV4', 'ST_IPV6', 'ST_EUI48', 'ST_EUI64', # shared strategy objects 66 'AT_INET', 'AT_INET6', 'AT_LINK', 'AT_EUI64', # type constants 67 ] 68
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Sep 29 23:23:25 2008 | http://epydoc.sourceforge.net |