Padding Arithmetic¶
pcapkit.corekit.schema.padding counts the octets of padding that take a
length to a boundary, for the padding fields, the schemas’ length callbacks, the
protocols’ makers and the capture engines alike. It is one of the
pcapkit.corekit.schema helpers shared across the schema layer, not part of
the header schema framework in pcapkit.protocols.schema; see
Choosing Between utilities and corekit.
Added in version 1.6.0.
- pcapkit.corekit.schema.padding.pad_length(length, align)[source]¶
Octets of padding that take
lengthoctets to analign-octet boundary.- Parameters:
- Returns:
from
0, wherelengthis already a multiple ofalign, toalign - 1.- Return type:
- Raises:
FieldValueError – If
alignis not positive.
A schema’s
lengthcallbacks are handed the packet data, not a protocol, so this is a plain function and not a protocol method.PaddingFieldsizes itself by it when givenalign.Added in version 1.6.0.