* 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 $
*
**********************************************************************/
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
* 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_ */
* 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 *);
/*
*/
int snmp_send(struct snmp_session *, struct snmp_pdu *);
-
/*
* void snmp_read(fdset)
* fd_set *fdset;
void snmp_api_stats(void *);
-
+#endif
#ifdef __cplusplus
}
#endif
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@
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.
*data++ = (u_char)(length & 0xFF);
return(data);
}
+#endif
/*
* asn_parse_length - interprets the length of the current object.
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
*datalength -= (bufp - data);
return(bufp + asn_length);
}
+#endif
/*
* asn_build_null - Builds an ASN null object.
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
return(data + strlength);
}
+#endif
/*
* To do: Write an asn_parse_exception function to go with the new
}
}
-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);
- }
-}
#include "util.h"
#include "snprintf.h"
-
+#if 0
static void sprint_by_type();
+#endif
+#if 0
static char *
uptimeString(timeticks, buf)
int timeticks;
}
sprintf(buf, "%d.%d.%d.%d",ip[0], ip[1], ip[2], ip[3]);
}
+#endif
#if 0
static void
}
#endif
+#if 0
static void
sprint_null(buf, var, foo, quiet)
char *buf;
break;
}
}
+#endif
static struct snmp_mib_tree *get_symbol();
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;
set_functions(subtree->child_list);
}
}
+#endif
void init_mib(char *file)
{
if (file != NULL)
Mib = read_mib(file);
+#if 0
set_functions(Mib);
+#endif
}
get_symbol(objid, objidlen, subtree, buf + 1);
}
-
+#if 0
void print_variable(objid, objidlen, pvariable)
oid *objid;
int objidlen;
}
printf("%s\n", tempbuf);
}
+#endif
static struct snmp_mib_tree *
get_symbol(objid, objidlen, subtree, buf)
-
-
+#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];
}
printf("%s", buf);
}
+#endif
void print_type(variable_list *var)
{
struct session_list *Sessions = NULL;
+#if 0
/*
* Get initial request ID for all transactions.
*/
}
-
/*
* Free each element in the input request list.
*/
xfree((char *)orp);
}
}
+#endif
/**********************************************************************/
* 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;
}
-
/*
* Close the input session. Frees all data allocated for the session,
* dequeues any pending requests, and closes any sockets allocated for
}
return(1);
}
+#endif
/*
* Takes a session and a pdu and serializes the ASN PDU into the area
* 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;
fprintf(out, "LIBSNMP: Session List: %d active, %d have requests pending.\n",
active, requests);
}
+#endif