Skip to content

packet

Packet

Bases: ABC

Object representation of a packet in the EO network protocol.

Source code in src/eolib/protocol/net/packet.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Packet(ABC):
    """
    Object representation of a packet in the EO network protocol.
    """

    @staticmethod
    @abstractmethod
    def family() -> PacketFamily:
        """
        Returns the packet family associated with this packet.

        Returns:
            PacketFamily: The packet family associated with this packet.
        """
        raise NotImplementedError()

    @staticmethod
    @abstractmethod
    def action() -> PacketAction:
        """
        Returns the packet action associated with this packet.

        Returns:
            PacketAction: The packet action associated with this packet.
        """
        raise NotImplementedError()

    @abstractmethod
    def write(self, writer: EoWriter) -> None:
        """
        Serializes and writes this packet to the provided EoWriter.

        Args:
            writer (EoWriter): the writer that this packet will be written to.
        """
        raise NotImplementedError()

family() abstractmethod staticmethod

Returns the packet family associated with this packet.

Returns:

Name Type Description
PacketFamily PacketFamily

The packet family associated with this packet.

Source code in src/eolib/protocol/net/packet.py
13
14
15
16
17
18
19
20
21
22
@staticmethod
@abstractmethod
def family() -> PacketFamily:
    """
    Returns the packet family associated with this packet.

    Returns:
        PacketFamily: The packet family associated with this packet.
    """
    raise NotImplementedError()

action() abstractmethod staticmethod

Returns the packet action associated with this packet.

Returns:

Name Type Description
PacketAction PacketAction

The packet action associated with this packet.

Source code in src/eolib/protocol/net/packet.py
24
25
26
27
28
29
30
31
32
33
@staticmethod
@abstractmethod
def action() -> PacketAction:
    """
    Returns the packet action associated with this packet.

    Returns:
        PacketAction: The packet action associated with this packet.
    """
    raise NotImplementedError()

write(writer) abstractmethod

Serializes and writes this packet to the provided EoWriter.

Parameters:

Name Type Description Default
writer EoWriter

the writer that this packet will be written to.

required
Source code in src/eolib/protocol/net/packet.py
35
36
37
38
39
40
41
42
43
@abstractmethod
def write(self, writer: EoWriter) -> None:
    """
    Serializes and writes this packet to the provided EoWriter.

    Args:
        writer (EoWriter): the writer that this packet will be written to.
    """
    raise NotImplementedError()