Lines Matching refs:pdu

169 snmp_pdu_create_response(struct snmp_pdu *pdu, struct snmp_pdu *resp)
172 strcpy(resp->community, pdu->community);
173 resp->version = pdu->version;
175 resp->request_id = pdu->request_id;
176 resp->version = pdu->version;
181 memcpy(&resp->engine, &pdu->engine, sizeof(pdu->engine));
182 memcpy(&resp->user, &pdu->user, sizeof(pdu->user));
184 resp->identifier = pdu->identifier;
185 resp->security_model = pdu->security_model;
186 resp->context_engine_len = pdu->context_engine_len;
187 memcpy(resp->context_engine, pdu->context_engine,
189 strlcpy(resp->context_name, pdu->context_name,
196 * the pdu error status and index will be set.
199 snmp_get(struct snmp_pdu *pdu, struct asn_buf *resp_b,
212 snmp_pdu_create_response(pdu, resp);
218 for (i = 0; i < pdu->nbindings; i++) {
219 resp->bindings[i].var = pdu->bindings[i].var;
220 if ((tp = find_node(&pdu->bindings[i], &except)) == NULL) {
221 if (pdu->version == SNMP_V1) {
224 pdu->error_status = SNMP_ERR_NOSUCHNAME;
225 pdu->error_index = i + 1;
242 if (pdu->version == SNMP_V1) {
243 pdu->error_status = SNMP_ERR_NOSUCHNAME;
244 pdu->error_index = i + 1;
253 pdu->error_status = SNMP_ERR_GENERR;
254 pdu->error_index = i + 1;
264 pdu->error_status = SNMP_ERR_TOOBIG;
265 pdu->error_index = 0;
272 pdu->error_status = SNMP_ERR_GENERR;
273 pdu->error_index = i + 1;
328 struct snmp_value *outb, struct snmp_pdu *pdu)
377 if (pdu->version == SNMP_V1) {
378 pdu->error_status = SNMP_ERR_NOSUCHNAME;
384 pdu->error_status = SNMP_ERR_GENERR;
396 snmp_getnext(struct snmp_pdu *pdu, struct asn_buf *resp_b,
407 snmp_pdu_create_response(pdu, resp);
412 for (i = 0; i < pdu->nbindings; i++) {
413 result = do_getnext(&context, &pdu->bindings[i],
414 &resp->bindings[i], pdu);
417 pdu->error_index = i + 1;
427 pdu->error_status = SNMP_ERR_TOOBIG;
428 pdu->error_index = 0;
435 pdu->error_status = SNMP_ERR_GENERR;
436 pdu->error_index = i + 1;
445 snmp_getbulk(struct snmp_pdu *pdu, struct asn_buf *resp_b,
459 snmp_pdu_create_response(pdu, resp);
465 if ((non_rep = pdu->error_status) > pdu->nbindings)
466 non_rep = pdu->nbindings;
470 result = do_getnext(&context, &pdu->bindings[i],
471 &resp->bindings[resp->nbindings], pdu);
474 pdu->error_index = i + 1;
488 pdu->error_status = SNMP_ERR_GENERR;
489 pdu->error_index = i + 1;
495 if (non_rep == pdu->nbindings)
499 for (cnt = 0; cnt < pdu->error_index; cnt++) {
501 for (i = non_rep; i < pdu->nbindings; i++) {
508 result = do_getnext(&context, &pdu->bindings[i],
509 &resp->bindings[resp->nbindings], pdu);
513 (pdu->nbindings - non_rep)],
514 &resp->bindings[resp->nbindings], pdu);
517 pdu->error_index = i + 1;
534 pdu->error_status = SNMP_ERR_GENERR;
535 pdu->error_index = i + 1;
552 rollback(struct context *context, struct snmp_pdu *pdu, u_int i)
559 b = &pdu->bindings[i];
570 if (pdu->version != SNMP_V1) {
571 pdu->error_status = SNMP_ERR_UNDO_FAILED;
572 pdu->error_index = 0;
656 snmp_set(struct snmp_pdu *pdu, struct asn_buf *resp_b,
671 snmp_pdu_create_response(pdu, resp);
680 for (i = 0; i < pdu->nbindings; i++) {
681 b = &pdu->bindings[i];
688 if (pdu->version == SNMP_V1) {
689 pdu->error_index = i + 1;
690 pdu->error_status = SNMP_ERR_NOSUCHNAME;
693 pdu->error_index = i + 1;
694 pdu->error_status = SNMP_ERR_NOT_WRITEABLE;
696 pdu->error_index = i + 1;
697 pdu->error_status = SNMP_ERR_NO_ACCESS;
699 pdu->error_index = i + 1;
700 pdu->error_status = SNMP_ERR_NO_CREATION;
714 if (pdu->version == SNMP_V1) {
715 pdu->error_index = i + 1;
716 pdu->error_status = SNMP_ERR_NOSUCHNAME;
718 pdu->error_index = i + 1;
719 pdu->error_status = SNMP_ERR_NOT_WRITEABLE;
728 if (pdu->version == SNMP_V1) {
729 pdu->error_index = i + 1;
730 pdu->error_status = SNMP_ERR_BADVALUE; /* v2: wrongType */
732 pdu->error_index = i + 1;
733 pdu->error_status = SNMP_ERR_WRONG_TYPE;
742 pdu->error_index = i + 1;
743 pdu->error_status = SNMP_ERR_GENERR;
749 pdu->error_index = i + 1;
750 pdu->error_status = SNMP_ERR_TOOBIG;
754 pdu->error_index = i + 1;
755 pdu->error_status = SNMP_ERR_GENERR;
768 for (i = 0; i < pdu->nbindings; i++) {
769 b = &pdu->bindings[i];
781 if (pdu->version == SNMP_V1) {
828 pdu->error_index = i + 1;
829 pdu->error_status = ret;
831 rollback(&context, pdu, i);
847 pdu->error_status = ret;
848 pdu->error_index = context.ctx.var_index;
851 if (pdu->version != SNMP_V1) {
852 pdu->error_status = SNMP_ERR_UNDO_FAILED;
853 pdu->error_index = 0;
856 rollback(&context, pdu, i);
872 for (i = 0; i < pdu->nbindings; i++) {
957 snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b,
981 resp.error_status = pdu->error_status;
982 resp.error_index = pdu->error_index;