• Home
  • Raw
  • Download

Lines Matching refs:elem

406 asn1_parse(register const u_char *p, u_int len, struct be *elem)  in asn1_parse()  argument
411 elem->asnlen = 0; in asn1_parse()
412 elem->type = BE_ANY; in asn1_parse()
435 elem->form = form; in asn1_parse()
436 elem->class = class; in asn1_parse()
437 elem->id = id; in asn1_parse()
464 elem->id = id = (id << 7) | *p; in asn1_parse()
474 elem->asnlen = *p; in asn1_parse()
476 if (elem->asnlen & ASN_BIT8) { in asn1_parse()
477 u_int32_t noct = elem->asnlen % ASN_BIT8; in asn1_parse()
478 elem->asnlen = 0; in asn1_parse()
485 elem->asnlen = (elem->asnlen << ASN_SHIFT8) | *p++; in asn1_parse()
487 if (len < elem->asnlen) { in asn1_parse()
488 printf("[len%d<asnlen%u]", len, elem->asnlen); in asn1_parse()
510 elem->type = BE_STR; in asn1_parse()
511 elem->data.str = p; in asn1_parse()
516 elem->type = BE_INT; in asn1_parse()
519 TCHECK2(*p, elem->asnlen); in asn1_parse()
522 for (i = elem->asnlen; i-- > 0; p++) in asn1_parse()
524 elem->data.integer = data; in asn1_parse()
529 elem->type = BE_OID; in asn1_parse()
530 elem->data.raw = (caddr_t)p; in asn1_parse()
534 elem->type = BE_NULL; in asn1_parse()
535 elem->data.raw = NULL; in asn1_parse()
539 elem->type = BE_OCTET; in asn1_parse()
540 elem->data.raw = (caddr_t)p; in asn1_parse()
550 elem->type = BE_INETADDR; in asn1_parse()
551 elem->data.raw = (caddr_t)p; in asn1_parse()
558 TCHECK2(*p, elem->asnlen); in asn1_parse()
559 elem->type = BE_UNS; in asn1_parse()
561 for (i = elem->asnlen; i-- > 0; p++) in asn1_parse()
563 elem->data.uns = data; in asn1_parse()
569 TCHECK2(*p, elem->asnlen); in asn1_parse()
570 elem->type = BE_UNS64; in asn1_parse()
572 for (i = elem->asnlen; i-- > 0; p++) { in asn1_parse()
577 elem->data.uns64.high = high; in asn1_parse()
578 elem->data.uns64.low = low; in asn1_parse()
583 elem->type = BE_OCTET; in asn1_parse()
584 elem->data.raw = (caddr_t)p; in asn1_parse()
594 elem->type = BE_NOSUCHOBJECT; in asn1_parse()
595 elem->data.raw = NULL; in asn1_parse()
599 elem->type = BE_NOSUCHINST; in asn1_parse()
600 elem->data.raw = NULL; in asn1_parse()
604 elem->type = BE_ENDOFMIBVIEW; in asn1_parse()
605 elem->data.raw = NULL; in asn1_parse()
613 TCHECK2(*p, elem->asnlen); in asn1_parse()
614 elem->type = BE_OCTET; in asn1_parse()
615 elem->data.raw = (caddr_t)p; in asn1_parse()
625 elem->type = BE_SEQ; in asn1_parse()
626 elem->data.raw = (caddr_t)p; in asn1_parse()
630 elem->type = BE_OCTET; in asn1_parse()
631 elem->data.raw = (caddr_t)p; in asn1_parse()
638 elem->type = BE_PDU; in asn1_parse()
639 elem->data.raw = (caddr_t)p; in asn1_parse()
643 elem->type = BE_OCTET; in asn1_parse()
644 elem->data.raw = (caddr_t)p; in asn1_parse()
651 p += elem->asnlen; in asn1_parse()
652 len -= elem->asnlen; in asn1_parse()
653 return elem->asnlen + hdr; in asn1_parse()
666 asn1_print(struct be *elem) in asn1_print() argument
668 u_char *p = (u_char *)elem->data.raw; in asn1_print()
669 u_int32_t asnlen = elem->asnlen; in asn1_print()
672 switch (elem->type) { in asn1_print()
731 printf("%d", elem->data.integer); in asn1_print()
735 printf("%u", elem->data.uns); in asn1_print()
742 if (elem->data.uns64.high == 0) { in asn1_print()
743 printf("%u", elem->data.uns64.low); in asn1_print()
746 d = elem->data.uns64.high * 4294967296.0; /* 2^32 */ in asn1_print()
747 if (elem->data.uns64.high <= 0x1fffff) { in asn1_print()
748 d += elem->data.uns64.low; in asn1_print()
756 d += (elem->data.uns64.low & 0xfffff000); in asn1_print()
763 elem->data.uns64.low & 0xfff); in asn1_print()
782 const u_char *p = elem->data.str; in asn1_print()
786 p = elem->data.str; in asn1_print()
803 printf("Seq(%u)", elem->asnlen); in asn1_print()
818 printf("[%s]", Class[EXCEPTIONS].Id[elem->id]); in asn1_print()
823 Class[CONTEXT].Id[elem->id], elem->asnlen); in asn1_print()
854 struct be elem; in asn1_decode() local
858 i = asn1_parse(p, length, &elem); in asn1_decode()
861 if (asn1_print(&elem) < 0) in asn1_decode()
863 if (elem.type == BE_SEQ || elem.type == BE_PDU) { in asn1_decode()
865 asn1_decode(elem.data.raw, elem.asnlen); in asn1_decode()
899 smi_decode_oid(struct be *elem, unsigned int *oid, in smi_decode_oid() argument
902 u_char *p = (u_char *)elem->data.raw; in smi_decode_oid()
903 u_int32_t asnlen = elem->asnlen; in smi_decode_oid()
951 struct be *elem) in smi_check_a_range() argument
960 ok = (elem->asnlen == smiRange->minValue.value.unsigned32); in smi_check_a_range()
962 ok = (elem->asnlen >= smiRange->minValue.value.unsigned32 in smi_check_a_range()
963 && elem->asnlen <= smiRange->maxValue.value.unsigned32); in smi_check_a_range()
968 ok = (elem->data.integer >= smiRange->minValue.value.integer32 in smi_check_a_range()
969 && elem->data.integer <= smiRange->maxValue.value.integer32); in smi_check_a_range()
973 ok = (elem->data.uns >= smiRange->minValue.value.unsigned32 in smi_check_a_range()
974 && elem->data.uns <= smiRange->maxValue.value.unsigned32); in smi_check_a_range()
1000 static int smi_check_range(SmiType *smiType, struct be *elem) in smi_check_range() argument
1009 ok = smi_check_a_range(smiType, smiRange, elem); in smi_check_range()
1020 ok = smi_check_range(parentType, elem); in smi_check_range()
1027 static SmiNode *smi_print_variable(struct be *elem, int *status) in smi_print_variable() argument
1033 *status = smi_decode_oid(elem, oid, sizeof(oid)/sizeof(unsigned int), in smi_print_variable()
1039 *status = asn1_print(elem); in smi_print_variable()
1057 smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem) in smi_print_value() argument
1066 return asn1_print(elem); in smi_print_value()
1069 if (elem->type == BE_NOSUCHOBJECT in smi_print_value()
1070 || elem->type == BE_NOSUCHINST in smi_print_value()
1071 || elem->type == BE_ENDOFMIBVIEW) { in smi_print_value()
1072 return asn1_print(elem); in smi_print_value()
1094 return asn1_print(elem); in smi_print_value()
1097 if (! smi_check_type(smiType->basetype, elem->type)) { in smi_print_value()
1101 if (! smi_check_range(smiType, elem)) { in smi_print_value()
1113 switch (elem->type) { in smi_print_value()
1118 smi_decode_oid(elem, oid, in smi_print_value()
1145 == elem->data.integer) { in smi_print_value()
1147 printf("(%d)", elem->data.integer); in smi_print_value()
1157 return asn1_print(elem); in smi_print_value()
1202 struct be elem; in varbind_print() local
1210 if ((count = asn1_parse(np, length, &elem)) < 0) in varbind_print()
1212 if (elem.type != BE_SEQ) { in varbind_print()
1214 asn1_print(&elem); in varbind_print()
1220 length = elem.asnlen; in varbind_print()
1221 np = (u_char *)elem.data.raw; in varbind_print()
1230 if ((count = asn1_parse(np, length, &elem)) < 0) in varbind_print()
1232 if (elem.type != BE_SEQ) { in varbind_print()
1234 asn1_print(&elem); in varbind_print()
1240 length = elem.asnlen; in varbind_print()
1241 np = (u_char *)elem.data.raw; in varbind_print()
1244 if ((count = asn1_parse(np, length, &elem)) < 0) in varbind_print()
1246 if (elem.type != BE_OID) { in varbind_print()
1248 asn1_print(&elem); in varbind_print()
1252 smiNode = smi_print_variable(&elem, &status); in varbind_print()
1254 status = asn1_print(&elem); in varbind_print()
1266 if ((count = asn1_parse(np, length, &elem)) < 0) in varbind_print()
1270 if (elem.type != BE_NULL) { in varbind_print()
1272 if (asn1_print(&elem) < 0) in varbind_print()
1276 if (elem.type != BE_NULL) { in varbind_print()
1278 status = smi_print_value(smiNode, pduid, &elem); in varbind_print()
1280 status = asn1_print(&elem); in varbind_print()
1298 struct be elem; in snmppdu_print() local
1302 if ((count = asn1_parse(np, length, &elem)) < 0) in snmppdu_print()
1304 if (elem.type != BE_INT) { in snmppdu_print()
1306 asn1_print(&elem); in snmppdu_print()
1310 printf("R=%d ", elem.data.integer); in snmppdu_print()
1315 if ((count = asn1_parse(np, length, &elem)) < 0) in snmppdu_print()
1317 if (elem.type != BE_INT) { in snmppdu_print()
1319 asn1_print(&elem); in snmppdu_print()
1325 && elem.data.integer != 0) { in snmppdu_print()
1328 DECODE_ErrorStatus(elem.data.integer)); in snmppdu_print()
1330 printf(" N=%d", elem.data.integer); in snmppdu_print()
1331 } else if (elem.data.integer != 0) { in snmppdu_print()
1333 printf(" %s", DECODE_ErrorStatus(elem.data.integer)); in snmppdu_print()
1334 error = elem.data.integer; in snmppdu_print()
1340 if ((count = asn1_parse(np, length, &elem)) < 0) in snmppdu_print()
1342 if (elem.type != BE_INT) { in snmppdu_print()
1344 asn1_print(&elem); in snmppdu_print()
1349 && elem.data.integer != 0) in snmppdu_print()
1350 printf("[errorIndex(%d)!=0]", elem.data.integer); in snmppdu_print()
1352 printf(" M=%d", elem.data.integer); in snmppdu_print()
1353 else if (elem.data.integer != 0) { in snmppdu_print()
1356 elem.data.integer); in snmppdu_print()
1358 printf("@%d", elem.data.integer); in snmppdu_print()
1359 error = elem.data.integer; in snmppdu_print()
1378 struct be elem; in trappdu_print() local
1384 if ((count = asn1_parse(np, length, &elem)) < 0) in trappdu_print()
1386 if (elem.type != BE_OID) { in trappdu_print()
1388 asn1_print(&elem); in trappdu_print()
1391 if (asn1_print(&elem) < 0) in trappdu_print()
1399 if ((count = asn1_parse(np, length, &elem)) < 0) in trappdu_print()
1401 if (elem.type != BE_INETADDR) { in trappdu_print()
1403 asn1_print(&elem); in trappdu_print()
1406 if (asn1_print(&elem) < 0) in trappdu_print()
1412 if ((count = asn1_parse(np, length, &elem)) < 0) in trappdu_print()
1414 if (elem.type != BE_INT) { in trappdu_print()
1416 asn1_print(&elem); in trappdu_print()
1419 generic = elem.data.integer; in trappdu_print()
1428 if ((count = asn1_parse(np, length, &elem)) < 0) in trappdu_print()
1430 if (elem.type != BE_INT) { in trappdu_print()
1432 asn1_print(&elem); in trappdu_print()
1436 if (elem.data.integer != 0) in trappdu_print()
1437 printf("[specific-trap(%d)!=0]", elem.data.integer); in trappdu_print()
1439 printf(" s=%d", elem.data.integer); in trappdu_print()
1446 if ((count = asn1_parse(np, length, &elem)) < 0) in trappdu_print()
1448 if (elem.type != BE_UNS) { /* XXX */ in trappdu_print()
1450 asn1_print(&elem); in trappdu_print()
1453 if (asn1_print(&elem) < 0) in trappdu_print()
1529 struct be elem; in scopedpdu_print() local
1533 if ((count = asn1_parse(np, length, &elem)) < 0) in scopedpdu_print()
1535 if (elem.type != BE_SEQ) { in scopedpdu_print()
1537 asn1_print(&elem); in scopedpdu_print()
1540 length = elem.asnlen; in scopedpdu_print()
1541 np = (u_char *)elem.data.raw; in scopedpdu_print()
1544 if ((count = asn1_parse(np, length, &elem)) < 0) in scopedpdu_print()
1546 if (elem.type != BE_STR) { in scopedpdu_print()
1548 asn1_print(&elem); in scopedpdu_print()
1555 for (i = 0; i < (int)elem.asnlen; i++) { in scopedpdu_print()
1556 printf("0x%02X", elem.data.str[i]); in scopedpdu_print()
1561 if ((count = asn1_parse(np, length, &elem)) < 0) in scopedpdu_print()
1563 if (elem.type != BE_STR) { in scopedpdu_print()
1565 asn1_print(&elem); in scopedpdu_print()
1571 printf("C=%.*s ", (int)elem.asnlen, elem.data.str); in scopedpdu_print()
1582 struct be elem; in community_print() local
1586 if ((count = asn1_parse(np, length, &elem)) < 0) in community_print()
1588 if (elem.type != BE_STR) { in community_print()
1590 asn1_print(&elem); in community_print()
1594 if (!(elem.asnlen == sizeof(DEF_COMMUNITY) - 1 && in community_print()
1595 strncmp((char *)elem.data.str, DEF_COMMUNITY, in community_print()
1598 printf("C=%.*s ", (int)elem.asnlen, elem.data.str); in community_print()
1611 struct be elem; in usm_print() local
1615 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1617 if (elem.type != BE_SEQ) { in usm_print()
1619 asn1_print(&elem); in usm_print()
1622 length = elem.asnlen; in usm_print()
1623 np = (u_char *)elem.data.raw; in usm_print()
1626 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1628 if (elem.type != BE_STR) { in usm_print()
1630 asn1_print(&elem); in usm_print()
1637 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1639 if (elem.type != BE_INT) { in usm_print()
1641 asn1_print(&elem); in usm_print()
1645 printf("B=%d ", elem.data.integer); in usm_print()
1650 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1652 if (elem.type != BE_INT) { in usm_print()
1654 asn1_print(&elem); in usm_print()
1658 printf("T=%d ", elem.data.integer); in usm_print()
1663 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1665 if (elem.type != BE_STR) { in usm_print()
1667 asn1_print(&elem); in usm_print()
1673 printf("U=%.*s ", (int)elem.asnlen, elem.data.str); in usm_print()
1676 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1678 if (elem.type != BE_STR) { in usm_print()
1680 asn1_print(&elem); in usm_print()
1687 if ((count = asn1_parse(np, length, &elem)) < 0) in usm_print()
1689 if (elem.type != BE_STR) { in usm_print()
1691 asn1_print(&elem); in usm_print()
1707 struct be elem; in v3msg_print() local
1715 if ((count = asn1_parse(np, length, &elem)) < 0) in v3msg_print()
1717 if (elem.type != BE_SEQ) { in v3msg_print()
1719 asn1_print(&elem); in v3msg_print()
1722 length = elem.asnlen; in v3msg_print()
1723 np = (u_char *)elem.data.raw; in v3msg_print()
1730 if ((count = asn1_parse(np, length, &elem)) < 0) in v3msg_print()
1732 if (elem.type != BE_INT) { in v3msg_print()
1734 asn1_print(&elem); in v3msg_print()
1741 if ((count = asn1_parse(np, length, &elem)) < 0) in v3msg_print()
1743 if (elem.type != BE_INT) { in v3msg_print()
1745 asn1_print(&elem); in v3msg_print()
1752 if ((count = asn1_parse(np, length, &elem)) < 0) in v3msg_print()
1754 if (elem.type != BE_STR) { in v3msg_print()
1756 asn1_print(&elem); in v3msg_print()
1759 if (elem.asnlen != 1) { in v3msg_print()
1760 printf("[msgFlags size %d]", elem.asnlen); in v3msg_print()
1763 flags = elem.data.str[0]; in v3msg_print()
1779 if ((count = asn1_parse(np, length, &elem)) < 0) in v3msg_print()
1781 if (elem.type != BE_INT) { in v3msg_print()
1783 asn1_print(&elem); in v3msg_print()
1786 model = elem.data.integer; in v3msg_print()
1810 if ((count = asn1_parse(np, length, &elem)) < 0) in v3msg_print()
1812 if (elem.type != BE_STR) { in v3msg_print()
1814 asn1_print(&elem); in v3msg_print()
1821 usm_print(elem.data.str, elem.asnlen); in v3msg_print()
1844 struct be elem; in snmp_print() local
1851 if ((count = asn1_parse(np, length, &elem)) < 0) in snmp_print()
1853 if (elem.type != BE_SEQ) { in snmp_print()
1855 asn1_print(&elem); in snmp_print()
1861 length = elem.asnlen; in snmp_print()
1862 np = (u_char *)elem.data.raw; in snmp_print()
1865 if ((count = asn1_parse(np, length, &elem)) < 0) in snmp_print()
1867 if (elem.type != BE_INT) { in snmp_print()
1869 asn1_print(&elem); in snmp_print()
1873 switch (elem.data.integer) { in snmp_print()
1878 printf("{ %s ", SnmpVersion[elem.data.integer]); in snmp_print()
1881 printf("[version = %d]", elem.data.integer); in snmp_print()
1884 version = elem.data.integer; in snmp_print()
1897 printf("[version = %d]", elem.data.integer); in snmp_print()