/*
- * $Id: radix.h,v 1.17 2003/06/19 13:12:00 robertc Exp $
+ * $Id: radix.h,v 1.18 2003/10/20 12:33:03 robertc Exp $
*/
#ifndef SQUID_RADIX_H
* Radix search tree node layout.
*/
-struct squid_radix_node {
+struct squid_radix_node
+{
+
struct squid_radix_mask *rn_mklist; /* list of masks contained in subtree */
+
struct squid_radix_node *rn_p; /* parent */
short rn_b; /* bit offset; -1-index(netmask) */
char rn_bmask; /* node: mask for bit test */
#define RNF_NORMAL 1 /* leaf contains normal route */
#define RNF_ROOT 2 /* leaf is root leaf for tree */
#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */
+
union {
- struct { /* leaf only data: */
- char *rn_Key; /* object of search */
- char *rn_Mask; /* netmask, if present */
- struct squid_radix_node *rn_Dupedkey;
- } rn_leaf;
- struct { /* node only data: */
- int rn_Off; /* where to start compare */
- struct squid_radix_node *rn_L; /* progeny */
- struct squid_radix_node *rn_R; /* progeny */
- } rn_node;
+
+ struct { /* leaf only data: */
+ char *rn_Key; /* object of search */
+ char *rn_Mask; /* netmask, if present */
+
+ struct squid_radix_node *rn_Dupedkey;
+ }
+
+ rn_leaf;
+
+ struct { /* node only data: */
+ int rn_Off; /* where to start compare */
+
+ struct squid_radix_node *rn_L; /* progeny */
+
+ struct squid_radix_node *rn_R; /* progeny */
+ }
+
+ rn_node;
} rn_u;
#ifdef RN_DEBUG
+
int rn_info;
+
struct squid_radix_node *rn_twin;
+
struct squid_radix_node *rn_ybro;
#endif
};
* Annotations to tree concerning potential routes applying to subtrees.
*/
-struct squid_radix_mask {
+struct squid_radix_mask
+{
short rm_b; /* bit offset; -1-index(netmask) */
char rm_unused; /* cf. rn_bmask */
unsigned char rm_flags; /* cf. rn_flags */
+
struct squid_radix_mask *rm_mklist; /* more masks to try */
union {
- char *rmu_mask; /* the mask */
- struct squid_radix_node *rmu_leaf; /* for normal routes */
+ char *rmu_mask; /* the mask */
+
+ struct squid_radix_node *rmu_leaf; /* for normal routes */
} rm_rmu;
int rm_refs; /* # of references to this struct */
-} *squid_rn_mkfreelist;
+};
+
+struct squid_radix_node_head
+{
-struct squid_radix_node_head {
struct squid_radix_node *rnh_treetop;
int rnh_addrsize; /* permit, but not require fixed keys */
int rnh_pktsize; /* permit, but not require fixed keys */
+
struct squid_radix_node *(*rnh_addaddr) /* add based on sockaddr */
- (void *v, void *mask,
- struct squid_radix_node_head * head, struct squid_radix_node nodes[]);
+ (void *v, void *mask,
+
+ struct squid_radix_node_head * head, struct squid_radix_node nodes[]);
+
struct squid_radix_node *(*rnh_addpkt) /* add based on packet hdr */
- (void *v, void *mask,
- struct squid_radix_node_head * head, struct squid_radix_node nodes[]);
+ (void *v, void *mask,
+
+ struct squid_radix_node_head * head, struct squid_radix_node nodes[]);
+
struct squid_radix_node *(*rnh_deladdr) /* remove based on sockaddr */
- (void *v, void *mask, struct squid_radix_node_head * head);
+
+ (void *v, void *mask, struct squid_radix_node_head * head);
+
struct squid_radix_node *(*rnh_delpkt) /* remove based on packet hdr */
- (void *v, void *mask, struct squid_radix_node_head * head);
+
+ (void *v, void *mask, struct squid_radix_node_head * head);
+
struct squid_radix_node *(*rnh_matchaddr) /* locate based on sockaddr */
- (void *v, struct squid_radix_node_head * head);
+
+ (void *v, struct squid_radix_node_head * head);
+
struct squid_radix_node *(*rnh_lookup) /* locate based on sockaddr */
- (void *v, void *mask, struct squid_radix_node_head * head);
+
+ (void *v, void *mask, struct squid_radix_node_head * head);
+
struct squid_radix_node *(*rnh_matchpkt) /* locate based on packet hdr */
- (void *v, struct squid_radix_node_head * head);
+
+ (void *v, struct squid_radix_node_head * head);
int (*rnh_walktree) /* traverse tree */
- (struct squid_radix_node_head * head, int (*f) (struct squid_radix_node *, void *), void *w);
+
+ (struct squid_radix_node_head * head, int (*f) (struct squid_radix_node *, void *), void *w);
+
struct squid_radix_node rnh_nodes[3]; /* empty tree for common case */
};
SQUIDCEXTERN void squid_rn_init (void);
+
SQUIDCEXTERN int squid_rn_inithead(struct squid_radix_node_head **, int);
SQUIDCEXTERN int squid_rn_refines(void *, void *);
+
SQUIDCEXTERN int squid_rn_walktree(struct squid_radix_node_head *, int (*)(struct squid_radix_node *, void *), void *);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_addmask(void *, int, int);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_addroute(void *, void *, struct squid_radix_node_head *, struct squid_radix_node[2]);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_delete(void *, void *, struct squid_radix_node_head *);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_insert(void *, struct squid_radix_node_head *, int *, struct squid_radix_node[2]);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_match(void *, struct squid_radix_node_head *);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_newpair(void *, int, struct squid_radix_node[2]);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_search(void *, struct squid_radix_node *);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_search_m(void *, struct squid_radix_node *, void *);
+
SQUIDCEXTERN struct squid_radix_node *squid_rn_lookup(void *, void *, struct squid_radix_node_head *);
#endif /* SQUID_RADIX_H */
/*
- * $Id: ACL.h,v 1.10 2003/08/04 22:14:38 robertc Exp $
+ * $Id: ACL.h,v 1.11 2003/10/20 12:33:01 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
/* acl.c */
SQUIDCEXTERN void aclDestroyAccessList(acl_access **list);
-SQUIDCEXTERN void aclDestroyAcls(acl **);
+SQUIDCEXTERN void aclDestroyAcls(ACL **);
SQUIDCEXTERN void aclDestroyAclList(acl_list **);
SQUIDCEXTERN void aclParseAccessLine(acl_access **);
SQUIDCEXTERN void aclParseAclList(acl_list **);
SQUIDCEXTERN void aclParseDenyInfoLine(struct _acl_deny_info_list **);
SQUIDCEXTERN void aclDestroyDenyInfoList(struct _acl_deny_info_list **);
-SQUIDCEXTERN wordlist *aclDumpGeneric(const acl *);
+SQUIDCEXTERN wordlist *aclDumpGeneric(const ACL *);
SQUIDCEXTERN void aclCacheMatchFlush(dlink_list * cache);
extern void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head);
int aclPurgeMethodInUse(acl_access * a);
void operator delete(void *);
static ACL *Factory (char const *);
- static void ParseAclLine(acl ** head);
+ static void ParseAclLine(ACL ** head);
static void Initialize();
static ACL* FindByName(const char *name);
void negated(bool isNegated);
bool matches (ACLChecklist *)const;
int op;
- acl *_acl;
+ ACL *_acl;
ACLList *next;
private:
/*
- * $Id: ACLBrowser.cc,v 1.1 2003/02/17 07:01:34 robertc Exp $
+ * $Id: ACLBrowser.cc,v 1.2 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLChecklist.h"
#include "ACLRegexData.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLStrategised<char const *>
+
+;
+template class ACLRequestHeaderStrategy<HDR_USER_AGENT>
+
+;
+
ACL::Prototype ACLBrowser::RegistryProtoype(&ACLBrowser::RegistryEntry_, "browser");
+
ACLStrategised<char const *> ACLBrowser::RegistryEntry_(new ACLRegexData, ACLRequestHeaderStrategy<HDR_USER_AGENT>::Instance(), "browser");
/*
- * $Id: ACLIntRange.cc,v 1.2 2003/08/04 22:14:38 robertc Exp $
+ * $Id: ACLIntRange.cc,v 1.3 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Robert Collins
#include "squid.h"
#include "ACLIntRange.h"
+/* explicit instantiation required for some systems */
+
+template cbdata_type List<Range<int> >
+::CBDATA_List;
+
void
ACLIntRange::parse()
{
/*
- * $Id: ACLMethod.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
+ * $Id: ACLMethod.cc,v 1.3 2003/10/20 12:33:01 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLChecklist.h"
#include "HttpRequest.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLStrategised<method_t>
+
+;
+
ACL::Prototype ACLMethod::RegistryProtoype(&ACLMethod::RegistryEntry_, "method");
+
ACLStrategised<method_t> ACLMethod::RegistryEntry_(new ACLMethodData, ACLMethodStrategy::Instance(), "method");
int
/*
- * $Id: ACLMethodData.cc,v 1.3 2003/08/04 22:14:38 robertc Exp $
+ * $Id: ACLMethodData.cc,v 1.4 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return values->findAndTune (toFind);
}
+/* explicit instantiation required for some systems */
+
+template cbdata_type List<method_t>
+::CBDATA_List;
+
wordlist *
ACLMethodData::dump()
{
/*
- * $Id: ACLMyPort.cc,v 1.1 2003/02/25 12:16:55 robertc Exp $
+ * $Id: ACLMyPort.cc,v 1.2 2003/10/20 12:33:01 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLIntRange.h"
#include "ACLChecklist.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLStrategised<int>
+
+;
+
ACL::Prototype ACLMyPort::RegistryProtoype(&ACLMyPort::RegistryEntry_, "myport");
+
ACLStrategised<int> ACLMyPort::RegistryEntry_(new ACLIntRange, ACLMyPortStrategy::Instance(), "myport");
int
/*
- * $Id: ACLProtocol.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
+ * $Id: ACLProtocol.cc,v 1.3 2003/10/20 12:33:01 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLChecklist.h"
#include "HttpRequest.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLStrategised<protocol_t>
+
+;
+
ACL::Prototype ACLProtocol::RegistryProtoype(&ACLProtocol::RegistryEntry_, "proto");
+
ACLStrategised<protocol_t> ACLProtocol::RegistryEntry_(new ACLProtocolData, ACLProtocolStrategy::Instance(), "proto");
int
/*
- * $Id: ACLProtocolData.cc,v 1.3 2003/08/04 22:14:38 robertc Exp $
+ * $Id: ACLProtocolData.cc,v 1.4 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return values->findAndTune (toFind);
}
+/* explicit instantiation required for some systems */
+
+template cbdata_type List<protocol_t>
+::CBDATA_List;
+
wordlist *
ACLProtocolData::dump()
{
/*
- * $Id: ACLReferer.cc,v 1.1 2003/02/17 07:01:34 robertc Exp $
+ * $Id: ACLReferer.cc,v 1.2 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLChecklist.h"
#include "ACLRegexData.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLRequestHeaderStrategy<HDR_REFERER>
+
+;
+
ACL::Prototype ACLReferer::RegistryProtoype(&ACLReferer::RegistryEntry_, "referer_regex");
+
ACLStrategised<char const *> ACLReferer::RegistryEntry_(new ACLRegexData, ACLRequestHeaderStrategy<HDR_REFERER>::Instance(), "referer_regex");
/*
- * $Id: ACLReplyMIMEType.cc,v 1.1 2003/02/25 12:16:55 robertc Exp $
+ * $Id: ACLReplyMIMEType.cc,v 1.2 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLChecklist.h"
#include "ACLRegexData.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLReplyHeaderStrategy<HDR_CONTENT_TYPE>
+
+;
+
ACL::Prototype ACLReplyMIMEType::RegistryProtoype(&ACLReplyMIMEType::RegistryEntry_, "rep_mime_type");
+
ACLStrategised<char const *> ACLReplyMIMEType::RegistryEntry_(new ACLRegexData, ACLReplyHeaderStrategy<HDR_CONTENT_TYPE>::Instance(), "rep_mime_type");
/*
- * $Id: ACLRequestMIMEType.cc,v 1.1 2003/02/17 07:01:34 robertc Exp $
+ * $Id: ACLRequestMIMEType.cc,v 1.2 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLChecklist.h"
#include "ACLRegexData.h"
+/* explicit template instantiation required for some systems */
+
+template class ACLRequestHeaderStrategy<HDR_CONTENT_TYPE>
+
+;
+
ACL::Prototype ACLRequestMIMEType::RegistryProtoype(&ACLRequestMIMEType::RegistryEntry_, "req_mime_type");
+
ACLStrategised<char const *> ACLRequestMIMEType::RegistryEntry_(new ACLRegexData, ACLRequestHeaderStrategy<HDR_CONTENT_TYPE>::Instance(), "req_mime_type");
/*
- * $Id: acl.cc,v 1.312 2003/09/21 00:30:46 robertc Exp $
+ * $Id: acl.cc,v 1.313 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
fatal ("unusable ACL::delete");
}
-acl *
+ACL *
ACL::FindByName(const char *name)
{
- acl *a;
+ ACL *a;
for (a = Config.aclList; a; a = a->next)
if (!strcasecmp(a->name, name))
ACL::ACL () {}
void
-ACL::ParseAclLine(acl ** head)
+ACL::ParseAclLine(ACL ** head)
{
/* we're already using strtok() to grok the line */
char *t = NULL;
- acl *A = NULL;
+ ACL *A = NULL;
LOCAL_ARRAY(char, aclname, ACL_NAME_SZ);
int new_acl = 0;
if (NULL == name)
return false;
- acl *a;
+ ACL *a;
if ((a = ACL::FindByName(name)))
return a->isProxyAuth();
aclParseAclList(acl_list ** head)
{
acl_list **Tail = head; /* sane name in the use below */
- acl *a = NULL;
+ ACL *a = NULL;
char *t;
/* next expect a list of ACL names, possibly preceeded
/*********************/
void
-aclDestroyAcls(acl ** head)
+aclDestroyAcls(ACL ** head)
{
ACL *next = NULL;
- for (acl *a = *head; a; a = next) {
+ for (ACL *a = *head; a; a = next) {
next = a->next;
delete a;
}
void
ACL::Initialize()
{
- acl *a = Config.aclList;
+ ACL *a = Config.aclList;
debug(53, 3) ("ACL::Initialize\n");
while (a) {
/*
- * $Id: asn.cc,v 1.97 2003/08/10 11:00:40 robertc Exp $
+ * $Id: asn.cc,v 1.98 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
struct squid_radix_node_head *AS_tree_head;
+/* explicit instantiation required for some systems */
+
+template cbdata_type List<int>
+::CBDATA_List;
+
/*
* Structure for as number information. it could be simply
* a list but it's coded as a structure for future
typedef struct _rtentry rtentry_t;
static int asnAddNet(char *, int);
+
static void asnCacheStart(int as);
+
static STCB asHandleReply;
static int destroyRadixNode(struct squid_radix_node *rn, void *w);
static int printRadixNode(struct squid_radix_node *rn, void *sentry);
-void asnAclInitialize(acl * acls);
+
+void asnAclInitialize(ACL * acls);
+
static void asStateFree(void *data);
+
static void destroyRadixNodeInfo(as_info *);
+
static OBJH asnStats;
/* PUBLIC */
return new ACLASN(*this);
}
+/* explicit template instantiation required for some systems */
+
+template class ACLStrategised<struct in_addr>
+
+;
+
ACL::Prototype ACLASN::SourceRegistryProtoype(&ACLASN::SourceRegistryEntry_, "src_as");
+
ACLStrategised<struct in_addr> ACLASN::SourceRegistryEntry_(new ACLASN, ACLSourceASNStrategy::Instance(), "src_as");
+
ACL::Prototype ACLASN::DestinationRegistryProtoype(&ACLASN::DestinationRegistryEntry_, "dst_as");
+
ACLStrategised<struct in_addr> ACLASN::DestinationRegistryEntry_(new ACLASN, ACLDestinationASNStrategy::Instance(), "dst_as");
int
/*
- * $Id: cache_cf.cc,v 1.450 2003/09/01 03:49:37 robertc Exp $
+ * $Id: cache_cf.cc,v 1.451 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
*****************************************************************************/
static void
-dump_acl(StoreEntry * entry, const char *name, acl * ae)
+dump_acl(StoreEntry * entry, const char *name, ACL * ae)
{
wordlist *w;
wordlist *v;
}
static void
-parse_acl(acl ** ae)
+parse_acl(ACL ** ae)
{
ACL::ParseAclLine(ae);
}
static void
-free_acl(acl ** ae)
+free_acl(ACL ** ae)
{
aclDestroyAcls(ae);
}
/*
- * $Id: comm.cc,v 1.390 2003/10/06 01:20:07 robertc Exp $
+ * $Id: comm.cc,v 1.391 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
assert (deferredReads.empty());
}
+/* explicit instantiation required for some systems */
+
+template cbdata_type List<DeferredRead>
+::CBDATA_List;
+
void
DeferredReadManager::delayRead(DeferredRead const &aRead) {
debug (5, 3)("Adding deferred read on fd %d\n", aRead.theRead.fd);
/*
- * $Id: external_acl.cc,v 1.53 2003/08/10 11:00:43 robertc Exp $
+ * $Id: external_acl.cc,v 1.54 2003/10/20 12:33:01 robertc Exp $
*
* DEBUG: section 82 External ACL
* AUTHOR: Henrik Nordstrom, MARA Systems AB
{
/* TODO: optimise this - we probably have a pointer to this
* around somewhere */
- acl *acl = ACL::FindByName(AclMatchedName);
+ ACL *acl = ACL::FindByName(AclMatchedName);
ACLExternal *me = dynamic_cast<ACLExternal *> (acl);
assert (me);
checklist->asyncInProgress(true);
void
AUFSFile::read(char *buf, off_t offset, size_t size)
{
- debug(79, 3) ("AUFSFile::read: %p, size %u\n", this, size);
+ debugs(79, 3, "AUFSFile::read: " << this << ", size " << size);
assert (fd > -1);
assert (ioRequestor.getRaw());
statCounter.syscalls.disk.reads++;
/*
- * $Id: structs.h,v 1.483 2003/10/16 21:40:16 robertc Exp $
+ * $Id: structs.h,v 1.484 2003/10/20 12:33:01 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#endif
-typedef class ACL acl;
-
struct _acl_address
{
}
onoff;
- acl *aclList;
+
+ class ACL *aclList;
struct
{