diff --git a/pytcp/protocols/arp/arp__errors.py b/pytcp/protocols/arp/arp__errors.py index 7644af5f..af06bb6a 100755 --- a/pytcp/protocols/arp/arp__errors.py +++ b/pytcp/protocols/arp/arp__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class ArpIntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class ArpIntegrityError(PacketIntegrityError): Exception raised when ARP packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[ARP] " + message) @@ -52,5 +52,5 @@ class ArpSanityError(PacketSanityError): Exception raised when ARP packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[ARP] " + message) diff --git a/pytcp/protocols/dhcp4/dhcp4__errors.py b/pytcp/protocols/dhcp4/dhcp4__errors.py index c5fa250f..aadd1516 100755 --- a/pytcp/protocols/dhcp4/dhcp4__errors.py +++ b/pytcp/protocols/dhcp4/dhcp4__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Dhcp4IntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Dhcp4IntegrityError(PacketIntegrityError): Exception raised when DHCPv4 packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[DHCPv4] " + message) @@ -52,5 +52,5 @@ class Dhcp4SanityError(PacketSanityError): Exception raised when DHCPv4 packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[DHCPv4] " + message) diff --git a/pytcp/lib/errors.py b/pytcp/protocols/errors.py similarity index 96% rename from pytcp/lib/errors.py rename to pytcp/protocols/errors.py index 4ce5dbf9..be848bd4 100755 --- a/pytcp/lib/errors.py +++ b/pytcp/protocols/errors.py @@ -53,7 +53,7 @@ class PacketIntegrityError(PacketValidationError): Exception raised when integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[INTEGRITY ERROR]" + message) @@ -62,5 +62,5 @@ class PacketSanityError(PacketValidationError): Exception raised when sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[SANITY ERROR]" + message) diff --git a/pytcp/protocols/ethernet/ethernet__errors.py b/pytcp/protocols/ethernet/ethernet__errors.py index ac9a55d2..1ecdee91 100755 --- a/pytcp/protocols/ethernet/ethernet__errors.py +++ b/pytcp/protocols/ethernet/ethernet__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class EthernetIntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class EthernetIntegrityError(PacketIntegrityError): Exception raised when Ethernet packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[Ethernet] " + message) @@ -52,5 +52,5 @@ class EthernetSanityError(PacketSanityError): Exception raised when Ethernet packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[Ethernet] " + message) diff --git a/pytcp/protocols/ethernet_802_3/ethernet_802_3__errors.py b/pytcp/protocols/ethernet_802_3/ethernet_802_3__errors.py index 1f6fe1de..a4e18547 100755 --- a/pytcp/protocols/ethernet_802_3/ethernet_802_3__errors.py +++ b/pytcp/protocols/ethernet_802_3/ethernet_802_3__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Ethernet8023IntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Ethernet8023IntegrityError(PacketIntegrityError): Exception raised when Ethernet 802.3 packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[Ethernet 802.3] " + message) @@ -52,5 +52,5 @@ class Ethernet8023SanityError(PacketSanityError): Exception raised when Ethernet 802.3 packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[Ethernet 802.3] " + message) diff --git a/pytcp/protocols/icmp4/icmp4__errors.py b/pytcp/protocols/icmp4/icmp4__errors.py index 2a42d89e..295548f1 100755 --- a/pytcp/protocols/icmp4/icmp4__errors.py +++ b/pytcp/protocols/icmp4/icmp4__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Icmp4IntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Icmp4IntegrityError(PacketIntegrityError): The ICMPv4 packet integrity check failure. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[ICMPv4] " + message) @@ -52,5 +52,5 @@ class Icmp4SanityError(PacketSanityError): The ICMPv4 packet sanity check failure. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[ICMPv4] " + message) diff --git a/pytcp/protocols/icmp6/icmp6__errors.py b/pytcp/protocols/icmp6/icmp6__errors.py index 1cad12b5..1aef0520 100755 --- a/pytcp/protocols/icmp6/icmp6__errors.py +++ b/pytcp/protocols/icmp6/icmp6__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Icmp6IntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Icmp6IntegrityError(PacketIntegrityError): Exception raised when ICMPv6 packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[ICMPv6] " + message) @@ -52,5 +52,5 @@ class Icmp6SanityError(PacketSanityError): Exception raised when ICMPv6 packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[ICMPv6] " + message) diff --git a/pytcp/protocols/ip4/ip4__errors.py b/pytcp/protocols/ip4/ip4__errors.py index 80a86c9a..0f73b071 100755 --- a/pytcp/protocols/ip4/ip4__errors.py +++ b/pytcp/protocols/ip4/ip4__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Ip4IntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Ip4IntegrityError(PacketIntegrityError): Exception raised when IPv4 packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[IPv4] " + message) @@ -52,5 +52,5 @@ class Ip4SanityError(PacketSanityError): Exception raised when IPv4 packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[IPv4] " + message) diff --git a/pytcp/protocols/ip6/ip6__errors.py b/pytcp/protocols/ip6/ip6__errors.py index 0e790877..1fb15906 100755 --- a/pytcp/protocols/ip6/ip6__errors.py +++ b/pytcp/protocols/ip6/ip6__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Ip6IntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Ip6IntegrityError(PacketIntegrityError): Exception raised when IPv6 packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[IPv6] " + message) @@ -52,5 +52,5 @@ class Ip6SanityError(PacketSanityError): Exception raised when IPv6 packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[IPv6] " + message) diff --git a/pytcp/protocols/ip6_frag/ip6_frag__errors.py b/pytcp/protocols/ip6_frag/ip6_frag__errors.py index aaa548ab..a0002dd4 100755 --- a/pytcp/protocols/ip6_frag/ip6_frag__errors.py +++ b/pytcp/protocols/ip6_frag/ip6_frag__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class Ip6FragIntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class Ip6FragIntegrityError(PacketIntegrityError): Exception raised when IPv6 Frag packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[IPv6 Frag] " + message) @@ -52,5 +52,5 @@ class Ip6FragSanityError(PacketSanityError): Exception raised when IPv6 Frag packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[IPv6 Frag] " + message) diff --git a/pytcp/protocols/tcp/tcp__errors.py b/pytcp/protocols/tcp/tcp__errors.py index 6810ef99..9943d391 100755 --- a/pytcp/protocols/tcp/tcp__errors.py +++ b/pytcp/protocols/tcp/tcp__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class TcpIntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class TcpIntegrityError(PacketIntegrityError): Exception raised when TCP packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[TCP] " + message) @@ -52,5 +52,5 @@ class TcpSanityError(PacketSanityError): Exception raised when TCP packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[TCP] " + message) diff --git a/pytcp/protocols/udp/udp__errors.py b/pytcp/protocols/udp/udp__errors.py index bc595f4c..7538e4b0 100755 --- a/pytcp/protocols/udp/udp__errors.py +++ b/pytcp/protocols/udp/udp__errors.py @@ -35,7 +35,7 @@ from __future__ import annotations -from pytcp.lib.errors import PacketIntegrityError, PacketSanityError +from pytcp.protocols.errors import PacketIntegrityError, PacketSanityError class UdpIntegrityError(PacketIntegrityError): @@ -43,7 +43,7 @@ class UdpIntegrityError(PacketIntegrityError): Exception raised when UDP packet integrity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[UDP] " + message) @@ -52,5 +52,5 @@ class UdpSanityError(PacketSanityError): Exception raised when UDP packet sanity check fails. """ - def __init__(self, message: str, /): + def __init__(self, message: str, /) -> None: super().__init__("[UDP] " + message) diff --git a/pytcp/stack/packet_handler/packet_handler__arp__rx.py b/pytcp/stack/packet_handler/packet_handler__arp__rx.py index b6a1dcb5..e93104c7 100755 --- a/pytcp/stack/packet_handler/packet_handler__arp__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__arp__rx.py @@ -39,10 +39,10 @@ from typing import TYPE_CHECKING from pytcp import stack -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log from pytcp.protocols.arp.arp__header import ArpOperation from pytcp.protocols.arp.arp__parser import ArpParser +from pytcp.protocols.errors import PacketValidationError class PacketHandlerArpRx(ABC): diff --git a/pytcp/stack/packet_handler/packet_handler__ethernet_802_3__rx.py b/pytcp/stack/packet_handler/packet_handler__ethernet_802_3__rx.py index 656cf5c3..ca5909c3 100755 --- a/pytcp/stack/packet_handler/packet_handler__ethernet_802_3__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__ethernet_802_3__rx.py @@ -37,8 +37,8 @@ from abc import ABC from typing import TYPE_CHECKING -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.ethernet_802_3.ethernet_802_3__parser import ( Ethernet8023Parser, ) diff --git a/pytcp/stack/packet_handler/packet_handler__ethernet__rx.py b/pytcp/stack/packet_handler/packet_handler__ethernet__rx.py index 918e89f7..9940cbe1 100755 --- a/pytcp/stack/packet_handler/packet_handler__ethernet__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__ethernet__rx.py @@ -38,8 +38,8 @@ from abc import ABC from typing import TYPE_CHECKING -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.ethernet.ethernet__header import EtherType from pytcp.protocols.ethernet.ethernet__parser import EthernetParser diff --git a/pytcp/stack/packet_handler/packet_handler__icmp4__rx.py b/pytcp/stack/packet_handler/packet_handler__icmp4__rx.py index 7c49654a..db4e21da 100755 --- a/pytcp/stack/packet_handler/packet_handler__icmp4__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__icmp4__rx.py @@ -41,9 +41,9 @@ from net_addr import Ip4Address from pytcp import stack -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log from pytcp.protocols.enums import IpProto +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.icmp4.icmp4__parser import Icmp4Parser from pytcp.protocols.icmp4.message.icmp4_message import Icmp4Type from pytcp.protocols.icmp4.message.icmp4_message__destination_unreachable import ( diff --git a/pytcp/stack/packet_handler/packet_handler__icmp6__rx.py b/pytcp/stack/packet_handler/packet_handler__icmp6__rx.py index 68cdda1e..471034a2 100755 --- a/pytcp/stack/packet_handler/packet_handler__icmp6__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__icmp6__rx.py @@ -41,9 +41,9 @@ from net_addr import Ip6Address from pytcp import stack -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log from pytcp.protocols.enums import IpProto +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.icmp6.icmp6__parser import Icmp6Parser from pytcp.protocols.icmp6.message.icmp6_message import Icmp6Type from pytcp.protocols.icmp6.message.icmp6_message__destination_unreachable import ( diff --git a/pytcp/stack/packet_handler/packet_handler__ip4__rx.py b/pytcp/stack/packet_handler/packet_handler__ip4__rx.py index f27d0134..a7c3cab3 100755 --- a/pytcp/stack/packet_handler/packet_handler__ip4__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__ip4__rx.py @@ -41,11 +41,11 @@ from typing import TYPE_CHECKING from pytcp import stack -from pytcp.lib.errors import PacketValidationError from pytcp.lib.inet_cksum import inet_cksum from pytcp.lib.logger import log from pytcp.lib.packet import PacketRx from pytcp.protocols.enums import IpProto +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.ip4.ip4__header import IP4__HEADER__LEN from pytcp.protocols.ip4.ip4__parser import Ip4Parser diff --git a/pytcp/stack/packet_handler/packet_handler__ip6__rx.py b/pytcp/stack/packet_handler/packet_handler__ip6__rx.py index 0564cd8c..bc235793 100755 --- a/pytcp/stack/packet_handler/packet_handler__ip6__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__ip6__rx.py @@ -38,10 +38,10 @@ from abc import ABC from typing import TYPE_CHECKING -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log from pytcp.lib.packet import PacketRx from pytcp.protocols.enums import IpProto +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.ip6.ip6__parser import Ip6Parser diff --git a/pytcp/stack/packet_handler/packet_handler__tcp__rx.py b/pytcp/stack/packet_handler/packet_handler__tcp__rx.py index 1ed0c21d..a2fb2b54 100755 --- a/pytcp/stack/packet_handler/packet_handler__tcp__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__tcp__rx.py @@ -39,9 +39,9 @@ from typing import TYPE_CHECKING, cast from pytcp import stack -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log from pytcp.lib.packet import PacketRx +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.tcp.tcp__parser import TcpParser from pytcp.socket.tcp__metadata import TcpMetadata from pytcp.socket.tcp__socket import TcpSocket diff --git a/pytcp/stack/packet_handler/packet_handler__udp__rx.py b/pytcp/stack/packet_handler/packet_handler__udp__rx.py index af8daf03..25fa860f 100755 --- a/pytcp/stack/packet_handler/packet_handler__udp__rx.py +++ b/pytcp/stack/packet_handler/packet_handler__udp__rx.py @@ -40,9 +40,9 @@ from net_addr import Ip4Address from pytcp import stack -from pytcp.lib.errors import PacketValidationError from pytcp.lib.logger import log from pytcp.lib.packet import PacketRx +from pytcp.protocols.errors import PacketValidationError from pytcp.protocols.icmp4.icmp4__base import Icmp4Message from pytcp.protocols.icmp4.message.icmp4_message__destination_unreachable import ( Icmp4DestinationUnreachableCode,