]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Further SNMP cleanup...
authorwessels <>
Fri, 21 Nov 1997 13:41:11 +0000 (13:41 +0000)
committerwessels <>
Fri, 21 Nov 1997 13:41:11 +0000 (13:41 +0000)
13 files changed:
include/asn1.h
include/parse.h
include/snmp.h
include/snmp_api.h
include/snmp_client.h
include/snmp_impl.h
include/snmp_util.h
include/snmp_vars.h
snmplib/Makefile.in
snmplib/asn1.c
snmplib/mib.c
snmplib/parse.c
snmplib/snmp_api.c

index 8fd4456866fbeb5ee47da0b1dc5948f24b8728d2..d9702ec808ca864ca7ce64118c69013685d1ca1f 100644 (file)
@@ -30,13 +30,6 @@ SOFTWARE.
 #define ASN1_H
 
 
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
 #include <sys/types.h>
 
 #ifndef EIGHTBIT_SUBIDS
@@ -95,105 +88,105 @@ struct counter64 {
 };
 
 
-extern u_char *asn_parse_int _ANSI_ARGS_((u_char * data,
+extern u_char *asn_parse_int (u_char * data,
        int *datalength,
        u_char * type,
        long *intp,
-       int intsize));
+       int intsize);
 
-extern u_char *asn_build_int _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_int (u_char * data,
        int *datalength,
        u_char type,
        long *intp,
-       int intsize));
+       int intsize);
 
-extern u_char *asn_parse_unsigned_int _ANSI_ARGS_((u_char * data,
+extern u_char *asn_parse_unsigned_int (u_char * data,
        int *datalength,
        u_char * type,
        u_long * intp,
-       int intsize));
+       int intsize);
 
-extern u_char *asn_build_unsigned_int _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_unsigned_int (u_char * data,
        int *datalength,
        u_char type,
        u_long * intp,
-       int intsize));
+       int intsize);
 
-extern u_char *asn_parse_string _ANSI_ARGS_((u_char * data,
+extern u_char *asn_parse_string (u_char * data,
        int *datalength,
        u_char * type,
        u_char * string,
-       int *len));
+       int *len);
 
-extern u_char *asn_build_string _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_string (u_char * data,
        int *datalength,
        u_char type,
        u_char * str,
-       int len));
+       int len);
 
-extern u_char *asn_parse_header _ANSI_ARGS_((u_char * data,
+extern u_char *asn_parse_header (u_char * data,
        int *datalength,
-       u_char * type));
+       u_char * type);
 
-extern u_char *asn_build_header _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_header (u_char * data,
        int *datalength,
        u_char type,
-       int len));
+       int len);
 
-extern u_char *asn_build_sequence _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_sequence (u_char * data,
        int *datalength,
        u_char type,
-       int len));
+       int len);
 
-extern u_char *asn_parse_length _ANSI_ARGS_((u_char * data,
-       u_long * eln));
+extern u_char *asn_parse_length (u_char * data,
+       u_long * eln);
 
-extern u_char *asn_build_length _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_length (u_char * data,
        int *datalength,
-       int len));
+       int len);
 
-extern u_char *asn_parse_objid _ANSI_ARGS_((
+extern u_char *asn_parse_objid (
        u_char * data,
        int *datalength,
        u_char * type,
        oid * objid,
-       int *objidlength));
+       int *objidlength);
 
-extern u_char *asn_build_objid _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_objid (u_char * data,
        int *datalength,
        u_char type,
        oid * objid,
-       int objidlength));
+       int objidlength);
 
-extern u_char *asn_parse_null _ANSI_ARGS_((u_char * data,
+extern u_char *asn_parse_null (u_char * data,
        int *datalength,
-       u_char * type));
+       u_char * type);
 
-extern u_char *asn_build_null _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_null (u_char * data,
        int *datalength,
-       u_char type));
-extern u_char *asn_parse_bitstring _ANSI_ARGS_((u_char * data,
+       u_char type);
+extern u_char *asn_parse_bitstring (u_char * data,
        int *datalength,
        u_char * type,
        u_char * str,
-       int *len));
+       int *len);
 
-extern u_char *asn_build_bitstring _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_bitstring (u_char * data,
        int *datalength,
        u_char type,
        u_char * str,
-       int len));
+       int len);
 
-extern u_char *asn_parse_unsigned_int64 _ANSI_ARGS_((u_char * data,
+extern u_char *asn_parse_unsigned_int64 (u_char * data,
        int *datalength,
        u_char * type,
        struct counter64 * cp,
-       int cp_size));
+       int cp_size);
 
-extern u_char *asn_build_unsigned_int64 _ANSI_ARGS_((u_char * data,
+extern u_char *asn_build_unsigned_int64 (u_char * data,
        int *datalength,
        u_char type,
        struct counter64 * cp,
-       int cp_size));
+       int cp_size);
 
 #endif
index 4343e7557627585125f23157e1df5c0dfda394c5..92573e124e1a21c60ca37f5ca2d60bc45ac5d8a9 100644 (file)
@@ -27,21 +27,10 @@ SOFTWARE.
 #ifndef _PARSE_H
 #define _PARSE_H
 
-
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
-
 #define MAXLABEL       64      /* maximum characters in a label */
 #define MAXTOKEN       64      /* maximum characters in a token */
 #define MAXQUOTESTR    512     /* maximum characters in a quoted string */
 
-
-
 /*
  * A linked list of tag-value pairs for enumerated integers.
  */
@@ -98,7 +87,7 @@ struct tree {
 #define TYPE_NSAPADDRESS    13
 #define TYPE_UINTEGER      14
 
-struct tree *read_mib _ANSI_ARGS_((char *fname));
+struct tree *read_mib (const char *fname);
 
 
 #endif
index a5f9e06bb0d658716c037e1c347b64550cf99a86..aead0a99557a3f8e23670ba26d1c089066c3adcb 100644 (file)
@@ -121,15 +121,10 @@ typedef struct _conf_if_list {
 
 extern conf_if_list *if_list;
 
-/*extern void init_snmp(); */
-
-extern int read_objid(char *input,
-    oid * output,
-    int *out_len);
-
+extern int read_objid(char *input, oid * output, int *out_len);
+extern void snmp_add_null_var(struct snmp_pdu *, oid *, int);
 extern void sprint_objid(char *buf, oid * id, int idlen);
 extern void print_objid(oid * id, int idlen);
-void snmp_add_null_var(struct snmp_pdu *, oid *, int);
 extern void xdump(u_char * cp, int length, char *prefix);
 extern void snmp_synch_setup(struct snmp_session *session);
 extern int snmp_synch_response(struct snmp_session *ss,
index 292011573f2bd8fd01e0d72a3d08185e41f9a666..5241da56ac4b0dca97270f51de34e8a84551bf66 100644 (file)
@@ -27,15 +27,6 @@ SOFTWARE.
 #ifndef _SNMP_API_H
 #define _SNMP_API_H
 
-
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
-
 #include <sys/time.h>
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -189,7 +180,7 @@ struct variable_list {
  * 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 _ANSI_ARGS_((struct snmp_session * session));
+struct snmp_session *snmp_open (struct snmp_session * session);
 
 /*
  * int snmp_close(session)
@@ -199,7 +190,7 @@ struct snmp_session *snmp_open _ANSI_ARGS_((struct snmp_session * session));
  * dequeues any pending requests, and closes any sockets allocated for
  * the session.  Returns 0 on error, 1 otherwise.
  */
-int snmp_close _ANSI_ARGS_((struct snmp_session * session));
+int snmp_close (struct snmp_session * session);
 
 
 /*
@@ -215,8 +206,8 @@ int snmp_close _ANSI_ARGS_((struct snmp_session * session));
  * On any error, 0 is returned.
  * The pdu is freed by snmp_send() unless a failure occured.
  */
-int snmp_send _ANSI_ARGS_((struct snmp_session * session,
-       struct snmp_pdu * pdu));
+int snmp_send (struct snmp_session * session,
+       struct snmp_pdu * pdu);
 
 
 /*
@@ -267,10 +258,10 @@ void snmp_free_pdu(struct snmp_pdu *pdu);
  *
  * snmp_select_info returns the number of open sockets.  (i.e. The number of sessions open)
  */
-int snmp_select_info _ANSI_ARGS_((int *numfds,
+int snmp_select_info (int *numfds,
        fd_set * fdset,
        struct timeval * timeout,
-       int *block));
+       int *block);
 
 /*
  * void snmp_timeout();
@@ -283,7 +274,7 @@ int snmp_select_info _ANSI_ARGS_((int *numfds,
  * 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 _ANSI_ARGS_((void));
+void snmp_timeout (void);
 
 
 /*
index 6517520bef767588d9f78fc2f425870f05eff71d..ac2c4eef7946c1913b89422c41af650197862abd 100644 (file)
@@ -27,15 +27,6 @@ SOFTWARE.
 #ifndef SNMP_CLIENT_H
 #define SNMP_CLIENT_H
 
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
-
-
 struct synch_state {
     int waiting;
     int status;
@@ -49,10 +40,10 @@ struct synch_state {
 
 extern struct synch_state snmp_synch_state;
 
-extern struct snmp_pdu *snmp_pdu_create _ANSI_ARGS_((int cmd));
+extern struct snmp_pdu *snmp_pdu_create (int cmd);
 
-extern struct snmp_pdu *snmp_fix_pdu _ANSI_ARGS_((struct snmp_pdu * pdu,
-       int cmd));
-extern char *snmp_errstring _ANSI_ARGS_((int errstat));
+extern struct snmp_pdu *snmp_fix_pdu (struct snmp_pdu * pdu,
+       int cmd);
+extern char *snmp_errstring (int errstat);
 
 #endif
index abab343e7598bcecbcaa738b7068c888a07ba615..f6e8f1d7ddc923b352113eab2fa1438158b77a2f 100644 (file)
@@ -28,23 +28,6 @@ SOFTWARE.
 #ifndef SNMP_IMPL_H
 #define SNMP_IMPL_H
 
-
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
-
-#if (defined vax) || (defined (mips))
-/*
- * This is a fairly bogus thing to do, but there seems to be no better way for
- * compilers that don't understand void pointers.
- */
-#define void char
-#endif
-
 /*
  * Error codes:
  */
@@ -106,32 +89,32 @@ SOFTWARE.
 /* from snmp.c */
 extern u_char sid[];           /* size SID_MAX_LEN */
 
-extern u_char *snmp_parse_var_op _ANSI_ARGS_((u_char * data,
+extern u_char *snmp_parse_var_op (u_char * data,
        oid * var_name,
        int *var_name_len,
        u_char * var_val_type,
        int *var_val_len,
        u_char ** var_val,
-       int *listlength));
+       int *listlength);
 
-extern u_char *snmp_build_var_op _ANSI_ARGS_((u_char * data,
+extern u_char *snmp_build_var_op (u_char * data,
        oid * var_name,
        int *var_name_len,
        u_char var_val_type,
        int var_val_len,
        u_char * var_val,
-       int *listlength));
+       int *listlength);
 
-extern u_char *snmp_auth_parse _ANSI_ARGS_((u_char * data,
+extern u_char *snmp_auth_parse (u_char * data,
        int *length,
        u_char * sid,
        int *slen,
-       long *version));
+       long *version);
 
-extern u_char *snmp_auth_build _ANSI_ARGS_((u_char * data,
+extern u_char *snmp_auth_build (u_char * data,
        int *length,
        struct snmp_session * session,
        int is_agent,
-       int messagelen));
+       int messagelen);
 
 #endif
index 2b927fd22fd361ab1a70240fed93b8f527ea6490..cc35744ced487f3fa13d28b1e795a251f41983b6 100644 (file)
@@ -1,27 +1,18 @@
 #ifndef SNMP_UTIL_H
 #define SNMP_UTIL_H
 
-
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
-
 /*
  * call a function at regular intervals (in seconds):
  */
-extern void snmp_alarm _ANSI_ARGS_((int ival, void (*handler) (void)));
+extern void snmp_alarm (int ival, void (*handler) (void));
 
 
 /*
  * service for filedescriptors:
  */
 
-extern void fd_add _ANSI_ARGS_((int fd, void (*func) (int fd)));
-extern void fd_service _ANSI_ARGS_((void));
+extern void fd_add (int fd, void (*func) (int fd));
+extern void fd_service (void);
 
 
 /* ---------------------------------------------------------------------- */
@@ -37,7 +28,7 @@ extern void fd_service _ANSI_ARGS_((void));
  * ** character is always '\0'.
  */
 void
-strcpy_safe _ANSI_ARGS_((char *str, int str_len, char *val));
+strcpy_safe (char *str, int str_len, char *val);
 
 
 /*
@@ -45,13 +36,13 @@ strcpy_safe _ANSI_ARGS_((char *str, int str_len, char *val));
  * ** WARNING: this scans all interfaces (slow)
  */
 u_long
-Util_local_ip_address _ANSI_ARGS_((void));
+Util_local_ip_address (void);
 
 /*
  * ** Function to get the current time in seconds
  */
 long
-Util_time_now _ANSI_ARGS_((void));
+Util_time_now (void);
 
 /*
  * ** Function to determine how long the agent has been running
@@ -64,13 +55,13 @@ long
  * ** Read data from file
  */
 int
-Util_file_read _ANSI_ARGS_((char *file, int offset, char *data, int dataSz));
+Util_file_read (char *file, int offset, char *data, int dataSz);
 
 /*
  * ** Write data into file
  */
 int
-Util_file_write _ANSI_ARGS_((char *file, int offset, char *data, int dataSz));
+Util_file_write (char *file, int offset, char *data, int dataSz))
 
 
 /* ---------------------------------------------------------------------- */
index fab8622073c54c5187e0a305f83c92e4e53cf8dd..cb76e6c1177578665b56c4655e759e3ca0439acb 100644 (file)
@@ -28,15 +28,6 @@ PERFORMANCE OF THIS SOFTWARE.
 #ifndef SNMPLIB_H
 #define SNMPLIB_H
 
-
-#undef _ANSI_ARGS_
-#if (defined(__STDC__) && ! defined(NO_PROTOTYPE)) || defined(USE_PROTOTYPE)
-#define _ANSI_ARGS_(x) x
-#else
-#define _ANSI_ARGS_(x) ()
-#endif
-
-
 u_char *var_system();
 u_char *var_ifEntry();
 u_char *var_atEntry();
index 3cabbd8cc7c7227e80ce845aa09e86f19a68df0c..d333fe94819a57e1f1b15749d34527112347585e 100644 (file)
@@ -19,13 +19,12 @@ CSRCS=      snmp_client.c snmp.c snmp_auth.c asn1.c mib.c parse.c snmp_api.c \
 OBJS=  snmp_client.o snmp.o snmp_auth.o asn1.o mib.o parse.o snmp_api.o \
        md5.o usec.o snmpdump.o
 
-CC= @CC@
-FLAGS=  -g
-DEFS= -DBSD4_3 -DSQUID_SNMP=1
-INCLUDE= -I../include -I./../include -I../src -I./../src
-MIBDEFS= -DMIBFILEPATH=\"$(prefix)/lib\"
-# CFLAGS=-O -DDEBUG -DBSD4_3
-CFLAGS=  $(FLAGS) $(DEFS) $(CONFDEFS) $(INCLUDE)
+CC     = @CC@
+FLAGS  = -g
+DEFS   = -DSQUID_SNMP=1
+INCLUDE        = -I../include -I$(srcdir)/../include
+MIBDEFS        = -DMIBFILEPATH=\"$(prefix)/lib\"
+CFLAGS = $(FLAGS) $(DEFS) $(INCLUDE)
 
 
 all:   $(TARG)
index 7e370227005fdff9f6834b6fb6e1a0cdeabfaa8a..e97f8f9c4f3879ec010a4011a6d8f624abb0dd49 100644 (file)
@@ -28,32 +28,30 @@ 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.
 ******************************************************************/
-#ifdef KINETICS
-#include "gw.h"
-#endif
 
-#ifdef linux
+#include "config.h"
+
+#if HAVE_STDIO_H
 #include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#if HAVE_STRING_H
 #include <string.h>
 #endif
-
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
 #include <netinet/in.h>
-
-#ifdef vms
-#include <in.h>
 #endif
-
-
-#include "asn1.h"
-
+#if HAVE_ASSERT_H
 #include <assert.h>
-
-#ifndef NULL
-#define NULL   0
 #endif
 
+#include "asn1.h"
+
 #ifdef DEBUG
 #define ERROR(string)   printf("%s(%d): %s",__FILE__, __LINE__, string);
 #else
index 16da7854495ce3f1abe142678947eb8b606af95c..f6f71097fcec299d07cadc746301d9dffa1299b7 100644 (file)
@@ -21,8 +21,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 SOFTWARE.
 ******************************************************************/
 
-#include "squid.h"
-
 #include "asn1.h"
 #include "snmp.h"
 #include "snmp_impl.h"
@@ -568,12 +566,11 @@ static char Prefix[256];
 static int Suffix;
 
 void
-init_mib()
+init_mib(const char *file)
 {
-    char *file, *getenv(), *prefix;
+    char *prefix;
 
     Mib = 0;
-    file = Config.Snmp.mibPath;
     if (file)
        Mib = read_mib(file);
     if (!Mib)
index b7545cc3480e2ac834374abdb1a9f6ccb68d4ec0..a126452f81f96b5410060293a997edcb4458ce2d 100644 (file)
@@ -1700,8 +1700,7 @@ get_token(fp, token)
 }
 
 struct tree *
-read_mib(filename)
-     char *filename;
+read_mib(const char *filename)
 {
     FILE *fp;
     struct node *nodes;
index b899d18b0e04662e91d2847df132f81bfdd51891..45e8a0e6f49fceab72a3b40da325bd0db03b9094 100644 (file)
 
 #define PACKET_LENGTH  4500
 
-#ifndef BSD4_3
-#define BSD4_2
-#endif
-
-#if !defined(BSD4_3) && !defined(linux) && !defined(sun)
-
-typedef long fd_mask;
-#define NFDBITS        (sizeof(fd_mask) * NBBY)        /* bits per mask */
-
-#define        FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define        FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define        FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_ZERO(p)     bzero((char *)(p), sizeof(*(p)))
-#endif
-
 oid default_enterprise[] =
 {1, 3, 6, 1, 4, 1, 3, 1, 1};   /* enterprises.cmu.systems.cmuSNMP */