def sendDownloadResponseDocumentDescription(output, title, publication_time, mime_type, size, url, provider_count): serializer.send_vstring(output, title) serializer.send_integer(output, publication_time) serializer.send_vstring(output, mime_type) serializer.send_integer(output, size) serializer.send_vstring(output, url) serializer.send_short(output, provider_count)
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)
def sendDownloadResponse(output, document_id, flags): serializer.send_string(output, binascii.a2b_hex(document_id), 20) serializer.send_short(output, flags)