Metadata-Version: 2.0
Name: ezstruct
Version: 0.1.0
Summary: Expressive syntax for working with binary data formats and network protocols.
Home-page: http://github.com/matthewg/EzStruct/
Author: Matthew Sachs
Author-email: matthewg@zevils.com
License: Apache
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: six

========
EzStruct
========

:copyright: 2013 by Matthew Sachs
:license: Apache License v2.0

Expressive syntax for working with binary data formats and network
protocols.  Like the :py:mod:`struct` module, but with a more readable
syntax, especially if your format has:

* Length-prefixed variable-length byte sequences or strings
* Count-prefixed variable-count repeated fields
* Terminated (null or otherwise) strings
* String encodings
* Numbers which represent enumeration members

Example::

  tcp = ezstruct.Struct(
      "NET_ENDIAN",
      ezstruct.Field("UINT16", name="sport"),
      ezstruct.Field("UINT16", name="dport"),
      ezstruct.Field("UINT32", name="seqno"),
      ezstruct.Field("UINT32", name="ackno"),
      ezstruct.Field("UINT16",
                     name="flags",
                     value_transform=ezstruct.FieldTransform(
		         pack_flags_bitfield,
			 unpack_flags_bitfield)),
      ezstruct.Field("UINT16", name="window_size"),
      ezstruct.Field("UINT16", name="checksum"),
      ezstruct.Field("UINT16", name="urg"),
      ezstruct.Field("BYTES",
                     name="options",
		     default_pack_value={},
		     length=lambda data: data["offset"] - 5,
		     value_transform=ezstruct.FieldTransform(
                         pack_and_pad_options,
			 unpack_options)))

  header_data = {"sport": 123,
                 "dport": 456,
                 "seqno": 1,
                 "ackno": 0,
                 "flags": {"offset": 5,
		           "syn": 1},
		 "window_size": 100,
		 "checksum": 0,
		 "urg": 0}
  header_bytes = tcp.pack_bytes(header_data)
  assert tcp.unpack_bytes(header_bytes) == header_data


History
=======

v0.1.0, 2014-01-15
  Initial release.


Authors
=======

* `Matthew Sachs <http://github.com/matthewg/>`_


