Your IP : 216.73.216.209
3
�b�W �
@s�dZddlZddlmZdZdZdZdZdZ dZ
d Zd
ZdZ
dZd
ZdZeeeee e
eee
eeed�Zedd�ej�D��ZGdd�dejj�Zdd�Zdd�Zdd�Zdd�ZdS)zDNS Result Codes.�N�)�long�������� �
�)�NOERROR�FORMERR�SERVFAIL�NXDOMAIN�NOTIMP�REFUSED�YXDOMAIN�YXRRSET�NXRRSET�NOTAUTH�NOTZONE�BADVERSccs|]\}}||fVqdS)N�)�.0�x�yrr�/usr/lib/python3.6/rcode.py� <genexpr>6src@seZdZdZdS)�UnknownRcodezA DNS rcode is unknown.N)�__name__�
__module__�__qualname__�__doc__rrrrr 9sr cCsB|j�r$t|�}|dkr$|dkr$|Stj|j��}|dkr>t�|S)z�Convert text into an rcode.
@param text: the textual rcode
@type text: string
@raises UnknownRcode: the rcode is unknown
@rtype: int
ri�N)�isdigit�int�_by_text�get�upperr )�text�vrrr� from_text>s r,cCs0|d@|d?d@B}|dks$|dkr,td��|S)z�Return the rcode value encoded by flags and ednsflags.
@param flags: the DNS flags
@type flags: int
@param ednsflags: the EDNS flags
@type ednsflags: int
@raises ValueError: rcode is < 0 or > 4095
@rtype: int
��i�ri�zrcode must be >= 0 and <= 4095)�
ValueError)�flagsZ ednsflags�valuerrr�
from_flagsQsr2cCs8|dks|dkrtd��|d@}t|d@�d>}||fS)z�Return a (flags, ednsflags) tuple which encodes the rcode.
@param value: the rcode
@type value: int
@raises ValueError: rcode is < 0 or > 4095
@rtype: (int, int) tuple
ri�zrcode must be >= 0 and <= 4095r-i�r.)r/r)r1r+Zevrrr�to_flagsbs
r3cCstj|�}|dkrt|�}|S)zbConvert rcode into text.
@param value: the rcode
@type value: int
@rtype: string
N)� _by_valuer(�str)r1r*rrr�to_textrs
r6)r$Z
dns.exceptionZdnsZ_compatrrrrrrrrrrrrrr'�dict�itemsr4Z exceptionZDNSExceptionr r,r2r3r6rrrr�<module>s@
?>