Skip to main content
========
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/>`_

Metadata

Release files for ezstruct 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezstruct 0.1.0
File Size Uploaded Provenance Actions
ezstruct-0.1.0.tar.gz 13.9 kB Without provenance Details for ezstruct-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ezstruct 0.1.0
File Interpreter ABI Platform Actions
ezstruct-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for ezstruct-0.1.0-py2.py3-none-any.whl

Total release size: 25.5 kB

Release files / ezstruct-0.1.0.tar.gz

Download URL ezstruct-0.1.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
df2776974ac5328d5a82267ec6b8c49d5d6fb26580dec656e93ec54146401d0f
BLAKE2b-256 checksum
How to use checksums
6682edb807b2622082b15c56400fbe88301c238b5777aef86baab06bfabbd58e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ezstruct-0.1.0-py2.py3-none-any.whl

Download URL ezstruct-0.1.0-py2.py3-none-any.whl
Size 11.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
86dcc03a4f784a0b7095e610e58409dced8a83fa1e27fcf8dd0c90c838413a6c
BLAKE2b-256 checksum
How to use checksums
4bee2c5c5773aa5023fc940e9504f71dee7f28b6d81dbc3e593b466da66b8bd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ezstruct 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page