/usr/lib/python2.6/site-packages/netaddr/eui
NameSizeModeActions
iab.idx922300644editdlrm
iab.txt7272400644editdlrm
ieee.py90610755editdlrm
ieee.pyc78660644editdlrm
oui.idx3763620644editdlrm
oui.txt35230570644editdlrm
__init__.py249390644editdlrm
__init__.pyc264790644editdlrm
Edit: /usr/lib/python2.6/site-packages/netaddr/eui/__init__.pyc (26479B)
Ñò }DVc @sÚdZddklZlZlZddklZlZ ddk l Z ddk l Z ddklZddklZlZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdS(s] Classes and functions for dealing with MAC addresses, EUI-48, EUI-64, OUI, IAB identifiers. iÿÿÿÿ(tNotRegisteredErrortAddrFormatErrort DictDotLookup(teui48teui64(t mac_eui48(t eui64_base(t IPAddress(t_is_intt_is_strtBaseIdentifiercBsJeZdZdZd„Zd„Zd„Zd„Zd„Zd„Z RS( s$Base class for all IEEE identifiers.t_valuecCs d|_dS(N(tNoneR (tself((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__init__scCs|iS(s):return: integer value of this identifier(R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__int__scCs|iS(s):return: integer value of this identifier(R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__long__scCs |idjodSd|iS(s8:return: octal string representation of this identifier.it0s0%o(R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__oct__"scCs d|iS(s>:return: hexadecimal string representation of this identifier.s0x%x(R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__hex__)scCs|iS(sx :return: return the integer value of this identifier when passed to hex(), oct() or bin(). (R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt __index__.s(s_value( t__name__t __module__t__doc__t __slots__RRRRRR(((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR s     tOUIcBsweZdZd Zd„Zd„Zd„Zd„Zd„Zd„Z e d„ƒZ d d „Z d „Z d „ZRS(sŒ An individual IEEE OUI (Organisationally Unique Identifier). For online details see - http://standards.ieee.org/regauth/oui/ trecordscCsNtt|ƒiƒddkl}g|_t|tƒo"t|i ddƒdƒ|_ n]t |ƒo?d|jo djno ||_ qºt d|ƒ‚nt d |ƒ‚|i |ijomt|iƒ}xM|i|i D];\}}|i|ƒ|i|ƒ}|i|||ƒqíW|iƒntd |ƒ‚d S( sÔ Constructor :param oui: an OUI string ``XX-XX-XX`` or an unsigned integer. Also accepts and parses full MAC/EUI-48 address strings (but not MAC/EUI-48 integers)! iÿÿÿÿ(tieeet-tiiiÿÿÿs"OUI int outside expected range: %rsunexpected OUI format: %rsOUI %r not registered!N(tsuperRRt netaddr.euiRRt isinstancetstrtinttreplaceR Rt ValueErrort TypeErrort OUI_INDEXtopent OUI_REGISTRYtseektreadt _parse_datatcloseR(R touiRtfhtoffsettsizetdata((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR@s& "    cCsNt|tƒp.y|i|ƒ}Wq>tj otSXn|i|ijS(N(R Rt __class__t ExceptiontNotImplementedR (R tother((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__eq__gs  cCsNt|tƒp.y|i|ƒ}Wq>tj otSXn|i|ijS(N(R RR2R3R4R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__ne__os  cCs|i|ifS(s+:returns: Pickled state of an `OUI` object.(R R(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt __getstate__wscCs|\|_|_dS(s;:param state: data used to unpickle a pickled `OUI` object.N(R R(R tstate((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt __setstate__{scCsåhdd6dd6dd6gd6|d6|d6}xž|id ƒD]}|iƒ}|pq@nd |jo;|i|d<|id d ƒd |dtj otSXn|i|ijS(N(R RKR2R3R4R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR6s  cCsNt|tƒp.y|i|ƒ}Wq>tj otSXn|i|ijS(N(R RKR2R3R4R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR7s  cCs|i|ifS(s+:returns: Pickled state of an `IAB` object.(R RA(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR8scCs|\|_|_dS(s;:param state: data used to unpickle a pickled `IAB` object.N(R RA(R R9((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR:"scCs±xª|idƒD]™}|iƒ}|pqnd|joD|i|id<|id dƒd|idR?R RAR R!R@(R R1R/R0RB((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR+&s   cCs t|iƒS(s*The IEEE registration details for this IAB(RRA(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRF6scCsH|id>}d|d?d@|d?d@|d?d@|d?d@|d@fS(s*:return: string representation of this IABis%02X-%02X-%02X-%02X-%02X-00i iÿiii(R (R RG((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRH:s     cCsd|S(s@:return: executable Python string to recreate equivalent object.s IAB('%s')((R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRIEs(srecord(RRRRt staticmethodtFalseRSRR6R7R8R:R+RFRHRI(((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRK¸s 4       tEUIcBs—eZdZd%Zd&d&d„Zd„Zd„Zd„Zd„Z e ee d&dƒZ d „Z d „Z e e e d&d ƒZe d „ƒZe d „ƒZd„Ze d„ƒZe d„ƒZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd&d„Ze d„ƒZe d„ƒZe d„ƒZ d„Z!d„Z"d „Z#d!„Z$e d"„ƒZ%d#„Z&d$„Z'RS('s× An IEEE EUI (Extended Unique Identifier). Both EUI-48 (used for layer 2 MAC addresses) and EUI-64 are supported. Input parsing for EUI-48 addresses is flexible, supporting many MAC variants. t_modulet_dialectcCsWtt|ƒiƒd|_t|tƒoY|dj o#||iijotdƒ‚n|i|_|i|_|i |_ dS|dj oH|djo t |_qA|djo t |_qAtd|ƒ‚nht |ƒoZd|jo djno t |_qAd|jo djno t |_qAn||_ ||_ dS( s2 Constructor. :param addr: an EUI-48 (MAC) or EUI-64 address in string format or an unsigned integer. May also be another EUI object (copy construction). :param version: (optional) the explicit EUI address version, either 48 or 64. Mainly used to distinguish EUI-48 and EUI-64 identifiers specified as integers which may be numerically equivalent. :param dialect: (optional) the mac_* dialect to be used to configure the formatting of EUI-48 (MAC) addresses. s2cannot switch EUI versions using copy constructor!Ni0i@sunsupported EUI version %riIÿÿÿÿÿÿlÿÿÿÿ(RR[RR R\R tversionR$R tdialectt_eui48t_eui64Rtvalue(R taddrR^R_((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRVs,             cCs|i|ii|ifS(s+:returns: Pickled state of an `EUI` object.(R R\R^R_(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR8ˆscCso|\}}}||_|djo t|_n1|djo t|_ntdt|ƒƒ‚||_dS(sN :param state: data used to unpickle a pickled `EUI` object. i0i@s&unpickling failed for object state: %sN(R R`R\RaR$R!R_(R R9RbR^R_((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR:Œs     cCs|iS(N(R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt _get_valueŸscCs|idjoÓx¨ttfD]š}y |i|ƒ|_||_PWqtj oeyHdt|ƒjo |ijnot|ƒ|_||_PnWq·t j oq·XqXqW|idjotd|ƒ‚qŒnªt |ƒoOy|ii|ƒ|_WqŒtj o#td||ii fƒ‚qŒXnNdt|ƒjo|iijnot|ƒ|_ntd|ƒ‚dS(Nis failed to detect EUI version: %rsaddress %r is not an EUIv%dsbad address format: %r( R\R R`Rat str_to_intR RR"tmax_intR$R R^(R Rbtmodule((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt _set_value¢s6  '   *sBa positive integer representing the value of this EUI indentifier.cCs|iS(N(R](R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt _get_dialectÇscCst|djo*|itjo t|_qpt|_n:t|dƒot|dƒo ||_n tdƒ‚dS(Nt word_sizetword_fmts*custom dialects should subclass mac_eui48!(R R\RaRR]RthasattrR%(R Rb((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt _set_dialectÊs     sXa Python class providing support for the interpretation of various MAC address formats.cCsH|itjot|id?ƒS|itjot|id?ƒSdS(s:The OUI (Organisationally Unique Identifier) for this EUI.ii(N(R\R`RRbRa(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR-ÚscCsP|itjodt|dd!ƒS|itjodt|dd!ƒSdS(s*The EI (Extension Identifier) for this EUIs%02X-%02X-%02Xiis%02X-%02X-%02X-%02X-%02XiN(R\R`ttupleRa(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyteiâscCs d|id?jodjSS(s<:return: True if this EUI is an IAB address, False otherwisei i iÿ/ (R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytis_iabêscCs#|iƒot|id?ƒSdS(sr If is_iab() is True, the IAB (Individual Address Block) is returned, ``None`` otherwise. i N(RpRKR (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRTîs cCs |iiS(s/The EUI version represented by this EUI object.(R\R^(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR^÷scCsât|ƒo]|ii}| |jo|djnptdƒ‚n|ii|i|iƒ|St|tƒoT|ii|i|iƒ}g}t |i t |ƒƒŒD]}|||qµ~St d|ƒ‚dS(sû :return: The integer value of the word referenced by index (both positive and negative). Raises ``IndexError`` if index is out of bounds. Also supports Python list slices for accessing word groups. is!index out range for address type!sunsupported type %r!N( RR]t num_wordst IndexErrorR\t int_to_wordsR R tslicetrangetindicesRCR%(R R;Rqtwordst_[1]ti((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt __getitem__üs  #9cCst|tƒotdƒ‚nt|ƒptdƒ‚nd|jo|iidjnptd|ƒ‚nt|ƒptdƒ‚nd|jo|iijnp td||ii fƒ‚nt |i i |i |iƒƒ}|||<|i i|ƒ|_ dS( s=Set the value of the word referenced by index in this addresss"settable slices are not supported!sindex not an integer!iis'index %d outside address type boundary!svalue not an integer!s.value %d outside word size maximum of %d bits!N(R RttNotImplementedErrorRR%R]RqRrtmax_wordRjtlistR\RsR t words_to_int(R R;RbRw((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt __setitem__s ( $! cCst|i|ifƒS(sA:return: hash of this EUI object suitable for dict keys, sets etc(thashR^R (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__hash__&scCs`t|tƒp.y|i|ƒ}Wq>tj otSXn|i|if|i|ifjS(sy :return: ``True`` if this EUI object is numerically the same as other, ``False`` otherwise. (R R[R2R3R4R^R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR6*s  cCs`t|tƒp.y|i|ƒ}Wq>tj otSXn|i|if|i|ifjS(sy :return: ``True`` if this EUI object is numerically the same as other, ``False`` otherwise. (R R[R2R3R4R^R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyR76s  cCs`t|tƒp.y|i|ƒ}Wq>tj otSXn|i|if|i|ifjS(s :return: ``True`` if this EUI object is numerically lower in value than other, ``False`` otherwise. (R R[R2R3R4R^R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__lt__Bs  cCs`t|tƒp.y|i|ƒ}Wq>tj otSXn|i|if|i|ifjS(sˆ :return: ``True`` if this EUI object is numerically lower or equal in value to other, ``False`` otherwise. (R R[R2R3R4R^R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__le__Ns  cCs`t|tƒp.y|i|ƒ}Wq>tj otSXn|i|if|i|ifjS(sƒ :return: ``True`` if this EUI object is numerically greater in value than other, ``False`` otherwise. (R R[R2R3R4R^R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__gt__Zs  cCs`t|tƒp.y|i|ƒ}Wq>tj otSXn|i|if|i|ifjS(sŠ :return: ``True`` if this EUI object is numerically greater or equal in value to other, ``False`` otherwise. (R R[R2R3R4R^R (R R5((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyt__ge__fs  cCs|ii|i|ƒS(sÞ :param word_sep: (optional) the separator to insert between words. Default: None - use default separator for address type. :return: human-readable binary digit string of this address. (R\t int_to_bitsR (R tword_sep((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytbitsrscCs|ii|iƒS(s8The value of this EUI address as a packed binary string.(R\t int_to_packedR (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytpacked{scCs|ii|iƒS(s<A list of unsigned integer octets found in this EUI address.(R\RsR (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRw€scCs|ii|iƒS(sÜ The value of this EUI adddress in standard Python binary representational form (0bxxx). A back port of the format provided by the builtin bin() function found in Python 2.6.x and higher. (R\t int_to_binR (R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytbin…scCs\|idjo0|id?}|id@}|d>dB|B}n |i}|i|ddƒS(s2 - If this object represents an EUI-48 it is converted to EUI-64 as per the standard. - If this object is already an EUI-64, a new, numerically equivalent object is returned instead. :return: The value of this EUI object as a new 64-bit EUI object. i0iiÿÿÿi(IþÿR^i@(R^R R2(R t first_threet last_threet new_value((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pyRŽs    cCs|iƒ}|idN_|S(s¡ - create a new EUI object with a modified EUI-64 as described in RFC 4291 section 2.5.1 :return: a new and modified 64-bit EUI object. I(RR (R R((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytmodified_eui64¡s cCs,t|ƒt|iƒƒ}t|ddƒS(s5 .. note:: This poses security risks in certain scenarios. Please read RFC 4941 for details. Reference: RFCs 4291 and 4941. :param prefix: ipv6 prefix :return: new IPv6 `IPAddress` object based on this `EUI` using the technique described in RFC 4291. R^i(R"RR(R tprefixRG((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytipv6±s cCs |idƒS(s .. note:: This poses security risks in certain scenarios. Please read RFC 4941 for details. Reference: RFCs 4291 and 4941. :return: new link local IPv6 `IPAddress` object based on this `EUI` using the technique described in RFC 4291. l @þ(R’(R ((s5/tmp/pip-build-lt8jXN/netaddr/netaddr/eui/__init__.pytipv6_link_local¾scCsDh|iiƒd6}|iƒo|iiƒ|d s$’