]>
The Tcpdump Group git mirrors - tcpdump/blob - print-beep.c
2 * Copyright (C) 2000, Richard Sharpe
4 * This software may be distributed either under the terms of the
5 * BSD-style licence that accompanies tcpdump or under the GNU GPL
16 #include <tcpdump-stdinc.h>
25 #include "interface.h"
28 /* Check for a string but not go beyond length
29 * Return TRUE on match, FALSE otherwise
31 * Looks at the first few chars up to tl1 ...
34 static int l_strnstart(const char *, u_int
, const char *, u_int
);
37 l_strnstart(const char *tstr1
, u_int tl1
, const char *str2
, u_int l2
)
43 return (strncmp(tstr1
, str2
, tl1
) == 0 ? 1 : 0);
47 beep_print(const u_char
*bp
, u_int length
)
50 if (l_strnstart("MSG", 4, (const char *)bp
, length
)) /* A REQuest */
52 else if (l_strnstart("RPY ", 4, (const char *)bp
, length
))
54 else if (l_strnstart("ERR ", 4, (const char *)bp
, length
))
56 else if (l_strnstart("ANS ", 4, (const char *)bp
, length
))
58 else if (l_strnstart("NUL ", 4, (const char *)bp
, length
))
60 else if (l_strnstart("SEQ ", 4, (const char *)bp
, length
))
62 else if (l_strnstart("END", 4, (const char *)bp
, length
))
65 printf(" BEEP (payload or undecoded)");