Пример #1
0
 def __init__(self, message):
     super(ConnectResponseInstance, self).__init__(message)
     message_body = message[12:]
     self.raw_status = message_body[0:4]
     self.status, = Unpack.get_unsigned_long_data(self.raw_status)
     self.authenticator_ISMG = message_body[4:20]
     self.version, = Unpack.get_unsigned_char_data(message_body[20:21])
Пример #2
0
 def _receive(self):
     receive_data = self._so.recv(4)
     if receive_data:
         msg_length, = Unpack.get_unsigned_long_data(receive_data)
         response_data = receive_data + self._so.recv(msg_length)
         return response_data
     return None
Пример #3
0
 def handle_req_or_res(self, message):
     command_id, = Unpack.get_unsigned_long_data(message[4:8])
     print(hex(command_id))
     if command_id == CMPP_ACTIVE_TEST_REQ:
         resp = ActiveTestResponseInstance(message)
     else:
         resp = parse_to_response_instance(message)
     if resp:
         self._send(resp.message)
Пример #4
0
 def __init__(self, message):
     super(SubmitResponseInstance, self).__init__(message)
     message_body = message[12:]
     self.msg_id, = Unpack.get_unsigned_long_long_data(message_body[0:8])
     self.result, = Unpack.get_unsigned_long_data(message_body[8:12])
Пример #5
0
 def __init__(self, message):
     self.length, = Unpack.get_unsigned_long_data(message[0:4])
     self.command_id, = Unpack.get_unsigned_long_data(message[4:8])
     self.sequence, = Unpack.get_unsigned_long_data(message[8:12])
     self.message_body = message[12:self.length]
Пример #6
0
def parse_packet_head(message):
    t_len = Unpack.get_unsigned_long_data(message[:4])
    cm_id = Unpack.get_unsigned_long_data(message[4:8])
    seq_id = Unpack.get_unsigned_long_data(message[8:12])
    return t_len, cm_id, seq_id