Beispiel #1
0
def readSearchRequest(input):
    # min_score
    min_score = serializer.read_float(input)
    # forwarding node count
    forwarding_node_count = serializer.read_char(input)
    # result count
    result_count = serializer.read_char(input)
    # search query word count
    word_count = serializer.read_char(input)
    search_query = []
    for i in range(0, word_count):
        search_query.append(serializer.read_vstring(input))
    return (min_score, forwarding_node_count, result_count, search_query)
Beispiel #2
0
def readSearchRequest(input):
    # min_score
    min_score = serializer.read_float(input)
    # forwarding node count
    forwarding_node_count = serializer.read_char(input)
    # result count
    result_count = serializer.read_char(input)
    # search query word count 
    word_count = serializer.read_char(input)
    search_query = []
    for i in range(0, word_count):
        search_query.append(serializer.read_vstring(input))
    return (min_score, forwarding_node_count, result_count, search_query)
Beispiel #3
0
def readDownloadRequest(input):
    document_id = binascii.b2a_hex(serializer.read_string(input, 20))
    word_count = serializer.read_char(input)
    search_query = [];
    for i in range(0, word_count):
        search_query.append(serializer.read_vstring(input))
    return (document_id, search_query)
Beispiel #4
0
def readDownloadRequest(input):
    document_id = binascii.b2a_hex(serializer.read_string(input, 20))
    word_count = serializer.read_char(input)
    search_query = []
    for i in range(0, word_count):
        search_query.append(serializer.read_vstring(input))
    return (document_id, search_query)
Beispiel #5
0
def readSearchResponseHitInfo(input):
    return (
        # document id
        binascii.b2a_hex(serializer.read_string(input, 20)),
        # mime_type
        serializer.read_vstring(input),
        # url
        serializer.read_vstring(input),
        # publication time
        serializer.read_integer(input),
        # file size
        serializer.read_integer(input),
        # title
        serializer.read_vstring(input),
        # score count
        serializer.read_char(input),
        # provider count
        serializer.read_char(input))
Beispiel #6
0
def readSearchResponseHitInfo(input):
    return (
            # document id
            binascii.b2a_hex(serializer.read_string(input, 20)),
            # mime_type
            serializer.read_vstring(input),
            # url
            serializer.read_vstring(input),
            # publication time
            serializer.read_integer(input),
            # file size
            serializer.read_integer(input),
            # title
            serializer.read_vstring(input),
            # score count
            serializer.read_char(input),
            # provider count
            serializer.read_char(input)
    )
Beispiel #7
0
def readHeader(input):
    return (
        # protocol version
        serializer.read_string(input, 4),
        # vendor
        serializer.read_string(input, 16),
        # node ID
        #               serializer.read_string(input, 20),
        binascii.b2a_hex(serializer.read_string(input, 20)),
        # node IP
        serializer.read_ip(input),
        # node Port
        serializer.read_short(input),
        # node bandwidth
        serializer.read_integer(input),
        # node counter
        serializer.read_integer(input),
        # command type
        serializer.read_char(input),
        # query ID
        binascii.b2a_hex(serializer.read_string(input, 20)),
        # TTL
        serializer.read_char(input))
Beispiel #8
0
def readHeader(input):
    return (
            # protocol version
            serializer.read_string(input, 4),
            # vendor
            serializer.read_string(input, 16),
            # node ID
#               serializer.read_string(input, 20),
            binascii.b2a_hex(serializer.read_string(input, 20)),
            # node IP
            serializer.read_ip(input),
            # node Port
            serializer.read_short(input),
            # node bandwidth
            serializer.read_integer(input),
            # node counter
            serializer.read_integer(input),
            # command type
            serializer.read_char(input),
            # query ID
            binascii.b2a_hex(serializer.read_string(input, 20)),
            # TTL
            serializer.read_char(input)
    )
Beispiel #9
0
def readSearchResponseInfo(input):
    return (
            # hit count
            serializer.read_char(input)
    )
Beispiel #10
0
def readSearchResponseInfo(input):
    return (
        # hit count
        serializer.read_char(input))