%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/netaddr/strategy/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/netaddr/strategy/__pycache__/ipv6.cpython-312.pyc

�

ӊ�^��
�j�dZddlZdZ	ddlZejsed��ejejddlmZ
mZm	Z	dZddlmZddlmZmZmZmZmZmZmZmZ m!Z"d	Z#d
Z$dZ%e	Z&dZ'd
Z(d
Z)de#zdz
Z*e#e$zZ+de$zdz
Z,e-e.de#dz�D�cgc]}|e*de#|z
zdz
zf��c}�Z/e-e.de#dz�D�cgc]}e*de#|z
zdz
z|f��c}�Z0e-e.de#dz�D�cgc]}|de#|z
zdz
f��c}�Z1e-e.de#dz�D�cgc]}de#|z
zdz
|f��c}�Z2Gd�de3�Z4Gd�de4�Z5Gd�de4�Z6d%d�Z7d%d�Z8d&d�Z9d�Z:d�Z;d�Z<d�Zd'd�Zd�Zd�Zd �Zd&d!�Zd"�Zd#�Zd$�Z!y#e$rddl
mZ
mZm	Z	Y��WwxYwcc}wcc}wcc}wcc}w)(z
IPv6 address logic.
�NFz
IPv6 disabled)�	inet_pton�	inet_ntop�AF_INET6T)�AddrFormatError)	�valid_words�int_to_words�words_to_int�
valid_bits�bits_to_int�int_to_bits�	valid_bin�
int_to_bin�
bin_to_int���:�IPv6���c��eZdZdZdZdZy)�ipv6_compactz%An IPv6 dialect class - compact form.z%xTN��__name__�
__module__�__qualname__�__doc__�word_fmt�compact���7/usr/lib/python3/dist-packages/netaddr/strategy/ipv6.pyrrVs��/��H��Gr!rc��eZdZdZdZy)�	ipv6_fullz*An IPv6 dialect class - 'all zeroes' form.FN)rrrrrr r!r"r$r$^s��4��Gr!r$c��eZdZdZdZdZy)�ipv6_verbosez5An IPv6 dialect class - extra wide 'all zeroes' form.z%.4xFNrr r!r"r&r&ds��?��H��Gr!r&c�T�|dk(rtd��	tt|�y#YyxYw)a
    :param addr: An IPv6 address in presentation (string) format.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Future use - currently has no effect.

    :return: ``True`` if IPv6 address is valid, ``False`` otherwise.
    �z Empty strings are not supported!FT)r�
_inet_ptonr)�addr�flagss  r"�	valid_strr,ns5���r�z��@�A�A���8�T�"�����s�#�'c�p�	tt|�}t|�S#t$rt	|�d���wxYw)a
    :param addr: An IPv6 address in string form.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Future use - currently has no effect.

    :return: The equivalent unsigned integer for a given IPv6 address.
    z$ is not a valid IPv6 address string!)r)r�
packed_to_int�	Exceptionr)r*r+�
packed_ints   r"�
str_to_intr1�s>��R���$�/�
��Z�(�(���R��$�P�Q�Q�R�s��5c�P�|�t}d}	t|�}|jrtt|�}|Stt
jd|��}|D�cgc]}|j|z��}}tj|�}	|Scc}w#t$rt|�d���wxYw)z�
    :param int_val: An unsigned integer.

    :param dialect: (optional) a Python class defining formatting options.

    :return: The IPv6 presentation (string) format address equivalent to the
        unsigned integer provided.
    Nz>8Hz) is not a valid 128-bit unsigned integer!)
r�
int_to_packedr�
_inet_ntopr�list�_struct�unpackr�word_sep�joinr/�
ValueError)�int_val�dialectr*r0�words�word�tokenss       r"�
int_to_strr@�s��������D�U�"�7�+�
��?�?��h�
�3�D��K�
�����z�:�;�E�:?�@�$�g�&�&��-�@�F�@��=�=��(�D��K��A���U��'�S�T�T�U�s"�'B
�#B
�B�.B
�B
�
B%c��t|t�}t|jdd��}|j	�|gd�z}dj|�S)z�
    :param int_val: An unsigned integer.

    :return: The reverse DNS lookup for an IPv6 address in network byte
        order integer form.
    rr()�ip6�arpar(�.)r@r&r5�replace�reverser9)r;r*r?s   r"�int_to_arparG�sI���g�|�,�D�
�$�,�,�s�B�'�
(�F�
�N�N��
�)�
)�F��8�8�F��r!c�H�t|dd�}tjdg|���S)z�
    :param int_val: the integer to be packed.

    :return: a packed string that is equivalent to value represented by an
    unsigned integer.
    �� �>4I)rr6�pack)r;r=s  r"r3r3�s&��
��!�R�(�E��<�<��&��&�&r!c��ttjd|��}d}tt	|��D]\}}|}|d|zz}||z}�|S)a
    :param packed_int: a packed string containing an unsigned integer.
        It is assumed that string is packed in network byte order.

    :return: An unsigned integer equivalent to value of network address
        represented by packed binary string.
    rKrrJ)r5r6r7�	enumerate�reversed)r0r=r;�i�numr>s      r"r.r.�s\��
�����z�2�3�E��G��H�U�O�,�!���3����r�A�v�~���D�.��!�
�Nr!c�,�t|tt�S�N)�_valid_words�	word_size�	num_words�r=s r"rr�s����y�)�4�4r!c�X�|�
t�d}|�
t�d}t|||�S)NrVrU)�globals�
_int_to_words)r;rVrUs   r"rr�s5�����I�k�*�	����I�k�*�	���)�Y�7�7r!c�,�t|tt�SrS)�
_words_to_intrUrVrWs r"r	r	�s����	�9�5�5r!c�,�t|tt�SrS)�_valid_bits�widthr8��bitss r"r
r
�s���t�U�H�-�-r!c�,�t|tt�SrS)�_bits_to_intr_r8r`s r"rr�s����e�X�.�.r!c�L�|�
t�d}t|tt|�S)Nr8)rY�_int_to_bitsrUrV)r;r8s  r"rr�s%�����9�Z�(�����I�x�@�@r!c�"�t|t�SrS)�
_valid_binr_��bin_vals r"r
r
�s���g�u�%�%r!c�"�t|t�SrS)�_int_to_binr_)r;s r"rr�����w��&�&r!c�"�t|t�SrS)�_bin_to_intr_rhs r"rrrlr!)rrS)NN)=r�structr6�OPT_IMPORTS�socket�_socket�has_ipv6r/rrr)rr4�netaddr.fbsocket�netaddr.corer�netaddr.strategyrrTrrZr	r\r
r^rrcrrer
rgrrkrrnr_rUr8�family�family_name�version�	word_base�max_intrV�max_word�dict�range�prefix_to_netmask�netmask_to_prefix�prefix_to_hostmask�hostmask_to_prefix�objectrr$r&r,r1r@rGr3r.)rPs0r"�<module>r�sT������+�������(�(�������#�#��K�
)����	��
�	���
������
�	��u�*�q�.��
�Y��	�
�	�>�A����49�!�U�1�W�4E�F�q�a��A�%�!�)�$�q�(�	)�*�F�H���49�!�U�1�W�4E�F�q�g��u�q�y�!�A�%�&��*�F�H���*/��5��7�*;�<�Q�a�!���	�
�Q�
� �<�>���*/��5��7�*;�<�Q�q�U�Q�Y��!��a� �<�>���6������<���&
R� �<�'��&5�8�6�.�/�A�&�'�'��U�+�+�+�+��XG��G��=��=s)�<F�F!�F&�1F+�F0�F�F

Zerion Mini Shell 1.0