Your IP : 3.23.105.244
3
�b�W �@s@dZdZGdd�de�ZGdd�de�ZiZdd�Zdd �Zd
S)zEDNS Options�c@sdeZdZdZdd�Zdd�Zedd��Zdd �Zd
d�Z dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)�Optionz*Base class for all EDNS option types.
cCs
||_dS)z\Initialize an option.
@param otype: The rdata type
@type otype: int
N)�otype)�selfr�r�/usr/lib/python3.6/edns.py�__init__szOption.__init__cCst�dS)z*Convert an option to wire format.
N)�NotImplementedError)r�filerrr�to_wire!szOption.to_wirecCst�dS)a�Build an EDNS option object from wire format
@param otype: The option type
@type otype: int
@param wire: The wire-format message
@type wire: string
@param current: The offset in wire of the beginning of the rdata.
@type current: int
@param olen: The length of the wire-format option data
@type olen: int
@rtype: dns.edns.Option instanceN)r)�clsr�wire�current�olenrrr� from_wire&s
zOption.from_wirecCst�dS)z�Compare an EDNS option with another option of the same type.
Return < 0 if self < other, 0 if self == other,
and > 0 if self > other.
N)r)r�otherrrr�_cmp5szOption._cmpcCs,t|t�sdS|j|jkrdS|j|�dkS)NF�)�
isinstancerrr)rrrrr�__eq__<s
z
Option.__eq__cCs,t|t�sdS|j|jkrdS|j|�dkS)NFr)rrrr)rrrrr�__ne__Cs
z
Option.__ne__cCs*t|t�s|j|jkrtS|j|�dkS)Nr)rrr�NotImplementedr)rrrrr�__lt__Jsz
Option.__lt__cCs*t|t�s|j|jkrtS|j|�dkS)Nr)rrrrr)rrrrr�__le__Psz
Option.__le__cCs*t|t�s|j|jkrtS|j|�dkS)Nr)rrrrr)rrrrr�__ge__Vsz
Option.__ge__cCs*t|t�s|j|jkrtS|j|�dkS)Nr)rrrrr)rrrrr�__gt__\sz
Option.__gt__N)�__name__�
__module__�__qualname__�__doc__rr
�classmethodrrrrrrrrrrrrrsrcs<eZdZdZ�fdd�Zdd�Zedd��Zdd �Z�Z S)
�
GenericOptionzwGenerate Rdata Class
This class is used for EDNS option types for which we have no better
implementation.
cstt|�j|�||_dS)N)�superr r�data)rrr")� __class__rrrkszGenericOption.__init__cCs|j|j�dS)N)�writer")rr rrrr
oszGenericOption.to_wirecCs||||||��S)Nr)rrrr
rrrrrrszGenericOption.from_wirecCs$|j|jkrdS|j|jkr dSdS)Nr����)r")rrrrrrvs
zGenericOption._cmp)
rrrrrr
rrr�
__classcell__rr)r#rr cs
r cCstj|�}|dkrt}|S)N)�_type_to_class�getr )rrrrr�get_option_class�s
r*cCst|�}|j||||�S)auBuild an EDNS option object from wire format
@param otype: The option type
@type otype: int
@param wire: The wire-format message
@type wire: string
@param current: The offset in wire of the beginning of the rdata.
@type current: int
@param olen: The length of the wire-format option data
@type olen: int
@rtype: dns.edns.Option instance)r*r)rrr
rrrrr�option_from_wire�s
r+N)rZNSID�objectrr r(r*r+rrrr�<module>sN
?>