From: kostas <> Date: Wed, 25 Feb 1998 05:46:13 +0000 (+0000) Subject: Putting #if 0's, to remove code later X-Git-Tag: SQUID_3_0_PRE1~4003 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7274dc3124467cff8620b5a9ad4fb4ca451fefc8;p=thirdparty%2Fsquid.git Putting #if 0's, to remove code later --- diff --git a/include/asn1.h b/include/asn1.h index 59bb0794e9..7164e69298 100644 --- a/include/asn1.h +++ b/include/asn1.h @@ -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 diff --git a/include/snmp.h b/include/snmp.h index 48ffc8ddff..41e89cdac6 100644 --- a/include/snmp.h +++ b/include/snmp.h @@ -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 $ * **********************************************************************/ @@ -49,26 +49,23 @@ #include "snmp_session.h" /* The various modules */ -#include -#include -#include +#include "snmp_vars.h" +#include "snmp_pdu.h" +#include "snmp_msg.h" /* Other functions */ -#include -#include -#include -#include -#if 0 -#include -#endif +#include "snmp_coexist.h" +#include "version.h" +#include "snmp_error.h" +#include "snmp_api_error.h" /* Other stuff I didn't touch */ -#include -#include -#include -#include -#include -#include -#include -#include +#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_ */ diff --git a/include/snmp_api.h b/include/snmp_api.h index ce3ca4a90d..fd671435fa 100644 --- a/include/snmp_api.h +++ b/include/snmp_api.h @@ -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 diff --git a/snmplib/Makefile.in b/snmplib/Makefile.in index acfad595a8..6617a2558c 100644 --- a/snmplib/Makefile.in +++ b/snmplib/Makefile.in @@ -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@ diff --git a/snmplib/asn1.c b/snmplib/asn1.c index a995dc9ebe..c24dda36bf 100644 --- a/snmplib/asn1.c +++ b/snmplib/asn1.c @@ -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 diff --git a/snmplib/coexistance.c b/snmplib/coexistance.c index 7351cd44f4..6da3b2ecd3 100644 --- a/snmplib/coexistance.c +++ b/snmplib/coexistance.c @@ -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); - } -} diff --git a/snmplib/mib.c b/snmplib/mib.c index 7151bb1144..a7d69b23c4 100644 --- a/snmplib/mib.c +++ b/snmplib/mib.c @@ -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) { diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c index c61326d69a..fd63e44499 100644 --- a/snmplib/snmp_api.c +++ b/snmplib/snmp_api.c @@ -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