4
* Expected SUCCESSes for all tests: 0
9
* Test of dump_snmpEngineID(). SUCCESSes: 0
12
static char *rcsid = "$Id: misctest.c,v 5.0 2002/04/20 07:30:22 hardaker Exp $"; /* */
14
#include <net-snmp/net-snmp-config.h>
17
#ifdef HAVE_NETINET_IN_H
18
#include <netinet/in.h>
24
#include "transform_oids.h"
30
extern int optind, optopt, opterr;
39
#define USAGE "Usage: %s [-h][-1a]"
40
#define OPTIONLIST "1ah"
42
int doalltests = 0, dodumpseid = 0;
44
#define ALLOPTIONS (doalltests + dodumpseid)
48
#define LOCAL_MAXBUF (1024 * 8)
51
#define OUTPUT(o) fprintf(stdout, "\n\n%s\n\n", o);
56
fprintf(stdout, "\nSUCCESS: %s\n", s); \
59
#define FAILED(e, f) \
61
if (e != SNMPERR_SUCCESS) { \
62
fprintf(stdout, "\nFAILED: %s\n", f); \
70
#define IDBLAT_4 "00010203"
72
#define IDVIOLATE1 "8000000300deedcafe"
74
#define IDIPv4 "80000003010a090807"
75
#define IDIPv6 "8000000302100f0e0d0c0b0a090807060504030201"
76
#define IDMAC "8000000303ffeeddccbbaa"
78
#define IDTEXT "8000000304"
79
#define PRINTABLE "Let this be printable."
81
#define IDOCTETS_7 "80000003050001020304050607"
83
#define IDLOCAL_11 "8000000306000102030405060708090a0b"
85
#define IDIPv4_EXTRA3 "80000003010a090807010203"
87
#define ID_NUMSTRINGS 10
95
void usage(FILE * ofp);
97
int test_dumpseid(void);
104
main(int argc, char **argv)
106
int rval = SNMPERR_SUCCESS, failcount = 0;
109
local_progname = argv[0];
114
while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
137
} /* endwhile getopt */
143
} else if (ALLOPTIONS != 1) {
152
if (dodumpseid || doalltests) {
153
failcount += test_dumpseid();
174
" -1 Test dump_snmpEngineID()." NL
176
" -h Help." NL "" NL, local_progname);
184
/*******************************************************************-o-******
188
* Number of failures.
194
test_dosomething(void)
196
int rval = SNMPERR_SUCCESS, failcount = 0;
198
EM0(1, "UNIMPLEMENTED"); /* EM(1); /* */
200
test_dosomething_quit:
203
} /* end test_dosomething() */
209
/*******************************************************************-o-******
213
* Number of failures.
215
* Test dump_snmpEngineID().
220
int /* rval = SNMPERR_SUCCESS, */
221
failcount = 0, tlen, count = 0;
223
char buf[SNMP_MAXBUF],
224
*s, *t, *ris, *rawid_set[ID_NUMSTRINGS + 1] = {
237
OUTPUT("Test of dump_snmpEngineID. "
238
"(Does not report failure or success.)");
241
while ((ris = rawid_set[count++])) {
242
tlen = hex_to_binary2(ris, strlen(ris), &t);
245
memset(buf, 0, SNMP_MAXBUF);
246
memcpy(buf, t, tlen);
247
tlen += sprintf(buf + tlen, "%s", PRINTABLE);
252
#ifdef SNMP_TESTING_CODE
253
s = dump_snmpEngineID(t, &tlen);
254
printf("%s (len=%d)\n", s, tlen);
266
} /* end test_dumpseid() */