+ ND_PRINT((ndo, "%s", tstr));
+ return -1;
+}
+
+static int
+asn1_print_octets(netdissect_options *ndo, struct be *elem)
+{
+ const u_char *p = (const u_char *)elem->data.raw;
+ uint32_t asnlen = elem->asnlen;
+ uint32_t i;
+
+ ND_TCHECK2(*p, asnlen);
+ for (i = asnlen; i-- > 0; p++)
+ ND_PRINT((ndo, "_%.2x", EXTRACT_U_1(p)));
+ return 0;
+
+trunc:
+ ND_PRINT((ndo, "%s", tstr));
+ return -1;
+}
+
+static int
+asn1_print_string(netdissect_options *ndo, struct be *elem)
+{
+ register int printable = 1, first = 1;
+ const u_char *p;
+ uint32_t asnlen = elem->asnlen;
+ uint32_t i;
+
+ p = elem->data.str;
+ ND_TCHECK2(*p, asnlen);
+ for (i = asnlen; printable && i-- > 0; p++)
+ printable = ND_ISPRINT(EXTRACT_U_1(p));
+ p = elem->data.str;
+ if (printable) {
+ ND_PRINT((ndo, "\""));
+ if (fn_printn(ndo, p, asnlen, ndo->ndo_snapend)) {
+ ND_PRINT((ndo, "\""));
+ goto trunc;
+ }
+ ND_PRINT((ndo, "\""));
+ } else {
+ for (i = asnlen; i-- > 0; p++) {
+ ND_PRINT((ndo, first ? "%.2x" : "_%.2x", EXTRACT_U_1(p)));
+ first = 0;
+ }
+ }
+ return 0;
+
+trunc:
+ ND_PRINT((ndo, "%s", tstr));