Your IP : 18.191.72.87


Current Path : /lib64/python2.7/site-packages/dns/
Upload File :
Current File : //lib64/python2.7/site-packages/dns/update.pyo

�
!`Nc@szdZddlZddlZddlZddlZddlZddlZddlZdej	j
fd��YZdS(sDNS Dynamic Update Supporti����NtUpdatecBs�eZejjd
d
ejjd�Zd
d
d�Z	d�Z
d�Zd�Zd�Z
d�Zd
d�Zd
dd	�ZRS(c	Cs�tt|�j�|jtjjtjj�O_t|t	t
f�r^tjj|�}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(RR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
jtjjtjj
tjjtt�}n�t|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
jtt�}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(RR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
cGs~t|ttf�r-tjj|d�}nt|�dkr{|j|j	|tj
jtjjtj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(RR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
tjjtjj
dt
t
�}n]t|ttf�r�tjj|�}n|j|j|tj	j
|tjj
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(RR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__tdns.messageRtdns.namet
dns.opcodet	dns.rdatatdns.rdataclasstdns.rdatasettdns.tsigtmessagetMessageR(((s0/usr/lib64/python2.7/site-packages/dns/update.pyt<module>s