Lines Matching refs:elem
422 const u_char *p, u_int len, struct be *elem) in asn1_parse() argument
427 elem->asnlen = 0; in asn1_parse()
428 elem->type = BE_ANY; in asn1_parse()
450 elem->form = form; in asn1_parse()
451 elem->class = class; in asn1_parse()
452 elem->id = id; in asn1_parse()
481 elem->id = id = (id << 7) | GET_U_1(p); in asn1_parse()
490 elem->asnlen = GET_U_1(p); in asn1_parse()
492 if (elem->asnlen & ASN_BIT8) { in asn1_parse()
493 uint32_t noct = elem->asnlen % ASN_BIT8; in asn1_parse()
494 elem->asnlen = 0; in asn1_parse()
501 elem->asnlen = (elem->asnlen << ASN_SHIFT8) | GET_U_1(p); in asn1_parse()
505 if (len < elem->asnlen) { in asn1_parse()
506 ND_PRINT("[len%d<asnlen%u]", len, elem->asnlen); in asn1_parse()
521 ND_TCHECK_LEN(p, elem->asnlen); in asn1_parse()
529 elem->type = BE_STR; in asn1_parse()
530 elem->data.str = p; in asn1_parse()
535 elem->type = BE_INT; in asn1_parse()
538 if (elem->asnlen == 0) { in asn1_parse()
544 for (i = elem->asnlen; i != 0; p++, i--) in asn1_parse()
546 elem->data.integer = data; in asn1_parse()
551 elem->type = BE_OID; in asn1_parse()
552 elem->data.raw = (const uint8_t *)p; in asn1_parse()
556 elem->type = BE_NULL; in asn1_parse()
557 elem->data.raw = NULL; in asn1_parse()
561 elem->type = BE_OCTET; in asn1_parse()
562 elem->data.raw = (const uint8_t *)p; in asn1_parse()
571 elem->type = BE_INETADDR; in asn1_parse()
572 elem->data.raw = (const uint8_t *)p; in asn1_parse()
579 elem->type = BE_UNS; in asn1_parse()
581 for (i = elem->asnlen; i != 0; p++, i--) in asn1_parse()
583 elem->data.uns = data; in asn1_parse()
589 elem->type = BE_UNS64; in asn1_parse()
591 for (i = elem->asnlen; i != 0; p++, i--) in asn1_parse()
593 elem->data.uns64 = data64; in asn1_parse()
598 elem->type = BE_OCTET; in asn1_parse()
599 elem->data.raw = (const uint8_t *)p; in asn1_parse()
609 elem->type = BE_NOSUCHOBJECT; in asn1_parse()
610 elem->data.raw = NULL; in asn1_parse()
614 elem->type = BE_NOSUCHINST; in asn1_parse()
615 elem->data.raw = NULL; in asn1_parse()
619 elem->type = BE_ENDOFMIBVIEW; in asn1_parse()
620 elem->data.raw = NULL; in asn1_parse()
627 elem->type = BE_OCTET; in asn1_parse()
628 elem->data.raw = (const uint8_t *)p; in asn1_parse()
638 elem->type = BE_SEQ; in asn1_parse()
639 elem->data.raw = (const uint8_t *)p; in asn1_parse()
643 elem->type = BE_OCTET; in asn1_parse()
644 elem->data.raw = (const uint8_t *)p; in asn1_parse()
651 elem->type = BE_PDU; in asn1_parse()
652 elem->data.raw = (const uint8_t *)p; in asn1_parse()
656 elem->type = BE_OCTET; in asn1_parse()
657 elem->data.raw = (const uint8_t *)p; in asn1_parse()
663 p += elem->asnlen; in asn1_parse()
664 len -= elem->asnlen; in asn1_parse()
665 return elem->asnlen + hdr; in asn1_parse()
673 asn1_print_octets(netdissect_options *ndo, struct be *elem) in asn1_print_octets() argument
675 const u_char *p = (const u_char *)elem->data.raw; in asn1_print_octets()
676 uint32_t asnlen = elem->asnlen; in asn1_print_octets()
690 asn1_print_string(netdissect_options *ndo, struct be *elem) in asn1_print_string() argument
694 uint32_t asnlen = elem->asnlen; in asn1_print_string()
697 p = elem->data.str; in asn1_print_string()
701 p = elem->data.str; in asn1_print_string()
729 struct be *elem) in asn1_print() argument
732 uint32_t asnlen = elem->asnlen; in asn1_print()
735 switch (elem->type) { in asn1_print()
738 if (asn1_print_octets(ndo, elem) == -1) in asn1_print()
748 p = (const u_char *)elem->data.raw; in asn1_print()
797 ND_PRINT("%d", elem->data.integer); in asn1_print()
801 ND_PRINT("%u", elem->data.uns); in asn1_print()
805 ND_PRINT("%" PRIu64, elem->data.uns64); in asn1_print()
809 if (asn1_print_string(ndo, elem) == -1) in asn1_print()
814 ND_PRINT("Seq(%u)", elem->asnlen); in asn1_print()
820 p = (const u_char *)elem->data.raw; in asn1_print()
830 ND_PRINT("[%s]", Class[EXCEPTIONS].Id[elem->id]); in asn1_print()
834 ND_PRINT("%s(%u)", Class[CONTEXT].Id[elem->id], elem->asnlen); in asn1_print()
865 struct be elem; in asn1_decode() local
869 i = asn1_parse(ndo, p, length, &elem); in asn1_decode()
872 if (asn1_print(ndo, &elem) < 0) in asn1_decode()
874 if (elem.type == BE_SEQ || elem.type == BE_PDU) { in asn1_decode()
876 asn1_decode(elem.data.raw, elem.asnlen); in asn1_decode()
911 struct be *elem, unsigned int *oid, in smi_decode_oid() argument
914 const u_char *p = (const u_char *)elem->data.raw; in smi_decode_oid()
915 uint32_t asnlen = elem->asnlen; in smi_decode_oid()
960 struct be *elem) in smi_check_a_range() argument
969 ok = (elem->asnlen == smiRange->minValue.value.unsigned32); in smi_check_a_range()
971 ok = (elem->asnlen >= smiRange->minValue.value.unsigned32 in smi_check_a_range()
972 && elem->asnlen <= smiRange->maxValue.value.unsigned32); in smi_check_a_range()
977 ok = (elem->data.integer >= smiRange->minValue.value.integer32 in smi_check_a_range()
978 && elem->data.integer <= smiRange->maxValue.value.integer32); in smi_check_a_range()
982 ok = (elem->data.uns >= smiRange->minValue.value.unsigned32 in smi_check_a_range()
983 && elem->data.uns <= smiRange->maxValue.value.unsigned32); in smi_check_a_range()
1009 static int smi_check_range(SmiType *smiType, struct be *elem) in smi_check_range() argument
1018 ok = smi_check_a_range(smiType, smiRange, elem); in smi_check_range()
1029 ok = smi_check_range(parentType, elem); in smi_check_range()
1038 struct be *elem, int *status) in smi_print_variable() argument
1045 *status = asn1_print(ndo, elem); in smi_print_variable()
1048 *status = smi_decode_oid(ndo, elem, oid, sizeof(oid) / sizeof(unsigned int), in smi_print_variable()
1054 *status = asn1_print(ndo, elem); in smi_print_variable()
1072 SmiNode *smiNode, u_short pduid, struct be *elem) in smi_print_value() argument
1081 return asn1_print(ndo, elem); in smi_print_value()
1084 if (elem->type == BE_NOSUCHOBJECT in smi_print_value()
1085 || elem->type == BE_NOSUCHINST in smi_print_value()
1086 || elem->type == BE_ENDOFMIBVIEW) { in smi_print_value()
1087 return asn1_print(ndo, elem); in smi_print_value()
1109 return asn1_print(ndo, elem); in smi_print_value()
1112 if (! smi_check_type(smiType->basetype, elem->type)) { in smi_print_value()
1116 if (! smi_check_range(smiType, elem)) { in smi_print_value()
1128 switch (elem->type) { in smi_print_value()
1134 smi_decode_oid(ndo, elem, oid, in smi_print_value()
1161 == elem->data.integer) { in smi_print_value()
1163 ND_PRINT("(%d)", elem->data.integer); in smi_print_value()
1173 return asn1_print(ndo, elem); in smi_print_value()
1219 struct be elem; in varbind_print() local
1227 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in varbind_print()
1229 if (elem.type != BE_SEQ) { in varbind_print()
1231 asn1_print(ndo, &elem); in varbind_print()
1237 length = elem.asnlen; in varbind_print()
1238 np = (const u_char *)elem.data.raw; in varbind_print()
1247 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in varbind_print()
1249 if (elem.type != BE_SEQ) { in varbind_print()
1251 asn1_print(ndo, &elem); in varbind_print()
1257 length = elem.asnlen; in varbind_print()
1258 np = (const u_char *)elem.data.raw; in varbind_print()
1261 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in varbind_print()
1263 if (elem.type != BE_OID) { in varbind_print()
1265 asn1_print(ndo, &elem); in varbind_print()
1269 smiNode = smi_print_variable(ndo, &elem, &status); in varbind_print()
1271 status = asn1_print(ndo, &elem); in varbind_print()
1283 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in varbind_print()
1287 if (elem.type != BE_NULL) { in varbind_print()
1289 if (asn1_print(ndo, &elem) < 0) in varbind_print()
1293 if (elem.type != BE_NULL) { in varbind_print()
1295 status = smi_print_value(ndo, smiNode, pduid, &elem); in varbind_print()
1297 status = asn1_print(ndo, &elem); in varbind_print()
1316 struct be elem; in snmppdu_print() local
1320 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in snmppdu_print()
1322 if (elem.type != BE_INT) { in snmppdu_print()
1324 asn1_print(ndo, &elem); in snmppdu_print()
1328 ND_PRINT("R=%d ", elem.data.integer); in snmppdu_print()
1333 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in snmppdu_print()
1335 if (elem.type != BE_INT) { in snmppdu_print()
1337 asn1_print(ndo, &elem); in snmppdu_print()
1343 && elem.data.integer != 0) { in snmppdu_print()
1346 DECODE_ErrorStatus(elem.data.integer)); in snmppdu_print()
1348 ND_PRINT(" N=%d", elem.data.integer); in snmppdu_print()
1349 } else if (elem.data.integer != 0) { in snmppdu_print()
1351 ND_PRINT(" %s", DECODE_ErrorStatus(elem.data.integer)); in snmppdu_print()
1352 error_status = elem.data.integer; in snmppdu_print()
1358 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in snmppdu_print()
1360 if (elem.type != BE_INT) { in snmppdu_print()
1362 asn1_print(ndo, &elem); in snmppdu_print()
1367 && elem.data.integer != 0) in snmppdu_print()
1368 ND_PRINT("[errorIndex(%d)!=0]", elem.data.integer); in snmppdu_print()
1370 ND_PRINT(" M=%d", elem.data.integer); in snmppdu_print()
1371 else if (elem.data.integer != 0) { in snmppdu_print()
1373 ND_PRINT("[errorIndex(%d) w/o errorStatus]", elem.data.integer); in snmppdu_print()
1375 ND_PRINT("@%d", elem.data.integer); in snmppdu_print()
1392 struct be elem; in trappdu_print() local
1398 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in trappdu_print()
1400 if (elem.type != BE_OID) { in trappdu_print()
1402 asn1_print(ndo, &elem); in trappdu_print()
1405 if (asn1_print(ndo, &elem) < 0) in trappdu_print()
1413 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in trappdu_print()
1415 if (elem.type != BE_INETADDR) { in trappdu_print()
1417 asn1_print(ndo, &elem); in trappdu_print()
1420 if (asn1_print(ndo, &elem) < 0) in trappdu_print()
1426 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in trappdu_print()
1428 if (elem.type != BE_INT) { in trappdu_print()
1430 asn1_print(ndo, &elem); in trappdu_print()
1433 generic = elem.data.integer; in trappdu_print()
1442 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in trappdu_print()
1444 if (elem.type != BE_INT) { in trappdu_print()
1446 asn1_print(ndo, &elem); in trappdu_print()
1450 if (elem.data.integer != 0) in trappdu_print()
1451 ND_PRINT("[specific-trap(%d)!=0]", elem.data.integer); in trappdu_print()
1453 ND_PRINT(" s=%d", elem.data.integer); in trappdu_print()
1460 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in trappdu_print()
1462 if (elem.type != BE_UNS) { /* XXX */ in trappdu_print()
1464 asn1_print(ndo, &elem); in trappdu_print()
1467 if (asn1_print(ndo, &elem) < 0) in trappdu_print()
1544 struct be elem; in scopedpdu_print() local
1548 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in scopedpdu_print()
1550 if (elem.type != BE_SEQ) { in scopedpdu_print()
1552 asn1_print(ndo, &elem); in scopedpdu_print()
1555 length = elem.asnlen; in scopedpdu_print()
1556 np = (const u_char *)elem.data.raw; in scopedpdu_print()
1559 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in scopedpdu_print()
1561 if (elem.type != BE_STR) { in scopedpdu_print()
1563 asn1_print(ndo, &elem); in scopedpdu_print()
1570 if (asn1_print_octets(ndo, &elem) == -1) in scopedpdu_print()
1575 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in scopedpdu_print()
1577 if (elem.type != BE_STR) { in scopedpdu_print()
1579 asn1_print(ndo, &elem); in scopedpdu_print()
1586 if (asn1_print_string(ndo, &elem) == -1) in scopedpdu_print()
1600 struct be elem; in community_print() local
1604 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in community_print()
1606 if (elem.type != BE_STR) { in community_print()
1608 asn1_print(ndo, &elem); in community_print()
1612 if (!(elem.asnlen == sizeof(DEF_COMMUNITY) - 1 && in community_print()
1613 strncmp((const char *)elem.data.str, DEF_COMMUNITY, in community_print()
1617 if (asn1_print_string(ndo, &elem) == -1) in community_print()
1634 struct be elem; in usm_print() local
1638 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1640 if (elem.type != BE_SEQ) { in usm_print()
1642 asn1_print(ndo, &elem); in usm_print()
1645 length = elem.asnlen; in usm_print()
1646 np = (const u_char *)elem.data.raw; in usm_print()
1649 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1651 if (elem.type != BE_STR) { in usm_print()
1653 asn1_print(ndo, &elem); in usm_print()
1660 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1662 if (elem.type != BE_INT) { in usm_print()
1664 asn1_print(ndo, &elem); in usm_print()
1668 ND_PRINT("B=%d ", elem.data.integer); in usm_print()
1673 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1675 if (elem.type != BE_INT) { in usm_print()
1677 asn1_print(ndo, &elem); in usm_print()
1681 ND_PRINT("T=%d ", elem.data.integer); in usm_print()
1686 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1688 if (elem.type != BE_STR) { in usm_print()
1690 asn1_print(ndo, &elem); in usm_print()
1697 if (asn1_print_string(ndo, &elem) == -1) in usm_print()
1702 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1704 if (elem.type != BE_STR) { in usm_print()
1706 asn1_print(ndo, &elem); in usm_print()
1713 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in usm_print()
1715 if (elem.type != BE_STR) { in usm_print()
1717 asn1_print(ndo, &elem); in usm_print()
1734 struct be elem; in v3msg_print() local
1742 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in v3msg_print()
1744 if (elem.type != BE_SEQ) { in v3msg_print()
1746 asn1_print(ndo, &elem); in v3msg_print()
1749 length = elem.asnlen; in v3msg_print()
1750 np = (const u_char *)elem.data.raw; in v3msg_print()
1757 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in v3msg_print()
1759 if (elem.type != BE_INT) { in v3msg_print()
1761 asn1_print(ndo, &elem); in v3msg_print()
1768 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in v3msg_print()
1770 if (elem.type != BE_INT) { in v3msg_print()
1772 asn1_print(ndo, &elem); in v3msg_print()
1779 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in v3msg_print()
1781 if (elem.type != BE_STR) { in v3msg_print()
1783 asn1_print(ndo, &elem); in v3msg_print()
1786 if (elem.asnlen != 1) { in v3msg_print()
1787 ND_PRINT("[msgFlags size %d]", elem.asnlen); in v3msg_print()
1790 flags = GET_U_1(elem.data.str); in v3msg_print()
1805 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in v3msg_print()
1807 if (elem.type != BE_INT) { in v3msg_print()
1809 asn1_print(ndo, &elem); in v3msg_print()
1812 model = elem.data.integer; in v3msg_print()
1836 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in v3msg_print()
1838 if (elem.type != BE_STR) { in v3msg_print()
1840 asn1_print(ndo, &elem); in v3msg_print()
1847 usm_print(ndo, elem.data.str, elem.asnlen); in v3msg_print()
1871 struct be elem; in snmp_print() local
1879 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in snmp_print()
1881 if (elem.type != BE_SEQ) { in snmp_print()
1883 asn1_print(ndo, &elem); in snmp_print()
1889 length = elem.asnlen; in snmp_print()
1890 np = (const u_char *)elem.data.raw; in snmp_print()
1893 if ((count = asn1_parse(ndo, np, length, &elem)) < 0) in snmp_print()
1895 if (elem.type != BE_INT) { in snmp_print()
1897 asn1_print(ndo, &elem); in snmp_print()
1901 switch (elem.data.integer) { in snmp_print()
1906 ND_PRINT("{ %s ", SnmpVersion[elem.data.integer]); in snmp_print()
1909 ND_PRINT("SNMP [version = %d]", elem.data.integer); in snmp_print()
1912 version = elem.data.integer; in snmp_print()
1925 ND_PRINT("[version = %d]", elem.data.integer); in snmp_print()