/usr/lib/python2.6/site-packages/netaddr/strategy
NameSizeModeActions
eui48.py86330644editdlrm
eui48.pyc91970644editdlrm
eui64.py77100644editdlrm
eui64.pyc83220644editdlrm
ipv4.py80860644editdlrm
ipv4.pyc86590644editdlrm
ipv6.py76290644editdlrm
ipv6.pyc79030644editdlrm
__init__.py74710644editdlrm
__init__.pyc79450644editdlrm
Edit: /usr/lib/python2.6/site-packages/netaddr/strategy/ipv6.pyc (7903B)
Ñò }DVc@sCdZddkZeZyZddkZeipedƒ‚nei ei ddkl Z l Z l Z eZWn/ej o#ddkl Z l Z l Z nXddklZddklZlZlZlZlZlZlZ l!Z"l#Z$dZ%dZ&d Z'e Z(d Z)d Z*dZ+d e%d Z,e%e&Z-d e&d Z.e/gZ0e1de%d ƒD]#Z2e0e2e,d e%e2d Afq_[0ƒZ3e/gZ4e1de%d ƒD]#Z2e4e,d e%e2d Ae2fq©[4ƒZ5e/gZ6e1de%d ƒD]Z2e6e2d e%e2d fqó[6ƒZ7e/gZ8e1de%d ƒD]Z2e8d e%e2d e2fq9[8ƒZ9de:fd„ƒYZ;de;fd„ƒYZ<de;fd„ƒYZ=dd„Z>dd„Z?dd„ZAd„ZBd„ZCd„ZDd„Zddd„Zd„Zd„Zd„Zdd „Zd!„Zd"„Z!d#„Z#dS($s IPv6 address logic. iÿÿÿÿNs IPv6 disabled(t inet_ptont inet_ntoptAF_INET6(tAddrFormatError( t valid_wordst int_to_wordst words_to_intt valid_bitst bits_to_intt int_to_bitst valid_bint int_to_bint bin_to_inti€it:tIPv6iiiit ipv6_compactcBseZdZdZeZRS(s%An IPv6 dialect class - compact form.s%x(t__name__t __module__t__doc__tword_fmttTruetcompact(((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRVst ipv6_fullcBseZdZeZRS(s*An IPv6 dialect class - 'all zeroes' form.(RRRtFalseR(((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyR^st ipv6_verbosecBseZdZdZeZRS(s5An IPv6 dialect class - extra wide 'all zeroes' form.s%.4x(RRRRRR(((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRdscCs=|djotdƒ‚nytt|ƒWntSXtS(s :param addr: An IPv6 address in presentation (string) format. :param flags: decides which rules are applied to the interpretation of the addr value. Future use - currently has no effect. :return: ``True`` if IPv6 address is valid, ``False`` otherwise. ts Empty strings are not supported!(Rt _inet_ptonRRR(taddrtflags((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyt valid_strns cCsGytt|ƒ}t|ƒSWn#tj otd|ƒ‚nXdS(s :param addr: An IPv6 address in string form. :param flags: decides which rules are applied to the interpretation of the addr value. Future use - currently has no effect. :return: The equivalent unsigned integer for a given IPv6 address. s&%r is not a valid IPv6 address string!N(RRt packed_to_intt ExceptionR(RRt packed_int((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyt str_to_ints cCsÃ|djo t}nd}y|t|ƒ}|iott|ƒ}nPttid|ƒƒ}g}|D]}||i |ql~}t i |ƒ}Wn#t j ot d|ƒ‚nX|S(së :param int_val: An unsigned integer. :param dialect: (optional) a Python class defining formatting options. :return: The IPv6 presentation (string) format address equivalent to the unsigned integer provided. s>8Hs+%r is not a valid 128-bit unsigned integer!N(tNoneRt int_to_packedRt _inet_ntopRtlistt_structtunpackRtword_septjoinRt ValueError(tint_valtdialectRR twordst_[1]twordttokens((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyt int_to_str‘s    (cCsQt|tƒ}t|iddƒƒ}|iƒ|dddg}di|ƒS(s“ :param int_val: An unsigned integer. :return: The reverse DNS lookup for an IPv6 address in network byte order integer form. R Rtip6tarpat.(R1RR%treplacetreverseR)(R+RR0((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyt int_to_arpa¯s  cCs"t|ddƒ}tid|ŒS(s• :param int_val: the integer to be packed. :return: a packed string that is equivalent to value represented by an unsigned integer. ii s>4I(RR&tpack(R+R-((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyR#¾scCscttid|ƒƒ}d}x>tt|ƒƒD]*\}}|}|d|>}||B}q1W|S(s :param packed_int: a packed string containing an unsigned integer. It is assumed that string is packed in network byte order. :return: An unsigned integer equivalent to value of network address represented by packed binary string. s>4Iii (R%R&R't enumeratetreversed(R R-R+titnumR/((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRÉs cCst|ttƒS(N(t _valid_wordst word_sizet num_words(R-((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRÜscCsL|djotƒd}n|djotƒd}nt|||ƒS(NR?R>(R"tglobalst _int_to_words(R+R?R>((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRàs   cCst|ttƒS(N(t _words_to_intR>R?(R-((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRèscCst|ttƒS(N(t _valid_bitstwidthR((tbits((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRìscCst|ttƒS(N(t _bits_to_intRDR((RE((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyRðscCs1|djotƒd}nt|tt|ƒS(NR((R"R@t _int_to_bitsR>R?(R+R(((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyR ôs cCs t|tƒS(N(t _valid_binRD(tbin_val((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyR úscCs t|tƒS(N(t _int_to_binRD(R+((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyR þscCs t|tƒS(N(t _bin_to_intRD(RI((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pyR s(ERtstructR&Rt OPT_IMPORTStsockett_socketthas_ipv6RRRRRR$Rtnetaddr.fbsockett netaddr.coreRtnetaddr.strategyRR=RRARRBRRCRRFR RGR RHR RJR RKRDR>R(tfamilyt family_nametversiont word_basetmax_intR?tmax_wordtdictR.trangeR;tprefix_to_netmaskt_[2]tnetmask_to_prefixt_[3]tprefix_to_hostmaskt_[4]thostmask_to_prefixtobjectRRRRR!R"R1R7R#R(((s6/tmp/pip-build-lt8jXN/netaddr/netaddr/strategy/ipv6.pytsd    !@ GGCC