~ubuntu-branches/ubuntu/karmic/gtk-gnutella/karmic

« back to all changes in this revision

Viewing changes to src/if/core/hcache.h

  • Committer: Bazaar Package Importer
  • Author(s): Anand Kumria
  • Date: 2005-08-04 11:32:05 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050804113205-q746i4lgo3rtlegn
Tags: 0.95.4-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: hcache.h,v 1.5 2005/06/25 01:37:42 daichik Exp $
 
3
 *
 
4
 * Copyright (c) 2001-2003, Raphael Manfredi, Richard Eckart
 
5
 *
 
6
 *----------------------------------------------------------------------
 
7
 * This file is part of gtk-gnutella.
 
8
 *
 
9
 *  gtk-gnutella is free software; you can redistribute it and/or modify
 
10
 *  it under the terms of the GNU General Public License as published by
 
11
 *  the Free Software Foundation; either version 2 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *  gtk-gnutella is distributed in the hope that it will be useful,
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *  GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with gtk-gnutella; if not, write to the Free Software
 
21
 *  Foundation, Inc.:
 
22
 *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 *----------------------------------------------------------------------
 
24
 */
 
25
 
 
26
#ifndef _if_core_hcache_h_
 
27
#define _if_core_hcache_h_
 
28
 
 
29
#include <glib.h>
 
30
 
 
31
/***
 
32
 *** Gnet host cache
 
33
 ***/
 
34
 
 
35
typedef enum {
 
36
        HCACHE_FRESH_ANY = 0, /**< Fresh hosts to which we did not
 
37
                               yet try to connect. */
 
38
    HCACHE_VALID_ANY,     /**< All the Gnet nodes to which we were able to
 
39
                               connect and transmit at least one packet
 
40
                               (indicating a successful handshake). */
 
41
        HCACHE_FRESH_ULTRA,       /**< Fresh ultra nodes to which we did not
 
42
                               yet try to connect. (X-Try-Ultrapeer)*/
 
43
    HCACHE_VALID_ULTRA,   /**< Valid ultra nodes */
 
44
    HCACHE_TIMEOUT,       /**< We put in this list all the Gnet nodes which
 
45
                               gave us a timeout during connection. */
 
46
    HCACHE_BUSY,          /**< We put in this list all the Gnet nodes which
 
47
                               gave us a 503 (busy) during connection. */
 
48
    HCACHE_UNSTABLE,
 
49
        HCACHE_NONE,
 
50
    HCACHE_MAX
 
51
} hcache_type_t;
 
52
 
 
53
typedef enum {
 
54
    HOST_ANY,
 
55
    HOST_ULTRA,
 
56
    HOST_MAX
 
57
} host_type_t;
 
58
 
 
59
typedef struct hcache_stats {
 
60
    gint32      host_count; /**< Number of hosts in cache */
 
61
    guint32     hits;       /**< Hits to known hosts */
 
62
    guint32     misses;     /**< Total number of misses (added hosts) */
 
63
    gboolean    reading;    /**< TRUE if currently reading from disk */
 
64
} hcache_stats_t;
 
65
 
 
66
/*
 
67
 * Public interface, visible from the bridge.
 
68
 */
 
69
 
 
70
#ifdef CORE_SOURCES
 
71
 
 
72
void hcache_clear_host_type(host_type_t type);
 
73
void hcache_clear(hcache_type_t type);
 
74
void hcache_get_stats(hcache_stats_t *stats);
 
75
 
 
76
#endif /* CORE_SOURCES */
 
77
#endif /* _if_core_hcache_h_ */
 
78
 
 
79
/* vi: set ts=4 sw=4 cindent: */