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__/ethernet.cpython-310.pyc
o

�b��@spdZddlZddlmZmZddlmZddlmZGdd�de�Z	Gdd	�d	�Z
ee	�Gd
d�dej��ZdS)z1Support for working directly with ethernet frames�N)�	Interface�implementer)�protocol)�rawc@s eZdZdZdd�Zdd�ZdS)�IEthernetProtocolz6An interface for protocols that handle Ethernet framescC�dS)z"Add an IRawPacketProtocol protocolN�)�num�protorr�7/usr/lib/python3/dist-packages/twisted/pair/ethernet.py�addProto�zIEthernetProtocol.addProtocCr)z#An Ethernet frame has been receivedNr)�data�partialrrr�datagramReceivedr
z"IEthernetProtocol.datagramReceivedN)�__name__�
__module__�__qualname__�__doc__rrrrrrrsrc@seZdZdd�ZdS)�EthernetHeadercCs$t�d|dd��\|_|_|_dS)Nz!6s6sH�)�struct�unpack�dest�sourcer
)�selfrrrr�__init__s�zEthernetHeader.__init__N)rrrrrrrrrsrc@s&eZdZdd�Zdd�Zd	dd�ZdS)
�EthernetProtocolcCs
i|_dS)N)�etherProtos)rrrrr&s
zEthernetProtocol.__init__cCsRt�|�}|dkr
td��|dkrtd��||jvrg|j|<|j|�|�dS)Nrz'Added protocol must be positive or zeroiz"Added protocol must fit in 16 bits)r�IRawPacketProtocol�	TypeErrorr�append)rr	r
rrrr)s


zEthernetProtocol.addProtorcCsLt|dd��}|j�|jd�D]}|j|dd�||j|j|jd�qdS)Nrr)rrrrr)rr�getr
rrr)rrr�headerr
rrrr3s
��z!EthernetProtocol.datagramReceivedN)r)rrrrrrrrrrr$s
r)
rr�zope.interfacerr�twisted.internetr�twisted.pairrrr�AbstractDatagramProtocolrrrrr�<module>s