From 1c898d4ccabe93f579eca1841dc67741171f55f9 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 22 Apr 2009 03:07:51 +1200 Subject: [PATCH] Cleanups: Shuffle ClientInfo into a class - upgrade struct+typedef to public class - gets its own header as pre-requisite to Logs SourceLayout --- src/ClientInfo.h | 29 +++++++++++++++++++++++++++++ src/client_db.cc | 2 +- src/mem.cc | 2 +- src/structs.h | 22 ---------------------- src/typedefs.h | 2 -- 5 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 src/ClientInfo.h diff --git a/src/ClientInfo.h b/src/ClientInfo.h new file mode 100644 index 0000000000..0d91f76690 --- /dev/null +++ b/src/ClientInfo.h @@ -0,0 +1,29 @@ +#ifndef SQUID__SRC_CLIENTINFO_H +#define SQUID__SRC_CLIENTINFO_H + +#include "ip/IpAddress.h" + +class ClientInfo { +public: + hash_link hash; /* must be first */ + + IpAddress addr; + + struct { + int result_hist[LOG_TYPE_MAX]; + int n_requests; + kb_t kbytes_in; + kb_t kbytes_out; + kb_t hit_kbytes_out; + } Http, Icp; + + struct { + time_t time; + int n_req; + int n_denied; + } cutoff; + int n_established; /* number of current established connections */ + time_t last_seen; +}; + +#endif diff --git a/src/client_db.cc b/src/client_db.cc index 954ccb3fe9..855ae0db68 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -36,6 +35,7 @@ #include "squid.h" #include "event.h" #include "CacheManager.h" +#include "ClientInfo.h" #include "SquidTime.h" #include "Store.h" diff --git a/src/mem.cc b/src/mem.cc index 5d2797ac89..34c462c547 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -40,6 +39,7 @@ #include "event.h" #include "CacheManager.h" +#include "ClientInfo.h" #include "Mem.h" #include "memMeter.h" #include "Store.h" diff --git a/src/structs.h b/src/structs.h index d4b9a9f24f..4b0b564def 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1255,28 +1255,6 @@ struct _HttpHeaderStat { }; -struct _ClientInfo { - hash_link hash; /* must be first */ - - IpAddress addr; - - struct { - int result_hist[LOG_TYPE_MAX]; - int n_requests; - kb_t kbytes_in; - kb_t kbytes_out; - kb_t hit_kbytes_out; - } Http, Icp; - - struct { - time_t time; - int n_req; - int n_denied; - } cutoff; - int n_established; /* number of current established connections */ - time_t last_seen; -}; - struct _CacheDigest { /* public, read-only */ char *mask; /* bit mask */ diff --git a/src/typedefs.h b/src/typedefs.h index 0452f7b2aa..474864f278 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -165,8 +165,6 @@ typedef struct _storeSwapLogData storeSwapLogData; typedef struct _StatHist StatHist; -typedef struct _ClientInfo ClientInfo; - typedef struct _cd_guess_stats cd_guess_stats; typedef struct _CacheDigest CacheDigest; -- 2.47.3