--------------------- PatchSet 7223 Date: 2008/03/04 01:08:47 Author: amosjeffries Branch: cleanup Tag: (none) Log: Move dlink* objects into dlink.h and dlink.cc. Plus otehr .h fixes. Members: src/AuthConfig.h:1.3.26.1->1.3.26.2 src/AuthUser.cci:1.3->1.3.26.1 src/AuthUser.h:1.6.4.2->1.6.4.3 src/Makefile.am:1.138.2.7->1.138.2.8 src/client_side_reply.cc:1.125.2.2->1.125.2.3 src/dlink.cc:1.1->1.1.2.1 src/dlink.h:1.1->1.1.48.1 src/globals.h:1.33.4.2->1.33.4.3 src/protos.h:1.95.2.3->1.95.2.4 src/tools.cc:1.50.4.1->1.50.4.2 Index: squid3/src/AuthConfig.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthConfig.h,v retrieving revision 1.3.26.1 retrieving revision 1.3.26.2 diff -u -r1.3.26.1 -r1.3.26.2 --- squid3/src/AuthConfig.h 27 Feb 2008 04:28:57 -0000 1.3.26.1 +++ squid3/src/AuthConfig.h 4 Mar 2008 01:08:47 -0000 1.3.26.2 @@ -1,6 +1,5 @@ - /* - * $Id: AuthConfig.h,v 1.3.26.1 2008/02/27 04:28:57 amosjeffries Exp $ + * $Id: AuthConfig.h,v 1.3.26.2 2008/03/04 01:08:47 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -30,24 +29,30 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ - #ifndef SQUID_AUTHCONFIG_H #define SQUID_AUTHCONFIG_H -/* +class AuthUserRequest; +class StoreEntry; +class HttpReply; +class HttpRequest; +class CacheManager; + +/* for http_hdr_type parameters-by-value */ +#include "HttpHeader.h" + + +/** + \ingroup AuthAPI + \par * I am the configuration for an auth scheme. * Currently each scheme has only one instance of me, * but this may change. - */ - -/* This class is treated like a ref counted class. + \par + * This class is treated like a ref counted class. * If the children ever stop being singletons, implement the * ref counting... */ - -class AuthUserRequest; - -/// \ingroup AuthAPI class AuthConfig { Index: squid3/src/AuthUser.cci =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthUser.cci,v retrieving revision 1.3 retrieving revision 1.3.26.1 diff -u -r1.3 -r1.3.26.1 --- squid3/src/AuthUser.cci 9 May 2007 15:50:34 -0000 1.3 +++ squid3/src/AuthUser.cci 4 Mar 2008 01:08:47 -0000 1.3.26.1 @@ -1,6 +1,5 @@ - /* - * $Id: AuthUser.cci,v 1.3 2007/05/09 15:50:34 squidadm Exp $ + * $Id: AuthUser.cci,v 1.3.26.1 2008/03/04 01:08:47 amosjeffries Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -34,6 +33,11 @@ * Copyright (c) 2003, Robert Collins */ +/* for assert() */ +#include "assert.h" +/* for xstrdup() */ +#include "util.h" + char const * AuthUser::username () const { Index: squid3/src/AuthUser.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthUser.h,v retrieving revision 1.6.4.2 retrieving revision 1.6.4.3 diff -u -r1.6.4.2 -r1.6.4.3 --- squid3/src/AuthUser.h 27 Feb 2008 04:28:57 -0000 1.6.4.2 +++ squid3/src/AuthUser.h 4 Mar 2008 01:08:47 -0000 1.6.4.3 @@ -1,5 +1,5 @@ /* - * $Id: AuthUser.h,v 1.6.4.2 2008/02/27 04:28:57 amosjeffries Exp $ + * $Id: AuthUser.h,v 1.6.4.3 2008/03/04 01:08:47 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,9 +34,15 @@ #ifndef SQUID_AUTHUSER_H #define SQUID_AUTHUSER_H -#include "IPAddress.h" - class AuthUserRequest; +class AuthConfig; +class AuthUserHashPointer; + +/* for auth_type_t */ +#include "enums.h" + +#include "IPAddress.h" +#include "dlink.h" /** * \ingroup AuthAPI @@ -59,7 +65,7 @@ /** the config for this user */ AuthConfig *config; /** we only have one username associated with a given auth_user struct */ - auth_user_hash_pointer *usernamehash; + AuthUserHashPointer *usernamehash; /** we may have many proxy-authenticate strings that decode to the same user */ dlink_list proxy_auth_list; dlink_list proxy_match_cache; Index: squid3/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Makefile.am,v retrieving revision 1.138.2.7 retrieving revision 1.138.2.8 diff -u -r1.138.2.7 -r1.138.2.8 --- squid3/src/Makefile.am 27 Feb 2008 04:28:58 -0000 1.138.2.7 +++ squid3/src/Makefile.am 4 Mar 2008 01:08:47 -0000 1.138.2.8 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.138.2.7 2008/02/27 04:28:58 amosjeffries Exp $ +# $Id: Makefile.am,v 1.138.2.8 2008/03/04 01:08:47 amosjeffries Exp $ # # Uncomment and customize the following to suit your needs: # @@ -479,6 +479,7 @@ disk.cc \ $(DISKIO_SOURCE) \ dlink.h \ + dlink.cc \ $(DNSSOURCE) \ enums.h \ errorpage.cc \ @@ -816,6 +817,8 @@ defines.h \ $(DELAY_POOL_SOURCE) \ disk.cc \ + dlink.h \ + dlink.cc \ $(DNSSOURCE) \ enums.h \ errorpage.cc \ Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.125.2.2 retrieving revision 1.125.2.3 diff -u -r1.125.2.2 -r1.125.2.3 --- squid3/src/client_side_reply.cc 19 Feb 2008 11:39:40 -0000 1.125.2.2 +++ squid3/src/client_side_reply.cc 4 Mar 2008 01:08:47 -0000 1.125.2.3 @@ -1,6 +1,5 @@ - /* - * $Id: client_side_reply.cc,v 1.125.2.2 2008/02/19 11:39:40 amosjeffries Exp $ + * $Id: client_side_reply.cc,v 1.125.2.3 2008/03/04 01:08:47 amosjeffries Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -33,6 +32,10 @@ * */ +/* for ClientActiveRequests global */ +#include "dlink.h" + +/* old includes without reasons given. */ #include "squid.h" #include "client_side_reply.h" #include "errorpage.h" @@ -41,7 +44,6 @@ #include "HttpReply.h" #include "HttpRequest.h" #include "forward.h" - #include "clientStream.h" #include "AuthUserRequest.h" #if USE_SQUID_ESI --- /dev/null Tue Mar 4 01:24:35 2008 +++ squid3/src/dlink.cc Tue Mar 4 01:24:35 2008 @@ -0,0 +1,101 @@ +/* + * $Id: dlink.cc,v 1.1.2.1 2008/03/04 01:08:47 amosjeffries Exp $ + */ +#include "dlink.h" + +/* dlink are Mem-pooled */ +#include "MemPool.h" +/* for xstrdup() */ +#include "util.h" + + +dlink_list ClientActiveRequests; + +MemAllocator *dlink_node_pool = NULL; + +dlink_node * +dlinkNodeNew() +{ + if (dlink_node_pool == NULL) + dlink_node_pool = memPoolCreate("Dlink list nodes", sizeof(dlink_node)); + + /* where should we call delete dlink_node_pool;dlink_node_pool = NULL; */ + return (dlink_node *)dlink_node_pool->alloc(); +} + +/** The node needs to be unlinked FIRST */ +void +dlinkNodeDelete(dlink_node * m) +{ + if (m == NULL) + return; + + dlink_node_pool->free(m); +} + +void +dlinkAdd(void *data, dlink_node * m, dlink_list * list) +{ + m->data = data; + m->prev = NULL; + m->next = list->head; + + if (list->head) + list->head->prev = m; + + list->head = m; + + if (list->tail == NULL) + list->tail = m; +} + +void +dlinkAddAfter(void *data, dlink_node * m, dlink_node * n, dlink_list * list) +{ + m->data = data; + m->prev = n; + m->next = n->next; + + if (n->next) + n->next->prev = m; + else { + assert(list->tail == n); + list->tail = m; + } + + n->next = m; +} + +void +dlinkAddTail(void *data, dlink_node * m, dlink_list * list) +{ + m->data = data; + m->next = NULL; + m->prev = list->tail; + + if (list->tail) + list->tail->next = m; + + list->tail = m; + + if (list->head == NULL) + list->head = m; +} + +void +dlinkDelete(dlink_node * m, dlink_list * list) +{ + if (m->next) + m->next->prev = m->prev; + + if (m->prev) + m->prev->next = m->next; + + if (m == list->head) + list->head = m->next; + + if (m == list->tail) + list->tail = m->prev; + + m->next = m->prev = NULL; +} Index: squid3/src/dlink.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/dlink.h,v retrieving revision 1.1 retrieving revision 1.1.48.1 diff -u -r1.1 -r1.1.48.1 --- squid3/src/dlink.h 23 Apr 2006 11:27:37 -0000 1.1 +++ squid3/src/dlink.h 4 Mar 2008 01:08:47 -0000 1.1.48.1 @@ -1,6 +1,5 @@ - /* - * $Id: dlink.h,v 1.1 2006/04/23 11:27:37 squidadm Exp $ + * $Id: dlink.h,v 1.1.48.1 2008/03/04 01:08:47 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -30,7 +29,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ - #ifndef SQUID_DLINK_H #define SQUID_DLINK_H @@ -47,14 +45,22 @@ dlink_node *next; }; -struct _dlink_list +struct dlink_list { dlink_node *head; dlink_node *tail; }; -class dlink_node; +/* mported form globals.h */ +extern dlink_list ClientActiveRequests; + +/* imported directly from protos.h */ -typedef struct _dlink_list dlink_list; +SQUIDCEXTERN void dlinkAdd(void *data, dlink_node *, dlink_list *); +SQUIDCEXTERN void dlinkAddAfter(void *, dlink_node *, dlink_node *, dlink_list *); +SQUIDCEXTERN void dlinkAddTail(void *data, dlink_node *, dlink_list *); +SQUIDCEXTERN void dlinkDelete(dlink_node * m, dlink_list * list); +SQUIDCEXTERN void dlinkNodeDelete(dlink_node * m); +SQUIDCEXTERN dlink_node *dlinkNodeNew(void); #endif /* SQUID_DLINK_H */ Index: squid3/src/globals.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/globals.h,v retrieving revision 1.33.4.2 retrieving revision 1.33.4.3 diff -u -r1.33.4.2 -r1.33.4.3 --- squid3/src/globals.h 12 Feb 2008 02:48:48 -0000 1.33.4.2 +++ squid3/src/globals.h 4 Mar 2008 01:08:47 -0000 1.33.4.3 @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.33.4.2 2008/02/12 02:48:48 amosjeffries Exp $ + * $Id: globals.h,v 1.33.4.3 2008/03/04 01:08:47 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -129,7 +129,7 @@ extern double request_failure_ratio; /* 0.0 */ extern int store_hash_buckets; /* 0 */ extern hash_table *store_table; /* NULL */ - extern dlink_list ClientActiveRequests; +//MOVED:dlink.h extern dlink_list ClientActiveRequests; extern int hot_obj_count; /* 0 */ extern const int CacheDigestHashFuncCount; /* 4 */ extern CacheDigest *store_digest; /* NULL */ Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.95.2.3 retrieving revision 1.95.2.4 diff -u -r1.95.2.3 -r1.95.2.4 --- squid3/src/protos.h 2 Mar 2008 11:26:58 -0000 1.95.2.3 +++ squid3/src/protos.h 4 Mar 2008 01:08:47 -0000 1.95.2.4 @@ -1,5 +1,5 @@ /* - * $Id: protos.h,v 1.95.2.3 2008/03/02 11:26:58 amosjeffries Exp $ + * $Id: protos.h,v 1.95.2.4 2008/03/04 01:08:47 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -675,13 +675,13 @@ SQUIDCEXTERN peer_t parseNeighborType(const char *s); /* tools.c */ -#include "dlink.h" -SQUIDCEXTERN void dlinkAdd(void *data, dlink_node *, dlink_list *); -SQUIDCEXTERN void dlinkAddAfter(void *, dlink_node *, dlink_node *, dlink_list *); -SQUIDCEXTERN void dlinkAddTail(void *data, dlink_node *, dlink_list *); -SQUIDCEXTERN void dlinkDelete(dlink_node * m, dlink_list * list); -SQUIDCEXTERN void dlinkNodeDelete(dlink_node * m); -SQUIDCEXTERN dlink_node *dlinkNodeNew(void); +//UNUSED #include "dlink.h" +//UNUSED SQUIDCEXTERN void dlinkAdd(void *data, dlink_node *, dlink_list *); +//UNUSED SQUIDCEXTERN void dlinkAddAfter(void *, dlink_node *, dlink_node *, dlink_list *); +//UNUSED SQUIDCEXTERN void dlinkAddTail(void *data, dlink_node *, dlink_list *); +//UNUSED SQUIDCEXTERN void dlinkDelete(dlink_node * m, dlink_list * list); +//UNUSED SQUIDCEXTERN void dlinkNodeDelete(dlink_node * m); +//UNUSED SQUIDCEXTERN dlink_node *dlinkNodeNew(void); SQUIDCEXTERN void kb_incr(kb_t *, size_t); SQUIDCEXTERN int stringHasWhitespace(const char *); Index: squid3/src/tools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v retrieving revision 1.50.4.1 retrieving revision 1.50.4.2 diff -u -r1.50.4.1 -r1.50.4.2 --- squid3/src/tools.cc 12 Feb 2008 02:48:48 -0000 1.50.4.1 +++ squid3/src/tools.cc 4 Mar 2008 01:08:47 -0000 1.50.4.2 @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.50.4.1 2008/02/12 02:48:48 amosjeffries Exp $ + * $Id: tools.cc,v 1.50.4.2 2008/03/04 01:08:47 amosjeffries Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -84,8 +84,6 @@ SQUIDCEXTERN void (*failure_notify) (const char *); -MemAllocator *dlink_node_pool = NULL; - void releaseServerSockets(void) { @@ -1056,93 +1054,6 @@ fflush(debug_log); } -dlink_node * -dlinkNodeNew() -{ - if (dlink_node_pool == NULL) - dlink_node_pool = memPoolCreate("Dlink list nodes", sizeof(dlink_node)); - - /* where should we call delete dlink_node_pool;dlink_node_pool = NULL; */ - return (dlink_node *)dlink_node_pool->alloc(); -} - -/* the node needs to be unlinked FIRST */ -void -dlinkNodeDelete(dlink_node * m) -{ - if (m == NULL) - return; - - dlink_node_pool->free(m); -} - -void -dlinkAdd(void *data, dlink_node * m, dlink_list * list) -{ - m->data = data; - m->prev = NULL; - m->next = list->head; - - if (list->head) - list->head->prev = m; - - list->head = m; - - if (list->tail == NULL) - list->tail = m; -} - -void -dlinkAddAfter(void *data, dlink_node * m, dlink_node * n, dlink_list * list) -{ - m->data = data; - m->prev = n; - m->next = n->next; - - if (n->next) - n->next->prev = m; - else { - assert(list->tail == n); - list->tail = m; - } - - n->next = m; -} - -void -dlinkAddTail(void *data, dlink_node * m, dlink_list * list) -{ - m->data = data; - m->next = NULL; - m->prev = list->tail; - - if (list->tail) - list->tail->next = m; - - list->tail = m; - - if (list->head == NULL) - list->head = m; -} - -void -dlinkDelete(dlink_node * m, dlink_list * list) -{ - if (m->next) - m->next->prev = m->prev; - - if (m->prev) - m->prev->next = m->next; - - if (m == list->head) - list->head = m->next; - - if (m == list->tail) - list->tail = m->prev; - - m->next = m->prev = NULL; -} - void kb_incr(kb_t * k, size_t v) {