Example #1
0
class HandshakePacket(PacketType):
    DEFINITION_IDENTIFIER = "handshakepacket"
    DEFINITION_VERSION = "1.0"
    NOT_STARTED = 0
    SUCCESS = 1
    ERROR = 2
    FIELDS = [("SYN", UINT8({Optional: True})), ("ACK", UINT8({Optional:
                                                               True})),
              ("status", UINT8), ("error", STRING({Optional: True}))]
Example #2
0
class VNICPromiscuousLevelPacket(VNICSocketControlPacket):
    """
    This packet is both a getter/setter packet that can be
    sent by a client to either set or get the promiscuity 
    level. It is also sent back by the server as an acknowledgement
    with the current level
    
    Client sends VNICPromiscuousLevelPacket with no fields set
    Server responds with VNICPromiscuousLevelPacket with get set to current level
    
    Client sends VNICPromiscuousLevelPacket with set field set
    Server responds with VNICPromiscuousLevelPacket with get set to new level
    """
    DEFINITION_IDENTIFIER = "vsockets.VNICPromiscuousLevelPacket"
    DEFINITION_VERSION = "1.0"

    FIELDS = [("set", UINT8({Optional: True})), ("get", UINT8({Optional:
                                                               True}))]
Example #3
0
class VNICSocketOpenResponsePacket(VNICSocketControlPacket):
    DEFINITION_IDENTIFIER = "vsockets.VNICSocketOpenResponsePacket"
    DEFINITION_VERSION = "1.0"
    FIELDS = [("port", UINT16), ("errorCode", UINT8({Optional: True})),
              ("errorMessage", STRING({Optional: True}))]

    def isFailure(self):
        return (self.errorCode != FIELD_NOT_SET
                or self.errorMessage != FIELD_NOT_SET)