* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_ARRAY_H
#define SQUID_ARRAY_H
bool operator == (VectorIteratorBase const &rhs);
VectorIteratorBase & operator ++();
VectorIteratorBase operator ++(int);
- typename C::value_type & operator *() const
- {
+ typename C::value_type & operator *() const {
return theVector->items[pos];
}
- typename C::value_type * operator -> () const
- {
+ typename C::value_type * operator -> () const {
return &theVector->items[pos];
}
{
unsigned int n = 0;
for (unsigned int i = 0; i < count; i++) {
- if (items[i] != item) {
- if (i != n)
- items[n] = items[i];
- n++;
- }
+ if (items[i] != item) {
+ if (i != n)
+ items[n] = items[i];
+ n++;
+ }
}
count = n;
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
public:
CbDataListIterator(CbDataListContainer<C> const &list) : next_entry(list.head) {}
const C & next() {
- CbDataList<C> *entry = next_entry;
- if (entry)
- next_entry = entry->next;
- return entry->element;
+ CbDataList<C> *entry = next_entry;
+ if (entry)
+ next_entry = entry->next;
+ return entry->element;
}
bool end() {
- return next_entry == NULL;
+ return next_entry == NULL;
}
private:
CbDataList<C> *prev = NULL;
for (CbDataList<C> *node = this; node; node = node->
- next) {
+ next) {
if (node->element == toFind) {
if (prev != NULL) {
/* shift the element just found to the second position
/* Definitions for data structures and routines for the regular
* expression library, version 0.12.
- *
+ *
* Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. */
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
/* If this bit is not set, then + and ? are operators, and \+ and \? are
- * literals.
+ * literals.
* If set, then \+ and \? are operators and + and ? are literals. */
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
* ^ is an anchor if it is at the beginning of a regular
* expression or after an open-group or an alternation operator;
* $ is an anchor if it is at the end of a regular expression, or
- * before a close-group or an alternation operator.
- *
+ * before a close-group or an alternation operator.
+ *
* This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
* POSIX draft 11.2 says that * etc. in leading positions is undefined.
* We already implemented a previous draft which made those constructs
/* If this bit is set, then special characters are always special
* regardless of where they are in the pattern.
* If this bit is not set, then special characters are special only in
- * some contexts; otherwise they are ordinary. Specifically,
+ * some contexts; otherwise they are ordinary. Specifically,
* * + ? and intervals are only special when not after the beginning,
* open-group, or alternation operator. */
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
/* If this bit is set, either \{...\} or {...} defines an
- * interval, depending on RE_NO_BK_BRACES.
+ * interval, depending on RE_NO_BK_BRACES.
* If not set, \{, \}, {, and } are literals. */
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
* If not set, then \<digit> is a back-reference. */
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
-/* If this bit is set, then | is an alternation operator, and \| is literal.
+/* If this bit is set, then | is an alternation operator, and \| is literal.
* If not set, then \| is an alternation operator, and | is literal. */
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
* private to the regex routines. */
struct re_pattern_buffer {
-/* [[[begin pattern_buffer]]] */
+ /* [[[begin pattern_buffer]]] */
/* Space that holds the compiled pattern. It is declared as
* `unsigned char *' because its elements are
* sometimes used as array indexes. */
/* If true, an anchor at a newline matches. */
unsigned newline_anchor:1;
-/* [[[end pattern_buffer]]] */
+ /* [[[end pattern_buffer]]] */
};
typedef struct re_pattern_buffer regex_t;
extern int regcomp _RE_ARGS((regex_t * preg, const char *pattern, int cflags));
extern int regexec
_RE_ARGS((const regex_t * preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags));
+ regmatch_t pmatch[], int eflags));
extern size_t regerror
- _RE_ARGS((int errcode, const regex_t * preg, char *errbuf,
- size_t errbuf_size));
+ _RE_ARGS((int errcode, const regex_t * preg, char *errbuf,
+ size_t errbuf_size));
extern void regfree _RE_ARGS((regex_t * preg));
#endif /* SQUID_REGEXP_LIBRARY_H */
{
public:
IPAddress_list() { next = NULL; };
- ~IPAddress_list() { if(next) delete next; next = NULL; };
+ ~IPAddress_list() { if (next) delete next; next = NULL; };
IPAddress s;
IPAddress_list *next;
/// \ingroup MemPoolsAPI
class MemPoolIterator
{
- public:
+public:
MemImplementingAllocator *pool;
MemPoolIterator * next;
};
*/
class mgb_t
{
- public:
- mgb_t() : count(0), bytes(0){}
+public:
+ mgb_t() : count(0), bytes(0) {}
double count;
double bytes;
};
*/
class MemPoolMeter
{
- public:
+public:
void flush();
MemMeter alloc;
MemMeter inuse;
class MemImplementingAllocator;
/// \ingroup MemPoolsAPI
-class MemPools
+class MemPools
{
- public:
+public:
static MemPools &GetInstance();
MemPools();
void init();
int mem_idle_limit;
int poolCount;
bool defaultIsChunked;
- private:
+private:
static MemPools *Instance;
};
*/
class MemAllocatorProxy
{
- public:
+public:
inline MemAllocatorProxy(char const *aLabel, size_t const &);
/**
int getStats(MemPoolStats * stats);
char const * objectType() const;
- private:
+private:
MemAllocator *getAllocator() const;
const char *label;
size_t size;
/**
\ingroup MemPoolsAPI
\hideinitializer
- *
+ *
* This macro is intended for use within the declaration of a class.
*/
#define MEMPROXY_CLASS(CLASS) \
/**
\ingroup MemPoolsAPI
\hideinitializer
- *
+ *
* This macro is intended for use within the .h or .cci of a class as appropriate.
*/
#define MEMPROXY_CLASS_INLINE(CLASS) \
/// \ingroup MemPoolsAPI
class MemImplementingAllocator : public MemAllocator
{
- public:
+public:
MemImplementingAllocator(char const *aLabel, size_t aSize);
virtual MemPoolMeter const &getMeter() const;
virtual MemPoolMeter &getMeter();
virtual void setChunkSize(size_t chunksize) {}
virtual size_t objectSize() const;
virtual int getInUseCount() = 0;
- protected:
+protected:
virtual void *allocate() = 0;
virtual void deallocate(void *) = 0;
- private:
+private:
MemPoolMeter meter;
- public:
+public:
MemImplementingAllocator *next;
- public:
+public:
size_t alloc_calls;
size_t free_calls;
size_t obj_size;
/// \ingroup MemPoolsAPI
class MemPool : public MemImplementingAllocator
{
- public:
+public:
friend class MemChunk;
MemPool(const char *label, size_t obj_size);
~MemPool();
void *get();
void push(void *obj);
virtual int getInUseCount();
- protected:
+protected:
virtual void *allocate();
virtual void deallocate(void *);
- public:
+public:
/**
* Allows you tune chunk size of pooling. Objects are allocated in chunks
* instead of individually. This conserves memory, reduces fragmentation.
/// \ingroup MemPoolsAPI
class MemMalloc : public MemImplementingAllocator
{
- public:
+public:
MemMalloc(char const *label, size_t aSize);
virtual bool idleTrigger(int shift) const;
virtual void clean(time_t maxage);
virtual int getStats(MemPoolStats * stats);
virtual int getInUseCount();
- protected:
+protected:
virtual void *allocate();
virtual void deallocate(void *);
- private:
+private:
int inuse;
};
/// \ingroup MemPoolsAPI
class MemChunk
{
- public:
+public:
MemChunk(MemPool *pool);
~MemChunk();
void *freeList;
/// \ingroup MemPoolsAPI
class MemPoolStats
{
- public:
+public:
MemAllocator *pool;
const char *label;
MemPoolMeter *meter;
/// \ingroup MemPoolsAPI
/// \todo Classify and add constructor/destructor to initialize properly.
-struct _MemPoolGlobalStats
-{
+struct _MemPoolGlobalStats {
MemPoolMeter *TheMeter;
int tot_pools_alloc;
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
Range (C start_, C end_);
C start;
C end;
- Range intersection (Range const &) const;
+ Range intersection (Range const &) const;
C size() const;
};
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
RefCount (C const *p) : p_(p) { reference (*this); }
- ~RefCount()
- {
+ ~RefCount() {
dereference();
}
- RefCount (const RefCount &p) : p_(p.p_)
- {
+ RefCount (const RefCount &p) : p_(p.p_) {
reference (p);
}
- RefCount& operator = (const RefCount& p)
- {
+ RefCount& operator = (const RefCount& p) {
// DO NOT CHANGE THE ORDER HERE!!!
// This preserves semantics on self assignment
C const *newP_ = p.p_;
return *this;
}
- bool operator !() const { return !p_; }
+ bool operator !() const { return !p_; }
C const * operator-> () const {return p_; }
C * getRaw() {return const_cast<C *>(p_); }
- bool operator == (const RefCount& p) const
- {
+ bool operator == (const RefCount& p) const {
return p.p_ == p_;
}
- bool operator != (const RefCount &p) const
- {
+ bool operator != (const RefCount &p) const {
return p.p_ != p_;
}
private:
- void dereference(C const *newP = NULL)
- {
+ void dereference(C const *newP = NULL) {
/* Setting p_ first is important:
* we may be freed ourselves as a result of
* delete p_;
delete tempP_;
}
- void reference (const RefCount& p)
- {
+ void reference (const RefCount& p) {
if (p.p_)
p.p_->RefCountReference();
}
};
-struct RefCountable_
-{
- RefCountable_():count_(0){}
+struct RefCountable_ {
+ RefCountable_():count_(0) {}
- virtual ~RefCountable_(){}
+ virtual ~RefCountable_() {}
/* Not private, to allow class hierarchies */
- void RefCountReference() const
- {
+ void RefCountReference() const {
#if REFCOUNT_DEBUG
debug (0,1)("Incrementing this %p from count %u\n",this,count_);
#endif
++count_;
}
- unsigned RefCountDereference() const
- {
+ unsigned RefCountDereference() const {
#if REFCOUNT_DEBUG
debug (0,1)("Decrementing this %p from count %u\n",this,count_);
#endif
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_NEW_H
#define SQUID_NEW_H
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_STACK_H
using Vector<S>::items;
typedef typename Vector<S>::value_type value_type;
typedef typename Vector<S>::pointer pointer;
- value_type pop()
- {
+ value_type pop() {
if (!count)
return value_type();
}
/* todo, fatal on empty Top call */
- value_type top() const
- {
+ value_type top() const {
return count ? items[count - 1] : value_type();
}
};
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* $Id: asn1.h,v 1.13 2003/01/23 00:36:47 robertc Exp $
- *
+ *
**********************************************************************/
#ifndef EIGHTBIT_SUBIDS
#define IS_EXTENSION_ID(byte) (((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
u_char *asn_build_header(u_char *, int *, u_char, int);
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
#define SQ_MESH SQUIDMIB, 5 /* cacheMesh group { squid 5 } */
#define LEN_SQ_MESH LEN_SQUIDMIB+1
-/*
+/*
* cacheSystem group { squid 1 }
*/
#define LEN_SYS LEN_SQ_SYS + 1
#define LEN_SYS_INST LEN_SQ_SYS + 2
-/*
+/*
* cacheConfig group { squid 2 }
*/
#define LEN_CONF_INST LEN_SQ_CONF + 2
-/*
+/*
* cacheStorageConfig group { cacheConfig 5 }
*/
enum {
#define LEN_CONF_ST LEN_CONF + 1
#define LEN_CONF_ST_INST LEN_CONF + 2
-/*
+/*
* Cache Performance Group {squid 3}
*/
PERF_MEDIAN_ICP_REPLY, /* cacheIcpReplySvcTime */
PERF_MEDIAN_DNS, /* cacheDnsSvcTime */
PERF_MEDIAN_RHR, /* cacheRequestHitRatio */
- PERF_MEDIAN_BHR, /* cacheRequestByteRatio */
+ PERF_MEDIAN_BHR, /* cacheRequestByteRatio */
PERF_MEDIAN_HTTP_NH, /* cacheHttpNhSvcTime */
PERF_MEDIAN_END
};
-/*
+/*
* cacheNetwork group { squid 4 }
*/
/* cacheIpCache */
enum {
- IP_START,
+ IP_START,
IP_ENT, /* cacheIpEntrie */
IP_REQ, /* cacheIpRequests */
IP_HITS, /* acheIpHits */
-/*
+/*
* cacheMesh group { squid 5 }
*/
enum {
- MESH_START,
+ MESH_START,
MESH_PTBL, /* cachePeerTable */
MESH_CTBL, /* cacheClientTable */
MESH_END
};
/* cachePeerEntry */
-enum {
+enum {
MESH_PTBL_START,
MESH_PTBL_INDEX, /* cachePeerIndex */
MESH_PTBL_NAME, /* cachePeerName */
};
/* cacheClientEntry */
-enum {
+enum {
MESH_CTBL_START,
MESH_CTBL_ADDR_TYPE, /* cacheClientAddressType */
MESH_CTBL_ADDR, /* cacheClientAddress */
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_CONFIG_H
#elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
#define _SQUID_OS2_
/*
- * FIXME: the os2 port of bash seems to have problems checking
- * the return codes of programs in if statements. These options
- * need to be overridden.
- */
+* FIXME: the os2 port of bash seems to have problems checking
+* the return codes of programs in if statements. These options
+* need to be overridden.
+*/
#endif
/* FD_SETSIZE must be redefined before including sys/types.h */
#if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
#ifndef HAVE_PAD128_T
typedef union {
- long double _q;
- int32_t _l[4];
+ long double _q;
+ int32_t _l[4];
} pad128_t;
#endif
#ifndef HAVE_UPAD128_T
typedef union {
- long double _q;
- uint32_t _l[4];
+ long double _q;
+ uint32_t _l[4];
} upad128_t;
#endif
#endif
-/*
- * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
+/*
+ * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
*/
#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_) || defined(_SQUID_DRAGONFLY_))
#undef HAVE_MALLOC_H
/* gcc doesn't recognize the Windows native 64 bit formatting tags causing
* the compile fail, so we must disable the check on native Windows.
- */
+ */
#if __GNUC__ && !defined(_SQUID_MSWIN_)
#define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2)))
#ifdef HAVE_GETADDRINFO
- /* These functions are provided by the OS */
+/* These functions are provided by the OS */
#define xgetaddrinfo getaddrinfo
#define xfreeaddrinfo freeaddrinfo
#define xgai_strerror gai_strerror
#else /* !HAVE_GETADDRINFO */
/* SG 23/09/2007:
- On Windows the following definitions are already available, may be that
- this could be needed on some other platform */
+On Windows the following definitions are already available, may be that
+this could be needed on some other platform */
#if 0
-struct addrinfo
- {
+struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
char *ai_canonname; /* canonical name for nodename */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
- };
+};
/* Supposed to be defined in <netdb.h> */
#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */
/* RFC 2553 / Posix resolver */
SQUIDCEXTERN int xgetaddrinfo (const char *nodename, const char *servname,
- const struct addrinfo *hints, struct addrinfo **res);
+ const struct addrinfo *hints, struct addrinfo **res);
/* Free addrinfo structure and associated storage */
SQUIDCEXTERN void xfreeaddrinfo (struct addrinfo *ai);
#ifdef HAVE_GETNAMEINFO
- /* These functions are provided by the OS */
+/* These functions are provided by the OS */
#define xgetnameinfo getnameinfo
#else /* !HAVE_GETNAMEINFO */
/* RFC 2553 / Posix resolver */
SQUIDCEXTERN int xgetnameinfo(const struct sockaddr *sa,
- socklen_t salen,
- char *host,
- size_t hostlen,
- char *serv,
- size_t servlen,
- int flags );
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ int flags );
#endif /* HAVE_GETNAMEINFO */
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
/****************************************************************************
* Public functions
****************************************************************************/
-/*
+/*
* Create and initialize a new heap.
*/
SQUIDCEXTERN heap *new_heap(int init_size, heap_key_func gen_key);
-/*
+/*
* Delete a heap and clean up its memory. Does not delete what the heap
* nodes are pointing to!
*/
*/
SQUIDCEXTERN heap_t heap_update(heap *, heap_node * elm, heap_t dat);
-/*
+/*
* Generate a heap key for a given data object. Alternative macro form:
*/
#ifdef MACRO_DEBUG
#endif /* MACRO_DEBUG */
-/*
+/*
* Extract the minimum (root) element and maintain the heap property.
* Returns the data pointed to by the root node, which the caller must
* free as necessary.
*/
SQUIDCEXTERN heap_t heap_extractmin(heap *);
-/*
+/*
* Extract the last leaf node (does not change the heap property).
* Returns the data that had been in the heap which the caller must free if
* necessary. Note that the last node is guaranteed to be less than its
*/
SQUIDCEXTERN heap_t heap_extractlast(heap * hp);
-/*
+/*
* Get the root key, the nth key, the root (smallest) element, or the nth
* element. None of these operations modify the heap.
*/
SQUIDCEXTERN heap_t heap_peepmin(heap *);
SQUIDCEXTERN heap_t heap_peep(heap *, int n);
-/*
- * Is the heap empty? How many nodes (data objects) are in it?
+/*
+ * Is the heap empty? How many nodes (data objects) are in it?
*/
#ifdef MACRO_DEBUG
SQUIDCEXTERN int heap_empty(heap *);
#define heap_empty(heap) (((heap)->last <= 0) ? 1 : 0)
#endif /* MACRO_DEBUG */
-/*
+/*
* Print the heap or a node in the heap.
*/
SQUIDCEXTERN void heap_print(heap *);
#else
/* char *
- * inet_ntop(af, src, dst, size)
- * convert a network format address to presentation format.
- * return:
- * pointer to presentation format address (`dst'), or NULL (see errno).
- * author:
- * Paul Vixie, 1996.
- */
+* inet_ntop(af, src, dst, size)
+* convert a network format address to presentation format.
+* return:
+* pointer to presentation format address (`dst'), or NULL (see errno).
+* author:
+* Paul Vixie, 1996.
+*/
SQUIDCEXTERN const char * xinet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#else
/* int
- * inet_pton(af, src, dst)
- * convert from presentation format (which usually means ASCII printable)
- * to network format (which is usually some kind of binary format).
- * return:
- * 1 if the address was valid for the specified address family
- * 0 if the address wasn't valid (`dst' is untouched in this case)
- * -1 if some other error occurred (`dst' is untouched in this case, too)
- * author:
- * Paul Vixie, 1996.
- */
+* inet_pton(af, src, dst)
+* convert from presentation format (which usually means ASCII printable)
+* to network format (which is usually some kind of binary format).
+* return:
+* 1 if the address was valid for the specified address family
+* 0 if the address wasn't valid (`dst' is untouched in this case)
+* -1 if some other error occurred (`dst' is untouched in this case, too)
+* author:
+* Paul Vixie, 1996.
+*/
SQUIDCEXTERN int xinet_pton(int af, const char *src, void *dst);
#endif
#include "config.h"
/* object to track per-action memory usage (e.g. #idle objects) */
-class MemMeter {
- public:
+class MemMeter
+{
+public:
MemMeter() : level(0), hwater_level(0), hwater_stamp(0) {}
ssize_t level; /* current level (count or volume) */
ssize_t hwater_level; /* high water mark */
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* SQUID Web Proxy Cache http://www.squid-cache.org/
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
} ntlm_authenticate;
const char *ntlm_make_challenge(char *domain, char *domain_controller,
- char *challenge_nonce, int challenge_nonce_len);
+ char *challenge_nonce, int challenge_nonce_len);
lstring ntlm_fetch_string(char *packet, int32_t length, strhdr * str);
void ntlm_add_to_payload(char *payload, int *payload_length,
- strhdr * hdr, char *toadd,
- int toadd_length, int base_offset);
+ strhdr * hdr, char *toadd,
+ int toadd_length, int base_offset);
#endif /* SQUID_NTLMAUTH_H */
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
#define TYPE_NULL 10
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
void init_mib(char *);
void sprint_value(char *, oid *, int, struct variable_list *);
void print_value(oid *, int, struct variable_list *);
-/*void print_variable_list(struct variable_list *); */
-/*void print_variable_list_value(struct variable_list *); */
-/*void print_type(struct variable_list *); */
+ /*void print_variable_list(struct variable_list *); */
+ /*void print_variable_list_value(struct variable_list *); */
+ /*void print_type(struct variable_list *); */
void print_oid_nums(oid *, int);
struct snmp_mib_tree *read_mib(char *);
uint32_t lo, hi;
// Based on an example in Wikipedia
/* We cannot use "=A", since this would use %rax on x86_64 */
- asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
+asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
return (hrtime_t)hi << 32 | lo;
}
typedef struct _xprof_stats_data xprof_stats_data;
-struct _xprof_stats_data
-{
+struct _xprof_stats_data {
hrtime_t start;
hrtime_t stop;
hrtime_t delta;
int64_t summ;
};
-struct _xprof_stats_node
-{
+struct _xprof_stats_node {
const char *name;
xprof_stats_data accu;
xprof_stats_data hist;
* 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 */
* 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 */
int rm_refs; /* # of references to this struct */
};
-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 */
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_RFC1035_H
#define SQUID_RFC1035_H
};
SQUIDCEXTERN ssize_t rfc1035BuildAQuery(const char *hostname,
- char *buf,
- size_t sz,
- unsigned short qid,
- rfc1035_query * query);
+ char *buf,
+ size_t sz,
+ unsigned short qid,
+ rfc1035_query * query);
SQUIDCEXTERN ssize_t rfc1035BuildPTRQuery(const struct in_addr,
- char *buf,
- size_t sz,
- unsigned short qid,
- rfc1035_query * query);
+ char *buf,
+ size_t sz,
+ unsigned short qid,
+ rfc1035_query * query);
SQUIDCEXTERN void rfc1035SetQueryID(char *, unsigned short qid);
SQUIDCEXTERN int rfc1035MessageUnpack(const char *buf,
- size_t sz,
- rfc1035_message ** answer);
+ size_t sz,
+ rfc1035_message ** answer);
SQUIDCEXTERN int rfc1035QueryCompare(const rfc1035_query *, const rfc1035_query *);
SQUIDCEXTERN void rfc1035RRDestroy(rfc1035_rr ** rr, int n);
SQUIDCEXTERN void rfc1035MessageDestroy(rfc1035_message ** message);
#define RFC1035_CLASS_IN 1
- /* Child Library RFC3596 Depends on some otherwise internal functions */
+/* Child Library RFC3596 Depends on some otherwise internal functions */
SQUIDCEXTERN int rfc1035HeaderPack(char *buf,
- size_t sz,
- rfc1035_message * hdr);
+ size_t sz,
+ rfc1035_message * hdr);
SQUIDCEXTERN int rfc1035HeaderUnpack(const char *buf,
- size_t sz,
- unsigned int *off,
- rfc1035_message * h);
+ size_t sz,
+ unsigned int *off,
+ rfc1035_message * h);
SQUIDCEXTERN int rfc1035QuestionPack(char *buf,
- size_t sz,
- const char *name,
- const unsigned short type,
- const unsigned short _class);
+ size_t sz,
+ const char *name,
+ const unsigned short type,
+ const unsigned short _class);
#endif /* SQUID_RFC1035_H */
*/
#define RFC2181_MAXHOSTNAMELEN 256
- /// Back-port macro for old squid code still using SQUIDHOSTNAMELEN without RFC reference.
+/// Back-port macro for old squid code still using SQUIDHOSTNAMELEN without RFC reference.
#define SQUIDHOSTNAMELEN RFC2181_MAXHOSTNAMELEN
#endif /* _SQUID_INCLUDE_RFC1123_H */
* The following copyright and licence statement covers all changes made to the
* reference implementation.
*
- * Key changes to the reference implementation were:
+ * Key changes to the reference implementation were:
* alteration to a plain C layout.
* Create CvtBin function
* Allow CalcHA1 to make use of precaculated username:password:realm hash's
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_RFC3596_H
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* $Id: snmp-internal.h,v 1.4 2003/01/23 00:36:47 robertc Exp $
- *
+ *
**********************************************************************/
#define SNMP_PORT 161
/***************************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
- *
+ *
* $Id: snmp-mib.h,v 1.4 2003/01/23 00:36:47 robertc Exp $
- *
+ *
***************************************************************************/
#include <asn1.h> /* Need OID Definition */
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* $Id: snmp.h,v 1.16 2003/01/23 00:36:47 robertc Exp $
- *
+ *
**********************************************************************/
#if HAVE_SYS_TYPES_H
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
#define SNMP_DEFAULT_MACREPEATERS 0
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
/* Parse the buffer pointed to by arg3, of length arg4, into pdu arg2.
* Returns the community of the incoming PDU, or NULL
*/
u_char *snmp_parse(struct snmp_session *, struct snmp_pdu *,
- u_char *, int);
+ u_char *, int);
-/* Encode pdu arg2 into buffer arg3. arg4 contains the size of
- * the buffer.
- */
+ /* Encode pdu arg2 into buffer arg3. arg4 contains the size of
+ * the buffer.
+ */
int snmp_build(struct snmp_session *, struct snmp_pdu *,
- u_char *, int *);
+ u_char *, int *);
-/*
- * struct snmp_session *snmp_open(session)
- * struct snmp_session *session;
- *
- * Sets up the session with the snmp_session information provided
- * by the user. Then opens and binds the necessary UDP port.
- * A handle to the created session is returned (this is different than
- * the pointer passed to snmp_open()). On any error, NULL is returned
- * and snmp_errno is set to the appropriate error code.
- */
+ /*
+ * struct snmp_session *snmp_open(session)
+ * struct snmp_session *session;
+ *
+ * Sets up the session with the snmp_session information provided
+ * by the user. Then opens and binds the necessary UDP port.
+ * A handle to the created session is returned (this is different than
+ * the pointer passed to snmp_open()). On any error, NULL is returned
+ * and snmp_errno is set to the appropriate error code.
+ */
#if 0
struct snmp_session *snmp_open(struct snmp_session *);
-/*
- * int snmp_close(session)
- * struct snmp_session *session;
- *
- * Close the input session. Frees all data allocated for the session,
- * dequeues any pending requests, and closes any sockets allocated for
- * the session. Returns 0 on error, 1 otherwise.
- */
+ /*
+ * int snmp_close(session)
+ * struct snmp_session *session;
+ *
+ * Close the input session. Frees all data allocated for the session,
+ * dequeues any pending requests, and closes any sockets allocated for
+ * the session. Returns 0 on error, 1 otherwise.
+ */
int snmp_close(struct snmp_session *);
-/*
- * int snmp_send(session, pdu)
- * struct snmp_session *session;
- * struct snmp_pdu *pdu;
- *
- * Sends the input pdu on the session after calling snmp_build to create
- * a serialized packet. If necessary, set some of the pdu data from the
- * session defaults. Add a request corresponding to this pdu to the list
- * of outstanding requests on this session, then send the pdu.
- * Returns the request id of the generated packet if applicable, otherwise 1.
- * On any error, 0 is returned.
- * The pdu is freed by snmp_send() unless a failure occured.
- */
+ /*
+ * int snmp_send(session, pdu)
+ * struct snmp_session *session;
+ * struct snmp_pdu *pdu;
+ *
+ * Sends the input pdu on the session after calling snmp_build to create
+ * a serialized packet. If necessary, set some of the pdu data from the
+ * session defaults. Add a request corresponding to this pdu to the list
+ * of outstanding requests on this session, then send the pdu.
+ * Returns the request id of the generated packet if applicable, otherwise 1.
+ * On any error, 0 is returned.
+ * The pdu is freed by snmp_send() unless a failure occured.
+ */
int snmp_send(struct snmp_session *, struct snmp_pdu *);
-/*
- * void snmp_read(fdset)
- * fd_set *fdset;
- *
- * Checks to see if any of the fd's set in the fdset belong to
- * snmp. Each socket with it's fd set has a packet read from it
- * and snmp_parse is called on the packet received. The resulting pdu
- * is passed to the callback routine for that session. If the callback
- * routine returns successfully, the pdu and it's request are deleted.
- */
+ /*
+ * void snmp_read(fdset)
+ * fd_set *fdset;
+ *
+ * Checks to see if any of the fd's set in the fdset belong to
+ * snmp. Each socket with it's fd set has a packet read from it
+ * and snmp_parse is called on the packet received. The resulting pdu
+ * is passed to the callback routine for that session. If the callback
+ * routine returns successfully, the pdu and it's request are deleted.
+ */
void snmp_read(fd_set *);
-/*
- * int snmp_select_info(numfds, fdset, timeout, block)
- * int *numfds;
- * fd_set *fdset;
- * struct timeval *timeout;
- * int *block;
- *
- * Returns info about what snmp requires from a select statement.
- * numfds is the number of fds in the list that are significant.
- * All file descriptors opened for SNMP are OR'd into the fdset.
- * If activity occurs on any of these file descriptors, snmp_read
- * should be called with that file descriptor set.
- *
- * The timeout is the latest time that SNMP can wait for a timeout. The
- * select should be done with the minimum time between timeout and any other
- * timeouts necessary. This should be checked upon each invocation of select.
- * If a timeout is received, snmp_timeout should be called to check if the
- * timeout was for SNMP. (snmp_timeout is idempotent)
- *
- * Block is 1 if the select is requested to block indefinitely, rather than time out.
- * If block is input as 1, the timeout value will be treated as undefined, but it must
- * be available for setting in snmp_select_info. On return, if block is true, the value
- * of timeout will be undefined.
- *
- * snmp_select_info returns the number of open sockets. (i.e. The number of sessions open)
- */
+ /*
+ * int snmp_select_info(numfds, fdset, timeout, block)
+ * int *numfds;
+ * fd_set *fdset;
+ * struct timeval *timeout;
+ * int *block;
+ *
+ * Returns info about what snmp requires from a select statement.
+ * numfds is the number of fds in the list that are significant.
+ * All file descriptors opened for SNMP are OR'd into the fdset.
+ * If activity occurs on any of these file descriptors, snmp_read
+ * should be called with that file descriptor set.
+ *
+ * The timeout is the latest time that SNMP can wait for a timeout. The
+ * select should be done with the minimum time between timeout and any other
+ * timeouts necessary. This should be checked upon each invocation of select.
+ * If a timeout is received, snmp_timeout should be called to check if the
+ * timeout was for SNMP. (snmp_timeout is idempotent)
+ *
+ * Block is 1 if the select is requested to block indefinitely, rather than time out.
+ * If block is input as 1, the timeout value will be treated as undefined, but it must
+ * be available for setting in snmp_select_info. On return, if block is true, the value
+ * of timeout will be undefined.
+ *
+ * snmp_select_info returns the number of open sockets. (i.e. The number of sessions open)
+ */
int snmp_select_info(int *, fd_set *, struct timeval *, int *);
-/*
- * void snmp_timeout();
- *
- * snmp_timeout should be called whenever the timeout from snmp_select_info expires,
- * but it is idempotent, so snmp_timeout can be polled (probably a cpu expensive
- * proposition). snmp_timeout checks to see if any of the sessions have an
- * outstanding request that has timed out. If it finds one (or more), and that
- * pdu has more retries available, a new packet is formed from the pdu and is
- * resent. If there are no more retries available, the callback for the session
- * is used to alert the user of the timeout.
- */
+ /*
+ * void snmp_timeout();
+ *
+ * snmp_timeout should be called whenever the timeout from snmp_select_info expires,
+ * but it is idempotent, so snmp_timeout can be polled (probably a cpu expensive
+ * proposition). snmp_timeout checks to see if any of the sessions have an
+ * outstanding request that has timed out. If it finds one (or more), and that
+ * pdu has more retries available, a new packet is formed from the pdu and is
+ * resent. If there are no more retries available, the callback for the session
+ * is used to alert the user of the timeout.
+ */
void snmp_timeout(void);
-/*
- * This routine must be supplied by the application:
- *
- * int callback(operation, session, reqid, pdu, magic)
- * int operation;
- * struct snmp_session *session; The session authenticated under.
- * int reqid; The request id of this pdu (0 for TRAP)
- * struct snmp_pdu *pdu; The pdu information.
- * void *magic A link to the data for this routine.
- *
- * Returns 1 if request was successful, 0 if it should be kept pending.
- * Any data in the pdu must be copied because it will be freed elsewhere.
- * Operations are defined below:
- */
+ /*
+ * This routine must be supplied by the application:
+ *
+ * int callback(operation, session, reqid, pdu, magic)
+ * int operation;
+ * struct snmp_session *session; The session authenticated under.
+ * int reqid; The request id of this pdu (0 for TRAP)
+ * struct snmp_pdu *pdu; The pdu information.
+ * void *magic A link to the data for this routine.
+ *
+ * Returns 1 if request was successful, 0 if it should be kept pending.
+ * Any data in the pdu must be copied because it will be freed elsewhere.
+ * Operations are defined below:
+ */
/***************************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
- *
+ *
* $Id: snmp_api_error.h,v 1.5 2003/01/23 00:36:47 robertc Exp $
- *
+ *
***************************************************************************/
/* Error return values */
#define SNMPERR_LAST -16 /* Last error message */
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-/* extern int snmp_errno */
+ /* extern int snmp_errno */
const char *snmp_api_error(int);
int snmp_api_errno(void);
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
#endif /* HAVE_SRAND */
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
int snmp_get_socket_session(struct snmp_session *session_);
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
struct synch_state {
int waiting;
int status;
-/* status codes */
+ /* status codes */
#define STAT_SUCCESS 0
#define STAT_ERROR 1
#define STAT_TIMEOUT 2
};
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
extern struct synch_state snmp_synch_state;
-/* Synchronize Input with Agent */
+ /* Synchronize Input with Agent */
int snmp_synch_input(int, struct snmp_session *, int,
- struct snmp_pdu *, void *);
+ struct snmp_pdu *, void *);
-/* Synchronize Response with Agent */
+ /* Synchronize Response with Agent */
int snmp_synch_response(struct snmp_session *, struct snmp_pdu *,
- struct snmp_pdu **);
+ struct snmp_pdu **);
-/* Synchronize Setup */
+ /* Synchronize Setup */
void snmp_synch_setup(struct snmp_session *);
#ifdef __cplusplus
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
- *
+ *
* $Id: snmp_coexist.h,v 1.4 2003/01/23 00:36:47 robertc Exp $
- *
+ *
**********************************************************************/
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
int snmp_coexist_V2toV1(struct snmp_pdu *);
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* $Id: snmp_error.h,v 1.5 2003/01/23 00:36:47 robertc Exp $
- *
+ *
**********************************************************************/
/*
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
const char *snmp_errstring(int);
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
- *
+ *
* $Id: snmp_msg.h,v 1.4 2003/01/23 00:36:48 robertc Exp $
- *
+ *
**********************************************************************/
#define SNMP_VERSION_1 0 /* RFC 1157 */
#define SNMP_VERSION_2 1 /* RFC 1901 */
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-u_char *snmp_msg_Encode(u_char *, int *, u_char *, int, int, struct snmp_pdu *);
-u_char *snmp_msg_Decode(u_char *, int *, u_char *, int *, int *, struct snmp_pdu *);
+ u_char *snmp_msg_Encode(u_char *, int *, u_char *, int, int, struct snmp_pdu *);
+ u_char *snmp_msg_Decode(u_char *, int *, u_char *, int *, int *, struct snmp_pdu *);
#ifdef __cplusplus
}
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
- *
+ *
* $Id: snmp_pdu.h,v 1.11 2003/01/23 00:36:48 robertc Exp $
- *
+ *
**********************************************************************/
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-typedef struct sockaddr_in ipaddr;
+ typedef struct sockaddr_in ipaddr;
-/* An SNMP PDU */
-struct snmp_pdu {
- int command; /* Type of this PDU */
- ipaddr address; /* Address of peer */
+ /* An SNMP PDU */
+ struct snmp_pdu {
+ int command; /* Type of this PDU */
+ ipaddr address; /* Address of peer */
- int reqid; /* Integer32: Request id */
- int errstat; /* INTEGER: Error status */
- int errindex; /* INTEGER: Error index */
+ int reqid; /* Integer32: Request id */
+ int errstat; /* INTEGER: Error status */
+ int errindex; /* INTEGER: Error index */
- /* SNMPv2 Bulk Request */
- int non_repeaters; /* INTEGER: */
- int max_repetitions; /* INTEGER: */
+ /* SNMPv2 Bulk Request */
+ int non_repeaters; /* INTEGER: */
+ int max_repetitions; /* INTEGER: */
- struct variable_list *variables; /* Variable Bindings */
+ struct variable_list *variables; /* Variable Bindings */
- /* Trap information */
- oid *enterprise; /* System OID */
- int enterprise_length;
- ipaddr agent_addr; /* address of object generating trap */
- int trap_type; /* generic trap type */
- int specific_type; /* specific type */
- u_int time; /* Uptime */
-};
+ /* Trap information */
+ oid *enterprise; /* System OID */
+ int enterprise_length;
+ ipaddr agent_addr; /* address of object generating trap */
+ int trap_type; /* generic trap type */
+ int specific_type; /* specific type */
+ u_int time; /* Uptime */
+ };
-struct snmp_pdu *snmp_pdu_create(int);
-struct snmp_pdu *snmp_pdu_clone(struct snmp_pdu *);
-struct snmp_pdu *snmp_pdu_fix(struct snmp_pdu *, int);
-struct snmp_pdu *snmp_fix_pdu(struct snmp_pdu *, int);
-void snmp_free_pdu(struct snmp_pdu *);
-void snmp_pdu_free(struct snmp_pdu *);
+ struct snmp_pdu *snmp_pdu_create(int);
+ struct snmp_pdu *snmp_pdu_clone(struct snmp_pdu *);
+ struct snmp_pdu *snmp_pdu_fix(struct snmp_pdu *, int);
+ struct snmp_pdu *snmp_fix_pdu(struct snmp_pdu *, int);
+ void snmp_free_pdu(struct snmp_pdu *);
+ void snmp_pdu_free(struct snmp_pdu *);
-u_char *snmp_pdu_encode(u_char *, int *, struct snmp_pdu *);
-u_char *snmp_pdu_decode(u_char *, int *, struct snmp_pdu *);
+ u_char *snmp_pdu_encode(u_char *, int *, struct snmp_pdu *);
+ u_char *snmp_pdu_decode(u_char *, int *, struct snmp_pdu *);
/* Add a NULL Variable to a PDU */
-void snmp_add_null_var(struct snmp_pdu *, oid *, int);
-
-/* RFC 1905: Protocol Operations for SNMPv2
- *
- * RFC 1157: A Simple Network Management Protocol (SNMP)
- *
- * PDU Types
- */
+ void snmp_add_null_var(struct snmp_pdu *, oid *, int);
+
+ /* RFC 1905: Protocol Operations for SNMPv2
+ *
+ * RFC 1157: A Simple Network Management Protocol (SNMP)
+ *
+ * PDU Types
+ */
#define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0)
#define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1)
#define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2)
#define SNMP_DEFAULT_ADDRESS 0
#define SNMP_DEFAULT_REQID 0
-/* RFC 1907: Management Information Base for SNMPv2
- *
- * RFC 1157: A Simple Network Management Protocol (SNMP)
- *
- * Trap Types
- */
+ /* RFC 1907: Management Information Base for SNMPv2
+ *
+ * RFC 1157: A Simple Network Management Protocol (SNMP)
+ *
+ * Trap Types
+ */
#if UNUSED_CODE
#define SNMP_TRAP_COLDSTART (0x0)
#define SNMP_TRAP_WARMSTART (0x1)
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* $Id: snmp_session.h,v 1.5 2003/01/23 00:36:48 robertc Exp $
- *
+ *
**********************************************************************/
struct snmp_session {
#include "config.h"
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-/* call a function at regular intervals (in seconds): */
-extern void snmp_alarm(int ival, void (*handler) (void));
+ /* call a function at regular intervals (in seconds): */
+ extern void snmp_alarm(int ival, void (*handler) (void));
-/* service for filedescriptors: */
+ /* service for filedescriptors: */
-extern void fd_add(int fd, void (*func) (int fd));
-extern void fd_service(void);
+ extern void fd_add(int fd, void (*func) (int fd));
+ extern void fd_service(void);
-/* ---------------------------------------------------------------------- */
+ /* ---------------------------------------------------------------------- */
-/*
- * SNMP Agent extension for Spacer-Controler Management
- *
- * Copyright (c) 1997 FT/CNET/DES/GRL Olivier Montanuy
- */
+ /*
+ * SNMP Agent extension for Spacer-Controler Management
+ *
+ * Copyright (c) 1997 FT/CNET/DES/GRL Olivier Montanuy
+ */
-/* Function to safely copy a string, and ensure the last
- * character is always '\0'. */
-void strcpy_safe(char *str, int str_len, char *val);
+ /* Function to safely copy a string, and ensure the last
+ * character is always '\0'. */
+ void strcpy_safe(char *str, int str_len, char *val);
-/* Function to get IP address of this agent
- * WARNING: this scans all interfaces (slow) */
-u_long Util_local_ip_address(void);
+ /* Function to get IP address of this agent
+ * WARNING: this scans all interfaces (slow) */
+ u_long Util_local_ip_address(void);
-/* Function to get the current time in seconds */
-long Util_time_now(void);
+ /* Function to get the current time in seconds */
+ long Util_time_now(void);
-/* Function to determine how long the agent has been running
- * (WARNING: this seems rather slow) */
-long Util_time_running();
+ /* Function to determine how long the agent has been running
+ * (WARNING: this seems rather slow) */
+ long Util_time_running();
-/* Read data from file */
-int Util_file_read(char *file, int offset, char *data, int dataSz);
+ /* Read data from file */
+ int Util_file_read(char *file, int offset, char *data, int dataSz);
-/* Write data into file */
-int Util_file_write(char *file, int offset, char *data, int dataSz);
+ /* Write data into file */
+ int Util_file_write(char *file, int offset, char *data, int dataSz);
-/* ---------------------------------------------------------------------- */
+ /* ---------------------------------------------------------------------- */
#ifdef __cplusplus
}
/**********************************************************************
*
* Copyright 1997 by Carnegie Mellon University
- *
+ *
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* supporting documentation, and that the name of CMU not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
- *
+ *
* CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
- *
+ *
* Author: Ryan Troll <ryan+@andrew.cmu.edu>
- *
+ *
* $Id: snmp_vars.h,v 1.14 2007/12/14 23:11:44 amosjeffries Exp $
- *
+ *
**********************************************************************/
#include "asn1.h"
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-struct variable_list {
- struct variable_list *next_variable; /* NULL for last variable */
- oid *name; /* Object identifier of variable */
- int name_length; /* number of subid's in name */
- u_char type; /* ASN type of variable */
- union { /* value of variable */
- int *integer;
- u_char *string;
- oid *objid;
- } val;
- int val_len;
-};
-
-struct variable_list *snmp_var_new(oid *, int);
-struct variable_list *snmp_var_new_integer(oid *, int, int, unsigned char);
-struct variable_list *snmp_var_clone(struct variable_list *);
-void snmp_var_free(struct variable_list *);
-
-u_char *snmp_var_EncodeVarBind(u_char *, int *, struct variable_list *, int);
-u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int);
+ struct variable_list {
+ struct variable_list *next_variable; /* NULL for last variable */
+ oid *name; /* Object identifier of variable */
+ int name_length; /* number of subid's in name */
+ u_char type; /* ASN type of variable */
+ union { /* value of variable */
+ int *integer;
+ u_char *string;
+ oid *objid;
+ } val;
+ int val_len;
+ };
+
+ struct variable_list *snmp_var_new(oid *, int);
+ struct variable_list *snmp_var_new_integer(oid *, int, int, unsigned char);
+ struct variable_list *snmp_var_clone(struct variable_list *);
+ void snmp_var_free(struct variable_list *);
+
+ u_char *snmp_var_EncodeVarBind(u_char *, int *, struct variable_list *, int);
+ u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int);
#define MAX_NAME_LEN 64 /* number of subid's in a objid */
-/* RFC 1902: Structure of Management Information for SNMPv2
- *
- * Defined Types
- */
+ /* RFC 1902: Structure of Management Information for SNMPv2
+ *
+ * Defined Types
+ */
#define SMI_INTEGER ASN_INTEGER
#define SMI_STRING ASN_OCTET_STR
#define SMI_OBJID ASN_OBJECT_ID
#define SMI_COUNTER64 (ASN_APPLICATION | 6) /* INTEGER */
-/* constants for enums for the MIB nodes
- * cachePeerAddressType (InetAddressType / ASN_INTEGER)
- * cacheClientAddressType (InetAddressType / ASN_INTEGER)
- * Defined Types
- */
+ /* constants for enums for the MIB nodes
+ * cachePeerAddressType (InetAddressType / ASN_INTEGER)
+ * cacheClientAddressType (InetAddressType / ASN_INTEGER)
+ * Defined Types
+ */
#ifndef INETADDRESSTYPE_ENUMS
#define INETADDRESSTYPE_ENUMS
#endif /* INETADDRESSTYPE_ENUMS */
-/*
- * RFC 1905: Protocol Operations for SNMPv2
- *
- * Variable binding.
- *
- * VarBind ::=
- * SEQUENCE {
- * name ObjectName
- * CHOICE {
- * value ObjectSyntax
- * unSpecified NULL
- * noSuchObject[0] NULL
- * noSuchInstance[1] NULL
- * endOfMibView[2] NULL
- * }
- * }
- */
+ /*
+ * RFC 1905: Protocol Operations for SNMPv2
+ *
+ * Variable binding.
+ *
+ * VarBind ::=
+ * SEQUENCE {
+ * name ObjectName
+ * CHOICE {
+ * value ObjectSyntax
+ * unSpecified NULL
+ * noSuchObject[0] NULL
+ * noSuchInstance[1] NULL
+ * endOfMibView[2] NULL
+ * }
+ * }
+ */
#define SMI_NOSUCHOBJECT (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* noSuchObject[0] */
#define SMI_NOSUCHINSTANCE (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* noSuchInstance[1] */
#define SMI_ENDOFMIBVIEW (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* endOfMibView[2] */
-typedef struct variable variable;
-typedef struct variable_list variable_list;
+ typedef struct variable variable;
+ typedef struct variable_list variable_list;
#ifdef __cplusplus
}
SplayNode<V> const * finish() const;
SplayNode<V> * remove
- (const Value data, SPLAYCMP * compare);
+ (const Value data, SPLAYCMP * compare);
SplayNode<V> * insert(Value data, SPLAYCMP * compare);
typedef void SPLAYFREE(Value &);
typedef SplayIterator<V> iterator;
typedef const SplayConstIterator<V> const_iterator;
- Splay():head(NULL), elements (0){}
+ Splay():head(NULL), elements (0) {}
mutable SplayNode<V> * head;
template <class FindValue> Value const *find (FindValue const &, int( * compare)(FindValue const &a, Value const &b)) const;
void insert(Value const &, SPLAYCMP *compare);
void remove
- (Value const &, SPLAYCMP *compare);
+ (Value const &, SPLAYCMP *compare);
void destroy(SPLAYFREE *);
template<class V>
SplayNode<V> *
SplayNode<V>::remove
- (Value const dataToRemove, SPLAYCMP * compare)
+(Value const dataToRemove, SPLAYCMP * compare)
{
if (this == NULL)
return NULL;
template <class V>
void
Splay<V>::remove
- (Value const &value, SPLAYCMP *compare)
+(Value const &value, SPLAYCMP *compare)
{
assert (find (value, compare));
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_ENDIAN_H
/*
* Some systems define bswap_16() and bswap_32() in <byteswap.h>
*
- * Some systems define bswap16() and bswap32() in <sys/bswap.h>.
+ * Some systems define bswap16() and bswap32() in <sys/bswap.h>.
*
* Some systems define htobe16()/be16toh() and friends in <sys/endian.h>.
*/
# define le16toh(x) bswap16(x)
# define le32toh(x) bswap32(x)
# else /* ! WORDS_BIGENDIAN */
- /*
- * XXX: What about unusual byte orders like 3412 or 2143 ?
- * Nothing else in squid seems to care about them,
- * so we don't worry about them here either.
- */
+/*
+* XXX: What about unusual byte orders like 3412 or 2143 ?
+* Nothing else in squid seems to care about them,
+* so we don't worry about them here either.
+*/
# define htole16(x) (x)
# define htole32(x) (x)
# define le16toh(x) (x)
# define le32toh(x) (x)
# endif /* ! WORDS_BIGENDIAN */
#endif /* ! HAVE_HTOLE16 && ! defined(htole16) */
-
+
#endif /* SQUID_ENDIAN_H */
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
};
struct statfs {
- long f_type; /* type of filesystem (see below) */
- long f_bsize; /* optimal transfer block size */
- long f_blocks; /* total data blocks in file system */
- long f_bfree; /* free blocks in fs */
- long f_bavail; /* free blocks avail to non-superuser */
- long f_files; /* total file nodes in file system */
- long f_ffree; /* free file nodes in fs */
- long f_fsid; /* file system id */
- long f_namelen; /* maximum length of filenames */
- long f_spare[6]; /* spare for later */
+ long f_type; /* type of filesystem (see below) */
+ long f_bsize; /* optimal transfer block size */
+ long f_blocks; /* total data blocks in file system */
+ long f_bfree; /* free blocks in fs */
+ long f_bavail; /* free blocks avail to non-superuser */
+ long f_files; /* total file nodes in file system */
+ long f_ffree; /* free file nodes in fs */
+ long f_fsid; /* file system id */
+ long f_namelen; /* maximum length of filenames */
+ long f_spare[6]; /* spare for later */
};
#ifndef HAVE_GETTIMEOFDAY
-struct timezone
- {
+struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
- };
+};
#endif
#define CHANGE_FD_SETSIZE 1
#undef FD_READ
#undef FD_WRITE
#define EISCONN WSAEISCONN
-#define EINPROGRESS WSAEINPROGRESS
+#define EINPROGRESS WSAEINPROGRESS
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EALREADY WSAEALREADY
#define ETIMEDOUT WSAETIMEDOUT
/* internal to Microsoft CRTLIB */
typedef struct {
- long osfhnd; /* underlying OS file HANDLE */
- char osfile; /* attributes of file (e.g., open in text mode?) */
- char pipech; /* one char buffer for handles opened on pipes */
+ long osfhnd; /* underlying OS file HANDLE */
+ char osfile; /* attributes of file (e.g., open in text mode?) */
+ char pipech; /* one char buffer for handles opened on pipes */
#ifdef _MT
- int lockinitflag;
- CRITICAL_SECTION lock;
+ int lockinitflag;
+ CRITICAL_SECTION lock;
#endif /* _MT */
- } ioinfo;
+} ioinfo;
#define IOINFO_L2E 5
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
#define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1)) )
int l_so_type_siz = sizeof(l_so_type);
SOCKET sock = _get_osfhandle(fd);
- if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0){
+ if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0) {
int result = 0;
- if (closesocket(sock) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- result = 1;
- }
- _free_osfhnd(fd);
- _osfile(fd) = 0;
- return result;
- }
- else
- return _close(fd);
+ if (closesocket(sock) == SOCKET_ERROR) {
+ errno = WSAGetLastError();
+ result = 1;
+ }
+ _free_osfhnd(fd);
+ _osfile(fd) = 0;
+ return result;
+ } else
+ return _close(fd);
}
#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
SOCKET sock = _get_osfhandle(fd);
if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0)
- return ::recv(sock, (char FAR *) buf, (int)siz, 0);
+ return ::recv(sock, (char FAR *) buf, (int)siz, 0);
else
- return _read(fd, buf, (unsigned int)siz);
+ return _read(fd, buf, (unsigned int)siz);
}
inline
SOCKET sock = _get_osfhandle(fd);
if (::getsockopt(sock, SOL_SOCKET, SO_TYPE, l_so_type, &l_so_type_siz) == 0)
- return ::send(sock, (char FAR *) buf, siz, 0);
+ return ::send(sock, (char FAR *) buf, siz, 0);
else
- return _write(fd, buf, siz);
+ return _write(fd, buf, siz);
}
-inline
+inline
char *index(const char *s, int c)
{
return (char *)strchr(s,c);
}
/** \cond AUTODOCS-IGNORE */
-namespace Squid {
+namespace Squid
+{
/** \endcond */
inline
{
SOCKET result;
if ((result = ::accept(_get_osfhandle(s), a, (int *)l)) == INVALID_SOCKET) {
- if (WSAEMFILE == (errno = WSAGetLastError()))
- errno = EMFILE;
- return -1;
- }
- else
- return _open_osfhandle(result, 0);
+ if (WSAEMFILE == (errno = WSAGetLastError()))
+ errno = EMFILE;
+ return -1;
+ } else
+ return _open_osfhandle(result, 0);
}
inline
int bind(int s, struct sockaddr * n, int l)
{
if (::bind(_get_osfhandle(s),n,l) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
inline
int connect(int s, const struct sockaddr * n, int l)
{
if (::connect(_get_osfhandle(s),n,l) == SOCKET_ERROR) {
- if (WSAEMFILE == (errno = WSAGetLastError()))
- errno = EMFILE;
- return -1;
- }
- else
- return 0;
+ if (WSAEMFILE == (errno = WSAGetLastError()))
+ errno = EMFILE;
+ return -1;
+ } else
+ return 0;
}
-inline
-struct hostent * gethostbyname (const char *n)
-{
- HOSTENT FAR * result;
+inline
+struct hostent * gethostbyname (const char *n) {
+ HOSTENT FAR * result;
if ((result = ::gethostbyname(n)) == NULL)
- errno = WSAGetLastError();
+ errno = WSAGetLastError();
return result;
}
#define gethostbyname(n) Squid::gethostbyname(n)
{
SERVENT FAR * result;
if ((result = ::getservbyname(n, p)) == NULL)
- errno = WSAGetLastError();
+ errno = WSAGetLastError();
return result;
}
#define getservbyname(n,p) Squid::getservbyname(n,p)
{
HOSTENT FAR * result;
if ((result = ::gethostbyaddr(a, l, t)) == NULL)
- errno = WSAGetLastError();
+ errno = WSAGetLastError();
return result;
}
#define gethostbyaddr(a,l,t) Squid::gethostbyaddr(a,l,t)
int getsockname(int s, struct sockaddr * n, size_t * l)
{
if ((::getsockname(_get_osfhandle(s), n, (int *)l)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
inline
int gethostname(char * n, size_t l)
{
if ((::gethostname(n, l)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
#define gethostname(n,l) Squid::gethostname(n,l)
{
Sleep(1);
if ((::getsockopt(_get_osfhandle(s), l, o,(char *) v, n)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
/* Simple ioctl() emulation */
int ioctl(int s, int c, void * a)
{
if ((::ioctlsocket(_get_osfhandle(s), c, (u_long FAR *)a)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
inline
int ioctlsocket(int s, long c, u_long FAR * a)
{
if ((::ioctlsocket(_get_osfhandle(s), c, a)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
inline
int listen(int s, int b)
{
if (::listen(_get_osfhandle(s), b) == SOCKET_ERROR) {
- if (WSAEMFILE == (errno = WSAGetLastError()))
- errno = EMFILE;
- return -1;
- }
- else
- return 0;
+ if (WSAEMFILE == (errno = WSAGetLastError()))
+ errno = EMFILE;
+ return -1;
+ } else
+ return 0;
}
#define listen(s,b) Squid::listen(s,b)
{
int result;
if ((result = ::recv(_get_osfhandle(s), (char *)b, l, f)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
+ errno = WSAGetLastError();
return -1;
- }
- else
+ } else
return result;
}
{
int result;
if ((result = ::recvfrom(_get_osfhandle(s), (char *)b, l, f, fr, (int *)fl)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
+ errno = WSAGetLastError();
+ return -1;
+ } else
return result;
}
{
int result;
if ((result = ::select(n,r,w,e,t)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
+ errno = WSAGetLastError();
+ return -1;
+ } else
return result;
}
#define select(n,r,w,e,t) Squid::select(n,r,w,e,t)
{
int result;
if ((result = ::send(_get_osfhandle(s), (char *)b, l, f)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
+ errno = WSAGetLastError();
+ return -1;
+ } else
return result;
}
{
int result;
if ((result = ::sendto(_get_osfhandle(s), (char *)b, l, f, t, tl)) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
+ errno = WSAGetLastError();
+ return -1;
+ } else
return result;
}
if (::setsockopt(socket, l, o, v, n) == SOCKET_ERROR) {
errno = WSAGetLastError();
return -1;
- }
- else
+ } else
return 0;
}
#define setsockopt(s,l,o,v,n) Squid::setsockopt(s,l,o,v,n)
int shutdown(int s, int h)
{
if (::shutdown(_get_osfhandle(s),h) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
- return 0;
+ errno = WSAGetLastError();
+ return -1;
+ } else
+ return 0;
}
inline
{
SOCKET result;
if ((result = ::socket(f, t, p)) == INVALID_SOCKET) {
- if (WSAEMFILE == (errno = WSAGetLastError()))
- errno = EMFILE;
- return -1;
- }
- else
- return _open_osfhandle(result, 0);
+ if (WSAEMFILE == (errno = WSAGetLastError()))
+ errno = EMFILE;
+ return -1;
+ } else
+ return _open_osfhandle(result, 0);
}
#define socket(f,t,p) Squid::socket(f,t,p)
int WSAAsyncSelect(int s, HWND h, unsigned int w, long e)
{
if (::WSAAsyncSelect(_get_osfhandle(s), h, w, e) == SOCKET_ERROR) {
- errno = WSAGetLastError();
- return -1;
- }
- else
+ errno = WSAGetLastError();
+ return -1;
+ } else
return 0;
}
#else
if (::WSADuplicateSocketA(_get_osfhandle(s), n, l) == SOCKET_ERROR) {
#endif
- errno = WSAGetLastError();
- return -1;
- }
- else
+ errno = WSAGetLastError();
+ return -1;
+ } else
return 0;
}
#undef WSASocket
inline
-int WSASocket(int a, int t, int p, LPWSAPROTOCOL_INFO i, GROUP g, DWORD f)
-{
+int WSASocket(int a, int t, int p, LPWSAPROTOCOL_INFO i, GROUP g, DWORD f) {
SOCKET result;
#ifdef UNICODE
if ((result = ::WSASocketW(a, t, p, i, g, f)) == INVALID_SOCKET) {
#else
if ((result = ::WSASocketA(a, t, p, i, g, f)) == INVALID_SOCKET) {
#endif
- if (WSAEMFILE == (errno = WSAGetLastError()))
- errno = EMFILE;
- return -1;
- }
- else
- return _open_osfhandle(result, 0);
+ if (WSAEMFILE == (errno = WSAGetLastError()))
+ errno = EMFILE;
+ return -1;
+ } else
+ return _open_osfhandle(result, 0);
}
} /* namespace Squid */
#define RUSAGE_CHILDREN -1 /* terminated child processes */
struct rusage {
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
- long ru_maxrss; /* integral max resident set size */
- long ru_ixrss; /* integral shared text memory size */
- long ru_idrss; /* integral unshared data size */
- long ru_isrss; /* integral unshared stack size */
- long ru_minflt; /* page reclaims */
- long ru_majflt; /* page faults */
- long ru_nswap; /* swaps */
- long ru_inblock; /* block input operations */
- long ru_oublock; /* block output operations */
- long ru_msgsnd; /* messages sent */
- long ru_msgrcv; /* messages received */
- long ru_nsignals; /* signals received */
- long ru_nvcsw; /* voluntary context switches */
- long ru_nivcsw; /* involuntary context switches */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
+ long ru_maxrss; /* integral max resident set size */
+ long ru_ixrss; /* integral shared text memory size */
+ long ru_idrss; /* integral unshared data size */
+ long ru_isrss; /* integral unshared stack size */
+ long ru_minflt; /* page reclaims */
+ long ru_majflt; /* page faults */
+ long ru_nswap; /* swaps */
+ long ru_inblock; /* block input operations */
+ long ru_oublock; /* block output operations */
+ long ru_msgsnd; /* messages sent */
+ long ru_msgrcv; /* messages received */
+ long ru_nsignals; /* signals received */
+ long ru_nvcsw; /* voluntary context switches */
+ long ru_nivcsw; /* involuntary context switches */
};
#undef ACL
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* SQUID Web Proxy Cache http://www.squid-cache.org/
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
#include <netinet/in_systm.h>
#endif
-/*
+/*
* ISO C99 Standard printf() macros for 64 bit integers
* On some 64 bit platform, HP Tru64 is one, for printf must be used
- * "%lx" instead of "%llx"
+ * "%lx" instead of "%llx"
*/
#ifndef PRId64
#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
/**
\par
- Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
- If one is found, it is overwritten with a NULL, and *STRINGP is advanced
- to point to the next char after it. Otherwise, *STRINGP is set to NULL.
- If *STRINGP was already NULL, nothing happens.
- Returns the old value of *STRINGP.
+Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
+If one is found, it is overwritten with a NULL, and *STRINGP is advanced
+to point to the next char after it. Otherwise, *STRINGP is set to NULL.
+If *STRINGP was already NULL, nothing happens.
+Returns the old value of *STRINGP.
\par
- This is a variant of strtok() that is multithread-safe and supports
- empty fields.
+This is a variant of strtok() that is multithread-safe and supports
+empty fields.
\note Caveat: It modifies the original string.
\note Caveat: These functions cannot be used on constant strings.
\note Caveat: The identity of the delimiting character is lost.
\note Caveat: It doesn't work with multibyte strings unless all of the delimiter
- characters are ASCII characters < 0x30.
+characters are ASCII characters < 0x30.
- See also strtok_r().
- */
+See also strtok_r().
+*/
SQUIDCEXTERN char *strsep(char **stringp, const char *delim);
#endif /* HAVE_STRSEP */
#else
/**
- \par
- * Convert a string to a int64 integer.
- \par
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
+\par
+* Convert a string to a int64 integer.
+\par
+* Ignores `locale' stuff. Assumes that the upper and lower case
+* alphabets and digits are each contiguous.
+*/
SQUIDCEXTERN int64_t strtoll(const char *nptr, char **endptr, int base);
#endif /* !HAVE_STRTOLL */
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* The GNU C Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with the GNU C Library; see the file COPYING.LIB. If
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
+ *
*/
#ifndef SQUID_UTIL_H
SQUIDCEXTERN void xfree(void *);
SQUIDCEXTERN void xxfree(const void *);
#ifdef __cplusplus
-/*
+/*
* Any code using libstdc++ must have externally resolvable overloads
* for void * operator new - which means in the .o for the binary,
* or in a shared library. static libs don't propogate the symbol
*/
#ifndef _SQUID_EXTERNNEW_
#if defined(_SQUID_SGI_) && !defined(_GNUC_)
-/*
+/*
* The gcc compiler treats extern inline functions as being extern,
* while the SGI MIPSpro compilers treat them as inline. To get equivalent
* behavior, remove the inline keyword.