a
    sd_Á	  ã                   @   sv   d Z ddlZddlZG dd„ dejjƒZeƒ  ej	¡ G dd„ dej
jƒZdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ ZdS )zDNS Opcodes.é    Nc                   @   s8   e Zd ZdZdZdZdZdZedd„ ƒZ	edd	„ ƒZ
d
S )ÚOpcoder   é   é   é   é   c                 C   s   dS )Né   © ©Úclsr   r   ú,/usr/lib/python3/dist-packages/dns/opcode.pyÚ_maximum#   s    zOpcode._maximumc                 C   s   t S )N)ÚUnknownOpcoder	   r   r   r   Ú_unknown_exception_class'   s    zOpcode._unknown_exception_classN)Ú__name__Ú
__module__Ú__qualname__ZQUERYZIQUERYZSTATUSZNOTIFYÚUPDATEÚclassmethodr   r   r   r   r   r   r      s   
r   c                   @   s   e Zd ZdZdS )r   zAn DNS opcode is unknown.N)r   r   r   Ú__doc__r   r   r   r   r   .   s   r   c                 C   s
   t  | ¡S )z¨Convert text into an opcode.

    *text*, a ``str``, the textual opcode

    Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown.

    Returns an ``int``.
    )r   Ú	from_text)Útextr   r   r   r   2   s    
r   c                 C   s   | d@ d? S )zpExtract an opcode from DNS message flags.

    *flags*, an ``int``, the DNS flags.

    Returns an ``int``.
    é x  é   r   ©Úflagsr   r   r   Ú
from_flags?   s    r   c                 C   s   | d> d@ S )z™Convert an opcode to a value suitable for ORing into DNS message
    flags.

    *value*, an ``int``, the DNS opcode value.

    Returns an ``int``.
    r   r   r   ©Úvaluer   r   r   Úto_flagsJ   s    	r   c                 C   s
   t  | ¡S )z¥Convert an opcode to text.

    *value*, an ``int`` the opcode value,

    Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown.

    Returns a ``str``.
    )r   Úto_textr   r   r   r   r   V   s    
r   c                 C   s   t | ƒtjkS )zmIs the opcode in flags UPDATE?

    *flags*, an ``int``, the DNS message flags.

    Returns a ``bool``.
    )r   r   r   r   r   r   r   Ú	is_updatec   s    r    )r   Zdns.enumZdnsZdns.exceptionÚenumÚIntEnumr   ÚglobalsÚupdateÚ__members__Z	exceptionZDNSExceptionr   r   r   r   r   r    r   r   r   r   Ú<module>   s   