Make the "Save only marked frames" button in the "Save As..." dialog box
[obnox/wireshark/wip.git] / packet-lmi.c
index 4ccc0a80ee671ca4debffa620d52029ff0a3a31b..181d2de43287e49064fb9b2642db78e83e39c967 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.3 2001/03/30 10:51:50 guy Exp $
+ * $Id: packet-lmi.c,v 1.7 2001/12/03 03:59:36 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
@@ -126,7 +125,7 @@ dissect_lmi_link_int(tvbuff_t *tvb, int offset, proto_tree *tree)
 {
        proto_tree_add_uint(tree, hf_lmi_send_seq, tvb, offset, 1, tvb_get_guint8( tvb, offset));
        ++offset;
-       proto_tree_add_uint(tree, hf_lmi_recv_seq, tvb, offset, 0, tvb_get_guint8( tvb, offset));
+       proto_tree_add_uint(tree, hf_lmi_recv_seq, tvb, offset, 1, tvb_get_guint8( tvb, offset));
 
 }
 
@@ -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);
 
@@ -196,43 +195,43 @@ proto_register_lmi(void)
     static hf_register_info hf[] = {
        { &hf_lmi_call_ref,
          { "Call reference", "lmi.cmd", FT_UINT8, BASE_HEX, NULL, 0, 
-               "Call Reference" }},
+               "Call Reference", HFILL }},
 
        { &hf_lmi_msg_type,
          { "Message Type", "lmi.msg_type", FT_UINT8, BASE_HEX, VALS(msg_type_str), 0, 
-               "Message Type" }},
+               "Message Type", HFILL }},
 
        { &hf_lmi_inf_ele,
          { "Information Element", "lmi.inf_ele", FT_UINT8, BASE_DEC, VALS(element_type_str), 0,
-               "Information Element" }},
+               "Information Element", HFILL }},
        { &hf_lmi_inf_ele,
          { "Type", "lmi.inf_ele_type", FT_UINT8, BASE_DEC, VALS(element_type_str), 0,
-               "Information Element Type" }},
+               "Information Element Type", HFILL }},
        { &hf_lmi_inf_len,
          { "Length", "lmi.inf_ele_len", FT_UINT8, BASE_DEC, NULL, 0,
-               "Information Element Length" }},
+               "Information Element Length", HFILL }},
 
        { &hf_lmi_rcd_type,
          { "Record Type", "lmi.ele_rcd_type", FT_UINT8, BASE_DEC, VALS(record_type_str), 0,
-               "Record Type" }},
+               "Record Type", HFILL }},
        { &hf_lmi_send_seq,
          { "Send Seq", "lmi.send_seq", FT_UINT8, BASE_DEC, NULL, 0,
-               "Send Sequence" }},
+               "Send Sequence", HFILL }},
        { &hf_lmi_recv_seq,
          { "Recv Seq", "lmi.recv_seq", FT_UINT8, BASE_DEC, NULL, 0,
-               "Receive Sequence" }},
+               "Receive Sequence", HFILL }},
        { &hf_lmi_dlci_high,
          { "DLCI High", "lmi.dlci_hi", FT_UINT8, BASE_DEC, NULL, 0x3f,
-               "DLCI High bits" }},
+               "DLCI High bits", HFILL }},
        { &hf_lmi_dlci_low,
          { "DLCI Low", "lmi.dlci_low", FT_UINT8, BASE_DEC, NULL, 0x78,
-               "DLCI Low bits" }},
+               "DLCI Low bits", HFILL }},
        { &hf_lmi_new,
          { "DLCI New", "lmi.dlci_new", FT_UINT8, BASE_DEC, VALS(pvc_status_new_str), 0x08,
-               "DLCI New Flag" }},
+               "DLCI New Flag", HFILL }},
        { &hf_lmi_act,
          { "DLCI Active","lmi.dlci_act", FT_UINT8, BASE_DEC, VALS(pvc_status_act_str), 0x02,
-               "DLCI Active Flag" }},
+               "DLCI Active Flag", HFILL }},
     };
     static gint *ett[] = {
         &ett_lmi,
@@ -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);
 }