HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/pair/test/__pycache__/test_ip.cpython-38.pyc
U


W[,;�@sdddlmZddlmZddlmZmZddlmZe�	ej
�Gdd�d��ZGdd�dej�Z
d	S)
�)�unittest)�
components)�ip�raw)�	interfacec@seZdZdd�Zdd�ZdS)�
MyProtocolcCst|�|_dS)N)�list�	expecting)�selfr	�r�;/usr/lib/python3/dist-packages/twisted/pair/test/test_ip.py�__init__szMyProtocol.__init__cKs�|jstd��|j�d�\}}|��}tt|��}|��}tt|��}||ks^td||f��|D].}||||ksbtd|||||f��qb||ks�td||f��||ks�td||f��dS)Nz(Got a packet when not expecting anymore.rzExpected %r, got %rzExpected %s=%r, got %r)r	�AssertionError�pop�keysr�sorted)r
�data�kwZ
expectDataZexpectKwZexpectKwKeysZkwKeys�krrr�datagramReceiveds,zMyProtocol.datagramReceivedN)�__name__�
__module__�__qualname__r
rrrrrr
src@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�IPTestscCsjt��}tddddddddd	d
dddd
d�
fg�}|�d|�|jdddddd�|jrftd|j��dS�N�foobarr�1.2.3.4�5.6.7.8������������
�partial�dest�source�protocol�versionZihlZtosZtot_lenZfragment_idZfragment_offsetZ
dont_fragmentZmore_fragmentsZttl�Tޭ��FEfoobar�dummy�r(r)r*r+�5Should not expect any more packets, but still want %r�r�
IPProtocolr�addProtorr	r�r
�proto�p1rrr�testPacketParsings8����zIPTests.testPacketParsingcCs�t��}tddddddddd	d
dddd
d�
fddddddddd	d
dddd
d�
fg�}|�d|�|jdddddd�|jdddddd�|jr�td|j��dS)Nrrrrrrr r!r"r#r$r%r&r'�quux�5.4.3.2�6.7.8.9r-r.r/�Tޭ��FE	quuxr0r1r4rrr�testMultiplePacketsJsb���#���zIPTests.testMultiplePacketscCs�t��}tddddddddd	d
dddd
d�
fg�}tddddddddd	d
dddd
d�
fg�}|�d|�|�d|�|jdddddd�|jr�td|j��|jr�td|j��dSrr1�r
r5r6Zp2rrr�testMultipleSameProtos�sb�������zIPTests.testMultipleSameProtoscCs4t��}tg�}|�d|�|jdddddd�dS)Nr%r-rr.r/)rr2rr3rr4rrr�testWrongProtoNotSeen�s�zIPTests.testWrongProtoNotSeencCs8t��}tddddddddd	d
dddd
d�
fddddddddd	d
dddd
d�
fg�}|�d|�tddddddddd	d
dddd
d�
fddddddddd	d
dddd
d�
fg�}|�d|�|jdddddd�|jdddddd�|jdddddd�|jdddddd�|j�rtd|j��|j�r4td|j��dS)Nrrrrrrr r!r"r#r$r%r&r'r8r9r:�
sTޭ��
FE	quuxr.r/r-r;sTޭ��
FEfoobarr0r1r=rrr�testDemuxing�s����#���$����
�
�zIPTests.testDemuxingcCs<t��}z|�dd�Wntjk
r.Yn
Xtd��dS)z2Adding a wrong level protocol raises an exception.�*Z	silliness�2addProto must raise an exception for bad protocolsN)rr2r3rZCannotAdaptr�r
�errr�testAddingBadProtos_WrongLevel�sz&IPTests.testAddingBadProtos_WrongLevelc
CsZt��}z|�dtg��Wn0tk
rL}z|jdkr:n�W5d}~XYn
Xtd��dS)z=Adding a protocol with a negative number raises an exception.���)z'Added protocol must be positive or zeroNrC�rr2r3r�	TypeError�argsrrDrrr�testAddingBadProtos_TooSmall�s
z$IPTests.testAddingBadProtos_TooSmallc
CsZt��}z|�dtg��Wn0tk
rL}z|jdkr:n�W5d}~XYn
Xtd��dS)�<Adding a protocol with a number >=2**32 raises an exception.l�z"Added protocol must fit in 32 bitsNrCrHrDrrr�testAddingBadProtos_TooBig�s
z"IPTests.testAddingBadProtos_TooBigc
CsZt��}z|�dtg��Wn0tk
rL}z|jdkr:n�W5d}~XYn
Xtd��dS)rLlrMNrCrHrDrrr�testAddingBadProtos_TooBig2�s
z#IPTests.testAddingBadProtos_TooBig2N)rrrr7r<r>r?rArFrKrNrOrrrrrs+KC
rN)Z
twisted.trialrZtwisted.pythonrZtwisted.pairrr�zoperZimplementerZIRawDatagramProtocolrZTestCaserrrrr�<module>s