ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     3
bW'                 @   s`   d Z ddlZddlZddlZddlZddlZddlZddlZddl	m
Z
 G dd dejjZdS )zDNS Dynamic Update Support    N   )string_typesc                   sx   e Zd Zejjddejjf fdd	ZdddZ	dd Z
dd	 Zd
d Zdd Zdd ZdddZd fdd	Z  ZS )UpdateNc                s   t t| j  |  jtjjtjjO  _t|t	r>tj
j|}|| _t|t	rZtjj|}|| _| j| j| j|tjjddd |dk	r| j|||d dS )a  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
        T)ZcreateZforce_uniqueN)	algorithm)superr   __init__flagsdnsZopcodeZto_flagsZUPDATE
isinstancer   name	from_textorigin
rdataclasszone_rdclass
find_rrsetZquestion	rdatatypeZSOAZuse_tsig)selfZzoneZrdclassZkeyringZkeynameZkeyalgorithm)	__class__ /usr/lib/python3.6/update.pyr      s    


zUpdate.__init__c          	   C   sB   |dkr| j }|j }| j||| j|j||dd}|j|| dS )z&Add a single RR to the update section.NT)	authoritycoversr   r   rdtypeadd)r   r   ttlrdZdeletingsectionr   Zrrsetr   r   r   _add_rrE   s    zUpdate._add_rrc       
      G   s:  t |trtjj|d}t |d tjjrnx@|D ]8}|rF| j||j x |D ]}| j	||j
||d qLW q0W nt|}t|jd}t |d tjjr|r| j||d j x|D ]}| j	||||d qW nh|jd}t |trtjj|}|r| j|| x6|D ].}	tjj| j||	| j}| j	||||d qW dS )a  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...Nr   )r   )r
   r   r	   r   r   rdatasetRdatasetdeleter   r   r   listintpoprdataRdatar   r   r   )
r   replacer   r   argsrdsr   r   r   sr   r   r   _addO   s0    






zUpdate._addc             G   s   | j d| j|f|  dS )zAdd records.  The first argument is always a name.  The other
        arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...FN)r*   r   )r   r   r'   r   r   r   r   w   s    	z
Update.addc          	   G   sf  t |trtjj|d}t|dkrR| j| j|tjj	tj
j	tj
jtj
j	dd nt |d tjjrx|D ]&}x |D ]}| j|d|tjj qtW qjW nt|}t |d tjjrx|D ]}| j|d|tjj qW n|jd}t |trtj
j|}t|dkr(| j| j|| j|tj
jtjj	dd n:x8|D ]0}tjj| j||| j}| j|d|tjj q.W dS )zDelete records.  The first argument is always a name.  The other
        arguments can be:

                - I{nothing}

                - rdataset...

                - rdata...

                - rdtype, [string...]Nr   T)r
   r   r	   r   r   lenr   r   r   ANYr   NONEr   r   r   r!   r$   r%   r#   r   r   )r   r   r'   r(   r   r   r)   r   r   r   r       s6    








zUpdate.deletec             G   s   | j d| j|f|  dS )aQ  Replace 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.TN)r*   r   )r   r   r'   r   r   r   r&      s    zUpdate.replacec          	   G   s   t |trtjj|d}t|dkrL| j| j|tjj	tj
j	tj
jddd nt |d tjjs|t |d tjjs|t|dkrt |d tjjst|}|jdd | jd| j|f|  n@|d }t |trtj
j|}| j| j|tjj	|tj
jddd dS )aB  Require 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...Nr   Tr   F)r
   r   r	   r   r   r+   r   answerr   r,   r   r-   r   r   r$   r%   r!   insertr*   )r   r   r'   r   r   r   r   present   s*    




zUpdate.presentc          	   C   s   t |trtjj|d}|dkrH| j| j|tjjtj	j
tj	jddd n8t |tr^tj	j|}| j| j|tjj|tj	jddd dS )zRequire that an owner name (and optionally an rdata type) does
        not exist as a prerequisite to the execution of the update.NT)r
   r   r	   r   r   r   r.   r   r-   r   r,   )r   r   r   r   r   r   absent   s    




zUpdate.absent  c                s    |dkr| j }tt| j||S )zcReturn a string containing the update in DNS compressed wire
        format.
        @rtype: stringN)r   r   r   to_wire)r   r   Zmax_size)r   r   r   r3      s    zUpdate.to_wire)NN)N)Nr2   )__name__
__module____qualname__r	   r   INZtsigZdefault_algorithmr   r   r*   r   r    r&   r0   r1   r3   __classcell__r   r   )r   r   r      s   %

(+$
r   )__doc__Zdns.messager	   Zdns.nameZ
dns.opcodeZ	dns.rdataZdns.rdataclassZdns.rdatasetZdns.tsigZ_compatr   messageZMessager   r   r   r   r   <module>   s   