Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions pcapkit/protocols/data/internet/ipv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ def __new__(cls, *args: 'Any', **kwargs: 'Any') -> 'ToSField':
class Flags(Data):
"""Data model for IPv4 Flags."""

#: Reserved flag bit.
reserved: 'int'
#: Don't fragment.
df: 'bool'
#: More fragments.
mf: 'bool'

if TYPE_CHECKING:
def __init__(self, df: 'bool', mf: 'bool') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
def __init__(self, reserved: 'int', df: 'bool', mf: 'bool') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin


@info_final
Expand Down Expand Up @@ -120,6 +122,8 @@ class IPv4(Protocol):
if TYPE_CHECKING:
#: Options, present only when the header carries any.
options: 'OrderedMultiDict[OptionNumber, Option]'
#: Octets after the End of Option List, present along with ``options``.
padding: 'bytes'

def __init__(self, version: 'Literal[4]', hdr_len: 'int', tos: 'ToSField', len: 'int', id: 'int', flags: 'Flags', offset: 'int', ttl: 'timedelta', protocol: 'TransType', checksum: 'bytes', src: 'IPv4Address', dst: 'IPv4Address') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin

Expand Down Expand Up @@ -202,11 +206,13 @@ class LSROption(Option):

#: Pointer.
pointer: 'int'
#: Route.
#: Route, i.e. the address slots before the pointer.
route: 'tuple[IPv4Address, ...]'
#: Address slots at or beyond the pointer.
remaining: 'tuple[IPv4Address, ...]'

if TYPE_CHECKING:
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', pointer: 'int', route: 'tuple[IPv4Address, ...]') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', pointer: 'int', route: 'tuple[IPv4Address, ...]', remaining: 'tuple[IPv4Address, ...]') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin


@info_final
Expand Down Expand Up @@ -245,11 +251,13 @@ class RROption(Option):

#: Pointer.
pointer: 'int'
#: Route.
#: Route, i.e. the address slots before the pointer.
route: 'Optional[tuple[IPv4Address, ...]]'
#: Address slots at or beyond the pointer.
remaining: 'tuple[IPv4Address, ...]'

if TYPE_CHECKING:
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', pointer: 'int', route: 'Optional[tuple[IPv4Address, ...]]') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', pointer: 'int', route: 'Optional[tuple[IPv4Address, ...]]', remaining: 'tuple[IPv4Address, ...]') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin


@info_final
Expand All @@ -269,11 +277,13 @@ class SSROption(Option):

#: Pointer.
pointer: 'int'
#: Route.
#: Route, i.e. the address slots before the pointer.
route: 'Optional[tuple[IPv4Address, ...]]'
#: Address slots at or beyond the pointer.
remaining: 'tuple[IPv4Address, ...]'

if TYPE_CHECKING:
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', pointer: 'int', route: 'Optional[tuple[IPv4Address, ...]]') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', pointer: 'int', route: 'Optional[tuple[IPv4Address, ...]]', remaining: 'tuple[IPv4Address, ...]') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin


@info_final
Expand Down Expand Up @@ -355,17 +365,23 @@ class QuickStartRequestOption(QSOption):
ttl: 'timedelta'
#: Nonce.
nonce: 'int'
#: Reserved bits after the nonce.
reserved: 'int'

if TYPE_CHECKING:
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', func: 'QSFunction', rate: 'int', ttl: 'timedelta', nonce: 'int') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', func: 'QSFunction', rate: 'int', ttl: 'timedelta', nonce: 'int', reserved: 'int') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin


@info_final
class QuickStartReportOption(QSOption):
"""Data model for IPv4 Quick Start report of approved rate option."""

#: Not-used octet, where a request carries its TTL.
unused: 'int'
#: Nonce.
nonce: 'int'
#: Reserved bits after the nonce.
reserved: 'int'

if TYPE_CHECKING:
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', func: 'QSFunction', rate: 'int', nonce: 'int') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
def __init__(self, code: 'OptionNumber', length: 'int', type: 'OptionType', func: 'QSFunction', rate: 'int', unused: 'int', nonce: 'int', reserved: 'int') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,line-too-long,redefined-builtin
Loading
Loading