As the gtk2 directory is no longer needed (GTK1 and 2 are using the same sources...
[obnox/wireshark/wip.git] / packet-tftp.c
index 19aefd47f211b997688bc8a4432711f636d87257..879619b72f52fc96551ad9eef430aa45e226bf02 100644 (file)
@@ -5,24 +5,24 @@
  * Craig Newell <CraigN@cheque.uq.edu.au>
  *     RFC2347 TFTP Option Extension
  *
- * $Id: packet-tftp.c,v 1.37 2002/05/24 22:50:55 guy Exp $
+ * $Id$
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
  * Copied from packet-bootp.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 "config.h"
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
 #include <glib.h>
 #include <epan/packet.h>
 #include <epan/conversation.h>
@@ -85,6 +77,7 @@ static const value_string tftp_error_code_vals[] = {
   { 5, "Unknown transfer ID" },
   { 6, "File already exists" },
   { 7, "No such user" },
+  { 8, "Option negotiation failed" },
   { 0, NULL }
 };
 
@@ -100,7 +93,7 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        guint16         opcode;
        guint16         bytes;
        guint16         blocknum;
-       u_int           i1;
+       guint           i1;
        guint16         error;
 
        /*
@@ -152,7 +145,7 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                            offset, 2, opcode);
        }
        offset += 2;
-           
+
        switch (opcode) {
 
        case TFTP_RRQ:
@@ -225,9 +218,11 @@ dissect_tftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                    (bytes < 512)?" (last)":"" );
          }
 
-         if (tree) {
-           proto_tree_add_text(tftp_tree, tvb, offset, -1,
+         if (bytes != 0) {
+           if (tree) {
+             proto_tree_add_text(tftp_tree, tvb, offset, -1,
                "Data (%d bytes)", bytes);
+           }
          }
          break;