]> The Tcpdump Group git mirrors - tcpdump/commitdiff
add basic support for the SIP protocol
authorhannes <hannes>
Tue, 27 Jul 2004 17:04:20 +0000 (17:04 +0000)
committerhannes <hannes>
Tue, 27 Jul 2004 17:04:20 +0000 (17:04 +0000)
Makefile.in
interface.h
print-sip.c [new file with mode: 0644]
print-udp.c
udp.h

index 615ac7641934aa50b35f649f4f1b4f9176bb41d4..3acae8c4aed0059166ed0e16f12bef44966106e5 100644 (file)
@@ -17,7 +17,7 @@
 #  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 #
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.288 2004-06-15 09:45:41 hannes Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.289 2004-07-27 17:04:20 hannes Exp $ (LBL)
 
 #
 # Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -82,7 +82,7 @@ CSRC =        addrtoname.c gmpls.c oui.c gmt2local.c ipproto.c l2vpn.c machdep.c parsen
        print-nfs.c print-ntp.c print-null.c print-ospf.c \
        print-pflog.c print-pim.c print-ppp.c print-pppoe.c \
        print-pptp.c print-radius.c print-raw.c print-rip.c \
-       print-rsvp.c print-rx.c print-sctp.c print-sl.c print-sll.c \
+       print-rsvp.c print-rx.c print-sctp.c print-sip.c print-sl.c print-sll.c \
        print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
        print-symantec.c print-tcp.c print-telnet.c print-tftp.c \
        print-timed.c print-token.c print-udp.c print-vjc.c print-vrrp.c \
index 9eae7a23c1050ac225da8db45fb03af8945a1869..b8a5c9aee4df0bf4f7e8dd8797e23ada08ce40c5 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.232 2004-07-21 22:00:10 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.233 2004-07-27 17:05:41 hannes Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -278,6 +278,7 @@ extern void mpls_lsp_ping_print(const u_char *, u_int);
 extern void zephyr_print(const u_char *, int);
 extern void hsrp_print(const u_char *, u_int);
 extern void bfd_print(const u_char *, u_int, u_int);
+extern void sip_print(const u_char *, u_int);
 
 #ifdef INET6
 extern void ip6_print(const u_char *, u_int);
diff --git a/print-sip.c b/print-sip.c
new file mode 100644 (file)
index 0000000..48562f8
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * Original code by Hannes Gredler ([email protected])
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-sip.c,v 1.1 2004-07-27 17:04:20 hannes Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "interface.h"
+#include "extract.h"
+
+#include "udp.h"
+
+void
+sip_print(register const u_char *pptr, register u_int len)
+{
+    u_int idx;
+
+    printf("SIP, length: %u%s", len, vflag ? "\n\t" : "");
+
+    /* in non-verbose mode just lets print the protocol and length */
+    if (vflag < 1)
+        return;
+
+    for (idx = 0; idx < len; idx++) {
+        if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */
+            safeputchar(*(pptr+idx));
+        } else {
+            printf("\n\t");
+            idx+=1;
+        }
+    }
+
+    /* do we want to see an additionally hexdump ? */
+    if (vflag> 1)
+        print_unknown_data(pptr,"\n\t",len);
+
+    return;
+}
index 8c3759ead13ffdf03eb26a6b87472e351a1ae437..eace4c5db72ccb6dd1749f12c0aec096d99ffcd4 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.132 2004-06-06 19:20:03 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.133 2004-07-27 17:04:21 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -679,6 +679,8 @@ udp_print(register const u_char *bp, u_int length,
                        bfd_print((const u_char *)(up+1), length, dport);
                 else if (ISPORT(LMP_PORT))
                        lmp_print((const u_char *)(up + 1), length);
+                else if (ISPORT(SIP_PORT))
+                       sip_print((const u_char *)(up + 1), length);
                else
                        (void)printf("UDP, length %u",
                            (u_int32_t)(ulen - sizeof(*up)));
diff --git a/udp.h b/udp.h
index 79e3528854756a222d1b2089e492aa3f5ee04de3..490645bb9b82acbe3da7d29818d6b7d421f35b46 100644 (file)
--- a/udp.h
+++ b/udp.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.6 2004-04-19 21:17:14 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.7 2004-07-27 17:04:21 hannes Exp $ (LBL) */
 /*
  * Copyright (c) 1982, 1986, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -52,12 +52,14 @@ struct udphdr {
 #define NTP_PORT 123           /*XXX*/
 #define SNMPTRAP_PORT 162      /*XXX*/
 #define ISAKMP_PORT 500                /*XXX*/
+#define SYSLOG_PORT 514         /* rfc3164 */
 #define TIMED_PORT 525         /*XXX*/
 #define RIP_PORT 520           /*XXX*/
 #define LDP_PORT 646
 #define AODV_PORT 654          /*XXX*/
 #define KERBEROS_SEC_PORT 750  /*XXX*/
 #define L2TP_PORT 1701         /*XXX*/
+#define SIP_PORT 5060
 #define ISAKMP_PORT_USER1 7500 /*XXX - nonstandard*/
 #define ISAKMP_PORT_USER2 8500 /*XXX - nonstandard*/
 #define RX_PORT_LOW 7000       /*XXX*/