From: Amos Jeffries Date: Mon, 29 Sep 2008 09:56:06 +0000 (+1300) Subject: SourceFormat: include/ X-Git-Tag: SQUID_3_1_0_1~45^2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5dd4956c5bf287c30dcb178b7d8a451de7c6560;p=thirdparty%2Fsquid.git SourceFormat: include/ --- diff --git a/include/Array.h b/include/Array.h index 3c265840d2..6f4745c5c5 100644 --- a/include/Array.h +++ b/include/Array.h @@ -19,16 +19,16 @@ * 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 @@ -58,13 +58,11 @@ public: 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]; } @@ -254,11 +252,11 @@ Vector::prune(E item) { 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; diff --git a/include/CbDataList.h b/include/CbDataList.h index 0aa43dba40..79dcfef618 100644 --- a/include/CbDataList.h +++ b/include/CbDataList.h @@ -18,12 +18,12 @@ * 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. @@ -79,13 +79,13 @@ class CbDataListIterator public: CbDataListIterator(CbDataListContainer const &list) : next_entry(list.head) {} const C & next() { - CbDataList *entry = next_entry; - if (entry) - next_entry = entry->next; - return entry->element; + CbDataList *entry = next_entry; + if (entry) + next_entry = entry->next; + return entry->element; } bool end() { - return next_entry == NULL; + return next_entry == NULL; } private: @@ -148,7 +148,7 @@ CbDataList::findAndTune(C const & toFind) CbDataList *prev = NULL; for (CbDataList *node = this; node; node = node-> - next) { + next) { if (node->element == toFind) { if (prev != NULL) { /* shift the element just found to the second position diff --git a/include/GNUregex.h b/include/GNUregex.h index 2b890fbbac..f04a019dd8 100644 --- a/include/GNUregex.h +++ b/include/GNUregex.h @@ -8,19 +8,19 @@ /* 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. */ @@ -47,7 +47,7 @@ typedef unsigned reg_syntax_t; #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) @@ -63,8 +63,8 @@ typedef unsigned reg_syntax_t; * ^ 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 @@ -74,7 +74,7 @@ typedef unsigned reg_syntax_t; /* 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) @@ -96,7 +96,7 @@ typedef unsigned reg_syntax_t; #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) @@ -121,7 +121,7 @@ typedef unsigned reg_syntax_t; * If not set, then \ 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) @@ -275,7 +275,7 @@ typedef enum { * 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. */ @@ -338,7 +338,7 @@ struct re_pattern_buffer { /* 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; @@ -399,10 +399,10 @@ typedef struct { 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 */ diff --git a/include/IPAddress.h b/include/IPAddress.h index ce88e33321..6152c68b12 100644 --- a/include/IPAddress.h +++ b/include/IPAddress.h @@ -420,7 +420,7 @@ class IPAddress_list { 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; diff --git a/include/MemPool.h b/include/MemPool.h index 90a998d95f..95b773b9c8 100644 --- a/include/MemPool.h +++ b/include/MemPool.h @@ -74,7 +74,7 @@ typedef struct _MemPoolGlobalStats MemPoolGlobalStats; /// \ingroup MemPoolsAPI class MemPoolIterator { - public: +public: MemImplementingAllocator *pool; MemPoolIterator * next; }; @@ -85,8 +85,8 @@ class MemPoolIterator */ class mgb_t { - public: - mgb_t() : count(0), bytes(0){} +public: + mgb_t() : count(0), bytes(0) {} double count; double bytes; }; @@ -97,7 +97,7 @@ class mgb_t */ class MemPoolMeter { - public: +public: void flush(); MemMeter alloc; MemMeter inuse; @@ -116,9 +116,9 @@ class MemPoolMeter class MemImplementingAllocator; /// \ingroup MemPoolsAPI -class MemPools +class MemPools { - public: +public: static MemPools &GetInstance(); MemPools(); void init(); @@ -180,7 +180,7 @@ class MemPools int mem_idle_limit; int poolCount; bool defaultIsChunked; - private: +private: static MemPools *Instance; }; @@ -249,7 +249,7 @@ private: */ class MemAllocatorProxy { - public: +public: inline MemAllocatorProxy(char const *aLabel, size_t const &); /** @@ -273,7 +273,7 @@ class MemAllocatorProxy int getStats(MemPoolStats * stats); char const * objectType() const; - private: +private: MemAllocator *getAllocator() const; const char *label; size_t size; @@ -285,7 +285,7 @@ class MemAllocatorProxy /** \ingroup MemPoolsAPI \hideinitializer - * + * * This macro is intended for use within the declaration of a class. */ #define MEMPROXY_CLASS(CLASS) \ @@ -296,7 +296,7 @@ class MemAllocatorProxy /** \ingroup MemPoolsAPI \hideinitializer - * + * * This macro is intended for use within the .h or .cci of a class as appropriate. */ #define MEMPROXY_CLASS_INLINE(CLASS) \ @@ -324,7 +324,7 @@ CLASS::operator delete (void *address) \ /// \ingroup MemPoolsAPI class MemImplementingAllocator : public MemAllocator { - public: +public: MemImplementingAllocator(char const *aLabel, size_t aSize); virtual MemPoolMeter const &getMeter() const; virtual MemPoolMeter &getMeter(); @@ -347,14 +347,14 @@ class MemImplementingAllocator : public MemAllocator 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; @@ -363,7 +363,7 @@ class MemImplementingAllocator : public MemAllocator /// \ingroup MemPoolsAPI class MemPool : public MemImplementingAllocator { - public: +public: friend class MemChunk; MemPool(const char *label, size_t obj_size); ~MemPool(); @@ -380,10 +380,10 @@ class MemPool : public MemImplementingAllocator 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. @@ -413,7 +413,7 @@ class MemPool : public MemImplementingAllocator /// \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); @@ -425,17 +425,17 @@ class MemMalloc : public MemImplementingAllocator 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; @@ -450,7 +450,7 @@ class MemChunk /// \ingroup MemPoolsAPI class MemPoolStats { - public: +public: MemAllocator *pool; const char *label; MemPoolMeter *meter; @@ -472,8 +472,7 @@ class MemPoolStats /// \ingroup MemPoolsAPI /// \todo Classify and add constructor/destructor to initialize properly. -struct _MemPoolGlobalStats -{ +struct _MemPoolGlobalStats { MemPoolMeter *TheMeter; int tot_pools_alloc; diff --git a/include/Range.h b/include/Range.h index 2023bafff1..32405fa2de 100644 --- a/include/Range.h +++ b/include/Range.h @@ -19,12 +19,12 @@ * 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. @@ -49,7 +49,7 @@ public: Range (C start_, C end_); C start; C end; - Range intersection (Range const &) const; + Range intersection (Range const &) const; C size() const; }; diff --git a/include/RefCount.h b/include/RefCount.h index dd92597c55..03c737f9cc 100644 --- a/include/RefCount.h +++ b/include/RefCount.h @@ -21,12 +21,12 @@ * 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. @@ -48,18 +48,15 @@ public: 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_; @@ -68,7 +65,7 @@ public: return *this; } - bool operator !() const { return !p_; } + bool operator !() const { return !p_; } C const * operator-> () const {return p_; } @@ -82,19 +79,16 @@ public: C * getRaw() {return const_cast(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_; @@ -106,8 +100,7 @@ private: delete tempP_; } - void reference (const RefCount& p) - { + void reference (const RefCount& p) { if (p.p_) p.p_->RefCountReference(); } @@ -116,15 +109,13 @@ private: }; -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 @@ -132,8 +123,7 @@ struct RefCountable_ ++count_; } - unsigned RefCountDereference() const - { + unsigned RefCountDereference() const { #if REFCOUNT_DEBUG debug (0,1)("Decrementing this %p from count %u\n",this,count_); #endif diff --git a/include/SquidNew.h b/include/SquidNew.h index 5ddb2ee869..10da4ee510 100644 --- a/include/SquidNew.h +++ b/include/SquidNew.h @@ -19,16 +19,16 @@ * 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 diff --git a/include/Stack.h b/include/Stack.h index a4c8b9baf9..d54ed49f1d 100644 --- a/include/Stack.h +++ b/include/Stack.h @@ -19,16 +19,16 @@ * 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 @@ -49,8 +49,7 @@ public: using Vector::items; typedef typename Vector::value_type value_type; typedef typename Vector::pointer pointer; - value_type pop() - { + value_type pop() { if (!count) return value_type(); @@ -62,8 +61,7 @@ public: } /* todo, fatal on empty Top call */ - value_type top() const - { + value_type top() const { return count ? items[count - 1] : value_type(); } }; diff --git a/include/asn1.h b/include/asn1.h index 28187b767f..b1edf8f4a8 100644 --- a/include/asn1.h +++ b/include/asn1.h @@ -11,9 +11,9 @@ /********************************************************************** * * 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 @@ -21,7 +21,7 @@ * 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 @@ -29,9 +29,9 @@ * 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 @@ -69,7 +69,8 @@ typedef u_char oid; #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); diff --git a/include/assert.h b/include/assert.h index 30130239d1..bed2a99da5 100644 --- a/include/assert.h +++ b/include/assert.h @@ -19,12 +19,12 @@ * 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. diff --git a/include/cache_snmp.h b/include/cache_snmp.h index ac95622c15..f72b638b5e 100644 --- a/include/cache_snmp.h +++ b/include/cache_snmp.h @@ -54,7 +54,7 @@ #define SQ_MESH SQUIDMIB, 5 /* cacheMesh group { squid 5 } */ #define LEN_SQ_MESH LEN_SQUIDMIB+1 -/* +/* * cacheSystem group { squid 1 } */ @@ -69,7 +69,7 @@ enum { #define LEN_SYS LEN_SQ_SYS + 1 #define LEN_SYS_INST LEN_SQ_SYS + 2 -/* +/* * cacheConfig group { squid 2 } */ @@ -88,7 +88,7 @@ enum { #define LEN_CONF_INST LEN_SQ_CONF + 2 -/* +/* * cacheStorageConfig group { cacheConfig 5 } */ enum { @@ -103,7 +103,7 @@ enum { #define LEN_CONF_ST LEN_CONF + 1 #define LEN_CONF_ST_INST LEN_CONF + 2 -/* +/* * Cache Performance Group {squid 3} */ @@ -176,7 +176,7 @@ enum { 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 }; @@ -184,7 +184,7 @@ enum { -/* +/* * cacheNetwork group { squid 4 } */ @@ -198,7 +198,7 @@ enum { /* cacheIpCache */ enum { - IP_START, + IP_START, IP_ENT, /* cacheIpEntrie */ IP_REQ, /* cacheIpRequests */ IP_HITS, /* acheIpHits */ @@ -236,19 +236,19 @@ enum { -/* +/* * 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 */ @@ -269,7 +269,7 @@ enum { }; /* cacheClientEntry */ -enum { +enum { MESH_CTBL_START, MESH_CTBL_ADDR_TYPE, /* cacheClientAddressType */ MESH_CTBL_ADDR, /* cacheClientAddress */ diff --git a/include/config.h b/include/config.h index cd7fb1a037..8bfbe58ae3 100644 --- a/include/config.h +++ b/include/config.h @@ -19,16 +19,16 @@ * 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 @@ -132,10 +132,10 @@ #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 */ @@ -320,20 +320,20 @@ typedef long mtyp_t; #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 @@ -407,7 +407,7 @@ typedef union { /* 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))) diff --git a/include/getaddrinfo.h b/include/getaddrinfo.h index d5ac51adc0..628c401642 100644 --- a/include/getaddrinfo.h +++ b/include/getaddrinfo.h @@ -46,7 +46,7 @@ #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 @@ -54,11 +54,10 @@ #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 */ @@ -67,7 +66,7 @@ struct addrinfo 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 */ #define AI_PASSIVE 1 /* Socket address is intended for `bind'. */ @@ -102,7 +101,7 @@ struct addrinfo /* 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); diff --git a/include/getnameinfo.h b/include/getnameinfo.h index 71a386e742..53a07787b6 100644 --- a/include/getnameinfo.h +++ b/include/getnameinfo.h @@ -10,19 +10,19 @@ #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 */ diff --git a/include/heap.h b/include/heap.h index d5f23f516a..36efb22c3a 100644 --- a/include/heap.h +++ b/include/heap.h @@ -19,16 +19,16 @@ * 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. - * + * */ /**************************************************************************** @@ -88,12 +88,12 @@ typedef struct _heap { * 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! */ @@ -122,7 +122,7 @@ SQUIDCEXTERN heap_t heap_delete(heap *, heap_node * elm); */ 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 @@ -132,14 +132,14 @@ SQUIDCEXTERN heap_key heap_gen_key(heap * hp, heap_t dat); #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 @@ -148,7 +148,7 @@ SQUIDCEXTERN heap_t heap_extractmin(heap *); */ 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. */ @@ -158,8 +158,8 @@ SQUIDCEXTERN heap_key heap_peepkey(heap *, int n); 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 *); @@ -169,7 +169,7 @@ SQUIDCEXTERN int heap_nodes(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 *); diff --git a/include/inet_ntop.h b/include/inet_ntop.h index 5b18fb207c..a7bf206224 100644 --- a/include/inet_ntop.h +++ b/include/inet_ntop.h @@ -11,13 +11,13 @@ #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 diff --git a/include/inet_pton.h b/include/inet_pton.h index 1a7dbeee65..5c95540dfa 100644 --- a/include/inet_pton.h +++ b/include/inet_pton.h @@ -11,16 +11,16 @@ #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 diff --git a/include/memMeter.h b/include/memMeter.h index 2ef24733c3..1550ab5a72 100644 --- a/include/memMeter.h +++ b/include/memMeter.h @@ -7,8 +7,9 @@ #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 */ diff --git a/include/ntlmauth.h b/include/ntlmauth.h index 049c9057e5..b51beac51f 100644 --- a/include/ntlmauth.h +++ b/include/ntlmauth.h @@ -9,12 +9,12 @@ * 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/ @@ -33,12 +33,12 @@ * 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. @@ -156,10 +156,10 @@ typedef struct _ntlm_authenticate { } 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 */ diff --git a/include/parse.h b/include/parse.h index 63e13263fc..80dd242525 100644 --- a/include/parse.h +++ b/include/parse.h @@ -9,13 +9,13 @@ 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 @@ -67,7 +67,8 @@ struct snmp_mib_tree { #define TYPE_NULL 10 #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif void init_mib(char *); @@ -79,9 +80,9 @@ extern "C" { 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 *); diff --git a/include/profiling.h b/include/profiling.h index c6ab231361..49768f0bf9 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -37,7 +37,7 @@ get_tick(void) 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; } @@ -185,8 +185,7 @@ typedef struct _xprof_stats_node xprof_stats_node; 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; @@ -197,8 +196,7 @@ struct _xprof_stats_data int64_t summ; }; -struct _xprof_stats_node -{ +struct _xprof_stats_node { const char *name; xprof_stats_data accu; xprof_stats_data hist; diff --git a/include/radix.h b/include/radix.h index e74131e9a0..060150f171 100644 --- a/include/radix.h +++ b/include/radix.h @@ -46,8 +46,7 @@ * 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 */ @@ -93,8 +92,7 @@ struct squid_radix_node * 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 */ @@ -108,8 +106,7 @@ struct squid_radix_mask 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 */ diff --git a/include/rfc1035.h b/include/rfc1035.h index 1f5d1a9eb2..3a8119e135 100644 --- a/include/rfc1035.h +++ b/include/rfc1035.h @@ -19,16 +19,16 @@ * 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 @@ -94,19 +94,19 @@ struct _rfc1035_message { }; 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); @@ -119,18 +119,18 @@ SQUIDCEXTERN const char *rfc1035_error_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 */ diff --git a/include/rfc2181.h b/include/rfc2181.h index e1662ef810..d5c7e1b6a2 100644 --- a/include/rfc2181.h +++ b/include/rfc2181.h @@ -21,7 +21,7 @@ */ #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 */ diff --git a/include/rfc2617.h b/include/rfc2617.h index f52156c5f1..e44e3126cc 100644 --- a/include/rfc2617.h +++ b/include/rfc2617.h @@ -5,7 +5,7 @@ * 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 diff --git a/include/rfc3596.h b/include/rfc3596.h index e5df130411..94125ecdd2 100644 --- a/include/rfc3596.h +++ b/include/rfc3596.h @@ -23,16 +23,16 @@ * 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 diff --git a/include/snmp-internal.h b/include/snmp-internal.h index 020342f6d6..f3891edecf 100644 --- a/include/snmp-internal.h +++ b/include/snmp-internal.h @@ -5,9 +5,9 @@ /********************************************************************** * * 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 @@ -15,7 +15,7 @@ * 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 @@ -23,9 +23,9 @@ * 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 diff --git a/include/snmp-mib.h b/include/snmp-mib.h index 33e56ca04e..eeabf39e00 100644 --- a/include/snmp-mib.h +++ b/include/snmp-mib.h @@ -5,9 +5,9 @@ /*************************************************************************** * * 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 @@ -15,7 +15,7 @@ * 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 @@ -23,11 +23,11 @@ * 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 - * + * * $Id: snmp-mib.h,v 1.4 2003/01/23 00:36:47 robertc Exp $ - * + * ***************************************************************************/ #include /* Need OID Definition */ diff --git a/include/snmp.h b/include/snmp.h index 2dc9732227..33b2578b26 100644 --- a/include/snmp.h +++ b/include/snmp.h @@ -8,9 +8,9 @@ /********************************************************************** * * 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 @@ -18,7 +18,7 @@ * 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 @@ -26,9 +26,9 @@ * 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 diff --git a/include/snmp_api.h b/include/snmp_api.h index 80caab04bc..3df9d406c1 100644 --- a/include/snmp_api.h +++ b/include/snmp_api.h @@ -15,13 +15,13 @@ 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 @@ -52,7 +52,8 @@ SOFTWARE. #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. @@ -60,122 +61,122 @@ extern "C" { * 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: + */ diff --git a/include/snmp_api_error.h b/include/snmp_api_error.h index 3fbd14073b..a138bd8ed8 100644 --- a/include/snmp_api_error.h +++ b/include/snmp_api_error.h @@ -5,9 +5,9 @@ /*************************************************************************** * * 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 @@ -15,7 +15,7 @@ * 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 @@ -23,11 +23,11 @@ * 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 - * + * * $Id: snmp_api_error.h,v 1.5 2003/01/23 00:36:47 robertc Exp $ - * + * ***************************************************************************/ /* Error return values */ @@ -52,10 +52,11 @@ #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); diff --git a/include/snmp_api_util.h b/include/snmp_api_util.h index c761f7aaff..8c0223af6a 100644 --- a/include/snmp_api_util.h +++ b/include/snmp_api_util.h @@ -12,13 +12,13 @@ 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 @@ -85,7 +85,8 @@ struct snmp_internal_session { #endif /* HAVE_SRAND */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif int snmp_get_socket_session(struct snmp_session *session_); diff --git a/include/snmp_client.h b/include/snmp_client.h index 3158e34931..73836fc09d 100644 --- a/include/snmp_client.h +++ b/include/snmp_client.h @@ -13,13 +13,13 @@ 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 @@ -32,7 +32,7 @@ SOFTWARE. struct synch_state { int waiting; int status; -/* status codes */ + /* status codes */ #define STAT_SUCCESS 0 #define STAT_ERROR 1 #define STAT_TIMEOUT 2 @@ -41,20 +41,21 @@ struct synch_state { }; #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 diff --git a/include/snmp_coexist.h b/include/snmp_coexist.h index 4095345fa5..562a174ca2 100644 --- a/include/snmp_coexist.h +++ b/include/snmp_coexist.h @@ -5,9 +5,9 @@ /********************************************************************** * * 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 @@ -15,7 +15,7 @@ * 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 @@ -23,15 +23,16 @@ * 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 - * + * * $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 *); diff --git a/include/snmp_error.h b/include/snmp_error.h index 03c5c51b18..5447fed228 100644 --- a/include/snmp_error.h +++ b/include/snmp_error.h @@ -5,9 +5,9 @@ /********************************************************************** * * 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 @@ -15,7 +15,7 @@ * 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 @@ -23,9 +23,9 @@ * 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 $ - * + * **********************************************************************/ /* @@ -56,7 +56,8 @@ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif const char *snmp_errstring(int); diff --git a/include/snmp_impl.h b/include/snmp_impl.h index 83ff0f1003..a91f29187d 100644 --- a/include/snmp_impl.h +++ b/include/snmp_impl.h @@ -16,13 +16,13 @@ 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 diff --git a/include/snmp_msg.h b/include/snmp_msg.h index 42900372ab..d6be7c1897 100644 --- a/include/snmp_msg.h +++ b/include/snmp_msg.h @@ -7,9 +7,9 @@ /********************************************************************** * * 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 @@ -17,7 +17,7 @@ * 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 @@ -25,22 +25,23 @@ * 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 - * + * * $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 } diff --git a/include/snmp_pdu.h b/include/snmp_pdu.h index ffab5b8e0a..ceb181ed93 100644 --- a/include/snmp_pdu.h +++ b/include/snmp_pdu.h @@ -13,9 +13,9 @@ /********************************************************************** * * 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 @@ -23,7 +23,7 @@ * 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 @@ -31,62 +31,63 @@ * 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 - * + * * $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) @@ -106,12 +107,12 @@ void snmp_add_null_var(struct snmp_pdu *, oid *, int); #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) diff --git a/include/snmp_session.h b/include/snmp_session.h index c8d77250bc..b6d1805eb7 100644 --- a/include/snmp_session.h +++ b/include/snmp_session.h @@ -7,9 +7,9 @@ /********************************************************************** * * 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 @@ -17,7 +17,7 @@ * 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 @@ -25,9 +25,9 @@ * 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 { diff --git a/include/snmp_util.h b/include/snmp_util.h index dc0fec111e..28432e20cb 100644 --- a/include/snmp_util.h +++ b/include/snmp_util.h @@ -7,50 +7,51 @@ #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 } diff --git a/include/snmp_vars.h b/include/snmp_vars.h index c2ad04dd95..4ccfcea231 100644 --- a/include/snmp_vars.h +++ b/include/snmp_vars.h @@ -4,9 +4,9 @@ /********************************************************************** * * 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 @@ -14,7 +14,7 @@ * 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 @@ -22,46 +22,47 @@ * 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 - * + * * $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 @@ -75,11 +76,11 @@ u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int); #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 @@ -94,28 +95,28 @@ u_char *snmp_var_DecodeVarBind(u_char *, int *, struct variable_list **, int); #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 } diff --git a/include/splay.h b/include/splay.h index cca55b3331..ec8e80375d 100644 --- a/include/splay.h +++ b/include/splay.h @@ -33,7 +33,7 @@ public: SplayNode const * finish() const; SplayNode * remove - (const Value data, SPLAYCMP * compare); + (const Value data, SPLAYCMP * compare); SplayNode * insert(Value data, SPLAYCMP * compare); @@ -61,14 +61,14 @@ public: typedef void SPLAYFREE(Value &); typedef SplayIterator iterator; typedef const SplayConstIterator const_iterator; - Splay():head(NULL), elements (0){} + Splay():head(NULL), elements (0) {} mutable SplayNode * head; template 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 *); @@ -159,7 +159,7 @@ SplayNode::destroy(SPLAYFREE * free_func) template SplayNode * SplayNode::remove - (Value const dataToRemove, SPLAYCMP * compare) +(Value const dataToRemove, SPLAYCMP * compare) { if (this == NULL) return NULL; @@ -312,7 +312,7 @@ Splay::insert(Value const &value, SPLAYCMP *compare) template void Splay::remove - (Value const &value, SPLAYCMP *compare) +(Value const &value, SPLAYCMP *compare) { assert (find (value, compare)); diff --git a/include/squid_endian.h b/include/squid_endian.h index 05c46c3801..a6f0b899f6 100644 --- a/include/squid_endian.h +++ b/include/squid_endian.h @@ -19,16 +19,16 @@ * 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 @@ -61,7 +61,7 @@ /* * Some systems define bswap_16() and bswap_32() in * - * Some systems define bswap16() and bswap32() in . + * Some systems define bswap16() and bswap32() in . * * Some systems define htobe16()/be16toh() and friends in . */ @@ -139,16 +139,16 @@ # 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 */ diff --git a/include/squid_mswin.h b/include/squid_mswin.h index b035499e8c..abae268fb5 100644 --- a/include/squid_mswin.h +++ b/include/squid_mswin.h @@ -20,12 +20,12 @@ * 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. @@ -188,24 +188,23 @@ struct group { }; 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 @@ -245,7 +244,7 @@ typedef char * caddr_t; #undef FD_READ #undef FD_WRITE #define EISCONN WSAEISCONN -#define EINPROGRESS WSAEINPROGRESS +#define EINPROGRESS WSAEINPROGRESS #define EWOULDBLOCK WSAEWOULDBLOCK #define EALREADY WSAEALREADY #define ETIMEDOUT WSAETIMEDOUT @@ -297,14 +296,14 @@ typedef char * caddr_t; /* 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)) ) @@ -337,18 +336,17 @@ int close(int fd) 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 */ @@ -376,9 +374,9 @@ int read(int fd, void * buf, size_t siz) 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 @@ -389,19 +387,20 @@ int write(int fd, const void * buf, size_t siz) 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 @@ -409,43 +408,39 @@ int accept(int s, struct sockaddr * a, size_t * l) { 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) @@ -455,7 +450,7 @@ SERVENT FAR* getservbyname (const char * n, const char * p) { SERVENT FAR * result; if ((result = ::getservbyname(n, p)) == NULL) - errno = WSAGetLastError(); + errno = WSAGetLastError(); return result; } #define getservbyname(n,p) Squid::getservbyname(n,p) @@ -465,7 +460,7 @@ HOSTENT FAR * gethostbyaddr(const char * a, int l, int t) { 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) @@ -474,22 +469,20 @@ inline 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) @@ -498,11 +491,10 @@ int getsockopt(int s, int l, int o, void * v, int * n) { 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 */ @@ -510,34 +502,31 @@ inline 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) @@ -546,10 +535,9 @@ int recv(int s, void * b, size_t l, int f) { int result; if ((result = ::recv(_get_osfhandle(s), (char *)b, l, f)) == SOCKET_ERROR) { - errno = WSAGetLastError(); + errno = WSAGetLastError(); return -1; - } - else + } else return result; } @@ -558,10 +546,9 @@ int recvfrom(int s, void * b, size_t l, int f, struct sockaddr * fr, size_t * fl { 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; } @@ -570,10 +557,9 @@ int select(int n, fd_set * r, fd_set * w, fd_set * e, struct timeval * t) { 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) @@ -583,10 +569,9 @@ int send(int s, const void * b, size_t l, int f) { 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; } @@ -595,10 +580,9 @@ int sendto(int s, const void * b, size_t l, int f, const struct sockaddr * t, in { 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; } @@ -612,8 +596,7 @@ int setsockopt(SOCKET s, int l, int o, const char * v, int n) 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) @@ -622,11 +605,10 @@ inline 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 @@ -634,12 +616,11 @@ int socket(int f, int t, int p) { 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) @@ -647,10 +628,9 @@ inline 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; } @@ -663,29 +643,26 @@ int WSADuplicateSocket(int s, DWORD n, LPWSAPROTOCOL_INFO l) #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 */ @@ -721,22 +698,22 @@ int WSASocket(int a, int t, int p, LPWSAPROTOCOL_INFO i, GROUP g, DWORD f) #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 diff --git a/include/squid_types.h b/include/squid_types.h index 4492d2ebb6..017c46d36a 100644 --- a/include/squid_types.h +++ b/include/squid_types.h @@ -9,12 +9,12 @@ * 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/ @@ -33,12 +33,12 @@ * 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. @@ -78,10 +78,10 @@ #include #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 */ diff --git a/include/squid_windows.h b/include/squid_windows.h index 5b0e72cfad..1a83a04ca1 100644 --- a/include/squid_windows.h +++ b/include/squid_windows.h @@ -19,12 +19,12 @@ * 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. diff --git a/include/sspwin32.h b/include/sspwin32.h index 4357c85a76..4fa0a12689 100644 --- a/include/sspwin32.h +++ b/include/sspwin32.h @@ -20,12 +20,12 @@ * 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. diff --git a/include/strsep.h b/include/strsep.h index b896debc9f..40d2ad22e2 100644 --- a/include/strsep.h +++ b/include/strsep.h @@ -34,23 +34,23 @@ /** \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 */ diff --git a/include/strtoll.h b/include/strtoll.h index 01f9fb3c8f..92e8edd044 100644 --- a/include/strtoll.h +++ b/include/strtoll.h @@ -18,12 +18,12 @@ #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 */ diff --git a/include/tempnam.h b/include/tempnam.h index 1de398b628..7a1a34c2b9 100644 --- a/include/tempnam.h +++ b/include/tempnam.h @@ -9,12 +9,12 @@ * 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, diff --git a/include/util.h b/include/util.h index 07a1a5a2e0..d3f1d34f46 100644 --- a/include/util.h +++ b/include/util.h @@ -19,16 +19,16 @@ * 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 @@ -73,7 +73,7 @@ SQUIDCEXTERN void Tolower(char *); 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 @@ -82,7 +82,7 @@ SQUIDCEXTERN void xxfree(const void *); */ #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.