00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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_VENDOR,
00043 MSG_STANDARD,
00044 MSG_PUSH_REQUEST,
00045 MSG_SEARCH,
00046 MSG_SEARCH_RESULTS,
00047 MSG_TOTAL,
00049 MSG_TYPE_COUNT
00050 };
00051
00052 typedef enum msg_drop_reason {
00053 MSG_DROP_BAD_SIZE = 0,
00054 MSG_DROP_TOO_SMALL,
00055 MSG_DROP_TOO_LARGE,
00056 MSG_DROP_WAY_TOO_LARGE,
00057 MSG_DROP_UNKNOWN_TYPE,
00058 MSG_DROP_UNEXPECTED,
00059 MSG_DROP_TTL0,
00060 MSG_DROP_IMPROPER_HOPS_TTL,
00061 MSG_DROP_MAX_TTL_EXCEEDED,
00062 MSG_DROP_THROTTLE,
00063 MSG_DROP_PONG_UNUSABLE,
00064 MSG_DROP_HARD_TTL_LIMIT,
00065 MSG_DROP_MAX_HOP_COUNT,
00066 MSG_DROP_ROUTE_LOST,
00067 MSG_DROP_NO_ROUTE,
00068 MSG_DROP_DUPLICATE,
00069 MSG_DROP_BANNED,
00070 MSG_DROP_SHUTDOWN,
00071 MSG_DROP_FLOW_CONTROL,
00072 MSG_DROP_QUERY_NO_NUL,
00073 MSG_DROP_QUERY_TOO_SHORT,
00074 MSG_DROP_QUERY_OVERHEAD,
00075 MSG_DROP_MALFORMED_SHA1,
00076 MSG_DROP_MALFORMED_UTF_8,
00077 MSG_DROP_BAD_RESULT,
00078 MSG_DROP_BAD_RETURN_ADDRESS,
00079 MSG_DROP_HOSTILE_IP,
00080
00081 MSG_DROP_REASON_COUNT
00082 } msg_drop_reason_t;
00083
00084 typedef enum {
00085 GNR_ROUTING_ERRORS = 0,
00086 GNR_LOCAL_SEARCHES,
00087 GNR_LOCAL_HITS,
00088 GNR_LOCAL_QUERY_HITS,
00089 GNR_OOB_PROXIED_QUERY_HITS,
00090 GNR_OOB_QUERIES,
00091 GNR_OOB_QUERIES_STRIPPED,
00092 GNR_DUPS_WITH_HIGHER_TTL,
00093 GNR_QUERY_OOB_PROXIED_DUPS,
00094 GNR_OOB_HITS_FOR_PROXIED_QUERIES,
00095 GNR_OOB_HITS_WITH_ALIEN_IP,
00096 GNR_UNCLAIMED_OOB_HITS,
00097 GNR_PARTIALLY_CLAIMED_OOB_HITS,
00098 GNR_QUERY_COMPACT_COUNT,
00099 GNR_QUERY_COMPACT_SIZE,
00100 GNR_QUERY_UTF8,
00101 GNR_QUERY_SHA1,
00102 GNR_BROADCASTED_PUSHES,
00103 GNR_PUSH_PROXY_RELAYED,
00104 GNR_PUSH_PROXY_BROADCASTED,
00105 GNR_PUSH_PROXY_FAILED,
00106 GNR_LOCAL_DYN_QUERIES,
00107 GNR_LEAF_DYN_QUERIES,
00108 GNR_OOB_PROXIED_QUERIES,
00109 GNR_DYN_QUERIES_COMPLETED_FULL,
00110 GNR_DYN_QUERIES_COMPLETED_PARTIAL,
00111 GNR_DYN_QUERIES_COMPLETED_ZERO,
00112 GNR_DYN_QUERIES_LINGER_EXTRA,
00113 GNR_DYN_QUERIES_LINGER_RESULTS,
00114 GNR_DYN_QUERIES_LINGER_COMPLETED,
00115 GNR_GTKG_TOTAL_QUERIES,
00116 GNR_GTKG_REQUERIES,
00117 GNR_QUERIES_WITH_GGEP_H,
00118 GNR_GIV_CALLBACKS,
00119 GNR_QUEUE_CALLBACKS,
00120 GNR_UDP_BOGUS_SOURCE_IP,
00121 GNR_UDP_ALIEN_MESSAGE,
00122 GNR_UDP_UNPROCESSED_MESSAGE,
00123
00124 GNR_TYPE_COUNT
00125 } gnr_stats_t;
00126
00127 #define STATS_FLOWC_COLUMNS 10
00128 #define STATS_RECV_COLUMNS 10
00130 typedef struct gnet_stat {
00131 guint64 drop_reason[MSG_DROP_REASON_COUNT][MSG_TYPE_COUNT];
00132
00133 struct {
00134 guint64 received[MSG_TYPE_COUNT];
00135 guint64 expired[MSG_TYPE_COUNT];
00136 guint64 dropped[MSG_TYPE_COUNT];
00137 guint64 queued[MSG_TYPE_COUNT];
00138 guint64 relayed[MSG_TYPE_COUNT];
00139 guint64 gen_queued[MSG_TYPE_COUNT];
00140 guint64 generated[MSG_TYPE_COUNT];
00141 guint64 received_hops[STATS_RECV_COLUMNS][MSG_TYPE_COUNT];
00142 guint64 received_ttl[STATS_RECV_COLUMNS][MSG_TYPE_COUNT];
00143 guint64 flowc_hops[STATS_FLOWC_COLUMNS][MSG_TYPE_COUNT];
00144 guint64 flowc_ttl[STATS_FLOWC_COLUMNS][MSG_TYPE_COUNT];
00145 } pkg, byte;
00146
00147 guint64 general[GNR_TYPE_COUNT];
00148 } gnet_stats_t;
00149
00150 typedef enum {
00151 BW_GNET_IN,
00152 BW_GNET_OUT,
00153 BW_HTTP_IN,
00154 BW_HTTP_OUT,
00155 BW_LEAF_IN,
00156 BW_LEAF_OUT,
00157 BW_GNET_UDP_IN,
00158 BW_GNET_UDP_OUT
00159 } gnet_bw_source;
00160
00161 typedef struct gnet_bw_stats {
00162 gboolean enabled;
00163 guint32 current;
00164 guint32 average;
00165 guint32 limit;
00166 } gnet_bw_stats_t;
00167
00168
00169
00170
00171
00172 #ifdef CORE_SOURCES
00173
00174 void gnet_stats_get(gnet_stats_t *stats);
00175 void gnet_stats_tcp_get(gnet_stats_t *stats);
00176 void gnet_stats_udp_get(gnet_stats_t *stats);
00177 void gnet_get_bw_stats(gnet_bw_source type, gnet_bw_stats_t *stats);
00178
00179 #endif
00180
00181 #endif
00182