]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
renamed snmp_request_t to SnmpRequest and moved to own header
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 22 Sep 2012 15:07:57 +0000 (17:07 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 22 Sep 2012 15:07:57 +0000 (17:07 +0200)
src/Makefile.am
src/SnmpRequest.h [new file with mode: 0644]
src/snmp_core.cc
src/structs.h

index 90ce339d4dc644d52d8586cf24075b9cfaf565a5..3ab295d09a0409ee93a326cf07178a1b56e7ad4e 100644 (file)
@@ -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 (file)
index 0000000..c6c3a79
--- /dev/null
@@ -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_ */
index 8e187c6e607e3dad9eaee5bb31cfac85157e0d89..4c9d45b6ccfeabb748e584324035aaffe7e87f06 100644 (file)
@@ -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;
index a5028e2079961a49dec53030007ddba9a5495479..f3d31064691bb5a34cf5e66b72487a195cac88d8 100644 (file)
@@ -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;