Frame numbers are unsigned.
[obnox/wireshark/wip.git] / packet-pop.c
index 6a205c4576ae806ce12f09a96a37799af7d43e90..b8c23bafa3413d63a13db8a014ba0bb42b6b61fb 100644 (file)
@@ -2,24 +2,24 @@
  * Routines for pop packet dissection
  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
  *
- * $Id: packet-pop.c,v 1.29 2002/01/21 07:36:38 guy Exp $
+ * $Id: packet-pop.c,v 1.33 2002/08/28 21:00:25 jmayer Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
  * Copied from packet-tftp.c
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <stdio.h>
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
 #include <string.h>
 #include <glib.h>
 #include <epan/packet.h>
@@ -54,8 +46,8 @@ static dissector_handle_t data_handle;
 
 #define TCP_PORT_POP                   110
 
-static gboolean response_is_continuation(const u_char *data);
-       
+static gboolean response_is_continuation(const guchar *data);
+
 static void
 dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
@@ -64,11 +56,11 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         proto_tree      *pop_tree;
        proto_item      *ti;
        gint            offset = 0;
-       const u_char    *line;
+       const guchar    *line;
        gint            next_offset;
        int             linelen;
        int             tokenlen;
-       const u_char    *next_token;
+       const guchar    *next_token;
 
        if (check_col(pinfo->cinfo, COL_PROTOCOL))
                col_set_str(pinfo->cinfo, COL_PROTOCOL, "POP");
@@ -80,7 +72,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         * 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);
+       linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
        line = tvb_get_ptr(tvb, offset, linelen);
 
        if (pinfo->match_port == pinfo->destport) {
@@ -107,8 +99,8 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        }
 
        if (tree) {
-               ti = proto_tree_add_item(tree, proto_pop, tvb, offset,
-                   tvb_length_remaining(tvb, offset), FALSE);
+               ti = proto_tree_add_item(tree, proto_pop, tvb, offset, -1,
+                   FALSE);
                pop_tree = proto_item_add_subtree(ti, ett_pop);
 
                if (is_continuation) {
@@ -173,7 +165,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                         * Find the end of the line.
                         */
                        linelen = tvb_find_line_end(tvb, offset, -1,
-                           &next_offset);
+                           &next_offset, FALSE);
 
                        /*
                         * Put this line.
@@ -186,7 +178,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        }
 }
 
-static gboolean response_is_continuation(const u_char *data)
+static gboolean response_is_continuation(const guchar *data)
 {
   if (strncmp(data, "+OK", strlen("+OK")) == 0)
     return FALSE;