|
Packit Service |
b38f0b |
/* HEADER Testing SNMP handler registration via the old API */
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
static oid Oid[] = { 1, 3, 6, 1, 3, 327 }; /* experimental.327 */
|
|
Packit Service |
b38f0b |
struct variable var_array[] = {
|
|
Packit Service |
b38f0b |
{ 0, 0/*type*/, 0/*acl*/, NULL/*findVar*/, 7, { 1, 3, 6, 1, 3, 327, 1 } },
|
|
Packit Service |
b38f0b |
{ 0, 0/*type*/, 0/*acl*/, NULL/*findVar*/, 7, { 1, 3, 6, 1, 3, 327, 2 } },
|
|
Packit Service |
b38f0b |
{ 0, 0/*type*/, 0/*acl*/, NULL/*findVar*/, 7, { 1, 3, 6, 1, 3, 327, 3 } },
|
|
Packit Service |
b38f0b |
};
|
|
Packit Service |
b38f0b |
netsnmp_session *sess;
|
|
Packit Service |
b38f0b |
int res;
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
init_snmp("snmp");
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
sess = calloc(1, sizeof(*sess));
|
|
Packit Service |
b38f0b |
snmp_sess_init(sess);
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
res =
|
|
Packit Service |
b38f0b |
netsnmp_register_old_api("exp.327.a",
|
|
Packit Service |
b38f0b |
var_array,
|
|
Packit Service |
b38f0b |
sizeof(var_array[0]),
|
|
Packit Service |
b38f0b |
sizeof(var_array)/sizeof(var_array[0]),
|
|
Packit Service |
b38f0b |
Oid,
|
|
Packit Service |
b38f0b |
sizeof(Oid)/sizeof(Oid[0]),
|
|
Packit Service |
b38f0b |
2, /* priority */
|
|
Packit Service |
b38f0b |
0, /* range_subid */
|
|
Packit Service |
b38f0b |
0, /* range_ubound */
|
|
Packit Service |
b38f0b |
sess,
|
|
Packit Service |
b38f0b |
"context", 5/*timeout*/, 0/*flags - ignored*/);
|
|
Packit Service |
b38f0b |
OK(res == SNMPERR_SUCCESS, "Handler registration (1).");
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
/* Verify that duplicate registration does not cause any havoc. */
|
|
Packit Service |
b38f0b |
res =
|
|
Packit Service |
b38f0b |
netsnmp_register_old_api("exp.327.b",
|
|
Packit Service |
b38f0b |
var_array,
|
|
Packit Service |
b38f0b |
sizeof(var_array[0]),
|
|
Packit Service |
b38f0b |
sizeof(var_array)/sizeof(var_array[0]),
|
|
Packit Service |
b38f0b |
Oid,
|
|
Packit Service |
b38f0b |
sizeof(Oid)/sizeof(Oid[0]),
|
|
Packit Service |
b38f0b |
2, /* priority */
|
|
Packit Service |
b38f0b |
0, /* range_subid */
|
|
Packit Service |
b38f0b |
0, /* range_ubound */
|
|
Packit Service |
b38f0b |
sess,
|
|
Packit Service |
b38f0b |
"context", 5/*timeout*/, 0/*flags - ignored*/);
|
|
Packit Service |
b38f0b |
OK(res == MIB_DUPLICATE_REGISTRATION, "Handler registration (2).");
|
|
Packit Service |
b38f0b |
|
|
Packit Service |
b38f0b |
snmp_shutdown("snmp");
|