Your IP : 18.116.8.83


Current Path : /lib64/python2.7/site-packages/dns/
Upload File :
Current File : //lib64/python2.7/site-packages/dns/rdataset.pyc

�
ҥ�Oc@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Zej
jZdej
jfd��YZdej
jfd��YZdej
jfd��YZd	�Zd
�Zd�Zd�ZdS(
sHDNS rdatasets (an rdataset is a set of rdatas of a given type and class)i����NtDifferingCoverscBseZdZRS(s�Raised if an attempt is made to add a SIG/RRSIG whose covered type
    is not the same as that of the other rdatas in the rdataset.(t__name__t
__module__t__doc__(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyRstIncompatibleTypescBseZdZRS(sBRaised if an attempt is made to add rdata of an incompatible type.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR$stRdatasetcBs�eZdZddddgZejjd�Zd�Zd�Z	dd�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zddedd�Zddded�Zd�ZRS(s�A DNS rdataset.

    @ivar rdclass: The class of the rdataset
    @type rdclass: int
    @ivar rdtype: The type of the rdataset
    @type rdtype: int
    @ivar covers: The covered type.  Usually this value is
    dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or
    dns.rdatatype.RRSIG, then the covers value will be the rdata
    type the SIG/RRSIG covers.  The library treats the SIG and RRSIG
    types as if they were a family of
    types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).  This makes RRSIGs much
    easier to work with than if RRSIGs covering different rdata
    types were aggregated into a single RRSIG rdataset.
    @type covers: int
    @ivar ttl: The DNS TTL (Time To Live) value
    @type ttl: int
    trdclasstrdtypetcoverstttlcCs;tt|�j�||_||_||_d|_dS(s�Create a new rdataset of the specified class and type.

        @see: the description of the class instance variables for the
        meaning of I{rdclass} and I{rdtype}iN(tsuperRt__init__RRRR	(tselfRRR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR>s
			cCsItt|�j�}|j|_|j|_|j|_|j|_|S(N(R
Rt_cloneRRRR	(Rtobj((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR
JscCs=t|�dkr||_n||jkr9||_ndS(s�Set the TTL of the rdataset to be the lesser of the set's current
        TTL or the specified TTL.  If the set contains no rdatas, set the TTL
        to the specified TTL.
        @param ttl: The TTL
        @type ttl: intiN(tlenR	(RR	((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt
update_ttlRscCs|j|jks$|j|jkr-t�n|dk	rI|j|�n|jtjjkss|jtjjkr�|j	�}t
|�dkr�|j	tjjkr�||_	q�|j	|kr�t�q�ntjj
|j�rt
|�dkr|j�ntt|�j|�dS(s%Add the specified rdata to the rdataset.

        If the optional I{ttl} parameter is supplied, then
        self.update_ttl(ttl) will be called prior to adding the rdata.

        @param rd: The rdata
        @type rd: dns.rdata.Rdata object
        @param ttl: The TTL
        @type ttl: intiN(RRRtNoneRtdnst	rdatatypetRRSIGtSIGRRtNONERtis_singletontclearR
Rtadd(RtrdR	R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR^s$	''
cCs*|j|j�tt|�j|�dS(N(RR	R
Rtunion_update(Rtother((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR~scCs*|j|j�tt|�j|�dS(N(RR	R
Rtintersection_update(RR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR�scCs*|j|j�tt|�j|�dS(s�Add all rdatas in other to self.

        @param other: The rdataset from which to update
        @type other: dns.rdataset.Rdataset objectN(RR	R
Rtupdate(RR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR�scCsk|jdkrd}ndtjj|j�d}dtjj|j�dtjj|j�|dS(Nitt(t)s<DNS t s
 rdataset>(RRRtto_textt
rdataclassRR(Rtctext((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt__repr__�s	cCs
|j�S(N(R#(R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt__str__�scCsct|t�stS|j|jksI|j|jksI|j|jkrMtStt|�j|�S(sTwo rdatasets are equal if they have the same class, type, and
        covers, and contain the same rdata.
        @rtype: bool(t
isinstanceRtFalseRRRR
t__eq__(RR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR*�scCs|j|�S(N(R*(RR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt__ne__�scKs%|d	k	r3|j||�}t|�}d}nd}d}tj�}|d	k	r`|}	n	|j}	t|�dkr�|d||tjj|	�tj	j|j
�fIJndxa|D]Y}
|d|||jtjj|	�tj	j|j
�|
jd|d||�fIJq�W|j�d S(
s�Convert the rdataset into DNS master file format.

        @see: L{dns.name.Name.choose_relativity} for more information
        on how I{origin} and I{relativize} determine the way names
        are emitted.

        Any additional keyword arguments are passed on to the rdata
        to_text() method.

        @param name: If name is not None, emit a RRs with I{name} as
        the owner name.
        @type name: dns.name.Name object
        @param origin: The origin for relative names, or None.
        @type origin: dns.name.Name object
        @param relativize: True if names should names be relativized
        @type relativize: boolR"Ris	%s%s%s %ss%s%s%d %s %s %storigint
relativizei����N(
Rtchoose_relativitytstrtStringIORRRR$R#RRR	tgetvalue(RtnameR,R-toverride_rdclasstkwtntexttpadtsRR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR#�s(			

#c
Cs�|dk	r|}t}n	|j}|jdd�t|�dkr�|j|||�tjd|j|dd�}|j	|�dS|r�t
|�}	tj|	�n|}	x�|	D]�}
|j|||�tjd|j||j
d�}|j	|�|j�}|
j|||�|j�}||dks?t�|j|d�tjd||�}|j	|�|jdd�q�Wt|�SdS(s,Convert the rdataset to wire format.

        @param name: The owner name of the RRset that will be emitted
        @type name: dns.name.Name object
        @param file: The file to which the wire format data will be appended
        @type file: file
        @param compress: The compression table to use; the default is None.
        @type compress: dict
        @param origin: The origin to be appended to any relative names when
        they are emitted.  The default is None.
        @returns: the number of records emitted
        @rtype: int
        iis!HHIHiis!HN(RR)RtseekRtto_wiretstructtpackRtwritetlisttrandomtshuffleR	ttelltAssertionError(
RR2tfiletcompressR,R3twant_shuffleRtstufftlRtstarttend((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR9�s8		



cCs5|j|kr1|j|kr1|j|kr1tStS(sSReturns True if this rdataset matches the specified class, type,
        and covers(RRRtTrueR)(RRRR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pytmatchs
N(RRRt	__slots__RRRRR
RRRRRRR&R'R*R+RIR#R9RJ(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR(s$		 							
		1/cCs�t|ttf�r*tjj|�}nt|ttf�rTtjj|�}nt||�}|j|�x9|D]1}tj	j|j
|j|�}|j|�qwW|S(s�Create an rdataset with the specified class, type, and TTL, and with
    the specified list of rdatas in text format.

    @rtype: dns.rdataset.Rdataset object
    (
R(R/tunicodeRR$t	from_textRRRtrdataRRR(RRR	ttext_rdatastrttR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pytfrom_text_lists

cGst||||�S(s�Create an rdataset with the specified class, type, and TTL, and with
    the specified rdatas in text format.

    @rtype: dns.rdataset.Rdataset object
    (RR(RRR	RO((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyRM'scCs�t|�dkr!td��nd}xR|D]J}|dkrkt|j|j�}|j|�t}n|j|�q.W|S(s�Create an rdataset with the specified TTL, and with
    the specified list of rdata objects.

    @rtype: dns.rdataset.Rdataset object
    isrdata list must not be emptyN(	Rt
ValueErrorRRRRRR)R(R	trdatasRPRt
first_time((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pytfrom_rdata_list0s

	cGs
t||�S(s�Create an rdataset with the specified TTL, and with
    the specified rdata objects.

    @rtype: dns.rdataset.Rdataset object
    (RV(R	RT((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt
from_rdataBs(RR>R0R:t
dns.exceptionRt
dns.rdatatypetdns.rdataclasst	dns.rdatatdns.settsettSett	SimpleSett	exceptiontDNSExceptionRRRRRRMRVRW(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt<module>s �