From d064a901a4c321e89eef5156b618b84e85e288ad Mon Sep 17 00:00:00 2001 From: Sebastian Majewski Date: Mon, 16 Sep 2024 23:52:54 -0500 Subject: [PATCH] Adding RAW socket support --- pytcp/socket/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pytcp/socket/__init__.py b/pytcp/socket/__init__.py index 81682e7b..218b0c75 100755 --- a/pytcp/socket/__init__.py +++ b/pytcp/socket/__init__.py @@ -76,6 +76,7 @@ def socket( from pytcp.socket.tcp__socket import TcpSocket from pytcp.socket.udp__socket import UdpSocket + from pytcp.socket.raw__socket import RawSocket match type, protocol: case SocketType.STREAM, None | IpProto.TCP: @@ -87,8 +88,8 @@ def socket( case SocketType.DGRAM, IpProto.ICMP4 | IpProto.ICMP6: raise NotImplementedError - case SocketType.RAW, IpProto.ICMP4 | IpProto.ICMP6: - raise NotImplementedError + case SocketType.RAW, _: + return RawSocket(address_family=family, ip_proto=protocol) case _: raise ValueError("Invalid socket type.")