• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/bsnmp/lib/

Lines Matching defs:pdu

169 snmp_pdu_create_response(const struct snmp_pdu *pdu, struct snmp_pdu *resp)
172 strcpy(resp->community, pdu->community);
173 resp->version = pdu->version;
174 if (pdu->flags & SNMP_MSG_AUTODISCOVER)
178 resp->request_id = pdu->request_id;
179 resp->version = pdu->version;
184 memcpy(&resp->engine, &pdu->engine, sizeof(pdu->engine));
185 memcpy(&resp->user, &pdu->user, sizeof(pdu->user));
187 resp->identifier = pdu->identifier;
188 resp->security_model = pdu->security_model;
189 resp->context_engine_len = pdu->context_engine_len;
190 memcpy(resp->context_engine, pdu->context_engine,
192 strlcpy(resp->context_name, pdu->context_name,
199 * the pdu error status and index will be set.
202 snmp_get(struct snmp_pdu *pdu, struct asn_buf *resp_b,
215 snmp_pdu_create_response(pdu, resp);
221 for (i = 0; i < pdu->nbindings; i++) {
222 resp->bindings[i].var = pdu->bindings[i].var;
223 if ((tp = find_node(&pdu->bindings[i], &except)) == NULL) {
224 if (pdu->version == SNMP_V1) {
227 pdu->error_status = SNMP_ERR_NOSUCHNAME;
228 pdu->error_index = i + 1;
245 if (pdu->version == SNMP_V1) {
246 pdu->error_status = SNMP_ERR_NOSUCHNAME;
247 pdu->error_index = i + 1;
256 pdu->error_status = SNMP_ERR_GENERR;
257 pdu->error_index = i + 1;
267 pdu->error_status = SNMP_ERR_TOOBIG;
268 pdu->error_index = 0;
275 pdu->error_status = SNMP_ERR_GENERR;
276 pdu->error_index = i + 1;
336 struct snmp_value *outb, struct snmp_pdu *pdu)
385 if (pdu->version == SNMP_V1) {
386 pdu->error_status = SNMP_ERR_NOSUCHNAME;
392 pdu->error_status = SNMP_ERR_GENERR;
404 snmp_getnext(struct snmp_pdu *pdu, struct asn_buf *resp_b,
415 snmp_pdu_create_response(pdu, resp);
420 for (i = 0; i < pdu->nbindings; i++) {
421 result = do_getnext(&context, &pdu->bindings[i],
422 &resp->bindings[i], pdu);
425 pdu->error_index = i + 1;
435 pdu->error_status = SNMP_ERR_TOOBIG;
436 pdu->error_index = 0;
443 pdu->error_status = SNMP_ERR_GENERR;
444 pdu->error_index = i + 1;
459 snmp_getbulk(struct snmp_pdu *pdu, struct asn_buf *resp_b,
473 snmp_pdu_create_response(pdu, resp);
479 if ((non_rep = pdu->error_status) > pdu->nbindings)
480 non_rep = pdu->nbindings;
484 result = do_getnext(&context, &pdu->bindings[i],
485 &resp->bindings[resp->nbindings], pdu);
488 pdu->error_index = i + 1;
502 pdu->error_status = SNMP_ERR_GENERR;
503 pdu->error_index = i + 1;
509 if (non_rep == pdu->nbindings)
513 for (cnt = 0; cnt < pdu->error_index; cnt++) {
515 for (i = non_rep; i < pdu->nbindings; i++) {
522 result = do_getnext(&context, &pdu->bindings[i],
523 &resp->bindings[resp->nbindings], pdu);
527 (pdu->nbindings - non_rep)],
528 &resp->bindings[resp->nbindings], pdu);
531 pdu->error_index = i + 1;
548 pdu->error_status = SNMP_ERR_GENERR;
549 pdu->error_index = i + 1;
571 rollback(struct context *context, struct snmp_pdu *pdu, u_int i)
578 b = &pdu->bindings[i];
589 if (pdu->version != SNMP_V1) {
590 pdu->error_status = SNMP_ERR_UNDO_FAILED;
591 pdu->error_index = 0;
675 snmp_set(struct snmp_pdu *pdu, struct asn_buf *resp_b,
690 snmp_pdu_create_response(pdu, resp);
699 for (i = 0; i < pdu->nbindings; i++) {
700 b = &pdu->bindings[i];
707 if (pdu->version == SNMP_V1) {
708 pdu->error_index = i + 1;
709 pdu->error_status = SNMP_ERR_NOSUCHNAME;
712 pdu->error_index = i + 1;
713 pdu->error_status = SNMP_ERR_NOT_WRITEABLE;
715 pdu->error_index = i + 1;
716 pdu->error_status = SNMP_ERR_NO_ACCESS;
718 pdu->error_index = i + 1;
719 pdu->error_status = SNMP_ERR_NO_CREATION;
733 if (pdu->version == SNMP_V1) {
734 pdu->error_index = i + 1;
735 pdu->error_status = SNMP_ERR_NOSUCHNAME;
737 pdu->error_index = i + 1;
738 pdu->error_status = SNMP_ERR_NOT_WRITEABLE;
747 if (pdu->version == SNMP_V1) {
748 pdu->error_index = i + 1;
749 pdu->error_status = SNMP_ERR_BADVALUE; /* v2: wrongType */
751 pdu->error_index = i + 1;
752 pdu->error_status = SNMP_ERR_WRONG_TYPE;
761 pdu->error_index = i + 1;
762 pdu->error_status = SNMP_ERR_GENERR;
768 pdu->error_index = i + 1;
769 pdu->error_status = SNMP_ERR_TOOBIG;
773 pdu->error_index = i + 1;
774 pdu->error_status = SNMP_ERR_GENERR;
787 for (i = 0; i < pdu->nbindings; i++) {
788 b = &pdu->bindings[i];
800 if (pdu->version == SNMP_V1) {
847 pdu->error_index = i + 1;
848 pdu->error_status = ret;
850 rollback(&context, pdu, i);
866 pdu->error_status = ret;
867 pdu->error_index = context.ctx.var_index;
870 if (pdu->version != SNMP_V1) {
871 pdu->error_status = SNMP_ERR_UNDO_FAILED;
872 pdu->error_index = 0;
875 rollback(&context, pdu, i);
891 for (i = 0; i < pdu->nbindings; i++) {
976 snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b,
985 snmp_pdu_create_response(pdu, &resp);
990 if (pdu->version == SNMP_V3) {
994 snmp_error("cannot decode encrypted pdu");
999 snmp_error("cannot decode scoped pdu header");
1021 snmp_error("cannot get pdu header");
1027 snmp_error("bad pdu header tag");
1039 resp.error_status = pdu->error_status;
1040 resp.error_index = pdu->error_index;