#include "interface.h"
#include "extract.h"
-#include "addrtoname.h"
-/*
+/*
* tokenlists and #defines taken from Ethereal - Network traffic analyzer
*/
* severity and facility values
*/
- if (!TTEST2(*pptr, 1))
- goto trunc;
-
+ TCHECK2(*pptr, 1);
if (*(pptr+msg_off) == '<') {
msg_off++;
-
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
-
+ TCHECK2(*(pptr+msg_off), 1);
while ( *(pptr+msg_off) >= '0' &&
*(pptr+msg_off) <= '9' &&
msg_off <= SYSLOG_MAX_DIGITS) {
-
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
-
pri = pri * 10 + (*(pptr+msg_off) - '0');
msg_off++;
-
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
-
+ TCHECK2(*(pptr+msg_off), 1);
}
- if (*(pptr+msg_off) == '>')
- msg_off++;
+ if (*(pptr+msg_off) != '>') {
+ printf("[|syslog]");
+ return;
+ }
+ msg_off++;
} else {
printf("[|syslog]");
return;
facility = (pri & SYSLOG_FACILITY_MASK) >> 3;
severity = pri & SYSLOG_SEVERITY_MASK;
-
if (vflag < 1 )
{
printf("SYSLOG %s.%s, length: %u",
len);
return;
}
-
+
printf("SYSLOG, length: %u\n\tFacility %s (%u), Severity %s (%u)\n\tMsg: ",
len,
tok2str(syslog_facility_values, "unknown (%u)", facility),
/* print the syslog text in verbose mode */
for (; msg_off < len; msg_off++) {
- if (!TTEST2(*(pptr+msg_off), 1))
- goto trunc;
- safeputchar(*(pptr+msg_off));
+ TCHECK2(*(pptr+msg_off), 1);
+ safeputchar(*(pptr+msg_off));
}
- if (vflag > 1) {
- if(!print_unknown_data(pptr,"\n\t",len))
- return;
- }
-
+ if (vflag > 1)
+ print_unknown_data(pptr,"\n\t",len);
+
return;
trunc: