]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
kostas initial snmp support
authorwessels <>
Fri, 21 Nov 1997 07:29:31 +0000 (07:29 +0000)
committerwessels <>
Fri, 21 Nov 1997 07:29:31 +0000 (07:29 +0000)
configure
configure.in
doc/Programming-Guide/prog-guide.sgml
src/Makefile.in
src/client.cc
src/globals.h
src/main.cc
src/protos.h
src/structs.h

index 385d48935329d77f3ec998954f9f0f7cac52d75d..9f147ce5c937205f4652d87417faf8ee155a5088 100755 (executable)
--- a/configure
+++ b/configure
@@ -50,6 +50,8 @@ mandir='${prefix}/man'
 # Initialize some other variables.
 subdirs=
 MFLAGS= MAKEFLAGS=
+SNMPLIB='libsnmp.a'
+
 # Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
 
@@ -3608,6 +3610,7 @@ s%@host_os@%$host_os%g
 s%@CACHE_HTTP_PORT@%$CACHE_HTTP_PORT%g
 s%@CACHE_ICP_PORT@%$CACHE_ICP_PORT%g
 s%@CC@%$CC%g
+s%@SNMPLIB@%$SNMPLIB%g
 s%@CPP@%$CPP%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
@@ -3677,6 +3680,7 @@ CONFIG_FILES=\${CONFIG_FILES-"\
        ./lib/Makefile \
        ./include/config.h \
        ./scripts/Makefile \
+       ./snmplib/Makefile \
        ./scripts/RunCache \
        ./scripts/RunAccel \
        ./src/Makefile \
index 35b9e6d11aa9f291f523bd2582070bca0632bd9a..2ad288be3f3a8e534185ab0d5189e52f6529e715 100644 (file)
@@ -3,13 +3,13 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.82 1997/10/31 05:15:06 wessels Exp $
+dnl  $Id: configure.in,v 1.83 1997/11/21 00:29:32 wessels Exp $
 dnl
 dnl
 dnl
 AC_INIT(src/main.c)
 AC_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.82 $)dnl
+AC_REVISION($Revision: 1.83 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AC_CONFIG_AUX_DIR(aux)
 
@@ -584,6 +584,9 @@ if test "$ac_cv_lib_malloc_main" = "yes" ; then
                XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
        fi
 fi
+SNMPLIB='libsnmp.a'
+AC_SUBST(SNMPLIB)
+
 AC_SUBST(XTRA_OBJS)
 
 if test -z "$XTRA_LIBS"; then
@@ -604,6 +607,7 @@ AC_OUTPUT(\
        ./scripts/RunAccel \
        ./src/Makefile \
        ./contrib/Makefile \
+       ./snmplib/Makefile \
        ./icons/Makefile \
        ./errors/Makefile \
 )
index 3fe9eb0de5df7d974a882dde15e84684b0dd7bff..1aef7cb09b95ca626ee8f31dcaeb42b21c3373e3 100644 (file)
@@ -64,7 +64,7 @@ Squid consists of the following major components
 <sect1>Client Side
 
 <P>
-    These routines exist primarily in two source files: <em/cp.c/, and
+    These routines exist primarily in two source files: <em/.cp.c/, and
     <em/client_side.c/.  The name <em/icp.c/ is misleading, as it
     has more to do with accepting HTTP requests than the ICP protocol.
 
index aa39e3ff3abe3500e912836af98dbd032de69f58..7e74a0b2aa3a3d73d3a8b095fee97b26aaf24025 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.96 1997/11/20 06:25:24 wessels Exp $
+#  $Id: Makefile.in,v 1.97 1997/11/21 00:29:34 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -35,6 +35,7 @@ srcdir                = @srcdir@
 VPATH          = @srcdir@
 
 DEFAULT_CONFIG_FILE     = $(sysconfdir)/squid.conf
+DEFAULT_SNMP_CONF      = $(sysconfdir)/snmp.conf
 DEFAULT_MIME_TABLE     = $(sysconfdir)/mime.conf
 DEFAULT_DNSSERVER       = $(libexecdir)/dnsserver
 DEFAULT_CACHE_LOG       = $(localstatedir)/logs/cache.log
@@ -46,6 +47,7 @@ DEFAULT_PINGER                = $(libexecdir)/pinger
 DEFAULT_UNLINKD                = $(libexecdir)/unlinkd
 DEFAULT_ICON_DIR       = $(sysconfdir)/icons
 DEFAULT_ERROR_DIR      = $(sysconfdir)/errors
+DEFAULT_MIB_PATH       = $(sysconfdir)/squidmib.txt
 
 CC             = @CC@
 MAKEDEPEND     = @MAKEDEPEND@
@@ -137,8 +139,15 @@ OBJS               = \
                url.o \
                useragent.o \
                wais.o \
+               $(SNMP_OBJS) \
                $(XTRA_OBJS)
 
+SNMP_OBJS      = \
+               snmp.o \
+                snmp_vars.o \
+                snmp_agent.o \
+                snmp_config.o 
+
 DEFAULTS        = \
        -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\"
 
@@ -147,7 +156,7 @@ all:    squid.conf $(PROGS) $(UTILS) $(SUID_UTILS) $(CGIPROGS)
 $(OBJS): ../include/version.h
 
 squid: $(OBJS)
-       $(CC) -o $@ $(LDFLAGS) $(OBJS) $(SQUID_LIBS)
+       $(CC) -o $@ $(LDFLAGS) $(OBJS) $(SQUID_LIBS) $(SQUID_SNMP_LIBS)
 
 globals.o: globals.c Makefile
        $(CC) -c $< $(CFLAGS) $(DEFAULTS)
@@ -192,7 +201,9 @@ cf.data: cf.data.pre Makefile
        s%@DEFAULT_STORE_LOG@%$(DEFAULT_STORE_LOG)%g;\
        s%@DEFAULT_PID_FILE@%$(DEFAULT_PID_FILE)%g;\
        s%@DEFAULT_SWAP_DIR@%$(DEFAULT_SWAP_DIR)%g;\
+       s%@DEFAULT_SNMP_CONF@%$(DEFAULT_SNMP_CONF)%g;\
        s%@DEFAULT_ICON_DIR@%$(DEFAULT_ICON_DIR)%g;\
+        s%@DEFAULT_MIB_PATH@%$(DEFAULT_MIB_PATH)%g;\
        s%@DEFAULT_ERROR_DIR@%$(DEFAULT_ERROR_DIR)%g" < cf.data.pre >$@
 
 install-mkdirs:
@@ -264,6 +275,7 @@ install: all install-mkdirs
                        $(RM) -f $(libexecdir)/-$$f; \
                fi; \
        done
+       $(INSTALL_FILE) mib.txt $(sysconfdir)/mib.txt
        $(INSTALL_FILE) squid.conf $(sysconfdir)/squid.conf.default
        @if test -f $(sysconfdir)/squid.conf ; then \
                echo "$@ will not overwrite existing $(sysconfdir)/squid.conf" ; \
@@ -271,6 +283,14 @@ install: all install-mkdirs
                echo "$(INSTALL_FILE) squid.conf $(sysconfdir)"; \
                $(INSTALL_FILE) squid.conf $(sysconfdir); \
        fi
+       $(INSTALL_FILE) snmp.conf $(sysconfdir)/snmp.conf.default
+       @if test -f $(sysconfdir)/snmp.conf ; then \
+                echo "$@ will not overwrite existing $(sysconfdir)/snmp.conf" ; \
+        else \
+                echo "$(INSTALL_FILE) snmp.conf $(sysconfdir)"; \
+                $(INSTALL_FILE) snmp.conf $(sysconfdir); \
+        fi
+
        $(INSTALL_FILE) mime.conf $(sysconfdir)/mime.conf.default
        @if test -f $(sysconfdir)/mime.conf ; then \
                echo "$@ will not overwrite existing $(sysconfdir)/mime.conf" ; \
index c4c7964e946c82caebd0a3a333fd10a7788e2f3b..7272bd5ed91c761fedcaae3f8c2259d08dafa3c9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client.cc,v 1.40 1997/11/03 22:43:08 wessels Exp $
+ * $Id: client.cc,v 1.41 1997/11/21 00:29:34 wessels Exp $
  *
  * DEBUG: section 0     WWW Client
  * AUTHOR: Harvest Derived
@@ -270,7 +270,7 @@ main(int argc, char *argv[])
                fprintf(stderr, "client: ERROR: Cannot connect to %s:%d: Host unknown.\n", hostname, port);
            } else {
                char tbuf[BUFSIZ];
-               sprintf(tbuf, "client: ERROR: Cannot connect to %s:%d",
+               snprintf(tbuf, BUFSIZ, "client: ERROR: Cannot connect to %s:%d",
                    hostname, port);
                perror(tbuf);
            }
index 10143abc16cfc43085fea4d1027075e40028e073..280400f5eac1a1c0c42f161325d4cb70a669fcd7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.19 1997/11/20 06:25:26 wessels Exp $
+ * $Id: globals.h,v 1.20 1997/11/21 00:29:35 wessels Exp $
  */
 
 extern FILE *debug_log;                /* NULL */
@@ -68,6 +68,11 @@ extern int opt_zap_disk_store;       /* 0 */
 extern int syslog_enable;      /* 0 */
 extern int theInIcpConnection; /* -1 */
 extern int theOutIcpConnection;        /* -1 */
+#ifdef SQUID_SNMP
+extern int theInSnmpConnection;        /* -1 */
+extern int theOutSnmpConnection;       /* -1 */
+extern char *snmp_agentinfo;
+#endif
 extern int vhost_mode;         /* 0 */
 extern int vizSock;            /* -1 */
 extern iostats IOStats;
@@ -80,6 +85,7 @@ extern struct in_addr any_addr;
 extern struct in_addr local_addr;
 extern struct in_addr no_addr;
 extern struct in_addr theOutICPAddr;
+extern struct in_addr theOutSNMPAddr;
 extern struct timeval current_time;
 extern struct timeval squid_start;
 extern time_t squid_curtime;   /* 0 */
index e5a18eb69519caf0240ce2710b0e94f85e9f4b84..8f535a33a7f59e5225059b97db4b34b41ef4505e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.192 1997/11/15 00:14:49 wessels Exp $
+ * $Id: main.cc,v 1.193 1997/11/21 00:29:36 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -130,7 +130,10 @@ static void mainParseOptions(int, char **);
 static void sendSignal(void);
 static void serverConnectionsOpen(void);
 static void watch_child(char **);
-
+#ifdef SQUID_SNMP
+extern void init_snmp();
+extern void initSquidSnmp();
+#endif
 static void
 usage(void)
 {
@@ -401,24 +404,8 @@ serverConnectionsOpen(void)
        }
     }
 #ifdef SQUID_SNMP
-    if (Config.Port.snmp) {
-       enter_suid();
-       fd = comm_open(SOCK_STREAM,
-           0,
-           Config.Addrs.snmp_incoming,
-           SQUID_SNMP_PORT,
-           COMM_NONBLOCKING,
-           "SNMP Socket");
-       leave_suid();
-       if (fd < 0)
-           continue;
-       comm_listen(fd);
-       commSetSelect(fd, COMM_SELECT_READ, snmpAccept, NULL, 0);
-       debug(1, 1) ("Accepting SNMP connections on port %d, FD %d.\n",
-           (int) SQUID_SNMP_PORT, fd);
-    }
-#endif /* SQUID_SNMP */
-
+        initSquidSnmp();
+#endif
 
     clientdbInit();
     icmpOpen();
@@ -583,6 +570,10 @@ mainInitialize(void)
        statAvgInit();
     }
     configured_once = 1;
+
+#ifdef SQUID_SNMP
+       init_snmp();
+#endif
 }
 
 int
index 8997b51da239809b8a3ebcef0ac28e3c6cb7ba17..88f65e12f2e4220d426434abc56e49920357261c 100644 (file)
@@ -239,8 +239,15 @@ extern PF icpHandleUdp;
 extern PF httpAccept;
 extern DEFER httpAcceptDefer;
 #ifdef SQUID_SNMP
-extern PF snmpAccept;
+/*extern PF snmpHandleUdp;*/
+/*extern void initSquidSnmp();*/
 #endif /* SQUID_SNMP */
+
+extern void icpSendERROR(int fd,
+    log_type errorCode,
+    const char *text,
+    clientHttpRequest *,
+    int httpCode);
 extern void AppendUdp(icpUdpData *);
 extern PF icpUdpReply;
 extern void icpHandleIcpV3(int, struct sockaddr_in, char *, int);
index 38a85e70792287dfae167221cebb2cbf51d581cc..7e885e76d47547975dd10fe75497c9430d11a1c1 100644 (file)
@@ -129,6 +129,13 @@ struct _SquidConfig {
        u_short snmp;
 #endif
     } Port;
+    struct {
+       char *configFile;
+       char *agentInfo;
+       char *mibPath;
+       u_short localPort;
+       int do_queueing;
+       } Snmp;
     struct {
        char *log;
        char *access;
@@ -169,10 +176,11 @@ struct _SquidConfig {
        struct in_addr tcp_incoming;
        struct in_addr tcp_outgoing;
        struct in_addr udp_incoming;
+       struct in_addr udp_outgoing;
 #ifdef SQUID_SNMP
        struct in_addr snmp_incoming;
+       struct in_addr snmp_outgoing;
 #endif                         /* SQUID_SNMP */
-       struct in_addr udp_outgoing;
        struct in_addr client_netmask;
     } Addrs;
     size_t tcpRcvBufsz;