]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Putting #if 0's, to remove code later
authorkostas <>
Wed, 25 Feb 1998 05:46:13 +0000 (05:46 +0000)
committerkostas <>
Wed, 25 Feb 1998 05:46:13 +0000 (05:46 +0000)
include/asn1.h
include/snmp.h
include/snmp_api.h
snmplib/Makefile.in
snmplib/asn1.c
snmplib/coexistance.c
snmplib/mib.c
snmplib/snmp_api.c

index 59bb0794e9d535fb1693b2bbbca5e231fb343cb6..7164e692984ea2fa434dfeb4b32a8e42775e1c14 100644 (file)
@@ -28,7 +28,7 @@
  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  * SOFTWARE.
  * 
- * $Id: asn1.h,v 1.7 1998/02/22 11:51:06 kostas Exp $
+ * $Id: asn1.h,v 1.8 1998/02/24 22:46:13 kostas Exp $
  * 
  **********************************************************************/
 
@@ -87,9 +87,11 @@ u_char       *asn_build_objid(u_char *, int *, u_char, oid *, int);
 u_char *asn_parse_null(u_char *, int *, u_char *);
 u_char *asn_build_null(u_char *, int *, u_char);
 
+#if 0
 u_char *asn_parse_bitstring(u_char *, int *, u_char *, u_char *, int *);
 u_char *asn_build_bitstring(u_char *, int *, u_char, u_char *, int);
 
+#endif
 u_char *asn_build_exception(u_char *, int *, u_char);
 
 #ifdef __cplusplus
index 48ffc8ddffafa7d7cf08d621180ef4d22fc57796..41e89cdac6d86f265a8b3f4bae7bc78ce65907d9 100644 (file)
@@ -27,7 +27,7 @@
  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  * SOFTWARE.
  * 
- * $Id: snmp.h,v 1.11 1998/02/23 21:05:17 kostas Exp $
+ * $Id: snmp.h,v 1.12 1998/02/24 22:46:14 kostas Exp $
  * 
  **********************************************************************/
 
 #include "snmp_session.h"
 
 /* The various modules */
-#include <snmp_vars.h>
-#include <snmp_pdu.h>
-#include <snmp_msg.h>
+#include "snmp_vars.h"
+#include "snmp_pdu.h"
+#include "snmp_msg.h"
 
 /* Other functions */
-#include <snmp_coexist.h>
-#include <version.h>
-#include <snmp_error.h>
-#include <snmp_api_error.h>
-#if 0
-#include <mini-client.h>
-#endif
+#include "snmp_coexist.h"
+#include "version.h"
+#include "snmp_error.h"
+#include "snmp_api_error.h"
 /* Other stuff I didn't touch */
-#include <snmp_impl.h>
-#include <snmp_api.h>
-#include <snmp_client.h>
-#include <snmp-internal.h>
-#include <mib.h>
-#include <parse.h>
-#include <snmp_compat.h>
-#include <snmp_debug.h>
+#include "snmp_impl.h"
+#include "snmp_api.h"
+#include "snmp_client.h"
+#include "snmp-internal.h"
+#include "mib.h"
+#include "parse.h"
+#include "snmp_compat.h"
+#include "snmp_debug.h"
 
 #endif /* _SNMP_H_ */
index ce3ca4a90dcbe0770c608cb1d23718d4126148f1..fd671435fa03bd02bdfcdec6f44652cc86092e41 100644 (file)
@@ -74,6 +74,7 @@ int snmp_build(struct snmp_session *, struct snmp_pdu *,
  * the pointer passed to snmp_open()).  On any error, NULL is returned
  * and snmp_errno is set to the appropriate error code.
  */
+#if 0
 struct snmp_session *snmp_open(struct snmp_session *);
 
 /*
@@ -102,7 +103,6 @@ int snmp_close(struct snmp_session *);
  */
 int snmp_send(struct snmp_session *, struct snmp_pdu *);
 
-
 /*
  * void snmp_read(fdset)
  *     fd_set  *fdset;
@@ -178,7 +178,7 @@ void snmp_timeout(void);
 
 
 void snmp_api_stats(void *);
-
+#endif
 #ifdef __cplusplus
 }
 #endif
index acfad595a8a852b1f94d1606d9cbbb3ca13b3213..6617a2558c9e0231c1137122184d596a26cdb053 100644 (file)
@@ -21,13 +21,13 @@ CSRCS               = asn1.c parse.c snmp_dump.c snmp_vars.c \
                  coexistance.c snmp_api.c snmp_error.c  \
                  mib.c snmp_api_error.c   \
                  mibii.c snmp_api_util.c snmp_msg.c \
-                 snmp_client.c snmp_pdu.c 
+                 snmp_pdu.c 
 
 OBJS           = asn1.o parse.o snmp_dump.o snmp_vars.o \
                   coexistance.o snmp_api.o snmp_error.o  \
                   mib.o snmp_api_error.o   \
                   mibii.o snmp_api_util.o snmp_msg.o \
-                  snmp_client.o snmp_pdu.o
+                  snmp_pdu.o
 
 CC             = @CC@
 AR_R           = @AR_R@
index a995dc9ebef5ef3f43689d0944dd2115dd6dcaae..c24dda36bf451ea0aa8b5c48bfb1de5e0ceb3091 100644 (file)
@@ -533,6 +533,7 @@ u_char *asn_build_header_with_truth(u_char *data, int *datalength,
   return(asn_build_length(data, datalength, length, truth));
 }
 
+#if 0
 /*
  * asn_build_sequence - builds an ASN header for a sequence with the ID and
  * length specified.
@@ -566,6 +567,7 @@ u_char *asn_build_sequence(u_char *data, int *datalength,
   *data++ = (u_char)(length & 0xFF);
   return(data);
 }
+#endif
 
 /*
  * asn_parse_length - interprets the length of the current object.
@@ -829,6 +831,7 @@ u_char *asn_build_objid(u_char *data, int *datalength,
   return(data + asnlength);
 }
 
+#if 0
 /*
  * asn_parse_null - Interprets an ASN null type.
  *  On entry, datalength is input as the number of valid bytes following
@@ -863,6 +866,7 @@ u_char *asn_parse_null(u_char *data, int *datalength, u_char *type)
   *datalength -= (bufp - data);
   return(bufp + asn_length);
 }
+#endif
 
 /*
  * asn_build_null - Builds an ASN null object.
@@ -885,6 +889,8 @@ u_char *asn_build_null(u_char *data, int *datalength, u_char type)
   return(asn_build_header_with_truth(data, datalength, type, 0, 1));
 }
 
+#if 0
+
 /*
  * asn_parse_bitstring - pulls a bitstring out of an ASN bitstring type.
  *  On entry, datalength is input as the number of valid bytes following
@@ -983,6 +989,7 @@ u_char *asn_build_bitstring(u_char *data, int *datalength,
   return(data + strlength);
 }
 
+#endif
 
 /*
  * To do: Write an asn_parse_exception function to go with the new 
index 7351cd44f4069a6b3629e08ceec2c3149705f45b..6da3b2ecd3e5b4d0418f6c973139482a6c17c32f 100644 (file)
@@ -126,127 +126,3 @@ int snmp_coexist_V2toV1(struct snmp_pdu *PDU)
   }
 }
 
-oid SysUptime[]   = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
-/* SNMPv2:           .1 .3 .6 .1 .6
- * snmpModules:                     .3
- * snmpMib:                            .1
- * snmpMIBObjects:                        .1
- * snmpTrap:                                 .4
- */
-oid TrapOid[]     = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
-oid EnterOid[]    = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 3, 0};
-oid snmpTrapsOid[]= { 1, 3, 6, 1, 6, 3, 1, 1, 5};
-
-int snmp_coexist_V1toV2(struct snmp_pdu *PDU)
-{
-  /* Per 3.1.2:
-   */
-  switch (PDU->command) {
-    
-  case SNMP_PDU_RESPONSE:
-
-    if (PDU->errstat == SNMP_ERR_TOOBIG) {
-      snmp_var_free(PDU->variables);
-      PDU->variables = NULL;
-    }
-    return(1);
-    break;
-
-  case TRP_REQ_MSG:
-    {
-      struct variable_list *VarP;
-      oid NewOid[MAX_NAME_LEN];
-      oid NewOidLen = 0;
-
-      /* Fake SysUptime */
-      VarP = snmp_var_new(SysUptime, sizeof(SysUptime) / sizeof(oid));
-      if (VarP == NULL)
-       return(0);
-      VarP->type = ASN_INTEGER;
-      *VarP->val.integer = PDU->time;
-
-      /* Fake SNMPTrapOid */
-      VarP->next_variable = snmp_var_new(TrapOid, sizeof(TrapOid) / sizeof(oid));
-      if (VarP == NULL) {
-       snmp_var_free(VarP);
-       return(0);
-      }
-
-      if (PDU->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
-       xmemcpy(NewOid, PDU->enterprise, PDU->enterprise_length);
-       NewOidLen = PDU->enterprise_length;
-       NewOid[NewOidLen++] = 0;
-       NewOid[NewOidLen++] = PDU->specific_type;
-      } else {
-
-       /* Trap prefix */
-       NewOidLen = sizeof(snmpTrapsOid) / sizeof(oid);
-       xmemcpy(NewOid, snmpTrapsOid, NewOidLen);
-
-       switch (PDU->trap_type) {
-       case SNMP_TRAP_COLDSTART:
-         NewOid[NewOidLen++] = 1;
-         break;
-       case SNMP_TRAP_WARMSTART:
-         NewOid[NewOidLen++] = 2;
-         break;
-       case SNMP_TRAP_LINKDOWN:
-         NewOid[NewOidLen++] = 3; /* RFC 1573 */
-         break;
-       case SNMP_TRAP_LINKUP:
-         NewOid[NewOidLen++] = 4; /* RFC 1573 */
-         break;
-       case SNMP_TRAP_AUTHENTICATIONFAILURE:
-         NewOid[NewOidLen++] = 5;
-         break;
-       case SNMP_TRAP_EGPNEIGHBORLOSS:
-         NewOid[NewOidLen++] = 6; /* RFC 1213 */
-         break;
-       default:
-         snmplib_debug(2, "Unable to translate v1 trap type %d!\n",
-                 PDU->trap_type);
-         snmp_set_api_error(SNMPERR_PDU_TRANSLATION);
-         return(0);
-       }
-      }
-
-      /* ASSERT:  NewOid contains the new OID. */
-      VarP->next_variable->type = ASN_OBJECT_ID;
-      VarP->next_variable->val_len = NewOidLen;
-      VarP->next_variable->val.string = xmalloc(sizeof(oid)*NewOidLen);
-      if (VarP->next_variable->val.string == NULL) {
-       snmp_set_api_error(SNMPERR_OS_ERR);
-       return(0);
-      }
-      xmemcpy((char *)VarP->next_variable->val.string, 
-            (char *)NewOid, 
-            sizeof(oid)*NewOidLen);
-      
-      /* Prepend this list */
-      VarP->next_variable->next_variable = PDU->variables;
-      PDU->variables = VarP;
-
-      /* Finally, append the last piece */
-
-      for(VarP = PDU->variables; VarP->next_variable; VarP=VarP->next_variable)
-       ; /* Find the last element of the list. */
-
-      VarP->next_variable = snmp_var_new(EnterOid, 
-                                        sizeof(EnterOid) / sizeof(oid));
-      if (VarP->next_variable == NULL)
-       return(0);
-      VarP->next_variable->type = ASN_OBJECT_ID;
-      VarP->next_variable->val_len = PDU->enterprise_length;
-      VarP->next_variable->val.string = (u_char *)PDU->enterprise;
-
-      PDU->command = SNMP_PDU_V2TRAP;
-
-    } /* End of trap conversion */
-    return(1);
-    break;
-  default:
-    snmplib_debug(2, "Unable to translate PDU %d to SNMPv2!\n", PDU->command);
-    snmp_set_api_error(SNMPERR_PDU_TRANSLATION);
-    return(0);
-  }
-}
index 7151bb114451720f4ce9f04b881fbac63661bad0..a7d69b23c4a7f830a21c05da9aa6765b49f8764d 100644 (file)
@@ -81,9 +81,11 @@ SOFTWARE.
 
 #include "util.h"
 #include "snprintf.h"
-
+#if 0
 static void sprint_by_type();
+#endif
 
+#if 0
 static char *
 uptimeString(timeticks, buf)
     int timeticks;
@@ -373,6 +375,7 @@ int quiet;
     }
     sprintf(buf, "%d.%d.%d.%d",ip[0], ip[1], ip[2], ip[3]);
 }
+#endif
 
 #if 0
 static void
@@ -396,6 +399,7 @@ void *foo;
 }
 #endif 
 
+#if 0
 static void
 sprint_null(buf, var, foo, quiet)
     char *buf;
@@ -470,6 +474,7 @@ sprint_by_type(buf, var, enums, quiet)
            break;
     }
 }
+#endif
 
 static struct snmp_mib_tree *get_symbol();
 
@@ -477,6 +482,7 @@ oid RFC1066_MIB[] = { 1, 3, 6, 1, 2, 1 };
 unsigned char RFC1066_MIB_text[] = ".iso.org.dod.internet.mgmt.mib";
 struct snmp_mib_tree *Mib;
 
+#if 0
 static void
 set_functions(subtree)
     struct snmp_mib_tree *subtree;
@@ -521,6 +527,7 @@ set_functions(subtree)
        set_functions(subtree->child_list);
     }
 }
+#endif
 
 void init_mib(char *file)
 {
@@ -531,7 +538,9 @@ void init_mib(char *file)
 
     if (file != NULL)
        Mib = read_mib(file);
+#if 0
     set_functions(Mib);
+#endif
 }
 
 
@@ -725,7 +734,7 @@ void sprint_objid(buf, objid, objidlen)
     get_symbol(objid, objidlen, subtree, buf + 1);
 }
 
-
+#if 0
 void print_variable(objid, objidlen, pvariable)
     oid     *objid;
     int            objidlen;
@@ -811,6 +820,7 @@ void print_value(objid, objidlen, pvariable)
     }
     printf("%s\n", tempbuf);
 }
+#endif
 
 static struct snmp_mib_tree *
 get_symbol(objid, objidlen, subtree, buf)
@@ -854,14 +864,12 @@ found:
 
 
 
-
-
+#if 0
 void print_variable_list(variable_list *V)
 {
   print_variable(V->name, V->name_length, V);
 }
 
-
 void print_variable_list_value(variable_list *pvariable)
 {
   char    buf[512];
@@ -878,6 +886,7 @@ void print_variable_list_value(variable_list *pvariable)
   }
   printf("%s", buf);
 }
+#endif
 
 void print_type(variable_list *var)
 {
index c61326d69a7434dcbbdf0fb1a86686ffd0ceebe9..fd63e44499334d4b427a6d69e1535cfa309df53d 100644 (file)
@@ -116,6 +116,7 @@ extern int snmp_errno;
 
 struct session_list *Sessions = NULL;
 
+#if 0
 /*
  * Get initial request ID for all transactions.
  */
@@ -131,7 +132,6 @@ static void init_snmp(void)
 }
 
 
-
 /*
  * Free each element in the input request list.
  */
@@ -148,6 +148,7 @@ static void free_request_list(rp)
        xfree((char *)orp);
     }
 }
+#endif
 
 /**********************************************************************/
 
@@ -158,6 +159,7 @@ static void free_request_list(rp)
  * the pointer passed to snmp_open()).  On any error, NULL is returned
  * and snmp_errno is set to the appropriate error code.
  */
+#if 0
 struct snmp_session *snmp_open(struct snmp_session *session)
 {
   struct session_list *slp;
@@ -334,7 +336,6 @@ struct snmp_session *snmp_open(struct snmp_session *session)
 }
 
 
-
 /*
  * Close the input session.  Frees all data allocated for the session,
  * dequeues any pending requests, and closes any sockets allocated for
@@ -376,6 +377,7 @@ int snmp_close(struct snmp_session *session)
   }
   return(1);
 }
+#endif
 
 /*
  * Takes a session and a pdu and serializes the ASN PDU into the area
@@ -443,6 +445,7 @@ u_char *snmp_parse(struct snmp_session *session,
  * On any error, 0 is returned.
  * The pdu is freed by snmp_send() unless a failure occured.
  */
+#if 0
 int snmp_send(struct snmp_session *session, struct snmp_pdu *pdu)
 {
     struct session_list *slp;
@@ -887,3 +890,4 @@ void snmp_api_stats(void *outP)
   fprintf(out, "LIBSNMP: Session List: %d active, %d have requests pending.\n",
          active, requests);
 }
+#endif