File: //lib/python3/dist-packages/twisted/names/__pycache__/_rfc1982.cpython-310.pyc
o
�b�# � @ sR d Z ddlZddlmZmZ ddlmZ ddlmZ dZG dd� de�Z dgZ
dS ) a�
Utilities for handling RFC1982 Serial Number Arithmetic.
@see: U{http://tools.ietf.org/html/rfc1982}
@var RFC4034_TIME_FORMAT: RRSIG Time field presentation format. The Signature
Expiration Time and Inception Time field values MUST be represented either
as an unsigned decimal integer indicating seconds since 1 January 1970
00:00:00 UTC, or in the form YYYYMMDDHHmmSS in UTC. See U{RRSIG Presentation
Format<https://tools.ietf.org/html/rfc4034#section-3.2>}
� N)�datetime� timedelta)�nativeString)�
FancyStrMixinz%Y%m%d%H%M%Sc @ s� e Zd ZdZdZd!dd�Zdedd fdd �Zdefd
d�Z dd
� Z
dedefdd�Zdedefdd�Z
dedefdd�Zdedefdd�Zdedefdd�Zdedd fdd�Zdd� Zedd� �Zdd� Zd S )"�SerialNumbera�
An RFC1982 Serial Number.
This class implements RFC1982 DNS Serial Number Arithmetic.
SNA is used in DNS and specifically in DNSSEC as defined in RFC4034 in the
DNSSEC Signature Expiration and Inception Fields.
@see: U{https://tools.ietf.org/html/rfc1982}
@see: U{https://tools.ietf.org/html/rfc4034}
@ivar _serialBits: See C{serialBits} of L{__init__}.
@ivar _number: See C{number} of L{__init__}.
@ivar _modulo: The value at which wrapping will occur.
@ivar _halfRing: Half C{_modulo}. If another L{SerialNumber} value is larger
than this, it would lead to a wrapped value which is larger than the
first and comparisons are therefore ambiguous.
@ivar _maxAdd: Half C{_modulo} plus 1. If another L{SerialNumber} value is
larger than this, it would lead to a wrapped value which is larger than
the first. Comparisons with the original value would therefore be
ambiguous.
))�_number�number�%d)�_serialBits�
serialBitsr � c C sD || _ d| | _d|d | _d|d d | _t|�| j | _dS )a�
Construct an L{SerialNumber} instance.
@param number: An L{int} which will be stored as the modulo
C{number % 2 ^ serialBits}
@type number: L{int}
@param serialBits: The size of the serial number space. The power of two
which results in one larger than the largest integer corresponding
to a serial number value.
@type serialBits: L{int}
� � N)r
�_modulo� _halfRing�_maxAdd�intr )�selfr r � r �8/usr/lib/python3/dist-packages/twisted/names/_rfc1982.py�__init__8 s
zSerialNumber.__init__�other�returnc C s>