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:
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:
NumberField
Unsigned 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:
NumberField
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.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:
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:
NumberField
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.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:
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:
NumberField
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__
.
- 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:
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.IntEnum
class).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
NumberField
instead of updating the current instance.