8889841có !`Nc@szdZddlZddlZddlZddlZddlZddlZddlZdej j fd„ƒYZ dS(sDNS Dynamic Update SupportiÿÿÿÿNtUpdatecBs€eZejjd d ejjd„Zd d d„Z d„Z d„Z d„Z d„Z d„Zd d„Zd dd „ZRS( c Csëtt|ƒjƒ|jtjjtjjƒO_t|t t fƒr^tj j |ƒ}n||_ t|t ƒr‹tjj |ƒ}n||_|j|j|j |tjjdtdtƒ|dk rç|j||d|ƒndS(säInitialize a new DNS Update object. @param zone: The zone which is being updated. @type zone: A dns.name.Name or string @param rdclass: The class of the zone; defaults to dns.rdataclass.IN. @type rdclass: An int designating the class, or a string whose value is the name of a class. @param keyring: The TSIG keyring to use; defaults to None. @type keyring: dict @param keyname: The name of the TSIG key to use; defaults to None. The key must be defined in the keyring. If a keyring is specified but a keyname is not, then the key used will be the first key in the keyring. Note that the order of keys in a dictionary is not defined, so applications should supply a keyname when a keyring is used, unless they know the keyring contains only one key. @type keyname: dns.name.Name or string @param keyalgorithm: The TSIG algorithm to use; defaults to dns.tsig.default_algorithm. Constants for TSIG algorithms are defined in dns.tsig, and the currently implemented algorithms are HMAC_MD5, HMAC_SHA1, HMAC_SHA224, HMAC_SHA256, HMAC_SHA384, and HMAC_SHA512. @type keyalgorithm: string tcreatet force_uniquet algorithmN(tsuperRt__init__tflagstdnstopcodetto_flagstUPDATEt isinstancetstrtunicodetnamet from_texttorigint rdataclasst zone_rdclasst find_rrsettquestiont rdatatypetSOAtTruetNonetuse_tsig(tselftzonetrdclasstkeyringtkeynamet keyalgorithm((s0/usr/lib64/python2.7/site-packages/dns/update.pyRs!  !  c Csb|dkr|j}n|jƒ}|j|||j|j||ttƒ}|j||ƒdS(s&Add a single RR to the update section.N(Rt authoritytcoversRRtrdtypeRtadd(RRtttltrdtdeletingtsectionR!trrset((s0/usr/lib64/python2.7/site-packages/dns/update.pyt_add_rrAs    c GsÅt|ttfƒr-tjj|dƒ}nt|dtjjƒr£xx|D]O}|ro|j ||j ƒnx*|D]"}|j ||j |d|ƒqvWqMWnt |ƒ}t|jdƒƒ}t|dtjjƒr*|rý|j ||dj ƒnxÁ|D]}|j |||d|ƒqWn—|jdƒ}t|tƒr]tjj|ƒ}n|rv|j ||ƒnxH|D]@} tjj|j|| |jƒ}|j |||d|ƒq}WdS(sœAdd records. The first argument is the replace mode. If false, RRs are added to an existing RRset; if true, the RRset is replaced with the specified contents. The second argument is the section to add to. The third argument is always a name. The other arguments can be: - rdataset... - ttl, rdata... - ttl, rdtype, string...iR'N(R R R RRRRtrdatasettRdatasettdeleteR"R)R$tlisttinttpoptrdatatRdataRRR( RtreplaceR'RtargstrdsR%R$R"ts((s0/usr/lib64/python2.7/site-packages/dns/update.pyt_addKs0   '     cGs|jt|j||ŒdS(sÁAdd records. The first argument is always a name. The other arguments can be: - rdataset... - ttl, rdata... - ttl, rdtype, string...N(R6tFalseR (RRR3((s0/usr/lib64/python2.7/site-packages/dns/update.pyR#ss c Gst|ttfƒr-tjj|dƒ}nt|ƒdkr|j|j |tj j tj j tj j tj j ttƒ}nt|dtjjƒrÛxe|D]3}x*|D]"}|j|d|tj j ƒq®Wq¡Wn't|ƒ}t|dtjjƒr0xÿ|D]"}|j|d|tj j ƒqWnÒ|jdƒ}t|ttfƒritj j|ƒ}nt|ƒdkr´|j|j ||j|tj j tj j ttƒ}nNxK|D]C}tjj|j|||jƒ}|j|d|tj j ƒq»WdS(sÚDelete records. The first argument is always a name. The other arguments can be: - I{nothing} - rdataset... - rdata... - rdtype, [string...]iN(R R R RRRRtlenRR RtANYRtNONERR*R+R)R-R0R1R/RR(RRR3R(R4R%R"R5((s0/usr/lib64/python2.7/site-packages/dns/update.pyR,~s6   '  #     cGs|jt|j||ŒdS(sQReplace records. The first argument is always a name. The other arguments can be: - rdataset... - ttl, rdata... - ttl, rdtype, string... Note that if you want to replace the entire node, you should do a delete of the name followed by one or more calls to add.N(R6RR (RRR3((s0/usr/lib64/python2.7/site-packages/dns/update.pyR2©s c Gs~t|ttfƒr-tjj|dƒ}nt|ƒdkr{|j|j |tj j tj j tj j dttƒ}nÿt|dtjjƒs¿t|dtjjƒs¿t|ƒdkrt|dtjjƒs÷t|ƒ}|jddƒn|jt|j ||Œng|d}t|ttfƒrGtj j|ƒ}n|j|j |tj j |tj j dttƒ}dS(sBRequire that an owner name (and optionally an rdata type, or specific rdataset) exists as a prerequisite to the execution of the update. The first argument is always a name. The other arguments can be: - rdataset... - rdata... - rdtype, string...iiN(R R R RRRRR8RtanswerRR9RR:RR*R+R0R1R-tinsertR6R7(RRR3R(R"((s0/usr/lib64/python2.7/site-packages/dns/update.pytpresent¸s*      c CsÖt|ttfƒr-tjj|dƒ}n|dkru|j|j|tj j tj j tj j dt t ƒ}n]t|ttfƒrŸtj j|ƒ}n|j|j|tj j |tj j dt t ƒ}dS(s‚Require that an owner name (and optionally an rdata type) does not exist as a prerequisite to the execution of the update.N(R R R RRRRRR;RR:RR9R(RRR"R(((s0/usr/lib64/python2.7/site-packages/dns/update.pytabsentÜs    iÿÿcCs1|dkr|j}ntt|ƒj||ƒS(scReturn a string containing the update in DNS compressed wire format. @rtype: stringN(RRRRtto_wire(RRtmax_size((s0/usr/lib64/python2.7/site-packages/dns/update.pyR?ïs  N(t__name__t __module__RRtINRttsigtdefault_algorithmRR)R6R#R,R2R=R>R?(((s0/usr/lib64/python2.7/site-packages/dns/update.pyRs % ( +  $ ( t__doc__t dns.messageRtdns.namet dns.opcodet dns.rdatatdns.rdataclasst dns.rdatasettdns.tsigtmessagetMessageR(((s0/usr/lib64/python2.7/site-packages/dns/update.pyts