From: Francesco Chemolli Date: Sat, 22 Sep 2012 15:07:57 +0000 (+0200) Subject: renamed snmp_request_t to SnmpRequest and moved to own header X-Git-Tag: SQUID_3_3_0_1~33^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df6c653bc451f03cd7220a602f15c774ec555286;p=thirdparty%2Fsquid.git renamed snmp_request_t to SnmpRequest and moved to own header --- diff --git a/src/Makefile.am b/src/Makefile.am index 90ce339d4d..3ab295d09a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,7 @@ endif DIST_SUBDIRS += ssl SNMP_ALL_SOURCE = \ + SnmpRequest.h \ snmp_core.h \ snmp_core.cc \ snmp_agent.h \ diff --git a/src/SnmpRequest.h b/src/SnmpRequest.h new file mode 100644 index 0000000000..c6c3a79d8f --- /dev/null +++ b/src/SnmpRequest.h @@ -0,0 +1,60 @@ +#ifndef SQUID_SNMPREQUEST_H_ +#define SQUID_SNMPREQUEST_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_session.h" + +// POD +class SnmpRequest +{ +public: + u_char *buf; + u_char *outbuf; + int len; + int sock; + long reqid; + int outlen; + + Ip::Address from; + + struct snmp_pdu *PDU; + ACLChecklist *acl_checklist; + u_char *community; + + struct snmp_session session; +}; + +#endif /* SQUID_SNMP */ + +#endif /* SQUID_SNMPREQUEST_H_ */ diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 8e187c6e60..4c9d45b6cc 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -43,6 +43,7 @@ #include "snmp_agent.h" #include "snmp_core.h" #include "snmp/Forwarder.h" +#include "SnmpRequest.h" #include "SquidConfig.h" #include "tools.h" @@ -64,8 +65,8 @@ static oid *static_Inst(oid * name, snint * len, mib_tree_entry * current, oid_P static oid *time_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn); static oid *peer_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn); static oid *client_Inst(oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn); -static void snmpDecodePacket(snmp_request_t * rq); -static void snmpConstructReponse(snmp_request_t * rq); +static void snmpDecodePacket(SnmpRequest * rq); +static void snmpConstructReponse(SnmpRequest * rq); static oid_ParseFn *snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen); static oid_ParseFn *snmpTreeGet(oid * Current, snint CurrentLen); @@ -363,7 +364,7 @@ snmpHandleUdp(int sock, void *not_used) { LOCAL_ARRAY(char, buf, SNMP_REQUEST_SIZE); Ip::Address from; - snmp_request_t *snmp_rq; + SnmpRequest *snmp_rq; int len; debugs(49, 5, "snmpHandleUdp: Called."); @@ -382,7 +383,7 @@ snmpHandleUdp(int sock, void *not_used) buf[len] = '\0'; debugs(49, 3, "snmpHandleUdp: FD " << sock << ": received " << len << " bytes from " << from << "."); - snmp_rq = (snmp_request_t *)xcalloc(1, sizeof(snmp_request_t)); + snmp_rq = (SnmpRequest *)xcalloc(1, sizeof(SnmpRequest)); snmp_rq->buf = (u_char *) buf; snmp_rq->len = len; snmp_rq->sock = sock; @@ -400,7 +401,7 @@ snmpHandleUdp(int sock, void *not_used) * Turn SNMP packet into a PDU, check available ACL's */ static void -snmpDecodePacket(snmp_request_t * rq) +snmpDecodePacket(SnmpRequest * rq) { struct snmp_pdu *PDU; u_char *Community; @@ -447,7 +448,7 @@ snmpDecodePacket(snmp_request_t * rq) * Packet OK, ACL Check OK, Create reponse. */ static void -snmpConstructReponse(snmp_request_t * rq) +snmpConstructReponse(SnmpRequest * rq) { struct snmp_pdu *RespPDU; diff --git a/src/structs.h b/src/structs.h index a5028e2079..f3d3106469 100644 --- a/src/structs.h +++ b/src/structs.h @@ -43,31 +43,6 @@ class ACLChecklist; class ACLList; class PeerDigest; -#if SQUID_SNMP - -#include "snmp_session.h" -// POD -class snmp_request_t -{ -public: - u_char *buf; - u_char *outbuf; - int len; - int sock; - long reqid; - int outlen; - - Ip::Address from; - - struct snmp_pdu *PDU; - ACLChecklist *acl_checklist; - u_char *community; - - struct snmp_session session; -}; - -#endif /* SQUID_SNMP */ - struct acl_tos { acl_tos *next; ACLList *aclList;