| 1 |
/* HEADER Testing SNMP handler registration via the old API */ |
| 2 |
|
| 3 |
static oid Oid[] = { 1, 3, 6, 1, 3, 327 }; /* experimental.327 */ |
| 4 |
struct variable var_array[] = { |
| 5 |
{ 0, 0/*type*/, 0/*acl*/, NULL/*findVar*/, 7, { 1, 3, 6, 1, 3, 327, 1 } }, |
| 6 |
{ 0, 0/*type*/, 0/*acl*/, NULL/*findVar*/, 7, { 1, 3, 6, 1, 3, 327, 2 } }, |
| 7 |
{ 0, 0/*type*/, 0/*acl*/, NULL/*findVar*/, 7, { 1, 3, 6, 1, 3, 327, 3 } }, |
| 8 |
}; |
| 9 |
netsnmp_session *sess; |
| 10 |
int res; |
| 11 |
|
| 12 |
init_snmp("snmp"); |
| 13 |
|
| 14 |
sess = calloc(1, sizeof(*sess)); |
| 15 |
snmp_sess_init(sess); |
| 16 |
|
| 17 |
res = |
| 18 |
netsnmp_register_old_api("exp.327.a", |
| 19 |
var_array, |
| 20 |
sizeof(var_array[0]), |
| 21 |
sizeof(var_array)/sizeof(var_array[0]), |
| 22 |
Oid, |
| 23 |
sizeof(Oid)/sizeof(Oid[0]), |
| 24 |
2, /* priority */ |
| 25 |
0, /* range_subid */ |
| 26 |
0, /* range_ubound */ |
| 27 |
sess, |
| 28 |
"context", 5/*timeout*/, 0/*flags - ignored*/); |
| 29 |
OK(res == SNMPERR_SUCCESS, "Handler registration (1)."); |
| 30 |
|
| 31 |
/* Verify that duplicate registration does not cause any havoc. */ |
| 32 |
res = |
| 33 |
netsnmp_register_old_api("exp.327.b", |
| 34 |
var_array, |
| 35 |
sizeof(var_array[0]), |
| 36 |
sizeof(var_array)/sizeof(var_array[0]), |
| 37 |
Oid, |
| 38 |
sizeof(Oid)/sizeof(Oid[0]), |
| 39 |
2, /* priority */ |
| 40 |
0, /* range_subid */ |
| 41 |
0, /* range_ubound */ |
| 42 |
sess, |
| 43 |
"context", 5/*timeout*/, 0/*flags - ignored*/); |
| 44 |
OK(res == MIB_DUPLICATE_REGISTRATION, "Handler registration (2)."); |
| 45 |
|
| 46 |
snmp_shutdown("snmp"); |
| 47 |
free(sess); |