Added two new arguments to epan_init() and proto_init() to
[obnox/wireshark/wip.git] / packet-nntp.c
index a13e0f62d637fb262f569bba62d55cdc548fdf3a..3036d1ae2f76ab366b30f55b7f04e1c5056eb3c3 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for nntp packet dissection
  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
  *
- * $Id: packet-nntp.c,v 1.17 2001/01/03 06:55:30 guy Exp $
+ * $Id: packet-nntp.c,v 1.19 2001/01/22 08:03:45 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -57,19 +57,14 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        proto_tree      *nntp_tree;
        proto_item      *ti;
        gint            offset = 0;
-       const u_char    *line;
        gint            next_offset;
        int             linelen;
 
-       CHECK_DISPLAY_AS_DATA(proto_nntp, tvb, pinfo, tree);
-
         if (pinfo->match_port == pinfo->destport)
                type = "Request";
         else
                type = "Response";
 
-       pinfo->current_proto = "NNTP";
-
        if (check_col(pinfo->fd, COL_PROTOCOL))
                col_set_str(pinfo->fd, COL_PROTOCOL, "NNTP");
 
@@ -77,11 +72,14 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                /*
                 * Put the first line from the buffer into the summary
                 * (but leave out the line terminator).
+                *
+                * Note that "tvb_find_line_end()" will return a value that
+                * is not longer than what's in the buffer, so the
+                * "tvb_get_ptr()" call won't throw an exception.
                 */
                linelen = tvb_find_line_end(tvb, offset, -1, &next_offset);
-               line = tvb_get_ptr(tvb, offset, linelen);
                col_add_fstr(pinfo->fd, COL_INFO, "%s: %s", type,
-                   format_text(line, linelen));
+                   tvb_format_text(tvb, offset, linelen));
        }
 
        if (tree) {
@@ -149,5 +147,5 @@ proto_register_nntp(void)
 void
 proto_reg_handoff_nntp(void)
 {
-       dissector_add("tcp.port", TCP_PORT_NNTP, dissect_nntp);
+       dissector_add("tcp.port", TCP_PORT_NNTP, dissect_nntp, proto_nntp);
 }