forked from osmocom/wireshark
Do some cleanup:
- Separate .h file not req'd since not used elsewhere; - Use bitmasks instead of using non-portable bitfields; - Note possible incorrect display of crcError and alignError flags; - Clean up spacing. svn path=/trunk/; revision=31412
This commit is contained in:
parent
b77ad63939
commit
de767f7dea
|
@ -40,7 +40,6 @@ DISSECTOR_SRC = \
|
|||
DISSECTOR_INCLUDES = \
|
||||
packet-ams.h \
|
||||
packet-ecatmb.h \
|
||||
packet-esl.h \
|
||||
packet-ethercat-datagram.h \
|
||||
packet-ethercat-frame.h \
|
||||
packet-ioraw.h \
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
@ -35,7 +33,65 @@
|
|||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
|
||||
#include "packet-esl.h"
|
||||
#if 0
|
||||
/* XXX: using bitfields is compiler dependent: See README.developer */
|
||||
|
||||
typedef union _EslFlagsUnion
|
||||
{
|
||||
struct
|
||||
{
|
||||
guint16 port7 : 1;
|
||||
guint16 port6 : 1;
|
||||
guint16 port5 : 1;
|
||||
guint16 port4 : 1;
|
||||
guint16 port3 : 1;
|
||||
guint16 port2 : 1;
|
||||
guint16 port1 : 1;
|
||||
guint16 port0 : 1;
|
||||
guint16 extended : 1;
|
||||
guint16 reserved : 2;
|
||||
guint16 crcError : 1;
|
||||
guint16 alignError : 1;
|
||||
guint16 timeStampEna : 1;
|
||||
guint16 port9 : 1;
|
||||
guint16 port8 : 1;
|
||||
}d;
|
||||
struct
|
||||
{
|
||||
guint8 loPorts : 1;
|
||||
guint8 flagsHiPorts : 1;
|
||||
}lo_hi_flags;
|
||||
guint flags;
|
||||
} EslFlagsUnion;
|
||||
#endif
|
||||
|
||||
#define esl_port7_bitmask 0x0001
|
||||
#define esl_port6_bitmask 0x0002
|
||||
#define esl_port5_bitmask 0x0004
|
||||
#define esl_port4_bitmask 0x0008
|
||||
#define esl_port3_bitmask 0x0010
|
||||
#define esl_port2_bitmask 0x0020
|
||||
#define esl_port1_bitmask 0x0040
|
||||
#define esl_port0_bitmask 0x0080
|
||||
#define esl_extended_bitmask 0x0100
|
||||
|
||||
#define esl_crcError_bitmask 0x0800
|
||||
#define esl_alignError_bitmask 0x1000
|
||||
#define esl_timeStampEna_bitmask 0x2000
|
||||
#define esl_port9_bitmask 0x4000
|
||||
#define esl_port8_bitmask 0x8000
|
||||
|
||||
#if 0
|
||||
typedef struct _EslHeader
|
||||
{
|
||||
guint8 eslCookie[6]; /* 01 01 05 10 00 00 */
|
||||
EslFlagsUnion flags;
|
||||
guint64 timeStamp;
|
||||
} EslHeader, *PEslHeader;
|
||||
#endif
|
||||
|
||||
|
||||
#define SIZEOF_ESLHEADER 16
|
||||
|
||||
static dissector_handle_t eth_withoutfcs_handle;
|
||||
static int esl_enable_dissector = FALSE;
|
||||
|
@ -52,11 +108,14 @@ static int hf_esl_port = -1;
|
|||
static int hf_esl_crcerror = -1;
|
||||
static int hf_esl_alignerror = -1;
|
||||
|
||||
/* Note: using external tfs strings apparently doesn't work in a plugin */
|
||||
static const true_false_string flags_yes_no = {
|
||||
"yes",
|
||||
"no"
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* XXX: using bitfields is compiler dependent: See README.developer */
|
||||
static guint16 flags_to_port(guint16 flagsValue) {
|
||||
EslFlagsUnion flagsUnion;
|
||||
flagsUnion.flags = flagsValue;
|
||||
|
@ -83,7 +142,32 @@ static guint16 flags_to_port(guint16 flagsValue) {
|
|||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static guint16 flags_to_port(guint16 flagsValue) {
|
||||
if ( (flagsValue & esl_port0_bitmask) != 0 )
|
||||
return 0;
|
||||
else if ( (flagsValue & esl_port1_bitmask) != 0 )
|
||||
return 1;
|
||||
else if ( (flagsValue & esl_port2_bitmask) != 0 )
|
||||
return 2;
|
||||
else if ( (flagsValue & esl_port3_bitmask) != 0 )
|
||||
return 3;
|
||||
else if ( (flagsValue & esl_port4_bitmask) != 0 )
|
||||
return 4;
|
||||
else if ( (flagsValue & esl_port5_bitmask) != 0 )
|
||||
return 5;
|
||||
else if ( (flagsValue & esl_port6_bitmask) != 0 )
|
||||
return 6;
|
||||
else if ( (flagsValue & esl_port7_bitmask) != 0 )
|
||||
return 7;
|
||||
else if ( (flagsValue & esl_port8_bitmask) != 0 )
|
||||
return 8;
|
||||
else if ( (flagsValue & esl_port9_bitmask) != 0 )
|
||||
return 9;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*esl*/
|
||||
static void
|
||||
|
@ -239,17 +323,18 @@ proto_register_esl(void) {
|
|||
},
|
||||
{ &hf_esl_crcerror,
|
||||
{ "Crc Error", "esl.crcerror",
|
||||
FT_BOOLEAN, 16, TFS(&flags_yes_no), 0x1000,
|
||||
FT_BOOLEAN, 16, TFS(&flags_yes_no), 0x1000 /* XXX: Should be 0x0800 to match struct definition ?? */,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_esl_alignerror,
|
||||
{ "Alignment Error", "esl.alignerror",
|
||||
FT_BOOLEAN, 16, TFS(&flags_yes_no), 0x0800,
|
||||
FT_BOOLEAN, 16, TFS(&flags_yes_no), 0x0800 /* xxx: Should be 0x1000 to match struct definition ?? */,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_esl_timestamp,
|
||||
{ "timestamp", "esl.timestamp",
|
||||
FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
|
||||
FT_UINT64, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -268,7 +353,6 @@ proto_register_esl(void) {
|
|||
"Enable this dissector (default is false)",
|
||||
&esl_enable_dissector);
|
||||
|
||||
|
||||
proto_register_field_array(proto_esl,hf,array_length(hf));
|
||||
proto_register_subtree_array(ett,array_length(ett));
|
||||
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/* packet-esl.h
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2007 by Beckhoff Automation GmbH
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _PACKET_ESL_H_
|
||||
#define _PACKET_ESL_H_
|
||||
|
||||
typedef union _EslFlagsUnion
|
||||
{
|
||||
struct
|
||||
{
|
||||
guint16 port7 : 1;
|
||||
guint16 port6 : 1;
|
||||
guint16 port5 : 1;
|
||||
guint16 port4 : 1;
|
||||
guint16 port3 : 1;
|
||||
guint16 port2 : 1;
|
||||
guint16 port1 : 1;
|
||||
guint16 port0 : 1;
|
||||
guint16 extended : 1;
|
||||
guint16 reserved : 2;
|
||||
guint16 crcError : 1;
|
||||
guint16 alignError : 1;
|
||||
guint16 timeStampEna: 1;
|
||||
guint16 port9 : 1;
|
||||
guint16 port8 : 1;
|
||||
}d;
|
||||
struct
|
||||
{
|
||||
guint8 loPorts : 1;
|
||||
guint8 flagsHiPorts : 1;
|
||||
}lo_hi_flags;
|
||||
guint flags;
|
||||
}EslFlagsUnion;
|
||||
|
||||
#if 0
|
||||
typedef struct _EslHeader
|
||||
{
|
||||
guint8 eslCookie[6]; /* 01 01 05 10 00 00 */
|
||||
EslFlagsUnion flags;
|
||||
guint64 timeStamp;
|
||||
} EslHeader, *PEslHeader;
|
||||
#endif
|
||||
|
||||
|
||||
#define SIZEOF_ESLHEADER 16
|
||||
#endif /* _PACKET_ESL_H_*/
|
Loading…
Reference in New Issue