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:
NumberFieldInteger value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldUnsigned integer value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldShort integer value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldUnsigned short integer value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldLong integer value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldUnsigned long integer value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldByte value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- 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:
NumberFieldUnsigned byte value for protocol fields.
- Parameters:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes).default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
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:
length (
Union[int,Callable[[dict[str,Any]],int]]) – Field size (in bytes); if a callable is given, it should return an integer value and accept the current packet as its only argument.default (
IntEnum|IntEnum|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.namespace (
Union[Type[IntEnum],Type[IntEnum],None]) – Field namespace (aenum.IntEnumclass).callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
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:
length (
Union[int,Callable[[dict[str,Any]],int],None]) – Field size (in bytes); if a callable is given, it should return an integer value and accept the current packet as its only argument.default (
int|NoValueType) – Field default value, if any.signed (
bool) – Whether the field is signed.byteorder (
Literal['little','big']) – Field byte order.callback (
Callable[[Self,dict[str,Any]],None]) – Callback function to be called uponself.__call__.
- __call__(packet)[source]¶
Update field attributes.
- Parameters:
- Return type:
Self- Returns:
New instance of
NumberField.
This method will return a new instance of
NumberFieldinstead of updating the current instance.