Ñò î¡ßNc @s`dZddkZddkiZddkZddkZ ddk l Z l Z l Z ddklZlZlZlZlZddklZhhd6hd6hd6Zd e fd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZde fd„ƒYZd„Zdd„Zd„Zd„Z e!djo e ƒneƒdS(s  Routines for accessing data published by IANA (Internet Assigned Numbers Authority). More details can be found at the following URLs :- - IANA Home Page - U{http://www.iana.org/} - IEEE Protocols Information Home Page - U{http://www.iana.org/protocols/} iÿÿÿÿN(t Publishert Subscribert PrettyPrinter(t IPAddresst IPNetworktIPRangetcidr_abbrev_to_verbosetiprange_to_cidrs(t _dict_itemstIPv4tIPv6t multicasttLineRecordParsercBs)eZdZd„Zd„Zd„ZRS(sQ A configurable Parser that understands how to parse line based records. cKs¤tt|ƒiƒ||_|ii|ƒd|ijo d|_nd|ijo d|_nd|ijo d|_nd|ijo t |_ ndS(sa Constructor. fh - a valid, open file handle to line based record data. tre_starts^.*$t re_parse_linetre_stoptskip_blank_linesN( tsuperR t__init__tfht__dict__tupdateR RRtFalseR(tselfRtkwargs((s3/usr/lib/python2.6/site-packages/netaddr/ip/iana.pyR8s    cCs|S(sX This is the callback method invoked for every line considered valid by the line parser's settings. It is usually over-ridden by base classes to provide specific line parsing and line skipping logic. Any line can be vetoed (not passed to registered Subscriber objects) by simply returning None. ((Rtline((s3/usr/lib/python2.6/site-packages/netaddr/ip/iana.pyt parse_lineSs cCsd}t}t}x|iD]ú}|iƒ}|io|djoqn| o,tti|i|ƒƒdjo t }n|o,tti|i |ƒƒdjo t }n|oPn|o)tti|i |ƒƒdjoqn|o |i |ƒ}|i |ƒqqWdS(s Parse and normalises records, notifying registered subscribers with record data as it is encountered. tiN(tNoneRRtstripRtlent_retfindallR tTrueRRRtnotify(Rtrecordt section_startt section_endR((s3/usr/lib/python2.6/site-packages/netaddr/ip/iana.pytparse^s&  * ) )(t__name__t __module__t__doc__RRR&(((s3/usr/lib/python2.6/site-packages/netaddr/ip/iana.pyR 4s  t IPv4ParsercBs eZdZd„Zd„ZRS(sä A LineRecordParser that understands how to parse and retrieve data records from the IANA IPv4 address space file. It can be found online here :- - U{http://www.iana.org/assignments/ipv4-address-space} c KsJtt|ƒi|dddddddtƒdddddf|_dS(s’ Constructor. fh - a valid, open file handle to an OUI Registry data file. kwargs - additional parser options. R s^PrefixRs ^\d{3}\/\dRs ^Notes\s*$Rtprefixiit designationi1tdatei9i twhoisiCitstatusiWiN(sprefixii(R,ii1(R-i9i (R.iCi(R/iWi(RR*RR!t record_widths(RRR((s3/usr/lib/python2.6/site-packages/netaddr/ip/iana.pyRŽs c Csªh}x;|iD]0\}}}||||!}|iƒ||s.   ( Q7/9/   &