
    ui                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	rSSK
rSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKr " S S\R.                  R0                  5      r " S S\R.                  R0                  5      r " S S\R.                  R6                  5      r " S	 S
\R.                  R0                  5      r " S S\R.                  R0                  5      r " S S\R.                  R6                  5      r " S S\R.                  R6                  5      r  " S S\R.                  R6                  5      r! " S S\R.                  R6                  5      r" " S S\R.                  R6                  5      r# " S S\R.                  RH                  5      r% " S S\RL                  RN                  5      r(Sr)Sr* " S S5      r+ " S S 5      r, " S! S"\+5      r-S# r.S$ r/ " S% S&5      r0    S/S( jr1 " S) S*5      r2  S0S+ jr3S1S, jr4\Rj                  Rl                  SS'SSSSS4S- jr7  S2S. jr8\(Rr                  r9\(Rt                  r:\(Rv                  r;\(Rx                  r<g)3zDNS Messages    Nc                       \ rS rSrSrSrg)ShortHeader,   z2The DNS packet passed to from_wire() is too short. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       B/home/kodi/.kodi/addons/script.module.dnspython/lib/dns/message.pyr   r   ,   s    <r   r   c                       \ rS rSrSrSrg)TrailingJunk0   zEThe DNS packet passed to from_wire() has extra junk at the end of it.r   Nr   r   r   r   r   r   0   s    Or   r   c                       \ rS rSrSrSrg)UnknownHeaderField4   zRThe header field name was not recognized when converting from text
into a message.r   Nr   r   r   r   r   r   4   s    r   r   c                       \ rS rSrSrSrg)BadEDNS9   zHAn OPT record occurred somewhere other than
the additional data section.r   Nr   r   r   r   r   r   9       $r   r   c                       \ rS rSrSrSrg)BadTSIG>   zSA TSIG record occurred somewhere other than the end of
the additional data section.r   Nr   r   r   r   r   r   >   r   r   r   c                       \ rS rSrSrSrg)UnknownTSIGKeyC   z(A TSIG with an unknown key was received.r   Nr   r   r   r   r   r   C   s    2r   r   c                   $    \ rS rSrSrS1rS rSrg)	TruncatedG   zThe truncated flag is set.messagec                      U R                   S   $ )zRAs much of the message as could be processed.

Returns a ``dns.message.Message``.
r#   )kwargsselfs    r   r#   Truncated.messageL   s    
 {{9%%r   r   N)r   r	   r
   r   r   supp_kwargsr#   r   r   r   r   r!   r!   G   s    $+K&r   r!   c                       \ rS rSrSrSrg)NotQueryResponseT   z%Message is not a response to a query.r   Nr   r   r   r   r+   r+   T   s    /r   r+   c                       \ rS rSrSrSrg)ChainTooLongX   zThe CNAME chain is too long.r   Nr   r   r   r   r.   r.   X   s    &r   r.   c                       \ rS rSrSrSrg)AnswerForNXDOMAIN\   z.The rcode is NXDOMAIN but an answer was found.r   Nr   r   r   r   r1   r1   \   s    8r   r1   c                       \ rS rSrSrSrg)NoPreviousName_   zNo previous name was known.r   Nr   r   r   r   r4   r4   _   s    %r   r4   c                   8    \ rS rSrSrSrSrSrSr\	S 5       r
Srg	)
MessageSectionc   zMessage sectionsr            c                     gNr;   r   )clss    r   _maximumMessageSection._maximumj   s    r   r   N)r   r	   r
   r   r   QUESTIONANSWER	AUTHORITY
ADDITIONALclassmethodr?   r   r   r   r   r7   r7   c   s+    HFIJ r   r7   i     c                      \ rS rSrSr\rS3S jr\S 5       r	\	R                  S 5       r	\S 5       r\R                  S 5       r\S	 5       r\R                  S
 5       r\S 5       r\R                  S 5       rS rS rS4S jrS rS rS rS rS r\R.                  R0                  SSS4S jr\R.                  R0                  SSS4S jrS5S jr\S 5       rSSSSS\R<                  R>                  4S jr \S 5       r!\S 5       r"\S  5       r#\S! 5       r$\S" 5       r%\S\&S4S# j5       r'SS\&SS4S$ jr(\S% 5       r)\S& 5       r*\*R                  S' 5       r*\S( 5       r+\S) 5       r,S6S* jr-S+ r.S, r/S- r0S. r1S/ r2S0 r3S1 r4S2r5g)7Messager   zA DNS message.Nc                     Uc$  [         R                  R                  5       U l        OXl        SU l        / / / / /U l        S U l        SU l        S U l        S U l	        SU l
        SU l        S U l        S U l        0 U l        g )Nr   r   F)dnsentropy	random_16idflagssectionsoptrequest_payloadkeyringtsigrequest_macxfrorigintsig_ctxindex)r'   rN   s     r   __init__Message.__init__w   sx    :kk++-DGG
RR( 	
r   c                      U R                   S   $ )zThe question section.r   rP   r&   s    r   questionMessage.question        }}Qr   c                      XR                   S'   g Nr   r]   r'   vs     r   r^   r_          ar   c                      U R                   S   $ )zThe answer section.r9   r]   r&   s    r   answerMessage.answer   r`   r   c                      XR                   S'   g )Nr9   r]   rc   s     r   rg   rh      re   r   c                      U R                   S   $ )zThe authority section.r:   r]   r&   s    r   	authorityMessage.authority   r`   r   c                      XR                   S'   g )Nr:   r]   rc   s     r   rk   rl      re   r   c                      U R                   S   $ )zThe additional data section.r;   r]   r&   s    r   
additionalMessage.additional   r`   r   c                      XR                   S'   g r=   r]   rc   s     r   ro   rp      re   r   c                 8    S[        U R                  5      -   S-   $ )Nz<DNS message, ID >)reprrN   r&   s    r   __repr__Message.__repr__   s    "T$'']2S88r   c                 "    U R                  5       $ N)to_textr&   s    r   __str__Message.__str__   s    ||~r   c           	         [         R                  " 5       nUR                  SU R                  -  5        UR                  S[        R
                  R                  U R                  5       5      -  5        UR                  S[        R                  R                  U R                  5       5      -  5        UR                  S[        R                  R                  U R                  5      -  5        U R                  S:  a  UR                  SU R                  -  5        U R                  S:w  a;  UR                  S[        R                  R                  U R                  5      -  5        UR                  SU R                  -  5        U R                   H%  nUR                  S	UR                  5       -  5        M'     U R                  R                  R!                  5        He  u  pgUR                  S
U S35        U R#                  U5       H6  nUR                  UR                  " X40 UD65        UR                  S5        M8     Mg     UR%                  5       SS $ )zConvert the message to text.

The *origin*, *relativize*, and any other keyword
arguments are passed to the RRset ``to_wire()`` method.

Returns a ``str``.
zid %d
z
opcode %s
z	rcode %s
z	flags %s
r   zedns %s
z
eflags %s
zpayload %d
z
option %s
;
N)ioStringIOwriterN   rK   opcodery   rcoderO   edns	ednsflagsedns_to_textpayloadoptions_section_enum__members__itemssection_from_numbergetvalue)	r'   rW   
relativizekwsrQ   namewhichrrsets	            r   ry   Message.to_text   s    KKM		DGG#$	

 2 24;;= AAB	syy00>>?	syy00<<=99>GGK$))+,~~"		..t~~>? @GGNT\\12<<CGGMCKKM12  !//;;AACMTGGavRL!11%8f?B?@ 9 D zz|CR  r   c                 :   [        U[        5      (       d  gU R                  UR                  :w  a  gU R                  UR                  :w  a  g[	        U R
                  5       H6  u  p#UR
                  U   nU H  nXT;  d  M
      g   U H  nXS;  d  M
      g   M8     g)zTwo messages are equal if they have the same content in the
header, question, answer, and authority sections.

Returns a ``bool``.
FT)
isinstancerH   rN   rO   	enumeraterP   )r'   otherisectionother_sectionns         r   __eq__Message.__eq__   s     %))77ehh::$#DMM2JA!NN1-M)   ##  # 3 r   c                 .    U R                  U5      (       + $ rx   )r   )r'   r   s     r   __ne__Message.__ne__   s    ;;u%%%r   c                 J   UR                   [        R                   R                  -  S:X  dn  U R                  UR                  :w  dT  [        R                  R                  U R                   5      [        R                  R                  UR                   5      :w  a  gUR                  5       [        R                  R                  [        R                  R                  [        R                  R                  [        R                  R                  1;   a  [        UR                  5      S:X  a  g[        R                  R                  U R                   5      (       a  gU R                   H  nX!R                  ;  d  M    g   UR                   H  nX R                  ;  d  M    g   g)z9Is *other* a response this message?

Returns a ``bool``.
r   FT)rO   rK   QRrN   r   
from_flagsr   FORMERRSERVFAILNOTIMPREFUSEDlenr^   	is_update)r'   r   r   s      r   is_responseMessage.is_response   s    ;;%*77ehh::  ,::  -.;;=SYY..		0B0B YY--syy/@/@B B
 5>>"a'::

++
 A&  A%   r   c                     [        U R                  5       H  u  p#XL d  M  U R                  U5      s  $    [        S5      e)zReturn the "section number" of the specified section for use
in indexing.

*section* is one of the section attributes of this message.

Raises ``ValueError`` if the section isn't known.

Returns an ``int``.
zunknown section)r   rP   r   
ValueError)r'   r   r   our_sections       r   section_numberMessage.section_number  s>     (6NA%))!,, 7 *++r   c                 V    U R                   R                  U5      nU R                  U   $ )zReturn the section list associated with the specified section
number.

*number* is a section number `int` or the text form of a section
name.

Raises ``ValueError`` if the section isn't known.

Returns a ``list``.
)r   makerP   )r'   numberr   s      r   r   Message.section_from_number  s)     $$))&1}}W%%r   Fc	                    [        U[        5      (       a  Un	U R                  U	5      nOU R                  U5      n	XX4XV4n
U(       dS  U R                  b!  U R                  R                  U
5      nUb  U$ O%U H  nUR                  X#XEU5      (       d  M  Us  $    U(       d  [        e[        R                  R                  X#XEU5      nUR                  U5        U R                  b  XR                  U
'   U$ )a  Find the RRset with the given attributes in the specified section.

*section*, an ``int`` section number, or one of the section
attributes of this message.  This specifies the
the section of the message to search.  For example::

    my_message.find_rrset(my_message.answer, name, rdclass, rdtype)
    my_message.find_rrset(dns.message.ANSWER, name, rdclass, rdtype)

*name*, a ``dns.name.Name``, the name of the RRset.

*rdclass*, an ``int``, the class of the RRset.

*rdtype*, an ``int``, the type of the RRset.

*covers*, an ``int`` or ``None``, the covers value of the RRset.
The default is ``None``.

*deleting*, an ``int`` or ``None``, the deleting value of the RRset.
The default is ``None``.

*create*, a ``bool``.  If ``True``, create the RRset if it is not found.
The created RRset is appended to *section*.

*force_unique*, a ``bool``.  If ``True`` and *create* is also ``True``,
create a new RRset regardless of whether a matching RRset exists
already.  The default is ``False``.  This is useful when creating
DDNS Update messages, as order matters for them.

Raises ``KeyError`` if the RRset was not found and create was
``False``.

Returns a ``dns.rrset.RRset object``.
)r   intr   r   rY   get
full_matchKeyErrorrK   r   RRsetappend)r'   r   r   rdclassrdtypecoversdeletingcreateforce_uniquer   keyr   s               r   
find_rrsetMessage.find_rrset-  s    L gs##$N..~>G!009NWfGzz%

s+$ L % %E''v(02 2$ % N		vxHu::!#JJsOr   c	           
      X     U R                  XX4UXgU5      n	U	$ ! [         a    Sn	 U	$ f = f)a  Get the RRset with the given attributes in the specified section.

If the RRset is not found, None is returned.

*section*, an ``int`` section number, or one of the section
attributes of this message.  This specifies the
the section of the message to search.  For example::

    my_message.get_rrset(my_message.answer, name, rdclass, rdtype)
    my_message.get_rrset(dns.message.ANSWER, name, rdclass, rdtype)

*name*, a ``dns.name.Name``, the name of the RRset.

*rdclass*, an ``int``, the class of the RRset.

*rdtype*, an ``int``, the type of the RRset.

*covers*, an ``int`` or ``None``, the covers value of the RRset.
The default is ``None``.

*deleting*, an ``int`` or ``None``, the deleting value of the RRset.
The default is ``None``.

*create*, a ``bool``.  If ``True``, create the RRset if it is not found.
The created RRset is appended to *section*.

*force_unique*, a ``bool``.  If ``True`` and *create* is also ``True``,
create a new RRset regardless of whether a matching RRset exists
already.  The default is ``False``.  This is useful when creating
DDNS Update messages, as order matters for them.

Returns a ``dns.rrset.RRset object`` or ``None``.
N)r   r   )
r'   r   r   r   r   r   r   r   r   r   s
             r   	get_rrsetMessage.get_rrsetk  sD    J	OOG7F$,lDE   	E	s    ))r   c           	         Uc  U R                   b  U R                   nUS:X  a  U R                  S:w  a  U R                  nOSnUS:  a  SnOUS:  a  Sn[        R                  R	                  U R
                  U R                  X!5      nU R                   H4  nUR                  UR                  UR                  UR                  5        M6     U R                   H/  nUR                  " [        R                  R                  U40 UD6  M1     U R                   H/  nUR                  " [        R                  R                   U40 UD6  M1     U R"                  b4  UR                  [        R                  R$                  U R"                  5        U R&                   H/  nUR                  " [        R                  R$                  U40 UD6  M1     UR)                  5         U R*                  b  [        R*                  R-                  UR/                  5       U R0                  U R*                  S   [3        [4        R4                  " 5       5      U R6                  UU5      u  pU R*                  R9                  5         U R*                  R;                  U5        UR                  [        R                  R$                  U R*                  5        UR)                  5         U(       a  Xl        UR/                  5       $ )a#  Return a string containing the message in DNS compressed wire
format.

Additional keyword arguments are passed to the RRset ``to_wire()``
method.

*origin*, a ``dns.name.Name`` or ``None``, the origin to be appended
to any relative names.  If ``None``, and the message has an origin
attribute that is not ``None``, then it will be used.

*max_size*, an ``int``, the maximum size of the wire format
output; default is 0, which means "the message's request
payload, if nonzero, or 65535".

*multi*, a ``bool``, should be set to ``True`` if this message is
part of a multiple message sequence.

*tsig_ctx*, a ``dns.tsig.HMACTSig`` or ``dns.tsig.GSSTSig`` object, the
ongoing TSIG context, used when signing zone transfers.

Raises ``dns.exception.TooBig`` if *max_size* was exceeded.

Returns a ``bytes``.
r   i  i   )rW   rR   rK   rendererRendererrN   rO   r^   add_questionr   r   r   rg   	add_rrsetrB   rk   rC   rQ   rD   ro   write_headerrT   signget_wirerS   r   timerU   clearaddrX   )
r'   rW   max_sizemultirX   r   rr   new_tsigctxs
             r   to_wireMessage.to_wire  s   6 >dkk5[[Fq=##q(// c>HHLL!!$''4::xH]]ENN5::u||U]]C #[[EKK++U9b9 !^^EKK..<< $88KK//:__EKK//="= %	99 !hhmmAJJL,0LL,0IIaL,/		,<,0,<,<,4,13OX IIOOIIMM(#KK//;NN #zz|r   c                    [         R                  R                  R                  R                  [         R                  R                  [         R
                  R                  XX4XVU5	      n[         R                  R                  U SU5      $ rb   )rK   rdtypesANYTSIG
rdataclass	rdatatyper   
from_rdata)	keyname	algorithmtime_signedfudgemacoriginal_iderrorr   rT   s	            r   
_make_tsigMessage._make_tsig  s`     {{##((););S]]=O=O)2)4UD yy##GQ55r   ,  r   c           
      6   [        U[        R                  R                  5      (       a  UnUR                  nO[        U5      (       a	  U" X5      nO[        U[        5      (       a  [        R                  R                  U5      nUc  [        [        U5      5      nX   n[        U[        5      (       a   [        R                  R                  X(U5      nXl        Uc  U R                  nU R                  X R                  R                  SUSXEU5      U l        g)a  When sending, a TSIG signature using the specified key
should be added.

*key*, a ``dns.tsig.Key`` is the key to use.  If a key is specified,
the *keyring* and *algorithm* fields are not used.

*keyring*, a ``dict``, ``callable`` or ``dns.tsig.Key``, is either
the TSIG keyring or key to use.

The format of a keyring dict is a mapping from TSIG key name, as
``dns.name.Name`` to ``dns.tsig.Key`` or a TSIG secret, a ``bytes``.
If a ``dict`` *keyring* is specified but a *keyname* is not, 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 ``dict`` keyring is used, unless they know the keyring
contains only one key.  If a ``callable`` keyring is specified, the
callable will be called with the message and the keyname, and is
expected to return a key.

*keyname*, a ``dns.name.Name``, ``str`` or ``None``, the name of
thes TSIG key to use; defaults to ``None``.  If *keyring* is a
``dict``, the key must be defined in it.  If *keyring* is a
``dns.tsig.Key``, this is ignored.

*fudge*, an ``int``, the TSIG time fudge.

*original_id*, an ``int``, the TSIG original id.  If ``None``,
the message's id is used.

*tsig_error*, an ``int``, the TSIG error code.

*other_data*, a ``bytes``, the TSIG other data.

*algorithm*, a ``dns.name.Name``, the TSIG algorithm to use.  This is
only used if *keyring* is a ``dict``, and the key entry is a ``bytes``.
Nr   r   )r   rK   rT   Keyr   callablestr	from_textnextiterbytesrS   rN   r   r   )	r'   rS   r   r   r   
tsig_error
other_datar   r   s	            r   use_tsigMessage.use_tsig  s    P gsxx||,,ChhGg$(C'3''((,,W5tG}-"C#u%%hhll7;''KOOG\\-C-CQ$'*N	r   c                 R    U R                   (       a  U R                   R                  $ g rx   )rT   r   r&   s    r   r   Message.keyname  s    9999>>!r   c                 X    U R                   (       a  U R                   S   R                  $ g rb   )rT   r   r&   s    r   keyalgorithmMessage.keyalgorithm#  s     9999Q<)))r   c                 X    U R                   (       a  U R                   S   R                  $ g rb   )rT   r   r&   s    r   r   Message.mac*  s     9999Q<###r   c                 X    U R                   (       a  U R                   S   R                  $ g rb   )rT   r   r&   s    r   r   Message.tsig_error1  s     9999Q<%%%r   c                 ,    [        U R                  5      $ rx   )boolrT   r&   s    r   had_tsigMessage.had_tsig8  s    DIIr   c                 2   [         R                  R                  R                  R                  U[         R                  R                  U=(       d    S5      n[         R
                  R                  [         R                  R                  [        U 5      U5      $ )Nr   )
rK   r   r   OPTr   r   r   r   rootr   )rO   r   r   rQ   s       r   	_make_optMessage._make_opt<  sZ    kkoo!!%%gs}}/@/@&-m5yy##CHHMM3u:sCCr   c                     Ub  USL a  SnOUSL a  SnUS:  a  SU l         SU l        gUS-  nX!S-  -  nUc  / nU R                  X#U5      U l         Uc  UnX@l        g)a  Configure EDNS behavior.

*edns*, an ``int``, is the EDNS level to use.  Specifying
``None``, ``False``, or ``-1`` means "do not use EDNS", and in this case
the other parameters are ignored.  Specifying ``True`` is
equivalent to specifying 0, i.e. "use EDNS0".

*ednsflags*, an ``int``, the EDNS flag values.

*payload*, an ``int``, is the EDNS sender's payload field, which is the
maximum size of UDP datagram the sender can handle.  I.e. how big
a response to this message can be.

*request_payload*, an ``int``, is the EDNS payload size to use when
sending this message.  If not specified, defaults to the value of
*payload*.

*options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS
options.
NFr   Tr   l   ~ rF   )rQ   rR   r	  )r'   r   r   r   rR   r   s         r   use_ednsMessage.use_ednsB  s{    . <45=DT\D!8DH#$D  #I"*%I~~i'BDH&")#2 r   c                 J    U R                   (       a  U R                  S-  S-	  $ g)Ni   rF   r   )rQ   r   r&   s    r   r   Message.ednsk  s     88NNX-"44r   c                 R    U R                   (       a  U R                   R                  $ grb   )rQ   ttlr&   s    r   r   Message.ednsflagsr  s    8888<<r   c                     U R                   (       a  XR                   l        g U(       a  U R                  U5      U l         g g rx   )rQ   r  r	  rc   s     r   r   r  y  s*    88HHL~~a(DH r   c                 X    U R                   (       a  U R                   S   R                  $ grb   )rQ   r   r&   s    r   r   Message.payload  s     8888A;&&&r   c                 X    U R                   (       a  U R                   S   R                  $ g)Nr   r   )rQ   r   r&   s    r   r   Message.options  s     8888A;&&&r   c                     U(       a.  U =R                   [        R                  R                  -  sl         gU R                  (       a/  U =R                   [        R                  R                  ) -  sl         gg)zEnable or disable 'DNSSEC desired' flag in requests.

*wanted*, a ``bool``.  If ``True``, then DNSSEC data is
desired in the response, EDNS is enabled if required, and then
the DO bit is set.  If ``False``, the DO bit is cleared if
EDNS is enabled.
N)r   rK   rO   DOrQ   )r'   wanteds     r   want_dnssecMessage.want_dnssec  sA     NNciill*NXXNNsyy||m+N r   c                     [         R                  R                  [        U R                  5      [        U R
                  5      5      $ )z'Return the rcode.

Returns an ``int``.
)rK   r   r   r   rO   r   r&   s    r   r   Message.rcode  s,    
 yy##C

OS5HIIr   c                     [         R                  R                  U5      u  p#U =R                  S-  sl        U =R                  U-  sl        U =R                  S-  sl        U =R                  U-  sl        g)z:Set the rcode.

*rcode*, an ``int``, is the rcode to set.
i  i N)rK   r   to_flagsrO   r   )r'   r   valueevalues       r   	set_rcodeMessage.set_rcode  sR    
 )),,U3

f


e
*$& r   c                 f    [         R                  R                  [        U R                  5      5      $ )z(Return the opcode.

Returns an ``int``.
)rK   r   r   r   rO   r&   s    r   r   Message.opcode  s!    
 zz$$S_55r   c                     U =R                   S-  sl         U =R                   [        R                  R                  U5      -  sl         g)z=Set the opcode.

*opcode*, an ``int``, is the opcode to set.
i  N)rO   rK   r   r   )r'   r   s     r   
set_opcodeMessage.set_opcode  s/    
 	

f


cjj))&11
r   c                     U$ rx   r   )r'   r!  s     r   _get_one_rr_per_rrsetMessage._get_one_rr_per_rrset  s    r   c                     X4S S4$ NFr   )r'   r   r   r   r   s        r   _parse_rr_headerMessage._parse_rr_header  s    u--r   c                    U[         R                  R                  :X  aJ  U[        R                  :w  d/  U R
                  (       d  U[         R                  R                  :w  a  [        eO^U[         R                  R                  :X  a@  U[        R                  :w  d&  U[         R                  R                  :w  d  X2S-
  :w  a  [        eXVS S4$ )Nr9   F)rK   r   r  r7   rD   rQ   r   r  r   r   r   r   )r'   r   countpositionr   r   r   s          r   _parse_special_rr_header Message._parse_special_rr_header  s    S]]&&&.333txxsxx}}$ %s}}))).333#--+++19$u--r   )rO   rN   rY   rS   rQ   rW   rU   rR   rP   rT   rX   rV   rx   )NT)Nr   FN)T)6r   r	   r
   r   r   r7   r   rZ   propertyr^   setterrg   rk   ro   ru   rz   ry   r   r   r   r   r   rK   r   NONEr   r   r   staticmethodr   rT   default_algorithmr   r   r   r   r   r  DEFAULT_EDNS_PAYLOADr	  r  r   r   r   r   r  r   r#  r   r(  r+  r/  r4  r   r   r   r   rH   rH   r   s   "M"     __      ]]             9 !D.&@, &  --,,tE %<~ ++d5$*X@D 6 6 )-C!aC88559Nv           #7 D D
 4H!%t'3R     ) )    ,J	!62.
.r   rH   c                       \ rS rSrSrS rSrg)ChainingResulti  a  The result of a call to dns.message.QueryMessage.resolve_chaining().

The ``answer`` attribute is the answer RRSet, or ``None`` if it doesn't
exist.

The ``canonical_name`` attribute is the canonical name after all
chaining has been applied (this is the name as ``rrset.name`` in cases
where rrset is not ``None``).

The ``minimum_ttl`` attribute is the minimum TTL, i.e. the TTL to
use if caching the data.  It is the smallest of all the CNAME TTLs
and either the answer TTL if it exists or the SOA TTL and SOA
minimum values for negative answers.

The ``cnames`` attribute is a list of all the CNAME RRSets followed to
get to the canonical name.
c                 4    Xl         X l        X0l        X@l        g rx   )canonical_namerg   minimum_ttlcnames)r'   r?  rg   r@  rA  s        r   rZ   ChainingResult.__init__  s    ,&r   )rg   r?  rA  r@  N)r   r	   r
   r   r   rZ   r   r   r   r   r=  r=    s    "r   r=  c                        \ rS rSrS rS rSrg)QueryMessagei  c                    U R                   [        R                   R                  -  S:X  a  [        e[	        U R
                  5      S:w  a  [        R                  R                  eU R
                  S   nUR                  n[        R                  R                  nSnSn/ nU[        :  aH   U R                  U R                  X!R                  UR                  5      n[!        X4R                  5      n U[        :  a  [,        eU R/                  5       [        R.                  R0                  :X  a	  Ub  [2        eUch  Un	  U R                  U R4                  U	UR                  [        R$                  R6                  5      n
[!        X:R                  U
S   R8                  5      n [?        X$X65      $ ! ["         a    UR                  [        R$                  R&                  :w  a   U R                  U R                  UUR                  [        R$                  R&                  5      nUR)                  U5        [!        X7R                  5      nU H  nUR*                  n  O   US-  n GM  ! ["         a      GM  f = f GM  f = f! ["         a;     U	R;                  5       n	 O+! [        R                  R<                   a      GM  f = ff = fGM  )a  Follow the CNAME chain in the response to determine the answer
RRset.

Raises ``dns.message.NotQueryResponse`` if the message is not
a response.

Raises ``dns.message.ChainTooLong`` if the CNAME chain is too long.

Raises ``dns.message.AnswerForNXDOMAIN`` if the rcode is NXDOMAIN
but an answer was found.

Raises ``dns.exception.FormError`` if the question count is not 1.

Returns a ChainingResult object.
r   r9   N) rO   rK   r   r+   r   r^   	exception	FormErrorr   r  MAX_TTL	MAX_CHAINr   rg   r   r   minr   r   CNAMEr   targetr.   r   NXDOMAINr1   rk   SOAminimumparentNoParentr=  )r'   r^   qnamemin_ttlrg   r2  rA  crrsetrdaunamesrrsets              r   resolve_chainingQueryMessage.resolve_chaining  sK     ::		$)""t}}"--)))==#''//ie=M=M)1:gzz2( I::<399---&2D##>F
!__T^^V-5-=-=-0]]->->@F "'::vay7H7HIG eW==Q  ??cmm&9&99!%e191A1A141D1D"F f-"%gzz":"(B$&IIE! #) 
 # 
 %F   !'88,,  s]   +AF. >A#J  .2I=!B I%%
I5/I=4I55I=<I= 
KJK;K KKc                 6    U R                  5       R                  $ )au  Return the canonical name of the first name in the question
section.

Raises ``dns.message.NotQueryResponse`` if the message is not
a response.

Raises ``dns.message.ChainTooLong`` if the CNAME chain is too long.

Raises ``dns.message.AnswerForNXDOMAIN`` if the rcode is NXDOMAIN
but an answer was found.

Raises ``dns.exception.FormError`` if the question count is not 1.
)rX  r?  r&   s    r   r?  QueryMessage.canonical_name:  s     $$&555r   r   N)r   r	   r
   r   rX  r?  r   r   r   r   rD  rD    s    H>T6r   rD  c                      SS K n g rb   )
dns.update)rK   s    r   _maybe_import_updater^  K  s     r   c                     U [         R                  R                  :X  a  [        $ U [         R                  R                  :X  a$  [        5         [         R                  R                  $ [        $ rx   )	rK   r   QUERYrD  UPDATEr^  updateUpdateMessagerH   )r   s    r   _message_factory_from_opcoderd  T  sG    !!!	3::$$	$zz'''r   c                   :    \ rS rSrSr   S	S jrS rS rS rSr	g)
_WireReaderi^  a  Wire format reader.

parser: the binary parser
message: The message object being built
initialize_message: Callback to set message parsing options
question_only: Are we only reading the question?
one_rr_per_rrset: Put each RR into its own RRset?
keyring: TSIG keyring
ignore_trailing: Ignore trailing junk at end of request?
multi: Is this message part of a multi-message sequence?
DNS dynamic updates.
Nc                     [         R                  R                  U5      U l        S U l        X l        X0l        X@l        XPl        X`l	        Xpl
        g rx   )rK   wireParserparserr#   initialize_messagequestion_onlyone_rr_per_rrsetignore_trailingrS   r   )r'   rh  rk  rl  rm  rn  rS   r   s           r   rZ   _WireReader.__init__m  sA     hhood+"4* 0.
r   c           
      l   U R                   R                  U   n[        U5       H  nU R                  R	                  U R                   R
                  5      nU R                  R                  S5      u  pgU R                   R                  XUU5      u  pv  nU R                   R                  X5XvSSS9  M     g)zXRead the next *qcount* records from the wire data and add them to
the question section.
z!HHTr   r   N)	r#   rP   rangerj  get_namerW   
get_structr/  r   )r'   r   qcountr   _rR  r   r   s           r   _get_question_WireReader._get_questiony  s    
 ,,''7vAKK(()<)<=E $ 6 6u =V--nW.46 $Wa LL##GG+/d $ D r   c                 n	   U R                   R                  U   nU R                  n[        U5       GHn  nU R                  R
                  nU R                  R                  5       nU R                   R                  b&  UR                  U R                   R                  5      nOUnU R                  R                  S5      u  ppU	[        R                  R                  [        R                  R                  4;   a"  U R                   R                  UX%UX5      u  ppO U R                   R                  UXU	5      u  ppU(       a=  US:  a  [        R                   R"                  eSn[        R                  R$                  nOsU R                  R'                  U5         [        R(                  R+                  XU R                  U R                   R                  5      nSSS5        WR-                  5       nU R                   R.                  (       a   U	[        R                  R0                  :X  a  SnU	[        R                  R                  :X  a2  [        R2                  R5                  XU5      U R                   l        GMM  U	[        R                  R                  :X  Ga  U R8                  c  [;        S5      e[=        U R8                  [>        5      (       a\  U R8                  RA                  U5      n[=        U[B        5      (       a+  [        RD                  RG                  UUURH                  5      nOC[K        U R8                  5      (       a  U R9                  U R                   U5      nOU R8                  nUc  [;        SU-  5      eUU R                   l        [        RD                  RM                  U R                  RN                  UUU[Q        [R        RR                  " 5       5      U R                   RT                  UU R                   RV                  U RX                  5	      U R                   l+        [        R2                  R5                  USU5      U R                   l"        GM/  U R                   R[                  X8XUUSU5      nUc  GMU  US:  a  SnUR]                  X5        GMq     g! , (       d  f       GN= f)zRead the next I{count} records from the wire data and add them to
the specified section.

section: the section of the message to which to add records
count: the number of records to read
Nz!HHIHr   Tz"got signed message without keyringzkey '%s' unknowni)/r#   rP   rm  rr  rj  currentrs  rW   r   rt  rK   r   r  r   r4  r/  rF  rG  r8  restrict_tordatafrom_wire_parserr   rV   rN  r   r   rQ   rS   r   r   dictr   r   rT   r   r   r   validaterh  r   r   rU   rX   r   r   r   )r'   r   r2  r   r   r   rr_startabsolute_namer   r   r   r  rdlenr   emptyrU  r   r   r   s                      r   _get_section_WireReader._get_section  so    ,,''7,,uA{{**H KK002M||"".$//0C0CD$,0KK,B,B7,K)Vc#--++S]]-?-?@@LL99.:?D:AK 3(E LL11.26I 3( 19--111++[[,,U333G48KK48LL4G4GIB 4 ||Fcmm.?.?$?#***#&99#7#72#F 3==---<<'()MNNdllD11,,**=9C!#u--!hhll=#r||Ldll++,,t||]CC,,C;();d)BCC'*$HH%%dkk&6&6&)&3&(&)$))+&6&*ll&>&>&.&*ll&;&;&*jj2 % %(II$8$82$N!//0708$0<> >Z'IIb&C . 43s   A R%%
R4	c                    U R                   R                  5       S:  a  [        eU R                   R                  S5      u  pp4pV[	        [
        R                  R                  U5      5      nU" US9U l        [
        R                  R                  U5      U R                  l	        U R                  U R                  5        U R                  R                  U R                  5      U l        U R                  [        R                   U5        U R"                  (       a  U R                  $ U R%                  [        R&                  U5        U R%                  [        R(                  U5        U R%                  [        R*                  U5        U R,                  (       d$  U R                   R                  5       S:w  a  [.        eU R0                  (       ao  U R                  R2                  (       aT  U R                  R4                  (       d9  U R                  R2                  R7                  U R                   R8                  5        U R                  $ )zFRead a wire format DNS message and build a dns.message.Message
object.   z!HHHHHHrN   r   )rj  	remainingr   rt  rd  rK   r   r   r#   rO   Flagrk  r+  rm  rw  r7   rA   rl  r  rB   rC   rD   rn  r   r   rX   r  rb  rh  )r'   rN   rO   ru  ancountaucountadcountfactorys           r   read_WireReader.read  s    ;;  "R'KK""9- 	7FW.szz/D/DU/KL"~ YY^^E2-LL..t/D/DE 	>22F;<<.//9.22G<.33W=##(=(=(?1(D::$,,//8M8MLL!!(()9)9:||r   )rn  rk  rS   r#   r   rm  rj  rl  )FFFNF)
r   r	   r
   r   r   rZ   rw  r  r  r   r   r   r   rf  rf  ^  s+     @E9>%*
DK'Zr   rf  Fc           	        ^^^^ UUUU4S jn[        XUXX5      n UR                  5       nUR                  [        R                  R                  -  (       a  U
(       a	  [        US9eU$ ! [        R                  R                   ac    UR
                  (       aP  UR
                  R                  [        R                  R                  -  (       a  U
(       a  [        UR
                  S9ee f = f)a  Convert a DNS wire format message into a message
object.

*keyring*, a ``dns.tsig.Key`` or ``dict``, the key or keyring to use
if the message is signed.

*request_mac*, a ``bytes``.  If the message is a response to a
TSIG-signed request, *request_mac* should be set to the MAC of
that request.

*xfr*, a ``bool``, should be set to ``True`` if this message is part of
a zone transfer.

*origin*, a ``dns.name.Name`` or ``None``.  If the message is part
of a zone transfer, *origin* should be the origin name of the
zone.  If not ``None``, names will be relativized to the origin.

*tsig_ctx*, a ``dns.tsig.HMACTSig`` or ``dns.tsig.GSSTSig`` object, the
ongoing TSIG context, used when validating zone transfers.

*multi*, a ``bool``, should be set to ``True`` if this message is
part of a multiple message sequence.

*question_only*, a ``bool``.  If ``True``, read only up to
the end of the question section.

*one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its
own RRset.

*ignore_trailing*, a ``bool``.  If ``True``, ignore trailing
junk at end of the message.

*raise_on_truncation*, a ``bool``.  If ``True``, raise an exception if
the TC bit is set.

Raises ``dns.message.ShortHeader`` if the message is less than 12 octets
long.

Raises ``dns.message.TrailingJunk`` if there were octets in the message
past the end of the proper DNS message, and *ignore_trailing* is ``False``.

Raises ``dns.message.BadEDNS`` if an OPT record was in the
wrong section, or occurred more than once.

Raises ``dns.message.BadTSIG`` if a TSIG record was not the last
record of the additional data section.

Raises ``dns.message.Truncated`` if the TC flag is set and
*raise_on_truncation* is ``True``.

Returns a ``dns.message.Message``.
c                 >   > TU l         TU l        TU l        TU l        g rx   )rU   rV   rW   rX   )r#   rW   rU   rX   rV   s    r   rk  %from_wire.<locals>.initialize_message)  s!    )#r   )r#   )	rf  r  rK   rF  rG  r#   rO   TCr!   )rh  rS   rU   rV   rW   rX   r   rl  rm  rn  raise_on_truncationrk  readerms     ````        r   	from_wirer    s    r$ $ =)GLFKKM 	ww"5""H =="" >>v~~33ciillBFNN33s   A+ +BC,c                   D    \ rS rSrSr  SS jrS rS rS rS r	S	 r
S
rg)_TextReaderiA  aP  Text format reader.

tok: the tokenizer.
message: The message object being built.
DNS dynamic updates.
last_name: The most recently read name when building a message object.
one_rr_per_rrset: Put each RR into its own RRset?
origin: The origin for relative names
relativize: relativize names?
relativize_to: the origin to relativize to.
Nc                 .   S U l         [        R                  R                  XS9U l        S U l        X0l        X@l        XPl        X`l	        S U l
        SU l        SU l        [        U l        S U l        [        R                   R"                  U l        SU l        g )N
idna_codecr   r   )r#   rK   	tokenizer	Tokenizertok	last_namerm  rW   r   relativize_torN   r   r   r;  r   r   r   r`  rO   )r'   textr  rm  rW   r   r  s          r   rZ   _TextReader.__init__O  sz    ==**4*G 0$*	+
jj&&
r   c                    U R                   R                  5       nUR                  nUS:X  a!  U R                   R                  5       U l        GOUS:X  a   U R                   R                  5       nUR                  5       (       d  U R                   R                  U5        GO4U R                  [        R                  R                  UR                  5      -  U l        M  US:X  aB  U R                   R                  5       U l
        U R                  U R                  S-  -  U l        GOUS:X  a  U R                  S:  a  SU l
         U R                   R                  5       nUR                  5       (       d  U R                   R                  U5        GOEU R                  [        R                  R                  UR                  5      -  U l        M  US:X  a7  U R                   R                  5       U l        U R                  S:  a  SU l
        OUS:X  az  U R                   R                  5       n[        R                  R                  U5      U l        U R                  [        R                  R!                  U R                  5      -  U l        OKUS	:X  a?  U R                   R                  5       n[        R"                  R                  U5      U l        O[$        eU R                   R'                  5         g
)z5Process one line from the text format header section.rN   rO   r   rF   eflagsr   r   r   r   N)r  r   r!  get_intrN   is_identifierungetrO   rK   r   r   r   edns_from_textr   
get_stringr   r   r   r   get_eol)r'   rv  tokenwhatr  s        r   _header_line_TextReader._header_line`  s    {{4<hh&&(DGW_**,,HHNN5)!ZZ#))*=*=ekk*JJ
  V^((*DI!^^tyyB?DNXyy1}	**,,HHNN5)!%II,,U[[9":  Y88++-DLyy1}	X88&&(D**..t4DKcjj&9&9$++&FFDJW_88&&(D,,T2DJ$$r   c           	         U R                   R                  U   nU R                  R                  SS9nUR	                  5       (       dJ  U R                  R                  X0R                   R                  U R                  U R                  5      U l	        U R                  nUc  [        eU R                  R                  5       nUR                  5       (       d  [        R                  R                  e [        R                  R!                  UR"                  5      nU R                  R                  5       nUR                  5       (       d  [        R                  R                  e [        R(                  R!                  UR"                  5      nU R                   R+                  XXV5      u  pV  nU R                   R-                  X$XVSSS9  U R                  R/                  5         g! [        R                  R                   a    [        R                  R                  e[$         a    [        R                  R&                  n Nf = f)z7Process one line from the text format question section.Twant_leadingNrq  )r#   rP   r  r   is_whitespaceas_namerW   r   r  r  r4   r  rK   rF  SyntaxErrorr   r   r!  	ExceptionINr   r/  r   r  )r'   r   r   r  r   r   r   rv  s           r   _question_line_TextReader._question_line  s    ,,''7$/""$$!XX--e\\5H5H.2oo.2.@.@BDN ~~<  ""$$--+++	(nn..u{{;GHHLLNE&&((mm/// ) ((5LL)).P 	 !Qwt-1 	  	3 }}(( 	,--+++ 	(nn''G	(s   1A2G$ $AIIc           
      b   U R                   R                  U   nU R                  R                  SS9nUR	                  5       (       dJ  U R                  R                  X0R                   R                  U R                  U R                  5      U l	        U R                  nUc  [        eU R                  R                  5       nUR                  5       (       d  [        R                  R                  e [        UR                   S5      nU R                  R                  5       nUR                  5       (       d  [        R                  R                  e  [        R$                  R'                  UR                   5      nU R                  R                  5       nUR                  5       (       d  [        R                  R                  e [        R*                  R'                  UR                   5      nU R                   R-                  XXg5      u  pgpU R                  R                  5       nU	(       a/  UR/                  5       (       d  [        R                  R                  eU	(       d/  UR/                  5       (       a  [        R                  R0                  eUR/                  5       (       d  U R                  R3                  U5        [        R4                  R'                  XgU R                  U R                   R                  U R                  U R                  5      n
U
R7                  5       nOSn
[        R*                  R8                  nU R                   R;                  X$XgUUSU R<                  5      nU
b  UR?                  X5        gg! [        R                  R                   a    [        R                  R                  e["         a    Sn GNzf = f! [        R                  R                   a    [        R                  R                  e["         a    [        R$                  R(                  n GNhf = f)zVProcess one line from the text format answer, authority, or
additional data sections.
Tr  Nr   ) r#   rP   r  r   r  r  rW   r   r  r  r4   r  rK   rF  r  r   r!  r  r   r   r  r   r/  is_eol_or_eofUnexpectedEndr  r|  r   r8  r   rm  r   )r'   r   r   r  r   r  r   r   r   r  rU  r   r   s                r   _rr_line_TextReader._rr_line  s   
 ,,''7$/""$$!XX--e\\5H5H.2oo.2.@.@BDN ~~<  ""$$--+++	ekk1%CHHLLNE&&((mm/// )	(nn..u{{;GHHLLNE&&((mm/// ) ((5LL)).P 	+(,,..--+++,,..-----""$$HHNN5!$$Wdhh%)\\%8%8$//%)%7%79B YY[FB]]''F''(/(0$8M8MO >IIb G }}(( 	,--+++ 	C	 }}(( 	,--+++ 	(nn''G	(s(   1AN A2O AOOAP.-P.c                    [        U R                  5      nU" U R                  S9nU R                  Ul        U R                  S:  a1  UR                  U R                  U R                  U R                  5        U R                  (       a  UR                  U R                  5        U R                  (       a  U R                  Ul
        U$ )Nr  r   )rd  r   rN   rO   r   r  r   r   r   r#  rW   )r'   r  r#   s      r   _make_message_TextReader._make_message  s    .t{{;TWW%

99>TYYE::djj);;![[GNr   c                 p   U R                   nSn U R                  R                  SS5      nUR                  5       (       a  GO3UR	                  5       (       a  UR
                  R                  5       nUS:X  a  U R                   nU R                  (       a  U R                  nOU R                  5       n UR                  R                  U5      nU R                  (       d&  XPl        UR                  U R                  5      U l        U[        R                  :X  a  U R                  nOU R                   n U R                  R%                  5         GMA  U R                  R'                  U5        U" U5        GMf  U R                  (       d  U R                  5       U l        U R                  $ ! ["         a     Nf = f)zFRead a text format DNS message and build a dns.message.Message
object.NTHEADER)r  r  r   r  
is_commentr!  upperr#   r  r   r   r+  rm  r7   rA   r  r  r  r  r  )r'   line_methodr   r  ur#   s         r   r  _TextReader.read  sb    ''HHLLt,E""$$!!KK%%'="&"3"3K<<"llG #002G%,%:%:%D%DQ%GN  <<'.#99$:O:OP -%)@)@@&*&9&9&*mm   "HHNN5!'C D ||--/DL|| ! s   3A2F( &F( (
F54F5)r   r   rO   rN   r  r#   rm  r   rW   r   r   r   r  r  )FNTN)r   r	   r
   r   r   rZ   r  r  r  r  r  r   r   r   r   r  r  A  s1    
 ;@=A"(TB<|
*r   r  c                 <    [        XX#XE5      nUR                  5       $ )a  Convert the text format message into a message object.

The reader stops after reading the first blank line in the input to
facilitate reading multiple messages from a single file with
``dns.message.from_file()``.

*text*, a ``str``, the text format message.

*idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
is used.

*one_rr_per_rrset*, a ``bool``.  If ``True``, then each RR is put
into its own rrset.  The default is ``False``.

*origin*, a ``dns.name.Name`` (or ``None``), the
origin to use for relative names.

*relativize*, a ``bool``.  If true, name will be relativized.

*relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use
when relativizing names.  If not set, the *origin* value will be used.

Raises ``dns.message.UnknownHeaderField`` if a header is unknown.

Raises ``dns.exception.SyntaxError`` if the text is badly formed.

Returns a ``dns.message.Message object``
)r  r  )r  r  rm  rW   r   r  r  s          r   r   r   "  s#    H +;#4F;;=r   c                     [         R                  " 5        n[        U [        5      (       a  UR	                  [        U 5      5      n [        XU5      sSSS5        $ ! , (       d  f       g= f)a|  Read the next text format message from the specified file.

Message blocks are separated by a single blank line.

*f*, a ``file`` or ``str``.  If *f* is text, it is treated as the
pathname of a file to open.

*idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
is used.

*one_rr_per_rrset*, a ``bool``.  If ``True``, then each RR is put
into its own rrset.  The default is ``False``.

Raises ``dns.message.UnknownHeaderField`` if a header is unknown.

Raises ``dns.exception.SyntaxError`` if the text is badly formed.

Returns a ``dns.message.Message object``
N)
contextlib	ExitStackr   r   enter_contextopenr   )fr  rm  stacks       r   	from_filer  K  sJ    , 
			5a##DG,A(89 
 		s   ;A
A)c
           	      X   [        U [        5      (       a  [        R                  R	                  X	S9n [        R
                  R                  R                  U5      n[        R                  R                  R                  U5      n[        5       n
U
=R                  [        R                  R                  -  sl        U
R                  U
R                  XUSSS9  0 nUb  X[S'   Ub  XkS'   Ub  X{S'   Ub  XS'   U(       a  Uc  SnX;S	'   U
R                  " S
0 UD6  U
R!                  U5        U
$ )a8  Make a query message.

The query name, type, and class may all be specified either
as objects of the appropriate type, or as strings.

The query will have a randomly chosen query id, and its DNS flags
will be set to dns.flags.RD.

qname, a ``dns.name.Name`` or ``str``, the query name.

*rdtype*, an ``int`` or ``str``, the desired rdata type.

*rdclass*, an ``int`` or ``str``,  the desired rdata class; the default
is class IN.

*use_edns*, an ``int``, ``bool`` or ``None``.  The EDNS level to use; the
default is None (no EDNS).
See the description of dns.message.Message.use_edns() for the possible
values for use_edns and their meanings.

*want_dnssec*, a ``bool``.  If ``True``, DNSSEC data is desired.

*ednsflags*, an ``int``, the EDNS flag values.

*payload*, an ``int``, is the EDNS sender's payload field, which is the
maximum size of UDP datagram the sender can handle.  I.e. how big
a response to this message can be.

*request_payload*, an ``int``, is the EDNS payload size to use when
sending this message.  If not specified, defaults to the value of
*payload*.

*options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS
options.

*idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
is used.

Returns a ``dns.message.QueryMessage``
r  Trq  r   r   rR   r   r   r   r   )r   r   rK   r   r   r   	RdataTyper   r   
RdataClassrD  rO   RDr   r^   r  r  )rR  r   r   r  r  r   r   rR   r   r  r  r%   s               r   
make_queryr  g  s   Z %""5"@]]$$))&1Fnn'',,W5GAGGsyy||GLLUVD"  $
 F'{#y"$3 !#y("6NJJMM+Hr   c           	      ^   U R                   [        R                   R                  -  (       a  [        R                  R	                  S5      e[        U R                  5       5      nU" U R                  S9n[        R                   R                  U R                   [        R                   R                  -  -  Ul         U(       a-  U=R                   [        R                   R                  -  sl         UR                  U R                  5       5        [        U R                  5      Ul        U R                  S:  a  UR                  SSX R                  5        U R                   (       aF  UR#                  U R$                  U R&                  USUSU R(                  5        U R*                  Ul        U$ )a   Make a message which is a response for the specified query.
The message returned is really a response skeleton; it has all
of the infrastructure required of a response, but none of the
content.

The response's question section is a shallow copy of the query's
question section, so the query's question RRsets should not be
changed.

*query*, a ``dns.message.Message``, the query to respond to.

*recursion_available*, a ``bool``, should RA be set in the response?

*our_payload*, an ``int``, the payload size to advertise in EDNS
responses.

*fudge*, an ``int``, the TSIG time fudge.

*tsig_error*, an ``int``, the TSIG error.

Returns a ``dns.message.Message`` object whose specific class is
appropriate for the query.  For example, if query is a
``dns.update.UpdateMessage``, response will be too.
z&specified query message is not a queryr  r   Nr   )rO   rK   r   rF  rG  rd  r   rN   r  RAr(  listr^   r   r  r   r  r   rS   r   r   r   rU   )queryrecursion_availableour_payloadr   r   r  responses          r   make_responser    s   6 {{SYY\\!mm%%&NOO*5<<>:G%((#HYY\\U[[399<<%?@HN#)),,&'U^^,HzzQ!Q]];~~%--t$c5+=+=	?$yyOr   )
Nr   FNNFFFFF)NFNTNr.  )Fi    r   r   )=r   r  r   r   dns.wirerK   dns.ednsdns.enumdns.exception	dns.flagsdns.name
dns.opcodedns.entropy	dns.rcode	dns.rdatadns.rdataclassdns.rdatatype	dns.rrsetdns.rendererdns.ttldns.tsigdns.rdtypes.ANY.OPTdns.rdtypes.ANY.TSIGrF  rG  r   r   DNSExceptionr   r   r   r   r!   r+   r.   r1   r  r4   enumIntEnumr7   r;  rI  rH   r=  rD  r^  rd  rf  r  r  r   r  r   r  r  r  rA   rB   rC   rD   r   r   r   <module>r     s8  $   	                   =#--)) =P3==** P33 
$cmm%% $
$cmm%% $
3S]]// 3
&** 
&0s}}11 0'3==-- '922 9&S]].. &	SXX%% 	  	a	. a	.H 2Y67 Y6xO Od FJ#(499>Nb^ ^B 7<:>&R:8 '*nn&7&7$ D$#TdFR AE()*\ ""			$$	&&
r   