Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / tcpdump / print-sip.c
blobfc3ea327217b97ccc4bd19b796ba5ba7308ff245
1 /* $NetBSD$ */
3 /*
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
15 * Original code by Hannes Gredler (hannes@juniper.net)
18 #include <sys/cdefs.h>
19 #ifndef lint
20 #if 0
21 static const char rcsid[] _U_ =
22 "@(#) Header: /tcpdump/master/tcpdump/print-sip.c,v 1.1 2004/07/27 17:04:20 hannes Exp";
23 #else
24 __RCSID("$NetBSD: tcpdump2rcsid.ex,v 1.1 2001/06/25 20:09:58 itojun Exp $");
25 #endif
26 #endif
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
32 #include <tcpdump-stdinc.h>
34 #include <stdio.h>
35 #include <stdlib.h>
37 #include "interface.h"
38 #include "extract.h"
40 #include "udp.h"
42 void
43 sip_print(register const u_char *pptr, register u_int len)
45 u_int idx;
47 printf("SIP, length: %u%s", len, vflag ? "\n\t" : "");
49 /* in non-verbose mode just lets print the protocol and length */
50 if (vflag < 1)
51 return;
53 for (idx = 0; idx < len; idx++) {
54 if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */
55 safeputchar(*(pptr+idx));
56 } else {
57 printf("\n\t");
58 idx+=1;
62 /* do we want to see an additionally hexdump ? */
63 if (vflag> 1)
64 print_unknown_data(pptr,"\n\t",len);
66 return;