%PDF- %PDF-
Direktori : /lib/python3/dist-packages/netaddr/eui/__pycache__/ |
Current File : //lib/python3/dist-packages/netaddr/eui/__pycache__/ieee.cpython-312.pyc |
� ���^W$ � �� � d Z ddlmZ ddlZddlmZmZ ddl m Z mZ i Zi Z G d� de � Z G d� de� Z G d � d e� Zd� Zd� Zd � Zd� Zedk( r e� y e� y)z� Provides access to public OUI and IAB registration data published by the IEEE. More details can be found at the following URLs :- - IEEE Home Page - http://www.ieee.org/ - Registration Authority Home Page - http://standards.ieee.org/regauth/ � N)�_bytes_type�_importlib_resources)� Subscriber� Publisherc � � e Zd ZdZd� Zd� Zy)�FileIndexerz� A concrete Subscriber that receives OUI record offset information that is written to an index data file as a set of comma separated records. c � � t |d� rt |d� r|| _ nt |d� | _ t j | j d�� | _ y)z� Constructor. :param index_file: a file-like object or name of index file where index records will be written. �readline�tell�w� )�lineterminatorN)�hasattr�fh�open�_csv�writer)�self� index_files �2/usr/lib/python3/dist-packages/netaddr/eui/ieee.py�__init__zFileIndexer.__init__6 sB � � �:�z�*�w�z�6�/J� �D�G��:�s�+�D�G��k�k�$�'�'�$�?��� c �: � | j j |� y)z� Receives and writes index data to a CSV data file. :param data: record containing offset record information. N)r �writerow)r �datas r �updatezFileIndexer.updateD s � � �����T�"r N)�__name__� __module__�__qualname__�__doc__r r � r r r r 1 s � ��@�#r r c �( � � e Zd ZdZ� fd�Zd� Z� xZS )�OUIIndexParsera� A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size of the record (in bytes). The file processed by this parser is available online from this URL :- - http://standards.ieee.org/regauth/oui/oui.txt This is a sample of the record structure expected:: 00-CA-FE (hex) ACME CORPORATION 00CAFE (base 16) ACME CORPORATION 1 MAIN STREET SPRINGFIELD UNITED STATES c � �� t t | � � t |d� rt |d� r|| _ yt |d� | _ y)z� Constructor. :param ieee_file: a file-like object or name of file containing OUI records. When using a file-like object always open it in binary mode otherwise offsets will probably misbehave. r r �rbN)�superr# r r r r �r � ieee_file� __class__s �r r zOUIIndexParser.__init__b �: �� � �n�d�,�.��9�j�)�g�i��.H��D�G��9�d�+�D�Gr c � � d}d}d}t d� }t d� }t d� } | j j � }|sn�|r||v rd}|r�)||v r�|�"|j |� | j |� t |� }| j j � t |� z }|j � d } t | j ||� d� } | |g}n|t |� z }��|j |� | j |� y) z� Starts the parsing process which detects records and notifies registered subscribers as it finds each OUI record. TNr �(hex)�-� F� ) r r r �append�notify�lenr �split�int�replace)r �skip_header�record�size�marker�hyphen�empty_string�line�offset�oui�indexs r �parsezOUIIndexParser.parseq s � � �������W�%���S�!��"�2�����7�7�#�#�%�D����v��~�#������~��%��M�M�$�'��K�K��'��4�y���'�'�,�,�.�3�t�9�4���j�j�l�1�o���C�K�K���=�r�B������ ��D� �!��7 �<