Exemplo n.º 1
0
class BaseTCPChanMessage(Message):
    """ Base class for TCPChan messages

        Attributes:
            Fields (list): list of field
            version (int): protocol version (0)
    """

    Fields = [
        field_factory("Version", Uint8),
        field_factory("Op", Uint8),
    ]
    version = 0

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.Op = self.opcode
        self.Version = self.version
Exemplo n.º 2
0
class HandshakeReply(BaseTCPChanMessage):
    """ Handshake Reply Message

        Handshake reply message is sent upon reception of handshake request.
    """

    opcode = TCPCHAN_OP_HANDSHAKE_REPLY
    Fields = TCPChanMessage.Fields + [
        field_factory("Magic", Uint32),
    ]
Exemplo n.º 3
0
class HandshakeRequest(BaseTCPChanMessage):
    """ Handshake Request Message

        Handshake request message is sent as the first message to start the handshake procedure.
    """

    opcode = TCPCHAN_OP_HANDSHAKE_REQUEST
    Fields = TCPChanMessage.Fields + [
        field_factory("Magic", Uint32),
    ]
Exemplo n.º 4
0
class ChannelPayload(BaseTCPChanMessage):
    """ Channel Payload Message

        Channel payload message is used for delivery of payload to a specific channel.
    """

    opcode = TCPCHAN_OP_CHANNEL_PAYLOAD
    Fields = ChannelMessage.Fields + [
        field_factory("Payload", Bytes),
    ]
Exemplo n.º 5
0
class ChannelMessage(Message):
    Fields = TCPChanMessage.Fields + [
        field_factory("Channel", Uint32),
    ]