\title Squid Portability
-\section 1 Aim
+\section sec1 Aim
\par
Squid aims to build and run on many modern systems. To do this we have traditionally
stable build portability, code cleanliness, and clearer licensing.
-\section 2 Requirements
+\section sec2 Requirements
\par
The system calls used by Squid are not required to be standard. Often we depend on
But they are required to meet several other criteria:
\li They must be of actual benefit to Squid during its operation.
\li A better alternative must not exist.
- \li If not available on all OS an open-source GPLv2+ implementation must be available
- to be included with the Squid sources and used when required.
+ \li If not available on all OS an open-source GPLv2+ compatible implementation must be
+ available to be included with the Squid sources and used when required.
\par
-To be built into the libcompat-squid.la as a layer below all Squid-bundled binaries. The code
-must also qualify by being provided natively by some OS where Squid builds. \br
+To be built into the libcompat-squid.la as a layer below all Squid-bundled binaries. The
+code must also qualify by being provided natively by some OS where Squid builds. \br
Code and Algorithms which do not meet this final criteria are relegated to the slightly
higher level of basic component, rather than portability.
-\section 3 Component Types
+\section sec3 Component Types
\par Macro re-definition
Where the only difference between systems is their naming scheme. One of the schemes is
handling and memory allocation.
-\section 4 Layout
+\section sec4 Layout
The internal code structure of libcompat-squid.la files has a hierarchy. The API has a flat
global scope separate from the file layout. The API is pulled in by including compat/compat.h.
-The strict dependency requirements which exist within the compat API make including
+The strict dependency requirements which exist within the compat API make including an
individual part separately a risky operation.
\par
-Squid coding guidelines require each .c and .cc file to include squid.h first
-in their included files. squid.h begin with an order-specific sequence of defines and
-includes compat/compat.h to incorporate the compat layer appropriately in every soure file.
+Squid coding guidelines require each .c and .cc file to include squid.h first in their
+included files. squid.h begins with an order-specific sequence of defines and includes
+compat/compat.h to incorporate the compat layer appropriately in every source file.
\par
Internally the compat/ directory contains the public API file compat/compat.h which structures
as much as possible.
\par
-compat/compat_shared.h file contains the shared portability definitions which are shared
-across a great many systems. These should be written with protective macros to prevent any
-symbols or code being defined which is not necessary. Protections here must not be system-specific.
+compat/compat_shared.h file contains the portability definitions which are shared across a
+great many systems. These should be written with protective macros to prevent any symbols or
+code being defined which is not necessary. Protections here must not be system-specific.
\par
Also in compat/ directory are the .h and .c files for emulators detected by autoconf. These
/* implementation follows */
-/** \cond AUTODOCS-IGNORE */
+/** \cond AUTODOCS_IGNORE */
template <class C>
cbdata_type CbDataList<C>::CBDATA_CbDataList = CBDATA_UNKNOWN;
/** \endcond */
X_ACCELERATOR_VARY \
USE_ARP_ACL \
USE_ASYNC_IO \
+ USE_AUTH \
USE_CACHE_DIGESTS \
USE_CLASSFUL \
USE_DELAY_POOLS \
AsyncCallEnter \
AsyncCallExit \
CBDATA_CLASS2 \
+ CBDATA_CLASS_INIT \
+ CBDATA_NAMESPACED_CLASS_INIT \
MEMPROXY_CLASS_INLINE \
- MEMPROXY_CLASS
+ MEMPROXY_CLASS \
+ MEMPROXY_CLASS_INIT \
+ STUB \
+ STUB_NOP \
+ STUB_RETVAL
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
void *data; // cbdata-protected
/** The connection which this call pertains to.
- * \itemize On accept() calls this is the new client connection.
- * \itemize On connect() finished calls this is the newely opened connection.
- * \itemize On write calls this is the connection just written to.
- * \itemize On read calls this is the connection just read from.
- * \itemize On close calls this describes the connection which is now closed.
- * \itemize On timeouts this is the connection whose operation timed out.
- * NP: timeouts might also return to the connect/read/write handler with COMM_ERR_TIMEOUT.
+ * - On accept() calls this is the new client connection.
+ * - On connect() finished calls this is the newely opened connection.
+ * - On write calls this is the connection just written to.
+ * - On read calls this is the connection just read from.
+ * - On close calls this describes the connection which is now closed.
+ * - On timeouts this is the connection whose operation timed out.
+ * + NP: timeouts might also return to the connect/read/write handler with COMM_ERR_TIMEOUT.
*/
Comm::ConnectionPointer conn;
--loop_detect;
}
-/** \cond AUTODOCS-IGNORE */
+/** \cond AUTODOCS_IGNORE */
template <class RT>
cbdata_type IoResult<RT>::CBDATA_IoResult = CBDATA_UNKNOWN;
/** \endcond */
*
* Works on a raw character I/O buffer and tokenizes the content into
* either an error state or, an HTTP procotol request major segments:
- *
- * \item Request Line (method, URL, protocol, version)
- * \item Mime header block
+ * 1. Request Line (method, URL, protocol, version)
+ * 2. Mime header block
*/
class HttpParser
{
void *operator new(size_t);
void operator delete(void *);
- static ACL *Factory (char const *);
+ static ACL *Factory(char const *);
static void ParseAclLine(ConfigParser &parser, ACL ** head);
static void Initialize();
- static ACL* FindByName(const char *name);
+ static ACL *FindByName(const char *name);
ACL();
explicit ACL(const ACLFlag flgs[]) : cfgline(NULL), next(NULL), flags(flgs) { memset(name, '\0', sizeof(name)); }
/// Updates the checklist state on match, async, and failure.
bool matches(ACLChecklist *checklist) const;
- virtual ACL *clone()const = 0;
+ virtual ACL *clone() const = 0;
/// parses node represenation in squid.conf; dies on failures
virtual void parse() = 0;
virtual char const *typeString() const = 0;
virtual bool isProxyAuth() const;
virtual wordlist *dump() const = 0;
- virtual bool empty () const = 0;
- virtual bool valid () const;
+ virtual bool empty() const = 0;
+ virtual bool valid() const;
int cacheMatchAcl(dlink_list * cache, ACLChecklist *);
virtual int matchForCache(ACLChecklist *checklist);
{
public:
- Prototype ();
- Prototype (ACL const *, char const *);
+ Prototype();
+ Prototype(ACL const *, char const *);
~Prototype();
static bool Registered(char const *);
- static ACL *Factory (char const *);
+ static ACL *Factory(char const *);
private:
- ACL const*prototype;
+ ACL const *prototype;
char const *typeString;
private:
/* explicit instantiation required for some systems */
-/// \cond AUTODOCS-IGNORE
+/// \cond AUTODOCS_IGNORE
template cbdata_type CbDataList<int>::CBDATA_CbDataList;
/// \endcond
}
bool
-Acl::InnerNode::resumeMatchingAt(ACLChecklist *checklist, Nodes::const_iterator pos) const
+Acl::InnerNode::resumeMatchingAt(ACLChecklist *checklist, Acl::Nodes::const_iterator pos) const
{
debugs(28, 5, "checking " << name << " at " << (pos-nodes.begin()));
const int result = doMatch(checklist, pos);
#include "wordlist.h"
/* explicit instantiation required for some systems */
-/** \cond AUTODOCS-IGNORE */
+/** \cond AUTODOCS_IGNORE */
template cbdata_type CbDataList< Range<int> >::CBDATA_CbDataList;
/** \endcond */
/* explicit instantiation required for some systems */
-/// \cond AUTODOCS-IGNORE
+/// \cond AUTODOCS_IGNORE
template cbdata_type CbDataList<HttpRequestMethod>::CBDATA_CbDataList;
/// \endcond
/* explicit instantiation required for some systems */
-/// \cond AUTODOCS-IGNORE
+/// \cond AUTODOCS_IGNORE
template cbdata_type CbDataList<AnyP::ProtocolType>::CBDATA_CbDataList;
/// \endcond
}
/* explicit instantiation required for some systems */
-/** \cond AUTODOCS-IGNORE */
+/** \cond AUTODOCS_IGNORE */
// AYJ: 2009-05-20 : Removing. clashes with template <int> instantiation for other ACLs.
// template cbdata_type Ssl::Errors::CBDATA_CbDataList;
/** \endcond */
#include "HttpReply.h"
#include "HttpRequest.h"
-/** \cond AUTODOCS-IGNORE */
+/** \cond AUTODOCS_IGNORE */
cbdata_type Adaptation::AccessCheck::CBDATA_AccessCheck = CBDATA_UNKNOWN;
/** \endcond */
return isDetached;
}
-Adaptation::Icap::ConnWaiterDialer::ConnWaiterDialer(const CbcPointer<ModXact> &xact,
+Adaptation::Icap::ConnWaiterDialer::ConnWaiterDialer(const CbcPointer<Adaptation::Icap::ModXact> &xact,
Adaptation::Icap::ConnWaiterDialer::Parent::Method aHandler):
Parent(xact, aHandler)
{
public:
typedef NullaryMemFunT<ModXact> Parent;
ServiceRep::Pointer theService;
- ConnWaiterDialer(const CbcPointer<ModXact> &xact, Parent::Method aHandler);
+ ConnWaiterDialer(const CbcPointer<Adaptation::Icap::ModXact> &xact, Adaptation::Icap::ConnWaiterDialer::Parent::Method aHandler);
ConnWaiterDialer(const Adaptation::Icap::ConnWaiterDialer &aConnWaiter);
~ConnWaiterDialer();
};
#include "Parsing.h"
#include "wordlist.h"
-ACLFlag
-ACLMaxUserIP::SupportedFlags[] = {ACL_F_STRICT, ACL_F_END};
+ACLFlag ACLMaxUserIP::SupportedFlags[] = {ACL_F_STRICT, ACL_F_END};
-ACL *
-ACLMaxUserIP::clone() const
-{
- return new ACLMaxUserIP(*this);
-}
-
-ACLMaxUserIP::ACLMaxUserIP (char const *theClass) : ACL(SupportedFlags), class_ (theClass), maximum(0)
+ACLMaxUserIP::ACLMaxUserIP(char const *theClass) :
+ ACL(SupportedFlags),
+ class_(theClass),
+ maximum(0)
{}
-ACLMaxUserIP::ACLMaxUserIP (ACLMaxUserIP const & old) : class_ (old.class_), maximum (old.maximum)
+ACLMaxUserIP::ACLMaxUserIP(ACLMaxUserIP const &old) :
+ class_(old.class_),
+ maximum(old.maximum)
{
flags = old.flags;
}
ACLMaxUserIP::~ACLMaxUserIP()
{}
+ACL *
+ACLMaxUserIP::clone() const
+{
+ return new ACLMaxUserIP(*this);
+}
+
char const *
ACLMaxUserIP::typeString() const
{
}
bool
-ACLMaxUserIP::empty () const
+ACLMaxUserIP::empty() const
{
return false;
}
bool
-ACLMaxUserIP::valid () const
+ACLMaxUserIP::valid() const
{
return maximum > 0;
}
/// \ingroup ACLAPI
class ACLMaxUserIP : public ACL
{
-
public:
MEMPROXY_CLASS(ACLMaxUserIP);
- ACLMaxUserIP(char const *);
- ACLMaxUserIP(ACLMaxUserIP const &);
+ ACLMaxUserIP(char const *theClass);
+ ACLMaxUserIP(ACLMaxUserIP const &old);
~ACLMaxUserIP();
- ACLMaxUserIP&operator=(ACLMaxUserIP const &);
+ ACLMaxUserIP &operator =(ACLMaxUserIP const &);
- virtual ACL *clone()const;
+ virtual ACL *clone() const;
virtual char const *typeString() const;
virtual void parse();
- virtual int match(ACLChecklist *checklist);
+ virtual int match(ACLChecklist *cl);
virtual wordlist *dump() const;
- virtual bool empty () const;
- virtual bool valid () const;
+ virtual bool empty() const;
+ virtual bool valid() const;
virtual bool requiresRequest() const {return true;}
int getMaximum() const {return maximum;}
private:
static Prototype RegistryProtoype;
static ACLMaxUserIP RegistryEntry_;
- static ACLFlag SupportedFlags[];
+ static ACLFlag SupportedFlags[];
- int match(Auth::UserRequest::Pointer, Ip::Address const &);
+ int match(Auth::UserRequest::Pointer auth_user_request, Ip::Address const &src_addr);
char const *class_;
int maximum;
};
delete data;
}
-ACLProxyAuth::ACLProxyAuth(ACLData<char const *> *newData, char const *theType) : data (newData), type_(theType) {}
+ACLProxyAuth::ACLProxyAuth(ACLData<char const *> *newData, char const *theType) : data(newData), type_(theType) {}
-ACLProxyAuth::ACLProxyAuth (ACLProxyAuth const &old) : data (old.data->clone()), type_(old.type_)
+ACLProxyAuth::ACLProxyAuth(ACLProxyAuth const &old) : data(old.data->clone()), type_(old.type_)
{}
ACLProxyAuth &
-ACLProxyAuth::operator= (ACLProxyAuth const &rhs)
+ACLProxyAuth::operator=(ACLProxyAuth const &rhs)
{
data = rhs.data->clone();
type_ = rhs.type_;
}
bool
-ACLProxyAuth::empty () const
+ACLProxyAuth::empty() const
{
return data->empty();
}
bool
-ACLProxyAuth::valid () const
+ACLProxyAuth::valid() const
{
if (authenticateSchemeCount() == 0) {
debugs(28, DBG_CRITICAL, "Can't use proxy auth because no authentication schemes were compiled.");
public:
static ProxyAuthLookup *Instance();
- virtual void checkForAsync(ACLChecklist *)const;
+ virtual void checkForAsync(ACLChecklist *) const;
private:
static ProxyAuthLookup instance_;
class ACLProxyAuth : public ACL
{
-
public:
MEMPROXY_CLASS(ACLProxyAuth);
~ACLProxyAuth();
ACLProxyAuth(ACLData<char const *> *, char const *);
- ACLProxyAuth (ACLProxyAuth const &);
- ACLProxyAuth &operator= (ACLProxyAuth const &);
+ ACLProxyAuth(ACLProxyAuth const &);
+ ACLProxyAuth &operator =(ACLProxyAuth const &);
virtual char const *typeString() const;
virtual void parse();
virtual int match(ACLChecklist *checklist);
virtual wordlist *dump() const;
- virtual bool valid () const;
- virtual bool empty () const;
+ virtual bool valid() const;
+ virtual bool empty() const;
virtual bool requiresRequest() const {return true;}
virtual ACL *clone() const;
/* explicit instantiation required for some systems */
-/// \cond AUTODOCS-IGNORE
+/// \cond AUTODOCS_IGNORE
template cbdata_type CbDataList<DeferredRead>::CBDATA_CbDataList;
/// \endcond
"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
-#if DEAD_USING_QUOTEMIMEBLOB
-/** copy of Log::QuoteMimeBlob. Bugs there will be found here.
- * This omits [] characters but is otherwise identical to Log::QuoteMimeBlob when OLD_LOG_MIME = 1
- */
-static char *
-username_quote(const char *header)
-{
- int c;
- int i;
- char *buf;
- char *buf_cursor;
-
- if (header == NULL) {
- buf = static_cast<char *>(xcalloc(1, 1));
- *buf = '\0';
- return buf;
- }
-
- buf = static_cast<char *>(xcalloc(1, (strlen(header) * 3) + 1));
- buf_cursor = buf;
- /*
- * We escape: space \x00-\x1F and space (0x40) and \x7F-\xFF
- * to prevent garbage in the logs. CR and LF are also there just in case.
- */
-
- while ((c = *(const unsigned char *) header++) != '\0') {
- if (c == '\r') {
- *buf_cursor = '\\';
- ++buf_cursor;
- *buf_cursor = 'r';
- ++buf_cursor;
- } else if (c == '\n') {
- *buf_cursor = '\\';
- ++buf_cursor;
- *buf_cursor = 'n';
- ++buf_cursor;
- } else if (c <= 0x1F
- || c >= 0x7F
- || c == '%'
- || c == ' ') {
- *buf_cursor = '%';
- ++buf_cursor;
- i = c * 2;
- *buf_cursor = c2x[i];
- ++buf_cursor;
- *buf_cursor = c2x[i + 1];
- ++buf_cursor;
- } else {
- *buf_cursor = (char) c;
- ++buf_cursor;
- }
- }
-
- *buf_cursor = '\0';
- return buf;
-}
-#endif // DEAD
-
char *
Format::QuoteUrlEncodeUsername(const char *name)
{
return NULL;
return QuoteMimeBlob(name);
-// return username_quote(name);
}
char *
buf = static_cast<char *>(xcalloc(1, (strlen(header) * 3) + 1));
buf_cursor = buf;
- /**
+ /*
* Whe OLD_LOG_MIME is defined we escape: \x00-\x1F"#%;<>?{}|\\\\^~`\[\]\x7F-\xFF
* which is the default escape list for the CPAN Perl5 URI module
* modulo the inclusion of space (x40) to make the raw logs a bit
public:
Config();
- ~Config() {};
+ ~Config() {}
void parseConfigLine();
-/*
- */
-
#ifndef SQUID_SSL_CERT_VALIDATE_MESSAGE_H
#define SQUID_SSL_CERT_VALIDATE_MESSAGE_H
#include "HelperReply.h"
#include "ssl/crtd_message.h"
#include "ssl/support.h"
+
#include <vector>
namespace Ssl
public:
RecvdError(): id(0), error_no(SSL_ERROR_NONE), cert(NULL) {}
RecvdError(const RecvdError &);
- RecvdError & operator = (const RecvdError &);
+ RecvdError & operator =(const RecvdError &);
void setCert(X509 *); ///< Sets cert to the given certificate
int id; ///< The id of the error
ssl_error_t error_no; ///< The OpenSSL error code
* This class is responsible for composing or parsing messages destined to
* or comming from a cert validator helper.
* The messages format is:
- * <response/request code> <whitespace> <body length> <whitespace> <key=value> ...\1
+ * response/request-code SP body-length SP [key=value ...] \x01
*/
-class CertValidationMsg: public CrtdMessage
+class CertValidationMsg : public CrtdMessage
{
private:
/**
X509_Pointer cert; ///< A pointer to certificate
CertItem(): cert(NULL) {}
CertItem(const CertItem &);
- CertItem & operator = (const CertItem &);
+ CertItem & operator =(const CertItem &);
void setCert(X509 *); ///< Sets cert to the given certificate
};
};
}//namespace Ssl
+
#endif // SQUID_SSL_CERT_VALIDATE_MESSAGE_H
/**
* This class is responsible for composing and parsing messages destined to, or comming
* from an ssl_crtd server. Format of these mesages is:
- * <response/request code> <whitespace> <body length> <whitespace> <body>
+ * response/request-code SP body length SP body
*/
class CrtdMessage
{
};
} //namespace Ssl
+
#endif // SQUID_SSL_CRTD_MESSAGE_H