Metadata-Version: 2.1
Name: packet
Version: 0.5
Summary: create classes to (un)pack packets to/from objects with named fields
Home-page: http://www.ultimate.com/phil/python/#packet
Author: Phil Budne
Author-email: phil@ultimate.com
License: MIT
Download-URL: http://www.ultimate.com/phil/python/download/packet-0.5.tar.gz
Platform: Any
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking

The packet module is a front-end to the struct module.  It allows the
user to define a packet format, and to create a Python class to represent
those packets with named attributes for each packet field::

    # demo: make an IP packet packer/unpacker

    # IP Prototype
    ipp = Prototype()
    ipp.add_uint8('vhl')
    ipp.add_uint8('tos')
    ipp.add_uint16('len')
    ipp.add_uint16('id')
    ipp.add_uint16('off')
    ipp.add_uint8('ttl')
    ipp.add_uint8('p')
    ipp.add_uint16('sum')
    ipp.add_uint32('src')
    ipp.add_uint32('dst')
    IP = ipp.klass('IP', NETWORK)
    del ipp

    # ....

    # create an IP packet instance from bytes
    packet = IP(bytes)

    # create an empty packet
    packet = IP()

    # access fields
    print(packet.len)

    # pack fields into bytes
    bytes = packet.pack()


