def sendDownloadResponseProvider(output, node_id, node_ip, node_port, last_storing_time, last_seen_time, bandwidth, counter): serializer.send_string(output, binascii.a2b_hex(node_id), 20) serializer.send_ip(output, node_ip) serializer.send_short(output, node_port) serializer.send_integer(output, last_storing_time) serializer.send_integer(output, last_seen_time) serializer.send_integer(output, bandwidth) serializer.send_integer(output, counter)
def sendSearchResponseHitProvider(output, node_id, node_ip, node_port, last_storing_time, last_seen_time, bandwidth, counter): serializer.send_string(output, binascii.a2b_hex(node_id), 20) serializer.send_ip(output, node_ip) serializer.send_short(output, node_port) serializer.send_integer(output, last_storing_time) serializer.send_integer(output, last_seen_time) serializer.send_integer(output, bandwidth) serializer.send_integer(output, counter)
def sendHeader(output, command_type, queryID, TTL): serializer.send_string(output, constants.PROTOCOL_VERSION, 4) serializer.send_string(output, constants.VENDOR, 16) serializer.send_string(output, binascii.a2b_hex(globalvars.maay_core.getNodeID()), 20) serializer.send_ip(output, globalvars.maay_core.getNodeIP()) serializer.send_short(output, globalvars.maay_core.getNodePort()) serializer.send_integer(output, globalvars.maay_core.getBandwidth()) serializer.send_integer(output, globalvars.maay_core.getCounter()) serializer.send_char(output, command_type) serializer.send_string(output, binascii.a2b_hex(queryID), 20) serializer.send_char(output, TTL)