Ethereal-dev: [ethereal-dev] Dissector for the Session Announcement Protocol (SAP)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Heikki Vatiainen <hessu@xxxxxxxxx>
Date: Wed, 17 Nov 1999 01:23:39 +0200
I have added a dissector for the Session Announcement Protocol 
(SAP) which is responsible for bringing you the multicast session 
advertisements that the sdr program displays.

The document I based my work on is the Internet-Draft
draft-ietf-mmusic-sap-v2-03.txt 

The actual dissector file is available from
http://www.cs.tut.fi/~hessu/packet-sap.c
and the patch below adds the necessary things I had to add to the 
other files. There is also a fix for a typo in packet-ip.c. The 
core of the sap dissector file was copied from packet-tftp.c

Big thanks to Jason Lango for being able to use his SDP
dissector :)

Now the worries. Is there a clean way to access the IP header 
information from the UDP dissector? Dissecting a packet as a SAP 
packet is only meaningful if the packet was sent to a multicast IP 
address. Currently my dissector does not (can not?) check the 
destination IP address and will also feed the unicast IP/UDP 
packets to the SAP dissector if the destination UDP port is 9875.

Also I'm worrying if I got all the things right in my patch and 
the dissector file. If everything looks acceptable, I would like 
to add a couple of more protocol dissectors later.



? ethereal/packet-sap.c
Index: ethereal/Makefile.am
===================================================================
RCS file: /cvsroot/ethereal/Makefile.am,v
retrieving revision 1.108
diff -u -r1.108 Makefile.am
--- Makefile.am	1999/11/15 14:17:17	1.108
+++ Makefile.am	1999/11/16 22:33:40
@@ -114,6 +114,7 @@
 	packet-rtsp.c  \
 	packet-rx.c  \
 	packet-rx.h  \
+	packet-sap.c   \
 	packet-sdp.c   \
 	packet-smb.c   \
 	packet-sna.c   \
Index: ethereal/packet-ip.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ip.c,v
retrieving revision 1.61
diff -u -r1.61 packet-ip.c
--- packet-ip.c	1999/11/02 07:06:07	1.61
+++ packet-ip.c	1999/11/16 22:33:40
@@ -1212,7 +1212,7 @@
       strcpy(type_str, "PIM");
       break;
     case IGMP_V2_M_RPT:
-      strcpy(type_str, "Host reponse (v2)");
+      strcpy(type_str, "Host response (v2)");
       break;
     case IGMP_MTRC_RESP:
       strcpy(type_str, "Traceroute response");
Index: ethereal/packet-udp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-udp.c,v
retrieving revision 1.34
diff -u -r1.34 packet-udp.c
--- packet-udp.c	1999/11/14 20:44:51	1.34
+++ packet-udp.c	1999/11/16 22:33:40
@@ -80,6 +80,7 @@
 #define UDP_PORT_RADACCT_NEW 1813
 #define UDP_PORT_ICP    3130
 #define UDP_PORT_ICQ	4000
+#define UDP_PORT_SAP	9875
 #define UDP_PORT_RX_LOW 7000
 #define UDP_PORT_RX_HIGH 7009
 #define UDP_PORT_RX_AFS_BACKUPS 7021
@@ -169,6 +170,7 @@
 
   udp_hash_add(UDP_PORT_BOOTPS, dissect_bootp);
   udp_hash_add(UDP_PORT_TFTP, dissect_tftp);
+  udp_hash_add(UDP_PORT_SAP, dissect_sap);
 
 }
 
Index: ethereal/packet.h
===================================================================
RCS file: /cvsroot/ethereal/packet.h,v
retrieving revision 1.141
diff -u -r1.141 packet.h
--- packet.h	1999/11/15 14:17:20	1.141
+++ packet.h	1999/11/16 22:33:40
@@ -415,6 +415,10 @@
         ETT_RSVP_ADSPEC_SUBTREE2,
         ETT_RSVP_ADSPEC_SUBTREE3,
 	ETT_RTSP,
+	ETT_SAP,
+	ETT_SAP_FLAGS,
+	ETT_SAP_AUTH,
+	ETT_SAP_AUTHF,
 	ETT_SDP,
 	ETT_RADIUS,
 	ETT_RADIUS_AVP,
@@ -643,6 +647,7 @@
 void dissect_rsvp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_rtsp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_rx(const u_char *, int, frame_data *, proto_tree *);
+void dissect_sap(const u_char *, int, frame_data *, proto_tree *);
 void dissect_sdp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_sna(const u_char *, int, frame_data *, proto_tree *);
 void dissect_snmp(const u_char *, int, frame_data *, proto_tree *);



// Heikki
-- 
Heikki Vatiainen                  * hessu@xxxxxxxxx
Tampere University of Technology  * Tampere, Finland