3 ¢báW ã@s@dZdZGdd„deƒZGdd„deƒZiZdd„Zdd „Zd S) z EDNS Optionséc@sdeZdZdZdd„Zdd„Zedd„ƒZdd „Zd d „Z d d „Z dd„Z dd„Z dd„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Ú_cmp5sz Option._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__Js  z Option.__lt__cCs*t|tƒ s|j|jkrtS|j|ƒdkS)Nr)rrrrr)rrrrrÚ__le__Ps  z Option.__le__cCs*t|tƒ s|j|jkrtS|j|ƒdkS)Nr)rrrrr)rrrrrÚ__ge__Vs  z Option.__ge__cCs*t|tƒ s|j|jkrtS|j|ƒdkS)Nr)rrrrr)rrrrrÚ__gt__\s  z Option.__gt__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr Ú classmethodrrrrrrrrrrrrrs rcs<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)r rr r 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 )rr rrrÚget_option_classs 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)rr r rr rrrÚoption_from_wireˆs r+N)rZNSIDÚobjectrr r(r*r+rrrrÚs N