From 9c0a22562c238784a56ec9cf2197981b4af9352d Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Fri, 31 Aug 2012 17:45:51 +0200 Subject: [PATCH] Moved SNMP-related prototypes to a new home. --- include/cache_snmp.h | 9 +------- src/Makefile.am | 1 + src/client_db.cc | 4 ++++ src/client_db.h | 4 ++++ src/dns_internal.cc | 4 ++++ src/fqdncache.cc | 4 ++++ src/ipcache.cc | 4 ++++ src/main.cc | 3 +++ src/protos.h | 24 --------------------- src/snmp_agent.cc | 2 ++ src/snmp_agent.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ src/snmp_core.cc | 2 ++ src/snmp_core.h | 10 +++++++-- 13 files changed, 87 insertions(+), 34 deletions(-) create mode 100644 src/snmp_agent.h diff --git a/include/cache_snmp.h b/include/cache_snmp.h index 86acc263db..e60d432369 100644 --- a/include/cache_snmp.h +++ b/include/cache_snmp.h @@ -1,16 +1,9 @@ -/* - * $Id$ - */ #ifndef SQUID_CACHE_SNMP_H #define SQUID_CACHE_SNMP_H #if SQUID_SNMP -#if SIZEOF_LONG == 8 -#define snint int -#else -#define snint long -#endif +typedef int64_t snint; #ifndef MIN #define MIN(a,b) (a #endif diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 0a258ab76b..bb07a3985e 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -45,6 +45,10 @@ #include "Store.h" #include "wordlist.h" +#if SQUID_SNMP +#include "snmp_core.h" +#endif + /** \defgroup FQDNCacheAPI FQDN Cache API \ingroup Components diff --git a/src/ipcache.cc b/src/ipcache.cc index b032ed203d..2b0da11015 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -48,6 +48,10 @@ #include "Store.h" #include "wordlist.h" +#if SQUID_SNMP +#include "snmp_core.h" +#endif + /** \defgroup IPCacheAPI IP Cache API \ingroup Components diff --git a/src/main.cc b/src/main.cc index 20a16fdc9d..824105acc1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -135,6 +135,9 @@ #if USE_SQUID_ESI #include "esi/Module.h" #endif +#if SQUID_SNMP +#include "snmp_core.h" +#endif #if HAVE_PATHS_H #include diff --git a/src/protos.h b/src/protos.h index c99fa1042f..4163dc4bdf 100644 --- a/src/protos.h +++ b/src/protos.h @@ -37,30 +37,6 @@ #include "wordlist.h" #include "anyp/ProtocolType.h" -#if SQUID_SNMP -SQUIDCEXTERN PF snmpHandleUdp; -SQUIDCEXTERN void snmpInit(void); -SQUIDCEXTERN void snmpOpenPorts(void); -SQUIDCEXTERN void snmpClosePorts(void); -SQUIDCEXTERN const char * snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf); - -SQUIDCEXTERN void addr2oid(Ip::Address &addr, oid *Dest); -SQUIDCEXTERN void oid2addr(oid *Dest, Ip::Address &addr, u_int code); - -SQUIDCEXTERN Ip::Address *client_entry(Ip::Address *current); -extern variable_list *snmp_basicFn(variable_list *, snint *); -extern variable_list *snmp_confFn(variable_list *, snint *); -extern variable_list *snmp_sysFn(variable_list *, snint *); -extern variable_list *snmp_prfSysFn(variable_list *, snint *); -extern variable_list *snmp_prfProtoFn(variable_list *, snint *); -extern variable_list *snmp_prfPeerFn(variable_list *, snint *); -extern variable_list *snmp_netIpFn(variable_list *, snint *); -extern variable_list *snmp_netFqdnFn(variable_list *, snint *); -extern variable_list *snmp_netDnsFn(variable_list *, snint *); -extern variable_list *snmp_meshPtblFn(variable_list *, snint *); -extern variable_list *snmp_meshCtblFn(variable_list *, snint *); -#endif /* SQUID_SNMP */ - #include "comm/forward.h" extern void shut_down(int); diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index 97d0e4139c..2f73f6d873 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -38,6 +38,8 @@ #include "mem_node.h" #include "neighbors.h" #include "protos.h" +#include "snmp_agent.h" +#include "snmp_core.h" #include "StatCounters.h" #include "StatHist.h" #include "SquidMath.h" diff --git a/src/snmp_agent.h b/src/snmp_agent.h new file mode 100644 index 0000000000..7440e1547b --- /dev/null +++ b/src/snmp_agent.h @@ -0,0 +1,50 @@ +#ifndef SQUID_SNMP_AGENT_H_ +#define SQUID_SNMP_AGENT_H_ +/* + * DEBUG: section + * AUTHOR: + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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 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. + * + */ + +#if SQUID_SNMP + +#include "snmp_vars.h" + +extern variable_list *snmp_confFn(variable_list *, snint *); +extern variable_list *snmp_sysFn(variable_list *, snint *); +extern variable_list *snmp_prfSysFn(variable_list *, snint *); +extern variable_list *snmp_prfProtoFn(variable_list *, snint *); +extern variable_list *snmp_netIpFn(variable_list *, snint *); +extern variable_list *snmp_netFqdnFn(variable_list *, snint *); +extern variable_list *snmp_netDnsFn(variable_list *, snint *); +extern variable_list *snmp_meshPtblFn(variable_list *, snint *); +extern variable_list *snmp_meshCtblFn(variable_list *, snint *); + +#endif /* SQUID_SNMP */ +#endif /* SQUID_SNMP_AGENT_H_ */ diff --git a/src/snmp_core.cc b/src/snmp_core.cc index ccc42c0668..c2530a5da7 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -32,6 +32,7 @@ #include "squid.h" #include "acl/FilledChecklist.h" #include "base/CbcPointer.h" +#include "client_db.h" #include "comm.h" #include "comm/Connection.h" #include "comm/Loops.h" @@ -39,6 +40,7 @@ #include "ip/Address.h" #include "ip/tools.h" #include "protos.h" +#include "snmp_agent.h" #include "snmp_core.h" #include "snmp/Forwarder.h" #include "tools.h" diff --git a/src/snmp_core.h b/src/snmp_core.h index ce1947b8dc..cfec2acfc7 100644 --- a/src/snmp_core.h +++ b/src/snmp_core.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * DEBUG: section 49 SNMP Interface * */ @@ -35,5 +33,13 @@ extern struct snmp_pdu* snmpAgentResponse(struct snmp_pdu* PDU); extern AggrType snmpAggrType(oid* Current, snint CurrentLen); extern Comm::ConnectionPointer snmpOutgoingConn; +extern PF snmpHandleUdp; +extern void snmpInit(void); +extern void snmpOpenPorts(void); +extern void snmpClosePorts(void); +extern const char * snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf); +extern void addr2oid(Ip::Address &addr, oid *Dest); +extern void oid2addr(oid *Dest, Ip::Address &addr, u_int code); + #endif /* SQUID_SNMP_CORE_H */ -- 2.47.2