usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / tcpdump / print-sip.c
blobc5bc8534daaa784443d8fb45fb430d1173717831
1 /*
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
13 * Original code by Hannes Gredler (hannes@juniper.net)
16 #ifndef lint
17 static const char rcsid[] _U_ =
18 "@(#) $Header: /tcpdump/master/tcpdump/print-sip.c,v 1.1 2004-07-27 17:04:20 hannes Exp $";
19 #endif
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
25 #include <tcpdump-stdinc.h>
27 #include <stdio.h>
28 #include <stdlib.h>
30 #include "interface.h"
31 #include "extract.h"
33 #include "udp.h"
35 void
36 sip_print(register const u_char *pptr, register u_int len)
38 u_int idx;
40 printf("SIP, length: %u%s", len, vflag ? "\n\t" : "");
42 /* in non-verbose mode just lets print the protocol and length */
43 if (vflag < 1)
44 return;
46 for (idx = 0; idx < len; idx++) {
47 TCHECK2(*(pptr+idx), 2);
48 if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */
49 safeputchar(*(pptr+idx));
50 } else {
51 printf("\n\t");
52 idx+=1;
56 /* do we want to see an additionally hexdump ? */
57 if (vflag> 1)
58 print_unknown_data(pptr,"\n\t",len);
60 return;
62 trunc:
63 printf("[|sip]");