eaiovnaovbqoebvqoeavibavo 3 bW @s@dZdZGdddeZGdddeZiZddZdd Zd S) z EDNS Optionsc@sdeZdZdZddZddZeddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS)Optionz*Base class for all EDNS option types. cCs ||_dS)z\Initialize an option. @param otype: The rdata type @type otype: int N)otype)selfrr/usr/lib/python3.6/edns.py__init__szOption.__init__cCstdS)z*Convert an option to wire format. N)NotImplementedError)rfilerrrto_wire!szOption.to_wirecCstdS)aBuild 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)clsrwirecurrentolenrrr from_wire&s zOption.from_wirecCstdS)zCompare 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)rotherrrr_cmp5sz Option._cmpcCs,t|tsdS|j|jkrdS|j|dkS)NF) isinstancerrr)rrrrr__eq__<s   z Option.__eq__cCs,t|tsdS|j|jkrdS|j|dkS)NFr)rrrr)rrrrr__ne__Cs   z Option.__ne__cCs*t|t s|j|jkrtS|j|dkS)Nr)rrrNotImplementedr)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<eZdZdZfddZddZeddZdd ZZ S) GenericOptionzwGenerate Rdata Class This class is used for EDNS option types for which we have no better implementation. cstt|j|||_dS)N)superr rdata)rrr") __class__rrrkszGenericOption.__init__cCs|j|jdS)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_classgetr )rr rrrget_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 rrroption_from_wires r+N)rZNSIDobjectrr r(r*r+rrrrs N