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.
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.