Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

net_stats.h

Go to the documentation of this file.
00001 /*
00002  * $Id: net_stats.h 13632 2007-05-13 06:40:23Z cbiere $
00003  *
00004  * Copyright (c) 2001-2003, Raphael Manfredi, Richard Eckart
00005  *
00006  *----------------------------------------------------------------------
00007  * This file is part of gtk-gnutella.
00008  *
00009  *  gtk-gnutella is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  gtk-gnutella is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with gtk-gnutella; if not, write to the Free Software
00021  *  Foundation, Inc.:
00022  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *----------------------------------------------------------------------
00024  */
00025 
00026 #ifndef _if_core_net_stats_h_
00027 #define _if_core_net_stats_h_
00028 
00029 #include "common.h"
00030 
00031 /***
00032  *** General statistics
00033  ***/
00034 
00035 enum {
00036     MSG_UNKNOWN = 0,
00037     MSG_INIT,
00038     MSG_INIT_RESPONSE,
00039     MSG_BYE,
00040     MSG_QRP,
00041     MSG_HSEP,
00042     MSG_RUDP,
00043     MSG_VENDOR,
00044     MSG_STANDARD,
00045     MSG_PUSH_REQUEST,
00046     MSG_SEARCH,
00047     MSG_SEARCH_RESULTS,
00048     MSG_TOTAL,     
00050     MSG_TYPE_COUNT 
00051 };
00052 
00053 typedef enum msg_drop_reason {
00054     MSG_DROP_BAD_SIZE = 0,
00055     MSG_DROP_TOO_SMALL,
00056     MSG_DROP_TOO_LARGE,
00057     MSG_DROP_WAY_TOO_LARGE,
00058     MSG_DROP_UNKNOWN_TYPE,
00059     MSG_DROP_UNEXPECTED,
00060     MSG_DROP_TTL0,
00061     MSG_DROP_IMPROPER_HOPS_TTL,
00062     MSG_DROP_MAX_TTL_EXCEEDED,
00063     MSG_DROP_THROTTLE,
00064     MSG_DROP_PONG_UNUSABLE,
00065     MSG_DROP_HARD_TTL_LIMIT,
00066     MSG_DROP_MAX_HOP_COUNT,
00067     MSG_DROP_ROUTE_LOST,
00068     MSG_DROP_NO_ROUTE,
00069     MSG_DROP_DUPLICATE,
00070     MSG_DROP_BANNED,
00071     MSG_DROP_SHUTDOWN,
00072     MSG_DROP_FLOW_CONTROL,
00073     MSG_DROP_QUERY_NO_NUL,
00074     MSG_DROP_QUERY_TOO_SHORT,
00075     MSG_DROP_QUERY_OVERHEAD,
00076     MSG_DROP_BAD_URN,
00077     MSG_DROP_MALFORMED_SHA1,
00078     MSG_DROP_MALFORMED_UTF_8,
00079     MSG_DROP_BAD_RESULT,
00080     MSG_DROP_BAD_RETURN_ADDRESS,
00081     MSG_DROP_HOSTILE_IP,
00082     MSG_DROP_SPAM,
00083     MSG_DROP_EVIL,
00084     MSG_DROP_INFLATE_ERROR,
00085     MSG_DROP_UNKNOWN_HEADER_FLAGS,
00086     MSG_DROP_OWN_RESULT,
00087     
00088     MSG_DROP_REASON_COUNT 
00089 } msg_drop_reason_t;
00090 
00091 typedef enum {
00092     GNR_ROUTING_ERRORS = 0,
00093     GNR_LOCAL_SEARCHES,
00094     GNR_LOCAL_HITS,
00095     GNR_LOCAL_QUERY_HITS,
00096     GNR_OOB_PROXIED_QUERY_HITS,
00097     GNR_OOB_QUERIES,
00098     GNR_OOB_QUERIES_STRIPPED,
00099     GNR_DUPS_WITH_HIGHER_TTL,
00100     GNR_QUERY_OOB_PROXIED_DUPS,
00101     GNR_OOB_HITS_FOR_PROXIED_QUERIES,
00102     GNR_OOB_HITS_WITH_ALIEN_IP,
00103     GNR_UNCLAIMED_OOB_HITS,
00104     GNR_PARTIALLY_CLAIMED_OOB_HITS,
00105     GNR_SPURIOUS_OOB_HIT_CLAIM,
00106     GNR_UNREQUESTED_OOB_HITS,
00107     GNR_QUERY_COMPACT_COUNT,
00108     GNR_QUERY_COMPACT_SIZE,
00109     GNR_QUERY_UTF8,
00110     GNR_QUERY_SHA1,
00111     GNR_BROADCASTED_PUSHES,
00112     GNR_PUSH_PROXY_RELAYED,
00113     GNR_PUSH_PROXY_BROADCASTED,
00114     GNR_PUSH_PROXY_FAILED,
00115     GNR_LOCAL_DYN_QUERIES,
00116     GNR_LEAF_DYN_QUERIES,
00117     GNR_OOB_PROXIED_QUERIES,
00118     GNR_DYN_QUERIES_COMPLETED_FULL,
00119     GNR_DYN_QUERIES_COMPLETED_PARTIAL,
00120     GNR_DYN_QUERIES_COMPLETED_ZERO,
00121     GNR_DYN_QUERIES_LINGER_EXTRA,
00122     GNR_DYN_QUERIES_LINGER_RESULTS,
00123     GNR_DYN_QUERIES_LINGER_COMPLETED,
00124     GNR_GTKG_TOTAL_QUERIES,
00125     GNR_GTKG_REQUERIES,
00126     GNR_QUERIES_WITH_GGEP_H,
00127     GNR_GIV_CALLBACKS,
00128     GNR_QUEUE_CALLBACKS,
00129     GNR_UDP_BOGUS_SOURCE_IP,
00130     GNR_UDP_ALIEN_MESSAGE,
00131     GNR_UDP_UNPROCESSED_MESSAGE,
00132     GNR_UDP_TX_COMPRESSED,
00133     GNR_UDP_RX_COMPRESSED,
00134     GNR_UDP_LARGER_HENCE_NOT_COMPRESSED,
00135     
00136     GNR_TYPE_COUNT /* number of general stats */
00137 } gnr_stats_t;
00138 
00139 #define STATS_FLOWC_COLUMNS 10  
00140 #define STATS_RECV_COLUMNS 10   
00142 typedef struct gnet_stat {
00143     guint64 drop_reason[MSG_DROP_REASON_COUNT][MSG_TYPE_COUNT];
00144 
00145     struct {
00146         guint64 received[MSG_TYPE_COUNT];
00147         guint64 expired[MSG_TYPE_COUNT];
00148         guint64 dropped[MSG_TYPE_COUNT];
00149         guint64 queued[MSG_TYPE_COUNT];
00150         guint64 relayed[MSG_TYPE_COUNT];
00151         guint64 gen_queued[MSG_TYPE_COUNT];
00152         guint64 generated[MSG_TYPE_COUNT];
00153         guint64 received_hops[STATS_RECV_COLUMNS][MSG_TYPE_COUNT];
00154         guint64 received_ttl[STATS_RECV_COLUMNS][MSG_TYPE_COUNT];
00155         guint64 flowc_hops[STATS_FLOWC_COLUMNS][MSG_TYPE_COUNT];
00156         guint64 flowc_ttl[STATS_FLOWC_COLUMNS][MSG_TYPE_COUNT];
00157     } pkg, byte;
00158 
00159     guint64 general[GNR_TYPE_COUNT];
00160 } gnet_stats_t;
00161 
00162 typedef enum {
00163     BW_GNET_IN,
00164     BW_GNET_OUT,
00165     BW_HTTP_IN,
00166     BW_HTTP_OUT,
00167     BW_LEAF_IN,
00168     BW_LEAF_OUT,
00169     BW_GNET_UDP_IN,
00170     BW_GNET_UDP_OUT
00171 } gnet_bw_source;
00172 
00173 typedef struct gnet_bw_stats {
00174     gboolean enabled;
00175     guint32  current;
00176     guint32  average;
00177     guint32  limit;
00178 } gnet_bw_stats_t;
00179 
00180 /***
00181  *** General statistics
00182  ***/
00183 
00184 #ifdef CORE_SOURCES
00185 
00186 void gnet_stats_get(gnet_stats_t *stats);
00187 void gnet_stats_tcp_get(gnet_stats_t *stats);
00188 void gnet_stats_udp_get(gnet_stats_t *stats);
00189 void gnet_get_bw_stats(gnet_bw_source type, gnet_bw_stats_t *stats);
00190 const gchar *gnet_stats_drop_reason_to_string(msg_drop_reason_t reason);
00191 
00192 #endif /* CORE_SOURCES */
00193 
00194 #endif /* _if_core_net_stats_h_ */
00195 /* vi: set ts=4 sw=4 cindent: */

Generated on Sat Jun 30 17:53:23 2007 for gtk-gnutella by  doxygen 1.3.9.1