Remove uneeded #includes, forward refs & check_col();
tvb_reported_length_remaining() can return -1; Localize a variable. svn path=/trunk/; revision=39836
This commit is contained in:
parent
5f73d64e50
commit
47c4f27e0e
|
@ -28,7 +28,6 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
|
@ -107,7 +106,7 @@ dissect_hsr_prp_supervision(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
offset += 2;
|
||||
}
|
||||
|
||||
while (tvb_reported_length_remaining(tvb, offset)) {
|
||||
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
||||
/* TLV.type */
|
||||
tlv_type = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_item(hsr_prp_supervision_tree, hf_hsr_prp_supervision_tlv_type,
|
||||
|
@ -249,9 +248,6 @@ void proto_register_hsr_prp_supervision(void)
|
|||
/* Required function calls to register the header fields and subtree used */
|
||||
proto_register_field_array(proto_hsr_prp_supervision, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,12 +83,9 @@ dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
guint16 etype;
|
||||
guint16 lsdu_size, lsdu_size_correct;
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSR");
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "HSR");
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)){
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "HSR-Data Frame");
|
||||
}
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "HSR-Data Frame");
|
||||
|
||||
/* create display subtree for the protocol */
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ static const value_string prp_lan_vals[] = {
|
|||
|
||||
void proto_reg_handoff_prp(void);
|
||||
static int proto_prp = -1;
|
||||
static module_t *prp_module;
|
||||
|
||||
|
||||
/* Initialize trailer fields */
|
||||
|
@ -196,7 +195,6 @@ dissect_prp_redundancy_control_trailer(tvbuff_t *tvb, packet_info *pinfo _U_, pr
|
|||
/* Register the protocol with Wireshark */
|
||||
void proto_register_prp(void)
|
||||
{
|
||||
|
||||
static hf_register_info hf[] = {
|
||||
/*trailer*/
|
||||
{ &hf_prp_redundancy_control_trailer_sequence_nr,
|
||||
|
@ -234,6 +232,7 @@ void proto_register_prp(void)
|
|||
&ett_prp_redundancy_control_trailer,
|
||||
};
|
||||
|
||||
module_t *prp_module;
|
||||
|
||||
/* Register the protocol name and description */
|
||||
proto_prp = proto_register_protocol("Parallel Redundancy Protocol (IEC62439 Part 3)",
|
||||
|
@ -263,5 +262,5 @@ void proto_reg_handoff_prp(void)
|
|||
prefs_initialized = TRUE;
|
||||
}
|
||||
|
||||
proto_set_decoding(proto_prp, prp_enable_dissector);
|
||||
proto_set_decoding(proto_prp, prp_enable_dissector);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* http://code.google.com/p/nfc-tools/source/browse/trunk/libfreefare/libfreefare/mifare_classic.c
|
||||
* http://www.nxp.com/documents/data_sheet/MF1S703x.pdf
|
||||
* http://www.nxp.com/documents/application_note/AN1304.pdf
|
||||
*
|
||||
*
|
||||
* Copyright 2011, Tyson Key <tyson.key@gmail.com>
|
||||
*
|
||||
* $Id$
|
||||
|
@ -29,15 +29,13 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/strutil.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static int proto_mifare = -1;
|
||||
|
||||
|
@ -48,36 +46,33 @@ static int hf_mifare_key_b = -1;
|
|||
static int hf_mifare_uid = -1;
|
||||
static int hf_mifare_operand = -1;
|
||||
|
||||
#define AUTH_A 0x60
|
||||
#define AUTH_B 0x61
|
||||
#define READ 0x30
|
||||
#define WRITE 0xA0
|
||||
#define TRANSFER 0xB0
|
||||
#define AUTH_A 0x60
|
||||
#define AUTH_B 0x61
|
||||
#define READ 0x30
|
||||
#define WRITE 0xA0
|
||||
#define TRANSFER 0xB0
|
||||
#define DECREMENT 0xC0
|
||||
#define INCREMENT 0xC1
|
||||
#define RESTORE 0xC2
|
||||
#define RESTORE 0xC2
|
||||
|
||||
static const value_string hf_mifare_commands[] = {
|
||||
{AUTH_A, "AUTH_A"},
|
||||
{AUTH_B, "AUTH_B"},
|
||||
{READ, "READ"},
|
||||
{WRITE, "WRITE"},
|
||||
{TRANSFER, "TRANSFER"},
|
||||
{AUTH_A, "AUTH_A"},
|
||||
{AUTH_B, "AUTH_B"},
|
||||
{READ, "READ"},
|
||||
{WRITE, "WRITE"},
|
||||
{TRANSFER, "TRANSFER"},
|
||||
{DECREMENT, "DECREMENT"},
|
||||
{INCREMENT, "INCREMENT"},
|
||||
{RESTORE, "RESTORE"},
|
||||
{RESTORE, "RESTORE"},
|
||||
|
||||
/* End of commands */
|
||||
{0x00, NULL}
|
||||
};
|
||||
|
||||
static dissector_handle_t mifare_handle;
|
||||
static dissector_handle_t data_handle=NULL;
|
||||
static dissector_handle_t data_handle;
|
||||
static dissector_table_t mifare_dissector_table;
|
||||
|
||||
/* Forward-declare the dissector functions */
|
||||
static void dissect_mifare(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
||||
|
||||
/* Subtree handles: set by register_subtree_array */
|
||||
static gint ett_mifare = -1;
|
||||
|
||||
|
@ -86,7 +81,7 @@ static void dissect_mifare(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_item *item;
|
||||
proto_tree *mifare_tree;
|
||||
guint8 cmd;
|
||||
tvbuff_t *next_tvb = NULL;
|
||||
tvbuff_t *next_tvb = NULL;
|
||||
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MiFare");
|
||||
|
@ -118,7 +113,7 @@ static void dissect_mifare(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_item(mifare_tree, hf_mifare_uid, tvb, 8, 4, ENC_BIG_ENDIAN);
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "Authenticate with Key B");
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case READ:
|
||||
|
@ -229,7 +224,7 @@ proto_register_mifare(void)
|
|||
void
|
||||
proto_reg_handoff_mifare(void)
|
||||
{
|
||||
data_handle = find_dissector("data");
|
||||
data_handle = find_dissector("data");
|
||||
mifare_handle = find_dissector("mifare");
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue