mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 06:35:57 +00:00
Added external mibnode panic closure functions, tobe called for error responses.
This commit is contained in:
parent
e440590c37
commit
cfb082a20b
|
@ -160,7 +160,6 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
|
|
||||||
/* translate answer into a known lifeform */
|
/* translate answer into a known lifeform */
|
||||||
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
|
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
|
||||||
|
|
||||||
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
||||||
{
|
{
|
||||||
msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
|
msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
|
||||||
|
@ -168,6 +167,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->get_object_def_pc(request_id, np.ident_len, np.ident);
|
||||||
/* search failed, object id points to unknown object (nosuchname) */
|
/* search failed, object id points to unknown object (nosuchname) */
|
||||||
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
||||||
}
|
}
|
||||||
|
@ -211,6 +211,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->get_value_pc(request_id, &msg_ps->ext_object_def);
|
||||||
LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no variable space\n"));
|
LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no variable space\n"));
|
||||||
msg_ps->vb_ptr->ident = vb->ident;
|
msg_ps->vb_ptr->ident = vb->ident;
|
||||||
msg_ps->vb_ptr->ident_len = vb->ident_len;
|
msg_ps->vb_ptr->ident_len = vb->ident_len;
|
||||||
|
@ -220,9 +221,8 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* get_value_a() called to close external transaction */
|
|
||||||
en->get_value_a(request_id, &msg_ps->ext_object_def, 0, NULL);
|
|
||||||
/* vb->value_len == 0, empty value (e.g. empty string) */
|
/* vb->value_len == 0, empty value (e.g. empty string) */
|
||||||
|
en->get_value_a(request_id, &msg_ps->ext_object_def, 0, NULL);
|
||||||
vb->value = NULL;
|
vb->value = NULL;
|
||||||
snmp_varbind_tail_add(&msg_ps->outvb, vb);
|
snmp_varbind_tail_add(&msg_ps->outvb, vb);
|
||||||
/* search again (if vb_idx < msg_ps->invb.count) */
|
/* search again (if vb_idx < msg_ps->invb.count) */
|
||||||
|
@ -232,6 +232,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->get_value_pc(request_id, &msg_ps->ext_object_def);
|
||||||
LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no outvb space\n"));
|
LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no outvb space\n"));
|
||||||
snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
|
snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
|
||||||
}
|
}
|
||||||
|
@ -383,7 +384,6 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
|
|
||||||
/* translate answer into a known lifeform */
|
/* translate answer into a known lifeform */
|
||||||
en->get_object_def_a(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1], &msg_ps->ext_object_def);
|
en->get_object_def_a(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1], &msg_ps->ext_object_def);
|
||||||
|
|
||||||
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
||||||
{
|
{
|
||||||
msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
|
msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
|
||||||
|
@ -391,6 +391,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->get_object_def_pc(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1]);
|
||||||
/* search failed, object id points to unknown object (nosuchname) */
|
/* search failed, object id points to unknown object (nosuchname) */
|
||||||
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
||||||
}
|
}
|
||||||
|
@ -415,6 +416,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->get_value_pc(request_id, &msg_ps->ext_object_def);
|
||||||
LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_getnext_event: couldn't allocate outvb space\n"));
|
LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_getnext_event: couldn't allocate outvb space\n"));
|
||||||
snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
|
snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +529,6 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
|
|
||||||
/* translate answer into a known lifeform */
|
/* translate answer into a known lifeform */
|
||||||
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
|
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
|
||||||
|
|
||||||
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
||||||
{
|
{
|
||||||
msg_ps->state = SNMP_MSG_EXTERNAL_SET_TEST;
|
msg_ps->state = SNMP_MSG_EXTERNAL_SET_TEST;
|
||||||
|
@ -535,6 +536,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->get_object_def_pc(request_id, np.ident_len, np.ident);
|
||||||
/* search failed, object id points to unknown object (nosuchname) */
|
/* search failed, object id points to unknown object (nosuchname) */
|
||||||
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
||||||
}
|
}
|
||||||
|
@ -558,6 +560,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
en->set_test_pc(request_id,&msg_ps->ext_object_def);
|
||||||
/* bad value */
|
/* bad value */
|
||||||
snmp_error_response(msg_ps,SNMP_ES_BADVALUE);
|
snmp_error_response(msg_ps,SNMP_ES_BADVALUE);
|
||||||
}
|
}
|
||||||
|
@ -573,7 +576,6 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
|
|
||||||
/* translate answer into a known lifeform */
|
/* translate answer into a known lifeform */
|
||||||
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
|
en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
|
||||||
|
|
||||||
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
|
||||||
{
|
{
|
||||||
msg_ps->state = SNMP_MSG_EXTERNAL_SET_VALUE;
|
msg_ps->state = SNMP_MSG_EXTERNAL_SET_VALUE;
|
||||||
|
@ -582,8 +584,9 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* search failed, object id points to unknown object (nosuchname) */
|
en->get_object_def_pc(request_id, np.ident_len, np.ident);
|
||||||
snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
|
/* set_value failed, object has disappeared for some odd reason?? */
|
||||||
|
snmp_error_response(msg_ps,SNMP_ES_GENERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_VALUE)
|
else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_VALUE)
|
||||||
|
@ -594,6 +597,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
|
||||||
en = msg_ps->ext_mib_node;
|
en = msg_ps->ext_mib_node;
|
||||||
en->set_value_a(request_id, &msg_ps->ext_object_def, 0, NULL);
|
en->set_value_a(request_id, &msg_ps->ext_object_def, 0, NULL);
|
||||||
|
|
||||||
|
/** @todo use set_value_pc() if toobig */
|
||||||
msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE;
|
msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE;
|
||||||
msg_ps->vb_idx += 1;
|
msg_ps->vb_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,12 @@ struct mib_external_node
|
||||||
void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
|
void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
|
||||||
u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
|
u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
|
||||||
void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
|
void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
|
||||||
|
/** async Panic Close (agent returns error reply,
|
||||||
|
e.g. used for external transaction cleanup) */
|
||||||
|
void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
|
||||||
|
void (*get_value_pc)(u8_t rid, struct obj_def *od);
|
||||||
|
void (*set_test_pc)(u8_t rid, struct obj_def *od);
|
||||||
|
void (*set_value_pc)(u8_t rid, struct obj_def *od);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** export MIB tree from mib2.c */
|
/** export MIB tree from mib2.c */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user