~ubuntu-branches/ubuntu/raring/gift-gnutella/raring

« back to all changes in this revision

Viewing changes to src/message/query_route.c

  • Committer: Bazaar Package Importer
  • Author(s): Göran Weinholt
  • Date: 2005-07-31 13:56:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050731135653-3i7bcwnrbe7wfd1i
Tags: 0.0.10.1-1
* New upstream version.
  - Fixes FTBFS with gcc-4.0 (closes: #286732).
* Updated debian/patches/update-gwebcaches.patch.
* Updated debian/patches/remove-too-old-check.patch.
* debian/control:
  - Change the encoding of my name to UTF-8.
  - Updated to Standards-Version: 3.6.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: query_route.c,v 1.1 2004/01/04 03:57:53 hipnod Exp $
 
3
 *
 
4
 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net)
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify it
 
7
 * under the terms of the GNU General Public License as published by the
 
8
 * Free Software Foundation; either version 2, or (at your option) any
 
9
 * later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful, but
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * General Public License for more details.
 
15
 */
 
16
 
 
17
#include "gt_gnutella.h"
 
18
#include "msg_handler.h"
 
19
 
 
20
#include "gt_query_route.h"
 
21
 
 
22
/*****************************************************************************/
 
23
 
 
24
/* create a table for routing queries from a child node
 
25
 * disabled for now because ultrapeer mode doesnt work yet */
 
26
GT_MSG_HANDLER(gt_msg_query_route)
 
27
{
 
28
#if 0
 
29
        uint8_t   type;
 
30
        uint32_t len;
 
31
        uint8_t   largest_val;
 
32
        uint8_t   seq_no;
 
33
        uint8_t   seq_size;
 
34
        uint8_t   compressed;
 
35
        uint8_t   bits;
 
36
        size_t    size;
 
37
 
 
38
        GT->DBGFN (GT, "entered");
 
39
 
 
40
        type = gt_packet_get_uint8 (packet);
 
41
 
 
42
        /* TODO: rate-limit clients calling query_route; timeouts */
 
43
 
 
44
        switch (type)
 
45
        {
 
46
         case 0: /* reset table */
 
47
                len         = gt_packet_get_uint32 (packet);
 
48
                largest_val     = gt_packet_get_uint8  (packet);
 
49
 
 
50
                if (GT_NODE(c)->query_router)
 
51
                        query_router_free (GT_NODE(c)->query_router);
 
52
 
 
53
                GT_NODE(c)->query_router = query_router_new (len, largest_val);
 
54
 
 
55
                GT->DBGFN (GT, "reset table: len = %u, largest val = %u",
 
56
                           len, largest_val);
 
57
                break;
 
58
 
 
59
         case 1: /* patch table */
 
60
                seq_no     = gt_packet_get_uint8 (packet);
 
61
                seq_size   = gt_packet_get_uint8 (packet);
 
62
                compressed = gt_packet_get_uint8 (packet);
 
63
                bits       = gt_packet_get_uint8 (packet);
 
64
 
 
65
                GT->DBGFN (GT, "patch table: seq_no=%i seq_size=%i compressed=%i bits=%i",
 
66
                           seq_no, seq_size, compressed, bits);
 
67
 
 
68
                /* size of the patch is the packet length minus len of patch header */
 
69
                size = gt_packet_payload_len (packet) - 5;
 
70
 
 
71
                GT->DBGFN (GT, "size = %u, packet->offset = %u", size, packet->offset);
 
72
                query_router_update (GT_NODE(c)->query_router, seq_no, seq_size,
 
73
                                     compressed, bits, &packet->data[packet->offset],
 
74
                                     size);
 
75
                break;
 
76
 
 
77
         default:
 
78
                GT->DBGFN (GT, "unknown query-route message type: %d", type);
 
79
                break;
 
80
        }
 
81
#endif
 
82
}