HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/pair/__pycache__/ip.cpython-310.pyc
o

�b	�@sjdZddlZddlZddlmZddlmZddlmZGdd�d�Z	dZ
eej�Gd	d
�d
ej��Z
dS)z,Support for working directly with IP packets�N)�implementer)�protocol)�rawc@seZdZdd�ZdS)�IPHeaderc
Cs�t�d|dd��\
}|_|_|_}|_|_|_}}t�	|�|_
t�	|�|_|d@|_|d@d?d>|_
|d@|_|d@d	k|_|d
@d	k|_dS)Nz
!BBHHHBBH4s4s������i�i@ri )�struct�unpack�tos�tot_len�fragment_id�ttlr�check�socket�	inet_ntoa�saddr�daddr�version�ihl�fragment_offset�
dont_fragment�more_fragments)�self�data�
ihlversion�frag_offrr�r�1/usr/lib/python3/dist-packages/twisted/pair/ip.py�__init__s&
�

zIPHeader.__init__N)�__name__�
__module__�__qualname__r!rrrr rsrlc@s$eZdZdd�Zdd�Zdd�ZdS)�
IPProtocolcCs
i|_dS)N)�ipProtos)rrrr r!0s
zIPProtocol.__init__cCsRt�|�}|dkr
td��|tkrtd��||jvrg|j|<|j|�|�dS)Nrz'Added protocol must be positive or zeroz"Added protocol must fit in 32 bits)r�IRawDatagramProtocol�	TypeError�MAX_SIZEr&�append)r�num�protorrr �addProto3s


zIPProtocol.addProtocCsht|�}|j�|jd�D]%}|j|dd�||j|j|j|j|j|j	|j
|j|j|j
|j|jd�qdS)Nrr)r�partial�source�destrrrr
rrrrrr)rr&�getr�datagramReceivedrrrrr
rrrrrr)rrr.r0r/r�headerr,rrr r2=s&
��zIPProtocol.datagramReceivedN)r"r#r$r!r-r2rrrr r%.s
r%)�__doc__rr�zope.interfacer�twisted.internetr�twisted.pairrrr)�IRawPacketProtocol�AbstractDatagramProtocolr%rrrr �<module>s