1146773Ssam/* 2146773Ssam * Redistribution and use in source and binary forms, with or without 3146773Ssam * modification, are permitted provided that: (1) source code 4146773Ssam * distributions retain the above copyright notice and this paragraph 5146773Ssam * in its entirety, and (2) distributions including binary code include 6146773Ssam * the above copyright notice and this paragraph in its entirety in 7146773Ssam * the documentation or other materials provided with the distribution. 8146773Ssam * THIS SOFTWARE IS PROVIDED ``AS IS'' AND 9146773Ssam * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT 10146773Ssam * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 11146773Ssam * FOR A PARTICULAR PURPOSE. 12146773Ssam * 13146773Ssam * Original code by Hannes Gredler (hannes@juniper.net) 14146773Ssam */ 15146773Ssam 16146773Ssam#ifndef lint 17146773Ssamstatic const char rcsid[] _U_ = 18190207Srpaulo "@(#) $Header: /tcpdump/master/tcpdump/print-sip.c,v 1.1 2004-07-27 17:04:20 hannes Exp $"; 19146773Ssam#endif 20146773Ssam 21146773Ssam#ifdef HAVE_CONFIG_H 22146773Ssam#include "config.h" 23146773Ssam#endif 24146773Ssam 25146773Ssam#include <tcpdump-stdinc.h> 26146773Ssam 27146773Ssam#include <stdio.h> 28146773Ssam#include <stdlib.h> 29146773Ssam 30146773Ssam#include "interface.h" 31146773Ssam#include "extract.h" 32146773Ssam 33146773Ssam#include "udp.h" 34146773Ssam 35146773Ssamvoid 36146773Ssamsip_print(register const u_char *pptr, register u_int len) 37146773Ssam{ 38146773Ssam u_int idx; 39146773Ssam 40146773Ssam printf("SIP, length: %u%s", len, vflag ? "\n\t" : ""); 41146773Ssam 42146773Ssam /* in non-verbose mode just lets print the protocol and length */ 43146773Ssam if (vflag < 1) 44146773Ssam return; 45146773Ssam 46146773Ssam for (idx = 0; idx < len; idx++) { 47214478Srpaulo TCHECK2(*(pptr+idx), 2); 48146773Ssam if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */ 49146773Ssam safeputchar(*(pptr+idx)); 50146773Ssam } else { 51146773Ssam printf("\n\t"); 52146773Ssam idx+=1; 53146773Ssam } 54146773Ssam } 55146773Ssam 56146773Ssam /* do we want to see an additionally hexdump ? */ 57146773Ssam if (vflag> 1) 58146773Ssam print_unknown_data(pptr,"\n\t",len); 59146773Ssam 60146773Ssam return; 61214478Srpaulo 62214478Srpaulotrunc: 63214478Srpaulo printf("[|sip]"); 64146773Ssam} 65