Remove "text2pcap-scanner.obj" and "tools\lemon\lemon.obj" when a "nmake
[obnox/wireshark/wip.git] / packet-sdp.c
index 53c7048f2158c5d539b8dfce5fcdf17937f62fcc..b76019c05b54bcb38073941ed77a4e8c2e88f0b1 100644 (file)
@@ -4,7 +4,7 @@
  * Jason Lango <jal@netapp.com>
  * Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
  *
- * $Id: packet-sdp.c,v 1.14 2000/11/13 01:43:02 guy Exp $
+ * $Id: packet-sdp.c,v 1.20 2001/01/25 06:14:14 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -45,7 +45,7 @@ static int proto_sdp = -1;
 
 static int ett_sdp = -1;
 
-void
+static void
 dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
        proto_tree      *sdp_tree;
@@ -61,10 +61,6 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        const char      *typename;
        int             datalen;
 
-       CHECK_DISPLAY_AS_DATA(proto_sdp, tvb, pinfo, tree);
-
-       pinfo->current_proto = "SDP";
-
        /*
         * As RFC 2327 says, "SDP is purely a format for session
         * description - it does not incorporate a transport protocol,
@@ -98,7 +94,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         * Show the SDP message a line at a time.
         */
        section = 0;
-       while (tvb_length_remaining(tvb, offset)) {
+       while (tvb_offset_exists(tvb, offset)) {
                /*
                 * Find the end of the line.
                 */
@@ -118,6 +114,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                            next_offset - offset,
                            "Invalid line: %s",
                            tvb_format_text(tvb, offset, next_offset - offset));
+                        offset = next_offset;
                        continue;
                }
                value = line + 2;
@@ -215,7 +212,16 @@ proto_register_sdp(void)
                &ett_sdp,
        };
 
-        proto_sdp = proto_register_protocol("Session Description Protocol", "sdp");
+        proto_sdp = proto_register_protocol("Session Description Protocol",
+           "SDP", "sdp");
  /*       proto_register_field_array(proto_sdp, hf, array_length(hf));*/
        proto_register_subtree_array(ett, array_length(ett));
+
+       /*
+        * Register the dissector by name, so other dissectors can
+        * grab it by name rather than just referring to it directly
+        * (you can't refer to it directly from a plugin dissector
+        * on Windows without stuffing it into the Big Transfer Vector).
+        */
+       register_dissector("sdp", dissect_sdp, proto_sdp);
 }