Re: HEAD squid3/src Makefile.am,1.136,1.137 access_log.cc,1.51, 1.52 cf.data.pre,1.169,1.170 cf_gen_defines,1.4,1.5 main.cc,1.93, 1.94 protos.h,1.91,1.92 structs.h,1.124,1.125

From: Amos Jeffries <squid3@dont-contact.us>
Date: Thu, 24 Jan 2008 10:49:08 +1300 (NZDT)

> Update of cvs.devel.squid-cache.org:/cvsroot/squid/squid3/src
>
> Modified Files:
> Makefile.am access_log.cc cf.data.pre cf_gen_defines main.cc
> protos.h structs.h

A couple of things on this.

I'm a little confused why CVS is saying 'HEAD' for a SF commit instead of
your child branch.

Second, you are adding to protos.h and squid.h and structs.h.
We are trying to reduce the dependancies on these, particularly for
optional modules.

The config bits in structs.h you can create a ShagaConfig.h and define
class ShagaConfig which gets included into structs.h indirectly. (see
DelayConfig.h for good example).

The protos.h bits should be in their own shaga.h or SquidShaga.h which
things can include instead of the global files.

Thanks
Amos

> Log Message:
>
>
> Index: structs.h
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/structs.h,v
> retrieving revision 1.124
> retrieving revision 1.125
> diff -C2 -d -r1.124 -r1.125
> *** structs.h 19 Jan 2008 07:50:42 -0000 1.124
> --- structs.h 23 Jan 2008 16:46:36 -0000 1.125
> ***************
> *** 193,196 ****
> --- 193,206 ----
> {
>
> + #ifdef USE_SHAGA
> + struct {
> + char *db_host;
> + u_short db_port;
> + char *db_name;
> + char *db_user;
> + char *db_pwd;
> + }Shaga;
> + #endif
> +
> struct
> {
> ***************
> *** 536,539 ****
> --- 546,553 ----
> int surrogate_is_remote;
> #endif
> + #if USE_SHAGA
> + int enable_shaga;
> + int enable_db_config;
> + #endif
>
> int request_entities;
>
> Index: cf.data.pre
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/cf.data.pre,v
> retrieving revision 1.169
> retrieving revision 1.170
> diff -C2 -d -r1.169 -r1.170
> *** cf.data.pre 20 Jan 2008 11:51:46 -0000 1.169
> --- cf.data.pre 23 Jan 2008 16:46:35 -0000 1.170
> ***************
> *** 5521,5524 ****
> --- 5521,5588 ----
> rounded to 1000.
> DOC_END
> + NAME: enable_shaga_engine
> + COMMENT: on|off
> + IFDEF: USE_SHAGA
> + TYPE: onoff
> + LOC: Config.onoff.enable_shaga
> + DEFAULT: on
> + DOC_START
> + When this set to on,squid will write some entries from access.log file
> into database
> + DOC_END
> +
> + NAME: shaga_db_host
> + COMMENT: mysql server ip address
> + IFDEF: USE_SHAGA
> + TYPE: string
> + LOC: Config.Shaga.db_host
> + DEFAULT: 10.0.0.1
> + DOC_START
> + DOC_END
> +
> + NAME: shaga_db_port
> + COMMENT: listening port of mysql server
> + IFDEF: USE_SHAGA
> + TYPE: ushort
> + LOC: Config.Shaga.db_port
> + DEFAULT: 3306
> + DOC_START
> + DOC_END
> +
> + NAME: shaga_db_name
> + COMMENT: shaga database name
> + IFDEF: USE_SHAGA
> + TYPE: string
> + LOC: Config.Shaga.db_name
> + DEFAULT: shaga
> + DOC_START
> + DOC_END
> +
> + NAME: shaga_db_user
> + COMMENT: shaga database user
> + IFDEF: USE_SHAGA
> + TYPE: string
> + LOC: Config.Shaga.db_user
> + DEFAULT: shaga
> + DOC_START
> + DOC_END
> +
> + NAME: shaga_db_pwd
> + COMMENT: shaga database password
> + IFDEF: USE_SHAGA
> + TYPE: string
> + LOC: Config.Shaga.db_pwd
> + DEFAULT: shaga
> + DOC_START
> + DOC_END
> +
> + NAME: enable_db_config
> + COMMENT: on|off
> + IFDEF: USE_SHAGA
> + TYPE: onoff
> + LOC: Config.onoff.enable_db_config
> + DEFAULT: off
> + DOC_START
> + When this set to on,squid will read (some) configuration parameters
> from database
> + DOC_END
>
> EOF
>
> Index: main.cc
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/main.cc,v
> retrieving revision 1.93
> retrieving revision 1.94
> diff -C2 -d -r1.93 -r1.94
> *** main.cc 22 Jan 2008 17:51:40 -0000 1.93
> --- main.cc 23 Jan 2008 16:46:36 -0000 1.94
> ***************
> *** 668,672 ****
> --- 668,679 ----
> wccp2Init();
> #endif
> + #ifdef USE_SHAGA
> + if(Config.onoff.enable_shaga){
> +
> + shutdown_shaga_support();
> + init_shaga_support();
>
> + }else _db_print("ShagaEngine is disabled\n");
> + #endif
> serverConnectionsOpen();
>
> ***************
> *** 987,991 ****
> --- 994,1004 ----
>
> #endif
> + #ifdef USE_SHAGA
> + if(Config.onoff.enable_shaga){
>
> + init_shaga_support();
> +
> + }else _db_print("ShagaEngine is disabled\n");
> + #endif
> serverConnectionsOpen();
>
> ***************
> *** 1629,1633 ****
> wccp2ConnectionClose();
> #endif
> !
> releaseServerSockets();
> commCloseAllSockets();
> --- 1642,1650 ----
> wccp2ConnectionClose();
> #endif
> ! #ifdef USE_SHAGA
> ! if(Config.onoff.enable_shaga){
> ! shutdown_shaga_support();
> ! }
> ! #endif
> releaseServerSockets();
> commCloseAllSockets();
>
> Index: cf_gen_defines
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/cf_gen_defines,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -C2 -d -r1.4 -r1.5
> *** cf_gen_defines 2 Jul 2006 17:50:45 -0000 1.4
> --- cf_gen_defines 23 Jan 2008 16:46:36 -0000 1.5
> ***************
> *** 21,24 ****
> --- 21,25 ----
> define["USE_WCCPv2"]="--enable-wccpv2"
> define["ESI"]="--enable-esi"
> + define["USE_SHAGA"]="--enable-shaga"
> }
> /^IFDEF:/ {
>
> Index: protos.h
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/protos.h,v
> retrieving revision 1.91
> retrieving revision 1.92
> diff -C2 -d -r1.91 -r1.92
> *** protos.h 22 Jan 2008 01:21:46 -0000 1.91
> --- protos.h 23 Jan 2008 16:46:36 -0000 1.92
> ***************
> *** 809,812 ****
> --- 809,822 ----
>
> #endif
> + /* shaga.cc */
> + #ifdef USE_SHAGA
> + SQUIDCEXTERN int db_connect(char *dbhost,char *dbuser,char *dbpwd,char
> *dbname,unsigned int dbport);
> + SQUIDCEXTERN void init_shaga_support();
> + SQUIDCEXTERN void shutdown_shaga_support();
> + SQUIDCEXTERN int getExcludeHosts();
> + SQUIDCEXTERN int isExHost(char *host);
> + SQUIDCEXTERN int writeToDB(char * __time,char * username,char *
> ip_address,char * byte);
> +
> + #endif
>
> #endif /* SQUID_PROTOS_H */
>
> Index: access_log.cc
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/access_log.cc,v
> retrieving revision 1.51
> retrieving revision 1.52
> diff -C2 -d -r1.51 -r1.52
> *** access_log.cc 20 Jan 2008 09:50:56 -0000 1.51
> --- access_log.cc 23 Jan 2008 16:46:35 -0000 1.52
> ***************
> *** 1317,1320 ****
> --- 1317,1337 ----
> al->hier.host,
> al->http.content_type);
> +
> + #if USE_SHAGA
> + char t_timestamp[13];
> + char t_user[8];
> + char t_ip[15];
> + char t_byte[15];
> + if(Config.onoff.enable_shaga){
> + //
> + snprintf(t_timestamp,13,"%9ld.%03d", (long int)current_time.tv_sec,(
> (int)current_time.tv_usec / 1000));
> + sscanf((user ? user : dash_str),"%s",t_user);
> + sscanf(client,"%s",t_ip);
> + snprintf(t_byte,15,"%ld",(long int)al->cache.size);
> + //
> + writeToDB(t_timestamp,t_user,t_ip,t_byte); /* write to db TIMESTAMP
> ,USER ,IP ,BYTE */
> + }
> + #endif
> +
> } else {
> char *ereq = log_quote(al->headers.request);
> ***************
> *** 1337,1340 ****
> --- 1354,1374 ----
> ereq,
> erep);
> +
> + #if USE_SHAGA
> + char t_timestamp[13];
> + char t_user[8];
> + char t_ip[15];
> + char t_byte[15];
> + if(Config.onoff.enable_shaga){
> + //
> + snprintf(t_timestamp,13,"%9ld.%03d", (long int)current_time.tv_sec,(
> (int)current_time.tv_usec / 1000));
> + sscanf((user ? user : dash_str),"%s",t_user);
> + sscanf(client,"%s",t_ip);
> + snprintf(t_byte,15,"%ld",(long int)al->cache.size);
> + //
> + writeToDB(t_timestamp,t_user,t_ip,t_byte); /* write to db TIMESTAMP
> ,USER ,IP ,BYTE */
> + }
> + #endif
> +
> safe_free(ereq);
> safe_free(erep);
>
> Index: Makefile.am
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/Makefile.am,v
> retrieving revision 1.136
> retrieving revision 1.137
> diff -C2 -d -r1.136 -r1.137
> *** Makefile.am 14 Jan 2008 13:51:53 -0000 1.136
> --- Makefile.am 23 Jan 2008 16:46:35 -0000 1.137
> ***************
> *** 122,125 ****
> --- 122,131 ----
> endif
>
> + if ENABLE_SHAGA
> + SHAGASOURCE = shaga.cc shaga.h
> + else
> + SHAGASOURCE =
> + endif
> +
> if ENABLE_PINGER
> PINGER = pinger
> ***************
> *** 198,207 ****
> AM_CFLAGS = @SQUID_CFLAGS@
> AM_CXXFLAGS = @SQUID_CXXFLAGS@
> !
> EXTRA_LIBRARIES = libAIO.a libBlocking.a libDiskDaemon.a
> libDiskThreads.a ICAP/libicap.a
> noinst_LIBRARIES = @DISK_LIBS@ @ICAP_LIBS@
> noinst_LTLIBRARIES = libsquid.la libauth.la
>
> ! INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
> -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include
> INCLUDES += @SQUID_CPPUNIT_INC@
>
> --- 204,214 ----
> AM_CFLAGS = @SQUID_CFLAGS@
> AM_CXXFLAGS = @SQUID_CXXFLAGS@
> ! MYSQL_INC_DIR = /usr/local/include/mysql
> ! MYSQL_LIB_DIR = /usr/local/lib/mysql
> EXTRA_LIBRARIES = libAIO.a libBlocking.a libDiskDaemon.a
> libDiskThreads.a ICAP/libicap.a
> noinst_LIBRARIES = @DISK_LIBS@ @ICAP_LIBS@
> noinst_LTLIBRARIES = libsquid.la libauth.la
>
> ! INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
> -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include
> -I$(MYSQL_INC_DIR) -I$(MYSQL_LIB_DIR)
> INCLUDES += @SQUID_CPPUNIT_INC@
>
> ***************
> *** 421,424 ****
> --- 428,432 ----
> ACLChecklist.h \
> $(squid_ACLSOURCES) \
> + $(SHAGASOURCE) \
> asn.cc \
> AsyncCall.cc \
> ***************
> *** 673,676 ****
> --- 681,685 ----
> -lmiscutil \
> @XTRA_LIBS@ \
> + @SHAGALIB@ \
> @EPOLL_LIBS@ \
> @MINGW_LIBS@
> ***************
> *** 797,800 ****
> --- 806,810 ----
> CommIO.h \
> $(squid_COMMSOURCES) \
> + $(SHAGASOURCE) \
> ConfigOption.cc \
> defines.h \
> ***************
> *** 919,922 ****
> --- 929,933 ----
> @XTRA_LIBS@ \
> @EPOLL_LIBS@ \
> + @SHAGALIB@ \
> @MINGW_LIBS@
> ufsdump_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
> ***************
> *** 1335,1338 ****
> --- 1346,1350 ----
> clientStream.cc \
> $(squid_COMMSOURCES) \
> + $(SHAGASOURCE) \
> ConfigOption.cc \
> ConfigParser.cc \
> ***************
> *** 1508,1511 ****
> --- 1520,1524 ----
> disk.cc \
> $(DNSSOURCE) \
> + $(SHAGASOURCE) \
> event.cc \
> errorpage.cc \
> ***************
> *** 1891,1894 ****
> --- 1904,1908 ----
> peer_select.cc \
> pconn.cc \
> + $(SHAGASOURCE) \
> redirect.cc \
> referer.cc \
> ***************
> *** 2373,2376 ****
> --- 2387,2391 ----
> helper.cc \
> $(HTCPSOURCE) \
> + $(SHAGASOURCE) \
> http.cc \
> HttpBody.cc \
>
>
Received on Wed Jan 23 2008 - 14:49:14 MST

This archive was generated by hypermail pre-2.1.9 : Wed Jan 30 2008 - 12:00:09 MST