zyMac@sdZdZddlZdZdZGdddeZGdd d eZd d Ze d d Z ddZ ddZ ddZ ddZddZddZddZddZddZd d!ZGd"d#d#ZGd$d%d%eZGd&d'd'eZGd(d)d)eZGd*d+d+ZGd,d-d-eeZGd.d/d/eZGd0d1d1eeZGd2d3d3ZGd4d5d5eeZGd6d7d7eZGd8d9d9eeZ dS(:uA fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. u1.0iNi icBs|EeZdZdZdS(uAddressValueErroru%A Value Error related to the address.N(u__name__u __module__u __qualname__u__doc__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuAddressValueErrorsuAddressValueErrorcBs|EeZdZdZdS(uNetmaskValueErroru%A Value Error related to the netmask.N(u__name__u __module__u __qualname__u__doc__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuNetmaskValueErrorsuNetmaskValueErrorcCsfyt|SWnttfk r(YnXyt|SWnttfk rQYnXtd|dS(uTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address u0%r does not appear to be an IPv4 or IPv6 addressN(u IPv4AddressuAddressValueErroruNetmaskValueErroru IPv6Addressu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ip_addresssu ip_addresscCslyt||SWnttfk r+YnXyt||SWnttfk rWYnXtd|dS(uTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. u0%r does not appear to be an IPv4 or IPv6 networkN(u IPv4NetworkuAddressValueErroruNetmaskValueErroru IPv6Networku ValueError(uaddressustrict((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ip_network9su ip_networkcCsfyt|SWnttfk r(YnXyt|SWnttfk rQYnXtd|dS(ugTake an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. u2%r does not appear to be an IPv4 or IPv6 interfaceN(u IPv4InterfaceuAddressValueErroruNetmaskValueErroru IPv6Interfaceu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ip_interfaceWsu ip_interfacec Cs/y|jddSWntdYnXdS(u`Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. iubigu&Address negative or too large for IPv4N(uto_bytesu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuv4_int_to_packedzsuv4_int_to_packedc Cs/y|jddSWntdYnXdS(uRepresent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. iubigu&Address negative or too large for IPv6N(uto_bytesu ValueError(uaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuv6_int_to_packeds uv6_int_to_packedcCs>t|jd}t|dkr:td|n|S(uAHelper to split the netmask and raise AddressValueError if neededu/iuOnly one '/' permitted in %r(ustrusplitulenuAddressValueError(uaddressuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_split_optional_netmasksu_split_optional_netmaskcCsS|d}}x8|ddD]&}|j|jdkrD|}qPqW||fS(uFind a sequence of IPv#Address. Args: addresses: a list of IPv#Address objects. Returns: A tuple containing the first and last IP addresses in the sequence. iiN(u_ip(u addressesufirstulastuip((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_find_address_ranges  u_find_address_rangecCs=|dkr|Sx&t|D]}||?d@r|SqW|S(uCount the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. ii(urange(unumberubitsui((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_count_righthand_zero_bitss u_count_righthand_zero_bitsccs^t|tot|ts-tdn|j|jkrXtd||fn||krstdn|jdkrt}n$|jdkrt}n td|j}|j}|j}x||krYt t ||||dj d}|d|||f}|V|d|>7}|d|j krGPn|j |}qWd S( uSummarize a network range given the first and last IP addresses. Example: >>> list(summarize_address_range(IPv4Address('192.0.2.0'), ... IPv4Address('192.0.2.130'))) ... #doctest: +NORMALIZE_WHITESPACE [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: An iterator of the summarized IPv(4|6) network objects. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version of the first address is not 4 or 6. u1first and last must be IP addresses, not networksu%%s and %s are not of the same versionu*last IP address must be greater than firstiiuunknown IP versioniu%s/%dN(u isinstanceu _BaseAddressu TypeErroruversionu ValueErroru IPv4Networku IPv6Networku_max_prefixlenu_ipuminu_count_righthand_zero_bitsu bit_lengthu _ALL_ONESu __class__(ufirstulastuipuip_bitsu first_intulast_intunbitsunet((u./opt/alt/python33/lib64/python3.3/ipaddress.pyusummarize_address_ranges2       usummarize_address_rangecCsxd}g}d}x|D]}|s>|}|j|q|j|jkrk|j|jkrkd}q|t|jjdkr|j|d<}d}q|}|j|qW|}|s|SqdS(uvLoops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('192.0.2.0/26') ip2 = IPv4Network('192.0.2.64/26') ip3 = IPv4Network('192.0.2.128/26') ip4 = IPv4Network('192.0.2.192/26') _collapse_addresses_recursive([ip1, ip2, ip3, ip4]) -> [IPv4Network('192.0.2.0/24')] This shouldn't be called directly; it is called via collapse_addresses([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. iNFTi( uNoneuFalseuappendunetwork_addressubroadcast_addressuTrueulistusupernetusubnets(u addressesu last_addru ret_arrayu optimizeducur_addr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_collapse_addresses_recursives&  " u_collapse_addresses_recursivec Csd}g}g}g}x3|D]+}t|tr}|rm|dj|jkrmtd||dfn|j|q|j|jkr|r|dj|jkrtd||d fny|j|jWqJtk r|j|j YqJXq|r=|d j|jkr=td||d fn|j|qWt t |}t t |}x[|t |krt ||d\}}|j|d}|jt||quWttt ||dtjS( uCollapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: An iterator of the collapsed IPv(4|6)Network objects. Raises: TypeError: If passed a list of mixed version objects. iiu%%s and %s are not of the same versionNukeyiiiiii(u isinstanceu _BaseAddressu_versionu TypeErroruappendu _prefixlenu_max_prefixlenuipuAttributeErrorunetwork_addressusortedusetulenu_find_address_rangeuindexuextendusummarize_address_rangeuiteru_collapse_addresses_recursiveu _BaseNetworku_get_networks_key(u addressesuiuaddrsuipsunetsuipufirstulast((u./opt/alt/python33/lib64/python3.3/ipaddress.pyucollapse_addresses5s<   ucollapse_addressescCs6t|tr|jSt|tr2|jStS(u2Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may wish to have ipaddress sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. (u isinstanceu _BaseNetworku_get_networks_keyu _BaseAddressu_get_address_keyuNotImplemented(uobj((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuget_mixed_type_keyns   uget_mixed_type_keycBs\|EeZdZddZddZddZddZd d Zd d Zd S(u_TotalOrderingMixincCs tdS(N(uNotImplementedError(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__su_TotalOrderingMixin.__eq__cCs$|j|}|tkrtS| S(N(u__eq__uNotImplemented(uselfuotheruequal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__ne__s u_TotalOrderingMixin.__ne__cCs tdS(N(uNotImplementedError(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__su_TotalOrderingMixin.__lt__cCs3|j|}|tks"| r/|j|S|S(N(u__lt__uNotImplementedu__eq__(uselfuotheruless((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__le__s u_TotalOrderingMixin.__le__cCsI|j|}|tkrtS|j|}|tkr>tS|pG| S(N(u__lt__uNotImplementedu__eq__(uselfuotherulessuequal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__gt__s  u_TotalOrderingMixin.__gt__cCs$|j|}|tkrtS| S(N(u__lt__uNotImplemented(uselfuotheruless((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__ge__s u_TotalOrderingMixin.__ge__N( u__name__u __module__u __qualname__u__eq__u__ne__u__lt__u__le__u__gt__u__ge__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_TotalOrderingMixins      u_TotalOrderingMixincBs|EeZdZdZeddZeddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS(u_IPAddressBaseuThe mother class.cCs |jS(u:Return the longhand version of the IP address as a string.(u_explode_shorthand_ip_string(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuexplodedsu_IPAddressBase.explodedcCs t|S(u;Return the shorthand version of the IP address as a string.(ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu compressedsu_IPAddressBase.compressedcCs#dt|f}t|dS(Nu%200s has no version specified(utypeuNotImplementedError(uselfumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuversionsu_IPAddressBase.versioncCsi|dkr.d}t|||jfn||jkred}t|||j|jfndS(Niu-%d (< 0) is not permitted as an IPv%d addressu2%d (>= 2**%d) is not permitted as an IPv%d address(uAddressValueErroru_versionu _ALL_ONESu_max_prefixlen(uselfuaddressumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_check_int_addresss u!_IPAddressBase._check_int_addresscCsDt|}||kr@d}t|||||jfndS(Nu6%r (len %d != %d) is not permitted as an IPv%d address(ulenuAddressValueErroru_version(uselfuaddressu expected_lenu address_lenumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_check_packed_addresss    u$_IPAddressBase._check_packed_addresscCs|j|j|?AS(uTurn the prefix length into a bitwise netmask Args: prefixlen: An integer, the prefix length. Returns: An integer. (u _ALL_ONES(uselfu prefixlen((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_ip_int_from_prefixs u"_IPAddressBase._ip_int_from_prefixc Cst||j}|j|}||?}d|>d}||kr{|jd}|j|d}d}t||n|S(uReturn prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in axpanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones iiubigu&Netmask pattern %r mixes zeroes & ones(u_count_righthand_zero_bitsu_max_prefixlenuto_bytesu ValueError( uselfuip_intutrailing_zeroesu prefixlenu leading_onesuall_onesubyteslenudetailsumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_prefix_from_ip_ints      u"_IPAddressBase._prefix_from_ip_intcCsd|}t|ddS(Nu%r is not a valid netmask(uNetmaskValueErroruNone(uselfu netmask_strumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_report_invalid_netmasks u&_IPAddressBase._report_invalid_netmaskc Cstjj|s"|j|nyt|}Wntk rS|j|YnXd|kon|jkns|j|n|S(u Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask i(u_BaseV4u_DECIMAL_DIGITSu issupersetu_report_invalid_netmaskuintu ValueErroru_max_prefixlen(uselfu prefixlen_stru prefixlen((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_prefix_from_prefix_strings u)_IPAddressBase._prefix_from_prefix_stringcCsy|j|}Wntk r4|j|YnXy|j|SWntk rZYnX||jN}y|j|SWntk r|j|YnXdS(uTurn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask N(u_ip_int_from_stringuAddressValueErroru_report_invalid_netmasku_prefix_from_ip_intu ValueErroru _ALL_ONES(uselfuip_struip_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_prefix_from_ip_string s     u%_IPAddressBase._prefix_from_ip_stringN(u__name__u __module__u __qualname__u__doc__upropertyuexplodedu compresseduversionu_check_int_addressu_check_packed_addressu_ip_int_from_prefixu_prefix_from_ip_intu_report_invalid_netmasku_prefix_from_prefix_stringu_prefix_from_ip_string(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_IPAddressBases    u_IPAddressBasecBs|EeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ dS(u _BaseAddressuA generic IP object. This IP class contains the version independent methods which are used by single IP addresses. cCs9t|t r5dt|kr5td|ndS(Nu/uUnexpected '/' in %r(u isinstanceubytesustruAddressValueError(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__5su_BaseAddress.__init__cCs|jS(N(u_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__int__:su_BaseAddress.__int__c CsCy&|j|jko$|j|jkSWntk r>tSYnXdS(N(u_ipu_versionuAttributeErroruNotImplemented(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__=s  u_BaseAddress.__eq__cCsy|j|jkr+td||fnt|tsStd||fn|j|jkru|j|jkSdS(Nu%%s and %s are not of the same versionu"%s and %s are not of the same typeF(u_versionu TypeErroru isinstanceu _BaseAddressu_ipuFalse(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__Dsu_BaseAddress.__lt__cCs*t|tstS|jt||S(N(u isinstanceuintuNotImplementedu __class__(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__add__Qsu_BaseAddress.__add__cCs*t|tstS|jt||S(N(u isinstanceuintuNotImplementedu __class__(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__sub__Vsu_BaseAddress.__sub__cCsd|jjt|fS(Nu%s(%r)(u __class__u__name__ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__repr__[su_BaseAddress.__repr__cCst|j|jS(N(ustru_string_from_ip_intu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__^su_BaseAddress.__str__cCsttt|jS(N(uhashuhexuintu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__asu_BaseAddress.__hash__cCs |j|fS(N(u_version(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_get_address_keydsu_BaseAddress._get_address_keyN(u__name__u __module__u __qualname__u__doc__u__init__u__int__u__eq__u__lt__u__add__u__sub__u__repr__u__str__u__hash__u_get_address_key(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _BaseAddress-s        u _BaseAddresscBs|EeZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZeddZeddZeddZeddZed d!Zed"d#Zed$d%Zed&d'Zd(d)Zd*d+Zd,d-Zd.d?d/d0Zd.d?d1d2Zed3d4Zed5d6Zed7d8Z ed9d:Z!ed;d<Z"ed=d>Z#d?S(@u _BaseNetworku~A generic IP network object. This IP class contains the version independent methods which are used by networks. cCs i|_dS(N(u_cache(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__psu_BaseNetwork.__init__cCsd|jjt|fS(Nu%s(%r)(u __class__u__name__ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__repr__ssu_BaseNetwork.__repr__cCsd|j|jfS(Nu%s/%d(unetwork_addressu prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__vsu_BaseNetwork.__str__ccsNt|j}t|j}x)t|d|D]}|j|Vq2WdS(uGenerate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. iN(uintunetwork_addressubroadcast_addressurangeu_address_class(uselfunetworku broadcastux((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuhostsysu_BaseNetwork.hostsccsNt|j}t|j}x)t||dD]}|j|Vq2WdS(Ni(uintunetwork_addressubroadcast_addressurangeu_address_class(uselfunetworku broadcastux((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__iter__su_BaseNetwork.__iter__cCst|j}t|j}|dkrT|||krCtn|j||S|d7}|||krwtn|j||SdS(Nii(uintunetwork_addressubroadcast_addressu IndexErroru_address_class(uselfununetworku broadcast((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu __getitem__s    u_BaseNetwork.__getitem__cCs|j|jkr+td||fnt|tsStd||fn|j|jkru|j|jkS|j|jkr|j|jkSdS(Nu%%s and %s are not of the same versionu"%s and %s are not of the same typeF(u_versionu TypeErroru isinstanceu _BaseNetworkunetwork_addressunetmaskuFalse(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__su_BaseNetwork.__lt__c CsayD|j|jkoB|j|jkoBt|jt|jkSWntk r\tSYnXdS(N(u_versionunetwork_addressuintunetmaskuAttributeErroruNotImplemented(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__s   u_BaseNetwork.__eq__cCs tt|jt|jAS(N(uhashuintunetwork_addressunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__su_BaseNetwork.__hash__cCs`|j|jkrdSt|tr)dSt|jt|jkoYt|jkSSdS(NF(u_versionuFalseu isinstanceu _BaseNetworkuintunetwork_addressu_ipubroadcast_address(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu __contains__s  u_BaseNetwork.__contains__cCs:|j|kp9|j|kp9|j|kp9|j|kS(u*Tell if self is partly contained in other.(unetwork_addressubroadcast_address(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuoverlapssu_BaseNetwork.overlapscCsW|jjd}|dkrS|jt|jt|jB}||jd other eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25') IPv6Network('2001:db8::2000/124') > IPv6Network('2001:db8::1000/124') Raises: TypeError if the IP versions are different. u"%s and %s are not of the same typeiiii(u_versionu TypeErrorunetwork_addressunetmask(uselfuother((u./opt/alt/python33/lib64/python3.3/ipaddress.pyucompare_networks@s!u_BaseNetwork.compare_networkscCs|j|j|jfS(uNetwork-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). (u_versionunetwork_addressunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_get_networks_keypsu_BaseNetwork._get_networks_keyiccsK|j|jkr|VdS|dk rp||jkrEtdn|dkr`tdn||j}n|dkrtdn|j|}||jkrtd||fn|jd|j|j|f}|V|}xV|j}||jkr dS|jt|d}|jd||f}|VqdS( uThe subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), yield an iterator with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) Nunew prefix must be longeriu(cannot set prefixlen_diff and new_prefixiuprefix length diff must be > 0u0prefix length diff %d is invalid for netblock %su%s/%s( u _prefixlenu_max_prefixlenuNoneu ValueErroru __class__unetwork_addressubroadcast_addressu_address_classuint(uselfuprefixlen_diffu new_prefixu new_prefixlenufirstucurrentu broadcastunew_addr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyusubnetszs:        u_BaseNetwork.subnetscCs|jdkr|S|dk rh||jkr=tdn|dkrXtdn|j|}n|j|dkrtd|j|fn|jd|j|j|fdd }|jd|j|jfS( uThe supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) iunew prefix must be shorteriu(cannot set prefixlen_diff and new_prefixu;current prefixlen is %d, cannot have a prefixlen_diff of %du%s/%dustrictNF(u _prefixlenuNoneu ValueErroru prefixlenu __class__unetwork_addressuFalse(uselfuprefixlen_diffu new_prefixut((u./opt/alt/python33/lib64/python3.3/ipaddress.pyusupernets    u_BaseNetwork.supernetcCs|jjo|jjS(uTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. (unetwork_addressu is_multicastubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_multicasts u_BaseNetwork.is_multicastcCs|jjo|jjS(uTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. (unetwork_addressu is_reservedubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_reserveds u_BaseNetwork.is_reservedcCs|jjo|jjS(uTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. (unetwork_addressu is_link_localubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_link_locals u_BaseNetwork.is_link_localcCs|jjo|jjS(uTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 4193. (unetwork_addressu is_privateubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_privates u_BaseNetwork.is_privatecCs|jjo|jjS(uTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. (unetwork_addressuis_unspecifiedubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifieds u_BaseNetwork.is_unspecifiedcCs|jjo|jjS(uTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. (unetwork_addressu is_loopbackubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopbacks u_BaseNetwork.is_loopbackN($u__name__u __module__u __qualname__u__doc__u__init__u__repr__u__str__uhostsu__iter__u __getitem__u__lt__u__eq__u__hash__u __contains__uoverlapsupropertyubroadcast_addressuhostmaskuwith_prefixlenu with_netmasku with_hostmasku num_addressesu_address_classu prefixlenuaddress_excludeucompare_networksu_get_networks_keyuNoneusubnetsusupernetu is_multicastu is_reservedu is_link_localu is_privateuis_unspecifiedu is_loopback(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _BaseNetworkhs>         N 0 >)     u _BaseNetworkc Bs|EeZdZdZdedZedZed!ZddZ ddZ ddZ ddZ ddZ ddZddZeddZeddZd S("u_BaseV4uyBase IPv4 object. The following methods are used by IPv4 objects in both single IP addresses and networks. iiu 0123456789iiiiiiiiicCsd|_t|_dS(Ni(u_versionu IPV4LENGTHu_max_prefixlen(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__8s u_BaseV4.__init__cCs t|S(N(ustr(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_explode_shorthand_ip_string<su$_BaseV4._explode_shorthand_ip_stringcCs|stdn|jd}t|dkrItd|ny tjt|j|dSWn>tk r}ztd||fdWYdd}~XnXdS(uTurn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 Address. uAddress cannot be emptyu.iuExpected 4 octets in %rubigu%s in %rN( uAddressValueErrorusplitulenuintu from_bytesumapu _parse_octetu ValueErroruNone(uselfuip_struoctetsuexc((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_ip_int_from_string?s  u_BaseV4._ip_int_from_stringcCs|stdn|jj|s@d}t||nt|dkrkd}t||nt|d}|dkr|ddkrd }t||n|d krtd |n|S( u Convert a decimal octet into an integer. Args: octet_str: A string, the number to parse. Returns: The octet as an integer. Raises: ValueError: if the octet isn't strictly a decimal from [0..255]. uEmpty octet not permittedu#Only decimal digits permitted in %riu$At most 3 characters permitted in %ri iiu0u3Ambiguous (octal/decimal) value in %r not permittediuOctet %d (> 255) not permitted(u ValueErroru_DECIMAL_DIGITSu issupersetulenuint(uselfu octet_strumsgu octet_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _parse_octetXs  u_BaseV4._parse_octetcCs"djtt|jddS(uTurns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. u.iubig(ujoinumapustruto_bytes(uselfuip_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_string_from_ip_int|s u_BaseV4._string_from_ip_intcCs|jd}t|dkry.x'|D]}t||jkr+dSq+WWntk rgdSYnXx>t|D]0\}}|dkru|||dkrudSquWdSyt|}Wntk rdSYnXd|ko|jkSS(uVerify that the netmask is valid. Args: netmask: A string, either a prefix or dotted decimal netmask. Returns: A boolean, True if the prefix represents a valid IPv4 netmask. u.iiiFT( usplitulenuintu_valid_mask_octetsuFalseu ValueErroru enumerateuTrueu_max_prefixlen(uselfunetmaskumaskuxuidxuy((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_is_valid_netmasks"        u_BaseV4._is_valid_netmaskc s|jd}y&fddtt|D}Wntk rMdSYnXt|t|krjdS|d|dkrdSdS( uTest if the IP string is a hostmask (rather than a netmask). Args: ip_str: A string, the potential hostmask. Returns: A boolean, True if the IP string is a hostmask. u.cs%g|]}|jkr|qS((u_valid_mask_octets(u.0ux(uself(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu s u(_BaseV4._is_hostmask..iiFiT(usplitumapuintu ValueErroruFalseulenuTrue(uselfuip_strubitsuparts((uselfu./opt/alt/python33/lib64/python3.3/ipaddress.pyu _is_hostmasks &  u_BaseV4._is_hostmaskcCs|jS(N(u_max_prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu max_prefixlensu_BaseV4.max_prefixlencCs|jS(N(u_version(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuversionsu_BaseV4.versionN( iiiiiiiii(u__name__u __module__u __qualname__u__doc__u IPV4LENGTHu _ALL_ONESu frozensetu_DECIMAL_DIGITSu_valid_mask_octetsu__init__u_explode_shorthand_ip_stringu_ip_int_from_stringu _parse_octetu_string_from_ip_intu_is_valid_netmasku _is_hostmaskupropertyu max_prefixlenuversion(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_BaseV4(s      $  u_BaseV4cBs|EeZdZdZddZeddZeddZedd Zed d Z ed d Z eddZ eddZ dS(u IPv4Addressu/Represent and manipulate single IPv4 Addresses.cCstj||tj||t|trI|j|||_dSt|tr|j|dtj |d|_dSt |}|j ||_dS(u Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv4Address('192.0.2.1') == IPv4Address(3221225985). or, more generally IPv4Address(int(IPv4Address('192.0.2.1'))) == IPv4Address('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. Niubig( u _BaseAddressu__init__u_BaseV4u isinstanceuintu_check_int_addressu_ipubytesu_check_packed_addressu from_bytesustru_ip_int_from_string(uselfuaddressuaddr_str((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s   uIPv4Address.__init__cCs t|jS(u*The binary representation of this address.(uv4_int_to_packedu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyupackedsuIPv4Address.packedcCstd}||kS(uTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. u 240.0.0.0/4(u IPv4Network(uselfureserved_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_reserveds uIPv4Address.is_reservedcCsFtd}td}td}||kpE||kpE||kS(uTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 1918. u 10.0.0.0/8u 172.16.0.0/12u192.168.0.0/16(u IPv4Network(uselfu private_10u private_172u private_192((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_privates      uIPv4Address.is_privatecCstd}||kS(uTest if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. u 224.0.0.0/4(u IPv4Network(uselfumulticast_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_multicast s uIPv4Address.is_multicastcCstd}||kS(uTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. u0.0.0.0(u IPv4Address(uselfuunspecified_address((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifieds uIPv4Address.is_unspecifiedcCstd}||kS(uTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. u 127.0.0.0/8(u IPv4Network(uselfuloopback_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopback%s uIPv4Address.is_loopbackcCstd}||kS(uTest if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. u169.254.0.0/16(u IPv4Network(uselfulinklocal_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_link_local0s uIPv4Address.is_link_localN( u__name__u __module__u __qualname__u__doc__u__init__upropertyupackedu is_reservedu is_privateu is_multicastuis_unspecifiedu is_loopbacku is_link_local(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv4Addresss $    u IPv4AddresscBs|EeZdZddZddZddZddZd d Zed d Z ed dZ eddZ eddZ dS(u IPv4InterfacecCst|ttfrGtj||t|j|_|j|_ dSt |}tj||dt|dd|_|jj |_ |jj |_ |jj |_ dS(NiustrictF(u isinstanceubytesuintu IPv4Addressu__init__u IPv4Networku_ipunetworku_max_prefixlenu _prefixlenu_split_optional_netmaskuFalseunetmaskuhostmask(uselfuaddressuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__>s  uIPv4Interface.__init__cCs d|j|j|jjfS(Nu%s/%d(u_string_from_ip_intu_ipunetworku prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__NsuIPv4Interface.__str__c CsZtj||}| s%|tkr)|Sy|j|jkSWntk rUdSYnXdS(NF(u IPv4Addressu__eq__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_equal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__Rs uIPv4Interface.__eq__c CsStj||}|tkr"tSy|j|jkSWntk rNdSYnXdS(NF(u IPv4Addressu__lt__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_less((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__^s  uIPv4Interface.__lt__cCs|j|jAt|jjAS(N(u_ipu _prefixlenuintunetworkunetwork_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__isuIPv4Interface.__hash__cCs t|jS(N(u IPv4Addressu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuiplsuIPv4Interface.ipcCsd|j|j|jfS(Nu%s/%s(u_string_from_ip_intu_ipu _prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuwith_prefixlenpsuIPv4Interface.with_prefixlencCsd|j|j|jfS(Nu%s/%s(u_string_from_ip_intu_ipunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_netmaskusuIPv4Interface.with_netmaskcCsd|j|j|jfS(Nu%s/%s(u_string_from_ip_intu_ipuhostmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_hostmaskzsuIPv4Interface.with_hostmaskN( u__name__u __module__u __qualname__u__init__u__str__u__eq__u__lt__u__hash__upropertyuipuwith_prefixlenu with_netmasku with_hostmask(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv4Interface<s   u IPv4InterfacecBs/|EeZdZdZeZdddZdS(u IPv4NetworkueThis class represents and manipulates 32-bit IPv4 network + addresses.. Attributes: [examples for IPv4Network('192.0.2.0/27')] .network_address: IPv4Address('192.0.2.0') .hostmask: IPv4Address('0.0.0.31') .broadcast_address: IPv4Address('192.0.2.32') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 c Cstj||tj||t|tr`t||_|j|_t|j |_ dSt|t rt||_|j|_t|j |_ dSt |}t|j |d|_t|dkr"y|j|d|_Wq.tk r|j|d|_Yq.Xn |j|_t|j|j|_ |rtt |jt |j @|jkrtd|qntt |jt |j @|_|j|jdkr|j|_ndS(uInstantiate a new IPv4 network object. Args: address: A string or integer representing the IP [& network]. '192.0.2.0/24' '192.0.2.0/255.255.255.0' '192.0.0.2/0.0.0.255' are all functionally the same in IPv4. Similarly, '192.0.2.1' '192.0.2.1/255.255.255.255' '192.0.2.1/32' are also functionally equivalent. That is to say, failing to provide a subnetmask will create an object with a mask of /32. If the mask (portion after the / in the argument) is given in dotted quad form, it is treated as a netmask if it starts with a non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it starts with a zero field (e.g. 0.255.255.255 == /8), with the single exception of an all-zero mask which is treated as a netmask == /0. If no mask is given, a default of /32 is used. Additionally, an integer can be passed, so IPv4Network('192.0.2.1') == IPv4Network(3221225985) or, more generally IPv4Interface(int(IPv4Interface('192.0.2.1'))) == IPv4Interface('192.0.2.1') Raises: AddressValueError: If ipaddress isn't a valid IPv4 address. NetmaskValueError: If the netmask isn't valid for an IPv4 address. ValueError: If strict is True and a network address is not supplied. Niiiu%s has host bits set(u_BaseV4u__init__u _BaseNetworku isinstanceubytesu IPv4Addressunetwork_addressu_max_prefixlenu _prefixlenu _ALL_ONESunetmaskuintu_split_optional_netmasku_ip_int_from_stringulenu_prefix_from_prefix_stringuNetmaskValueErroru_prefix_from_ip_stringu_ip_int_from_prefixu ValueErroru__iter__uhosts(uselfuaddressustrictuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s:&      uIPv4Network.__init__NT(u__name__u __module__u __qualname__u__doc__u IPv4Addressu_address_classuTrueu__init__(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv4Networks u IPv4NetworkcBs|EeZdZdZdedZdZedZddZ dd Z d d Z d d Z dddZddZeddZeddZdS(u_BaseV6uyBase IPv6 object. The following methods are used by IPv6 objects in both single IP addresses and networks. iiiu0123456789ABCDEFabcdefcCsd|_t|_dS(Ni(u_versionu IPV6LENGTHu_max_prefixlen(uselfuaddress((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s u_BaseV6.__init__cCs|stdn|jd}d}t||kr[d||f}t|nd|dkryt|jj}Wn>tk r}ztd||fdWYdd}~XnX|jd |d ?d @|jd |d @n|jd}t||kr8d |d|f}t|nd}xYt dt|dD]>} || sX|dk rd |}t|n| }qXqXW|dk rr|} t||d} |ds| d8} | rd}t||qn|ds,| d8} | r,d}t||q,n|j| | } | dkrd}t||jd|fqnt||jkrd}t||j|fn|dsd}t||n|dsd}t||nt|} d} d} yd} x5t | D]'} | d K} | |j || O} qW| d | K} x9t | dD]'} | d K} | |j || O} qgW| SWn>t k r}ztd||fdWYdd}~XnXdS(uTurn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: An int, the IPv6 address Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. uAddress cannot be emptyu:iu At least %d parts expected in %ru.iu%s in %rNu%xiiu!At most %d colons permitted in %ru At most one '::' permitted in %riu0Leading ':' only permitted as part of '::' in %ru1Trailing ':' only permitted as part of '::' in %ru/Expected at most %d other parts with '::' in %ru,Exactly %d parts expected without '::' in %riii( uAddressValueErrorusplitulenu IPv4Addressupopu_ipuNoneuappendu _HEXTET_COUNTurangeu _parse_hextetu ValueError(uselfuip_strupartsu _min_partsumsguipv4_intuexcu _max_partsu skip_indexuiuparts_hiuparts_lou parts_skippeduip_int((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_ip_int_from_strings ,            #     u_BaseV6._ip_int_from_stringcCs]|jj|s%td|nt|dkrPd}t||nt|dS(u&Convert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. uOnly hex digits permitted in %riu$At most 4 characters permitted in %ri(u _HEX_DIGITSu issupersetu ValueErrorulenuint(uselfu hextet_strumsg((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu _parse_hextet\s u_BaseV6._parse_hextetc Csd}d}d}d}xot|D]a\}}|dkrz|d7}|dkr\|}n||kr|}|}qq%d}d}q%W|dkr||}|t|kr|dg7}ndg|||<|dkrdg|}qn|S( uCompresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. iiu0uiiii(u enumerateulen( uselfuhextetsubest_doublecolon_startubest_doublecolon_lenudoublecolon_startudoublecolon_lenuindexuhextetubest_doublecolon_end((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_compress_hextetsus.         u_BaseV6._compress_hextetscs|d krt|j}n||jkr<tdnd|fddtdddD}|j|}dj|S( u,Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. uIPv6 address is too largeu%032xcs1g|]'}dt||ddqS(u%xii(uint(u.0ux(uhex_str(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu s u/_BaseV6._string_from_ip_int..ii iu:N(uNoneuintu_ipu _ALL_ONESu ValueErrorurangeu_compress_hextetsujoin(uselfuip_intuhextets((uhex_stru./opt/alt/python33/lib64/python3.3/ipaddress.pyu_string_from_ip_ints  %u_BaseV6._string_from_ip_intcst|tr!t|j}n-t|trBt|j}n t|}|j|}d|fddtdddD}t|ttfrddj ||j fSdj |S( uExpand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. u%032xcs$g|]}||dqS(i((u.0ux(uhex_str(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu s u8_BaseV6._explode_shorthand_ip_string..ii iu%s/%du:( u isinstanceu IPv6Networkustrunetwork_addressu IPv6Interfaceuipu_ip_int_from_stringurangeu _BaseNetworkujoinu _prefixlen(uselfuip_struip_intuparts((uhex_stru./opt/alt/python33/lib64/python3.3/ipaddress.pyu_explode_shorthand_ip_strings   %u$_BaseV6._explode_shorthand_ip_stringcCs|jS(N(u_max_prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu max_prefixlensu_BaseV6.max_prefixlencCs|jS(N(u_version(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuversionsu_BaseV6.versionN(u__name__u __module__u __qualname__u__doc__u IPV6LENGTHu _ALL_ONESu _HEXTET_COUNTu frozensetu _HEX_DIGITSu__init__u_ip_int_from_stringu _parse_hextetu_compress_hextetsuNoneu_string_from_ip_intu_explode_shorthand_ip_stringupropertyu max_prefixlenuversion(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu_BaseV6s   g  / u_BaseV6cBs|EeZdZdZddZeddZeddZedd Zed d Z ed d Z eddZ eddZ eddZ eddZeddZeddZdS(u IPv6Addressu/Represent and manipulate single IPv6 Addresses.cCstj||tj||t|trI|j|||_dSt|tr|j|dtj |d|_dSt |}|j ||_dS(uInstantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:db8::') == IPv6Address(42540766411282592856903984951653826560) or, more generally IPv6Address(int(IPv6Address('2001:db8::'))) == IPv6Address('2001:db8::') Raises: AddressValueError: If address isn't a valid IPv6 address. Niubig( u _BaseAddressu__init__u_BaseV6u isinstanceuintu_check_int_addressu_ipubytesu_check_packed_addressu from_bytesustru_ip_int_from_string(uselfuaddressuaddr_str((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s   uIPv6Address.__init__cCs t|jS(u*The binary representation of this address.(uv6_int_to_packedu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyupackedsuIPv6Address.packedcCstd}||kS(uTest if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. uff00::/8(u IPv6Network(uselfumulticast_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_multicast s uIPv6Address.is_multicastcstdtdtdtdtdtdtdtdtd td td td td tdtdg}tfdd|DS(uTest if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. u::/8u100::/8u200::/7u400::/6u800::/5u1000::/4u4000::/3u6000::/3u8000::/3uA000::/3uC000::/3uE000::/4uF000::/5uF800::/6uFE00::/9c3s|]}|kVqdS(N((u.0ux(uself(u./opt/alt/python33/lib64/python3.3/ipaddress.pyu *su*IPv6Address.is_reserved..(u IPv6Networkuany(uselfureserved_networks((uselfu./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_reserveds uIPv6Address.is_reservedcCstd}||kS(uTest if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. u fe80::/10(u IPv6Network(uselfulinklocal_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_link_local,s uIPv6Address.is_link_localcCstd}||kS(u`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. u fec0::/10(u IPv6Network(uselfusitelocal_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_site_local7s uIPv6Address.is_site_localcCstd}||kS(uTest if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 4193. ufc00::/7(u IPv6Network(uselfuprivate_network((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_privateFs uIPv6Address.is_privatecCs |jdkS(uTest if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. i(u_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifiedQs uIPv6Address.is_unspecifiedcCs |jdkS(uTest if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. i(u_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopback\s uIPv6Address.is_loopbackcCs(|jd?dkrdSt|jd@S(uReturn the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. i ilN(u_ipuNoneu IPv4Address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu ipv4_mappedgs uIPv6Address.ipv4_mappedcCs@|jd?dkrdSt|jd?d@t|jd@fS(uTuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) i`i i@lN(u_ipuNoneu IPv4Address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuteredots uIPv6Address.teredocCs,|jd?dkrdSt|jd?d@S(uReturn the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. ipi iPlN(u_ipuNoneu IPv4Address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu sixtofours uIPv6Address.sixtofourN(u__name__u __module__u __qualname__u__doc__u__init__upropertyupackedu is_multicastu is_reservedu is_link_localu is_site_localu is_privateuis_unspecifiedu is_loopbacku ipv4_mappeduteredou sixtofour(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv6Addresss %      u IPv6AddresscBs|EeZdZddZddZddZddZd d Zed d Z ed dZ eddZ eddZ eddZ eddZdS(u IPv6InterfacecCst|ttfrGtj||t|j|_|j|_ dSt |}tj||dt|dd|_|jj |_ |jj |_ |jj |_ dS(NiustrictF(u isinstanceubytesuintu IPv6Addressu__init__u IPv6Networku_ipunetworku_max_prefixlenu _prefixlenu_split_optional_netmaskuFalseunetmaskuhostmask(uselfuaddressuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s  uIPv6Interface.__init__cCs d|j|j|jjfS(Nu%s/%d(u_string_from_ip_intu_ipunetworku prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__str__suIPv6Interface.__str__c CsZtj||}| s%|tkr)|Sy|j|jkSWntk rUdSYnXdS(NF(u IPv6Addressu__eq__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_equal((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__eq__s uIPv6Interface.__eq__c CsStj||}|tkr"tSy|j|jkSWntk rNdSYnXdS(NF(u IPv6Addressu__lt__uNotImplementedunetworkuAttributeErroruFalse(uselfuotheru address_less((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__lt__s  uIPv6Interface.__lt__cCs|j|jAt|jjAS(N(u_ipu _prefixlenuintunetworkunetwork_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__hash__suIPv6Interface.__hash__cCs t|jS(N(u IPv6Addressu_ip(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuipsuIPv6Interface.ipcCsd|j|j|jfS(Nu%s/%s(u_string_from_ip_intu_ipu _prefixlen(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuwith_prefixlensuIPv6Interface.with_prefixlencCsd|j|j|jfS(Nu%s/%s(u_string_from_ip_intu_ipunetmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_netmasksuIPv6Interface.with_netmaskcCsd|j|j|jfS(Nu%s/%s(u_string_from_ip_intu_ipuhostmask(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu with_hostmasksuIPv6Interface.with_hostmaskcCs|jdko|jjS(Ni(u_ipunetworkuis_unspecified(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyuis_unspecifiedsuIPv6Interface.is_unspecifiedcCs|jdko|jjS(Ni(u_ipunetworku is_loopback(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_loopbacksuIPv6Interface.is_loopbackN(u__name__u __module__u __qualname__u__init__u__str__u__eq__u__lt__u__hash__upropertyuipuwith_prefixlenu with_netmasku with_hostmaskuis_unspecifiedu is_loopback(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv6Interfaces   u IPv6InterfacecBsA|EeZdZdZeZdddZeddZ dS(u IPv6NetworkuvThis class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:db8::1000/124')] .network_address: IPv6Address('2001:db8::1000') .hostmask: IPv6Address('::f') .broadcast_address: IPv6Address('2001:db8::100f') .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0') .prefixlen: 124 cCstj||tj||t|tr`t||_|j|_t|j |_ dSt|t rt||_|j|_t|j |_ dSt |}t|j |d|_t|dkr|j|d|_n |j|_t|j|j|_ |ratt|jt|j @|jkratd|qantt|jt|j @|_|j|jdkr|j|_ndS(uInstantiate a new IPv6 Network object. Args: address: A string or integer representing the IPv6 network or the IP and prefix/netmask. '2001:db8::/128' '2001:db8:0000:0000:0000:0000:0000:0000/128' '2001:db8::' are all functionally the same in IPv6. That is to say, failing to provide a subnetmask will create an object with a mask of /128. Additionally, an integer can be passed, so IPv6Network('2001:db8::') == IPv6Network(42540766411282592856903984951653826560) or, more generally IPv6Network(int(IPv6Network('2001:db8::'))) == IPv6Network('2001:db8::') strict: A boolean. If true, ensure that we have been passed A true network address, eg, 2001:db8::1000/124 and not an IP address on a network, eg, 2001:db8::1/124. Raises: AddressValueError: If address isn't a valid IPv6 address. NetmaskValueError: If the netmask isn't valid for an IPv6 address. ValueError: If strict was True and a network address was not supplied. Niiiu%s has host bits set(u_BaseV6u__init__u _BaseNetworku isinstanceuintu IPv6Addressunetwork_addressu_max_prefixlenu _prefixlenu _ALL_ONESunetmaskubytesu_split_optional_netmasku_ip_int_from_stringulenu_prefix_from_prefix_stringu_ip_int_from_prefixu ValueErroru__iter__uhosts(uselfuaddressustrictuaddr((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu__init__s4      uIPv6Network.__init__cCs|jjo|jjS(u`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. (unetwork_addressu is_site_localubroadcast_address(uself((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu is_site_local3s uIPv6Network.is_site_localNT( u__name__u __module__u __qualname__u__doc__u IPv6Addressu_address_classuTrueu__init__upropertyu is_site_local(u __locals__((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu IPv6Networks Hu IPv6Network(!u__doc__u __version__u functoolsu IPV4LENGTHu IPV6LENGTHu ValueErroruAddressValueErroruNetmaskValueErroru ip_addressuTrueu ip_networku ip_interfaceuv4_int_to_packeduv6_int_to_packedu_split_optional_netmasku_find_address_rangeu_count_righthand_zero_bitsusummarize_address_rangeu_collapse_addresses_recursiveucollapse_addressesuget_mixed_type_keyu_TotalOrderingMixinu_IPAddressBaseu _BaseAddressu _BaseNetworku_BaseV4u IPv4Addressu IPv4Interfaceu IPv4Networku_BaseV6u IPv6Addressu IPv6Interfaceu IPv6Network(((u./opt/alt/python33/lib64/python3.3/ipaddress.pyu s>   #      8 0 9 !;wDdJ