Numerical Fields

Sized Fields

class pcapkit.corekit.fields.numbers.Int32Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Integer value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.UInt32Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Unsigned integer value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.Int16Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Short integer value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.UInt16Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Unsigned short integer value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.Int64Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Long integer value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.UInt64Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Unsigned long integer value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.Int8Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Byte value for protocol fields.

Parameters:
class pcapkit.corekit.fields.numbers.UInt8Field(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: NumberField

Unsigned byte value for protocol fields.

Parameters:

Enumeration Fields

class pcapkit.corekit.fields.numbers.EnumField(length, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, namespace=None, callback=<function EnumField.<lambda>>)[source]

Bases: NumberField[IntEnum | IntEnum]

Enumerated value for protocol fields.

Parameters:
post_process(value, packet)[source]

Process field value after parsing (unpacked).

Parameters:
Return type:

IntEnum | IntEnum

Returns:

Processed field value.

Internal Definitions

class pcapkit.corekit.fields.numbers.NumberField(length=None, default=<pcapkit.corekit.fields.field.NoValueType object>, signed=False, byteorder='big', bit_length=None, callback=<function NumberField.<lambda>>)[source]

Bases: Field[int], Generic[_T]

Numerical value for protocol fields.

Parameters:
property bit_length: int

Field bit length.

__call__(packet)[source]

Update field attributes.

Parameters:

packet (dict[str, Any]) – Packet data.

Return type:

Self

Returns:

New instance of NumberField.

This method will return a new instance of NumberField instead of updating the current instance.

build_template(length, signed)[source]

Build template for field.

Parameters:
  • length (int) – Field size (in bytes)

  • signed (bool) – Whether the field is signed

Return type:

str

Returns:

Template for field.

pre_process(value, packet)[source]

Process field value before construction (packing).

Parameters:
  • value (int) – Field value.

  • packet (dict[str, Any]) – Packet data.

Return type:

int | bytes

Returns:

Processed field value.

post_process(value, packet)[source]

Process field value after parsing (unpacked).

Parameters:
Return type:

int

Returns:

Processed field value.

Type Variables

pcapkit.corekit.fields.numbers._T: int