Add a routine to "epan/filesystem.c" to test whether a file is a FIFO.
[obnox/wireshark/wip.git] / packet-lmi.c
index 67fa7749e3e11e20a1f1bd044d75a0e736f4d56a..460c7881191b89f72ddd5200e4101173a600e3fb 100644 (file)
@@ -2,12 +2,11 @@
  * Routines for Frame Relay Local Management Interface (LMI) disassembly
  * Copyright 2001, Jeffrey C. Foster <jfoste@woodward.com>
  *
- * $Id: packet-lmi.c,v 1.5 2001/06/18 02:17:48 guy Exp $
+ * $Id: packet-lmi.c,v 1.9 2002/01/21 07:36:37 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998
- *
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -46,7 +45,7 @@
 #include <stdio.h>
 #include <glib.h>
 #include <string.h>
-#include "packet.h"
+#include <epan/packet.h>
 #include "nlpid.h"
 
 static int proto_lmi = -1;
@@ -149,8 +148,8 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        int             offset = 2, len;
        guint8          ele_id;
 
-       if (check_col(pinfo->fd, COL_PROTOCOL))
-               col_set_str(pinfo->fd, COL_PROTOCOL, "LMI");
+       if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               col_set_str(pinfo->cinfo, COL_PROTOCOL, "LMI");
 
        if (tree) {
                ti = proto_tree_add_item(tree, proto_lmi, tvb, 0, 3, FALSE);
@@ -160,7 +159,7 @@ dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                proto_tree_add_uint(lmi_tree, hf_lmi_msg_type,  tvb, 1, 1,  tvb_get_guint8( tvb, 1));
 
        /* Display the LMI elements */
-               while( offset < tvb_length( tvb)){
+               while (tvb_reported_length_remaining(tvb, offset) > 0) {
                        ele_id = tvb_get_guint8( tvb, offset);
                        len =  tvb_get_guint8( tvb, offset + 1);
 
@@ -247,5 +246,8 @@ proto_register_lmi(void)
 void
 proto_reg_handoff_lmi(void)
 {
-       dissector_add("fr.ietf", NLPID_LMI, dissect_lmi, proto_lmi);
+       dissector_handle_t lmi_handle;
+
+       lmi_handle = create_dissector_handle(dissect_lmi, proto_lmi);
+       dissector_add("fr.ietf", NLPID_LMI, lmi_handle);
 }