HOME


Mini Shell 1.0
DIR: /usr/lib/python3/dist-packages/twisted/pair/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/twisted/pair/__pycache__/ethernet.cpython-312.pyc
�

Ϫ�f����dZddlZddlmZmZddlmZddlmZGd�de�Z	Gd�d	�Z
ee	�Gd
�dej��Zy)z1Support for working directly with ethernet frames�N)�	Interface�implementer)�protocol)�rawc��eZdZdZd�Zd�Zy)�IEthernetProtocolz6An interface for protocols that handle Ethernet framesc��y)z"Add an IRawPacketProtocol protocolN�)�num�protos  �7/usr/lib/python3/dist-packages/twisted/pair/ethernet.py�addProtozIEthernetProtocol.addProto���c��y)z#An Ethernet frame has been receivedNr
)�data�partials  r
�datagramReceivedz"IEthernetProtocol.datagramReceivedrrN)�__name__�
__module__�__qualname__�__doc__rrr
rr
rrs��@�1�2rrc��eZdZd�Zy)�EthernetHeaderc�\�tjd|dd�\|_|_|_y)Nz!6s6sH�)�struct�unpack�dest�sourcer)�selfrs  r
�__init__zEthernetHeader.__init__s)��/5�}�}��d�;�Y�'�0
�,���D�K��rN)rrrr"r
rr
rrs��
rrc� �eZdZd�Zd�Zdd�Zy)�EthernetProtocolc��i|_y)N)�etherProtos)r!s r
r"zEthernetProtocol.__init__%s
����rc���tj|�}|dkrtd��|dk\rtd��||jvrg|j|<|j|j	|�y)Nrz'Added protocol must be positive or zeroiz"Added protocol must fit in 16 bits)r�IRawPacketProtocol�	TypeErrorr&�append)r!rrs   r
rzEthernetProtocol.addProto(so���&�&�u�-����7��E�F�F��%�<��@�A�A��d�&�&�&�$&�D���S�!������$�$�U�+rc���t|dd�}|jj|jd�D]9}|j	|dd||j
|j|j���;y)Nrr
)rrrr r)rr&�getrrrr )r!rr�headerrs     r
rz!EthernetProtocol.datagramReceived2sl����S�b�	�*���%�%�)�)�&�,�,��;�	�E��"�"��"�#�Y���[�[��}�}����
#�
�	rN)r)rrrr"rrr
rr
r$r$#s���,�	rr$)
rr�zope.interfacerr�twisted.internetr�twisted.pairrrr�AbstractDatagramProtocolr$r
rr
�<module>r2sS��8�
�1�%��2�	�2�
�
�
�
���x�8�8�� �r