Home | History | Annotate | Download | only in tcpdump

Lines Matching defs:elem

404            register const u_char *p, u_int len, struct be *elem)
409 elem->asnlen = 0;
410 elem->type = BE_ANY;
433 elem->form = form;
434 elem->class = class;
435 elem->id = id;
462 elem->id = id = (id << 7) | *p;
472 elem->asnlen = *p;
474 if (elem->asnlen & ASN_BIT8) {
475 uint32_t noct = elem->asnlen % ASN_BIT8;
476 elem->asnlen = 0;
483 elem->asnlen = (elem->asnlen << ASN_SHIFT8) | *p++;
485 if (len < elem->asnlen) {
486 ND_PRINT((ndo, "[len%d<asnlen%u]", len, elem->asnlen));
508 elem->type = BE_STR;
509 elem->data.str = p;
514 elem->type = BE_INT;
517 ND_TCHECK2(*p, elem->asnlen);
520 for (i = elem->asnlen; i-- > 0; p++)
522 elem->data.integer = data;
527 elem->type = BE_OID;
528 elem->data.raw = (caddr_t)p;
532 elem->type = BE_NULL;
533 elem->data.raw = NULL;
537 elem->type = BE_OCTET;
538 elem->data.raw = (caddr_t)p;
547 elem->type = BE_INETADDR;
548 elem->data.raw = (caddr_t)p;
555 ND_TCHECK2(*p, elem->asnlen);
556 elem->type = BE_UNS;
558 for (i = elem->asnlen; i-- > 0; p++)
560 elem->data.uns = data;
566 ND_TCHECK2(*p, elem->asnlen);
567 elem->type = BE_UNS64;
569 for (i = elem->asnlen; i-- > 0; p++) {
574 elem->data.uns64.high = high;
575 elem->data.uns64.low = low;
580 elem->type = BE_OCTET;
581 elem->data.raw = (caddr_t)p;
591 elem->type = BE_NOSUCHOBJECT;
592 elem->data.raw = NULL;
596 elem->type = BE_NOSUCHINST;
597 elem->data.raw = NULL;
601 elem->type = BE_ENDOFMIBVIEW;
602 elem->data.raw = NULL;
609 ND_TCHECK2(*p, elem->asnlen);
610 elem->type = BE_OCTET;
611 elem->data.raw = (caddr_t)p;
621 elem->type = BE_SEQ;
622 elem->data.raw = (caddr_t)p;
626 elem->type = BE_OCTET;
627 elem->data.raw = (caddr_t)p;
634 elem->type = BE_PDU;
635 elem->data.raw = (caddr_t)p;
639 elem->type = BE_OCTET;
640 elem->data.raw = (caddr_t)p;
646 p += elem->asnlen;
647 len -= elem->asnlen;
648 return elem->asnlen + hdr;
662 struct be *elem)
664 u_char *p = (u_char *)elem->data.raw;
665 uint32_t asnlen = elem->asnlen;
668 switch (elem->type) {
727 ND_PRINT((ndo, "%d", elem->data.integer));
731 ND_PRINT((ndo, "%u", elem->data.uns));
738 if (elem->data.uns64.high == 0) {
739 ND_PRINT((ndo, "%u", elem->data.uns64.low));
742 d = elem->data.uns64.high * 4294967296.0; /* 2^32 */
743 if (elem->data.uns64.high <= 0x1fffff) {
744 d += elem->data.uns64.low;
752 d += (elem->data.uns64.low & 0xfffff000);
759 elem->data.uns64.low & 0xfff);
778 const u_char *p = elem->data.str;
782 p = elem->data.str;
799 ND_PRINT((ndo, "Seq(%u)", elem->asnlen));
814 ND_PRINT((ndo, "[%s]", Class[EXCEPTIONS].Id[elem->id]));
818 ND_PRINT((ndo, "%s(%u)", Class[CONTEXT].Id[elem->id], elem->asnlen));
849 struct be elem;
853 i = asn1_parse(ndo, p, length, &elem);
856 if (asn1_print(ndo, &elem) < 0)
858 if (elem.type == BE_SEQ || elem.type == BE_PDU) {
860 asn1_decode(elem.data.raw, elem.asnlen);
895 struct be *elem, unsigned int *oid,
898 u_char *p = (u_char *)elem->data.raw;
899 uint32_t asnlen = elem->asnlen;
948 struct be *elem)
957 ok = (elem->asnlen == smiRange->minValue.value.unsigned32);
959 ok = (elem->asnlen >= smiRange->minValue.value.unsigned32
960 && elem->asnlen <= smiRange->maxValue.value.unsigned32);
965 ok = (elem->data.integer >= smiRange->minValue.value.integer32
966 && elem->data.integer <= smiRange->maxValue.value.integer32);
970 ok = (elem->data.uns >= smiRange->minValue.value.unsigned32
971 && elem->data.uns <= smiRange->maxValue.value.unsigned32);
997 static int smi_check_range(SmiType *smiType, struct be *elem)
1006 ok = smi_check_a_range(smiType, smiRange, elem);
1017 ok = smi_check_range(parentType, elem);
1026 struct be *elem, int *status)
1032 *status = smi_decode_oid(ndo, elem, oid, sizeof(oid) / sizeof(unsigned int),
1038 *status = asn1_print(ndo, elem);
1056 SmiNode *smiNode, u_char pduid, struct be *elem)
1065 return asn1_print(ndo, elem);
1068 if (elem->type == BE_NOSUCHOBJECT
1069 || elem->type == BE_NOSUCHINST
1070 || elem->type == BE_ENDOFMIBVIEW) {
1071 return asn1_print(ndo, elem);
1093 return asn1_print(ndo, elem);
1096 if (! smi_check_type(smiType->basetype, elem->type)) {
1100 if (! smi_check_range(smiType, elem)) {
1112 switch (elem->type) {
1117 smi_decode_oid(ndo, elem, oid,
1143 == elem->data.integer) {
1145 ND_PRINT((ndo, "(%d)", elem->data.integer));
1155 return asn1_print(ndo, elem);
1201 struct be elem;
1209 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1211 if (elem.type != BE_SEQ) {
1213 asn1_print(ndo, &elem);
1219 length = elem.asnlen;
1220 np = (u_char *)elem.data.raw;
1229 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1231 if (elem.type != BE_SEQ) {
1233 asn1_print(ndo, &elem);
1239 length = elem.asnlen;
1240 np = (u_char *)elem.data.raw;
1243 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1245 if (elem.type != BE_OID) {
1247 asn1_print(ndo, &elem);
1251 smiNode = smi_print_variable(ndo, &elem, &status);
1253 status = asn1_print(ndo, &elem);
1265 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1269 if (elem.type != BE_NULL) {
1271 if (asn1_print(ndo, &elem) < 0)
1275 if (elem.type != BE_NULL) {
1277 status = smi_print_value(ndo, smiNode, pduid, &elem);
1279 status = asn1_print(ndo, &elem);
1298 struct be elem;
1302 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1304 if (elem.type != BE_INT) {
1306 asn1_print(ndo, &elem);
1310 ND_PRINT((ndo, "R=%d ", elem.data.integer));
1315 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1317 if (elem.type != BE_INT) {
1319 asn1_print(ndo, &elem);
1325 && elem.data.integer != 0) {
1328 DECODE_ErrorStatus(elem.data.integer)));
1330 ND_PRINT((ndo, " N=%d", elem.data.integer));
1331 } else if (elem.data.integer != 0) {
1333 ND_PRINT((ndo, " %s", DECODE_ErrorStatus(elem.data.integer)));
1334 error = elem.data.integer;
1340 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1342 if (elem.type != BE_INT) {
1344 asn1_print(ndo, &elem);
1349 && elem.data.integer != 0)
1350 ND_PRINT((ndo, "[errorIndex(%d)!=0]", elem.data.integer));
1352 ND_PRINT((ndo, " M=%d", elem.data.integer));
1353 else if (elem.data.integer != 0) {
1355 ND_PRINT((ndo, "[errorIndex(%d) w/o errorStatus]", elem.data.integer));
1357 ND_PRINT((ndo, "@%d", elem.data.integer));
1358 error = elem.data.integer;
1378 struct be elem;
1384 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1386 if (elem.type != BE_OID) {
1388 asn1_print(ndo, &elem);
1391 if (asn1_print(ndo, &elem) < 0)
1399 elem)) < 0)
1401 if (elem.type != BE_INETADDR) {
1403 asn1_print(ndo, &elem);
1406 if (asn1_print(ndo, &elem) < 0)
1412 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1414 if (elem.type != BE_INT) {
1416 asn1_print(ndo, &elem);
1419 generic = elem.data.integer;
1428 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1430 if (elem.type != BE_INT) {
1432 asn1_print(ndo, &elem);
1436 if (elem.data.integer != 0)
1437 ND_PRINT((ndo, "[specific-trap(%d)!=0]", elem.data.integer));
1439 ND_PRINT((ndo, " s=%d", elem.data.integer));
1446 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1448 if (elem.type != BE_UNS) { /* XXX */
1450 asn1_print(ndo, &elem);
1453 if (asn1_print(ndo, &elem) < 0)
1531 struct be elem;
1535 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1537 if (elem.type != BE_SEQ) {
1539 asn1_print(ndo, &elem);
1542 length = elem.asnlen;
1543 np = (u_char *)elem.data.raw;
1546 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1548 if (elem.type != BE_STR) {
1550 asn1_print(ndo, &elem);
1557 for (i = 0; i < (int)elem.asnlen; i++) {
1558 ND_PRINT((ndo, "0x%02X", elem.data.str[i]));
1563 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1565 if (elem.type != BE_STR) {
1567 asn1_print(ndo, &elem);
1573 ND_PRINT((ndo, "C=%.*s ", (int)elem.asnlen, elem.data.str));
1585 struct be elem;
1589 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1591 if (elem.type != BE_STR) {
1593 asn1_print(ndo, &elem);
1597 if (!(elem.asnlen == sizeof(DEF_COMMUNITY) - 1 &&
1598 strncmp((char *)elem.data.str, DEF_COMMUNITY,
1601 ND_PRINT((ndo, "C=%.*s ", (int)elem.asnlen, elem.data.str));
1615 struct be elem;
1619 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1621 if (elem.type != BE_SEQ) {
1623 asn1_print(ndo, &elem);
1626 length = elem.asnlen;
1627 np = (u_char *)elem.data.raw;
1630 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1632 if (elem.type != BE_STR) {
1634 asn1_print(ndo, &elem);
1641 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1643 if (elem.type != BE_INT) {
1645 asn1_print(ndo, &elem);
1649 ND_PRINT((ndo, "B=%d ", elem.data.integer));
1654 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1656 if (elem.type != BE_INT) {
1658 asn1_print(ndo, &elem);
1662 ND_PRINT((ndo, "T=%d ", elem.data.integer));
1667 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1669 if (elem.type != BE_STR) {
1671 asn1_print(ndo, &elem);
1677 ND_PRINT((ndo, "U=%.*s ", (int)elem.asnlen, elem.data.str));
1680 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1682 if (elem.type != BE_STR) {
1684 asn1_print(ndo, &elem);
1691 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1693 if (elem.type != BE_STR) {
1695 asn1_print(ndo, &elem);
1712 struct be elem;
1720 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1722 if (elem.type != BE_SEQ) {
1724 asn1_print(ndo, &elem);
1727 length = elem.asnlen;
1728 np = (u_char *)elem.data.raw;
1735 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1737 if (elem.type != BE_INT) {
1739 asn1_print(ndo, &elem);
1746 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1748 if (elem.type != BE_INT) {
1750 asn1_print(ndo, &elem);
1757 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1759 if (elem.type != BE_STR) {
1761 asn1_print(ndo, &elem);
1764 if (elem.asnlen != 1) {
1765 ND_PRINT((ndo, "[msgFlags size %d]", elem.asnlen));
1768 flags = elem.data.str[0];
1783 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1785 if (elem.type != BE_INT) {
1787 asn1_print(ndo, &elem);
1790 model = elem.data.integer;
1814 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1816 if (elem.type != BE_STR) {
1818 asn1_print(ndo, &elem);
1825 usm_print(ndo, elem.data.str, elem.asnlen);
1849 struct be elem;
1856 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1858 if (elem.type != BE_SEQ) {
1860 asn1_print(ndo, &elem);
1866 length = elem.asnlen;
1867 np = (u_char *)elem.data.raw;
1870 if ((count = asn1_parse(ndo, np, length, &elem)) < 0)
1872 if (elem.type != BE_INT) {
1874 asn1_print(ndo, &elem);
1878 switch (elem.data.integer) {
1883 ND_PRINT((ndo, "{ %s ", SnmpVersion[elem.data.integer]));
1886 ND_PRINT((ndo, "[version = %d]", elem.data.integer));
1889 version = elem.data.integer;
1902 ND_PRINT((ndo, "[version = %d]", elem.data.integer));