print-snmp.c (146773) | print-snmp.c (147899) |
---|---|
1/* 2 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 3 * John Robert LoVerso. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 44 unchanged lines hidden (view full) --- 53 # on all copies. Neither the Government nor the University makes 54 # any warranty, express or implied, or assumes any liability or 55 # responsibility for the use of this software. 56 # @(#)snmp.awk.x 1.1 (LANL) 1/15/90 57 */ 58 59#ifndef lint 60static const char rcsid[] _U_ = | 1/* 2 * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 3 * John Robert LoVerso. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 44 unchanged lines hidden (view full) --- 53 # on all copies. Neither the Government nor the University makes 54 # any warranty, express or implied, or assumes any liability or 55 # responsibility for the use of this software. 56 # @(#)snmp.awk.x 1.1 (LANL) 1/15/90 57 */ 58 59#ifndef lint 60static const char rcsid[] _U_ = |
61 "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.62 2005/01/05 04:05:04 guy Exp $ (LBL)"; | 61 "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.62.2.2 2005/05/06 07:57:19 guy Exp $ (LBL)"; |
62#endif 63 64#ifdef HAVE_CONFIG_H 65#include "config.h" 66#endif 67 68#include <tcpdump-stdinc.h> 69 --- 711 unchanged lines hidden (view full) --- 781 register int printable = 1, first = 1; 782 const u_char *p = elem->data.str; 783 TCHECK2(*p, asnlen); 784 for (i = asnlen; printable && i-- > 0; p++) 785 printable = isprint(*p) || isspace(*p); 786 p = elem->data.str; 787 if (printable) { 788 putchar('"'); | 62#endif 63 64#ifdef HAVE_CONFIG_H 65#include "config.h" 66#endif 67 68#include <tcpdump-stdinc.h> 69 --- 711 unchanged lines hidden (view full) --- 781 register int printable = 1, first = 1; 782 const u_char *p = elem->data.str; 783 TCHECK2(*p, asnlen); 784 for (i = asnlen; printable && i-- > 0; p++) 785 printable = isprint(*p) || isspace(*p); 786 p = elem->data.str; 787 if (printable) { 788 putchar('"'); |
789 (void)fn_print(p, p + asnlen); | 789 if (fn_printn(p, asnlen, snapend)) { 790 putchar('"'); 791 goto trunc; 792 } |
790 putchar('"'); 791 } else 792 for (i = asnlen; i-- > 0; p++) { 793 printf(first ? "%.2x" : "_%.2x", *p); 794 first = 0; 795 } 796 break; 797 } --- 517 unchanged lines hidden (view full) --- 1315 fputs("[errorStatus!=INT]", stdout); 1316 asn1_print(&elem); 1317 return; 1318 } 1319 error = 0; 1320 if ((pduid == GETREQ || pduid == GETNEXTREQ || pduid == SETREQ 1321 || pduid == INFORMREQ || pduid == V2TRAP || pduid == REPORT) 1322 && elem.data.integer != 0) { | 793 putchar('"'); 794 } else 795 for (i = asnlen; i-- > 0; p++) { 796 printf(first ? "%.2x" : "_%.2x", *p); 797 first = 0; 798 } 799 break; 800 } --- 517 unchanged lines hidden (view full) --- 1318 fputs("[errorStatus!=INT]", stdout); 1319 asn1_print(&elem); 1320 return; 1321 } 1322 error = 0; 1323 if ((pduid == GETREQ || pduid == GETNEXTREQ || pduid == SETREQ 1324 || pduid == INFORMREQ || pduid == V2TRAP || pduid == REPORT) 1325 && elem.data.integer != 0) { |
1323 char errbuf[10]; | 1326 char errbuf[20]; |
1324 printf("[errorStatus(%s)!=0]", 1325 DECODE_ErrorStatus(elem.data.integer)); 1326 } else if (pduid == GETBULKREQ) { 1327 printf(" N=%d", elem.data.integer); 1328 } else if (elem.data.integer != 0) { | 1327 printf("[errorStatus(%s)!=0]", 1328 DECODE_ErrorStatus(elem.data.integer)); 1329 } else if (pduid == GETBULKREQ) { 1330 printf(" N=%d", elem.data.integer); 1331 } else if (elem.data.integer != 0) { |
1329 char errbuf[10]; | 1332 char errbuf[20]; |
1330 printf(" %s", DECODE_ErrorStatus(elem.data.integer)); 1331 error = elem.data.integer; 1332 } 1333 length -= count; 1334 np += count; 1335 1336 /* errorIndex (Integer) */ 1337 if ((count = asn1_parse(np, length, &elem)) < 0) --- 72 unchanged lines hidden (view full) --- 1410 return; 1411 if (elem.type != BE_INT) { 1412 fputs("[generic-trap!=INT]", stdout); 1413 asn1_print(&elem); 1414 return; 1415 } 1416 generic = elem.data.integer; 1417 { | 1333 printf(" %s", DECODE_ErrorStatus(elem.data.integer)); 1334 error = elem.data.integer; 1335 } 1336 length -= count; 1337 np += count; 1338 1339 /* errorIndex (Integer) */ 1340 if ((count = asn1_parse(np, length, &elem)) < 0) --- 72 unchanged lines hidden (view full) --- 1413 return; 1414 if (elem.type != BE_INT) { 1415 fputs("[generic-trap!=INT]", stdout); 1416 asn1_print(&elem); 1417 return; 1418 } 1419 generic = elem.data.integer; 1420 { |
1418 char buf[10]; | 1421 char buf[20]; |
1419 printf(" %s", DECODE_GenericTrap(generic)); 1420 } 1421 length -= count; 1422 np += count; 1423 1424 /* specific-trap (Integer) */ 1425 if ((count = asn1_parse(np, length, &elem)) < 0) 1426 return; --- 475 unchanged lines hidden --- | 1422 printf(" %s", DECODE_GenericTrap(generic)); 1423 } 1424 length -= count; 1425 np += count; 1426 1427 /* specific-trap (Integer) */ 1428 if ((count = asn1_parse(np, length, &elem)) < 0) 1429 return; --- 475 unchanged lines hidden --- |