aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/ethercat/packet-ams.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-21 17:18:11 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-21 17:18:11 +0000
commitf4360dc48c77e2ed875275c58939b5ff9a2a9946 (patch)
tree288a5ee9cf59e22c7e04ac8b8e9b9653a8515113 /plugins/ethercat/packet-ams.c
parent774b7caa055d336e7a1269868d08ced59cd8e9e9 (diff)
Create separate dissector function for TCP functionality so packet_info->ethertype doesn't need to be used.
svn path=/trunk/; revision=53478
Diffstat (limited to 'plugins/ethercat/packet-ams.c')
-rw-r--r--plugins/ethercat/packet-ams.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/plugins/ethercat/packet-ams.c b/plugins/ethercat/packet-ams.c
index 4b3cab463c..615a612960 100644
--- a/plugins/ethercat/packet-ams.c
+++ b/plugins/ethercat/packet-ams.c
@@ -396,11 +396,10 @@ static void NetIdFormater(tvbuff_t *tvb, guint offset, char *szText, gint nMax)
/*ams*/
-static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+static gint dissect_ams_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
proto_item *ti, *anItem;
proto_tree *ams_tree = NULL, *ams_adstree, *ams_statetree;
- gint offset = 0;
guint ams_length = tvb_reported_length(tvb);
guint16 stateflags = 0;
guint16 cmdId = 0;
@@ -413,14 +412,6 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
col_clear(pinfo->cinfo, COL_INFO);
- if( pinfo->ethertype != 0x88a4 )
- {
- if( TcpAdsParserHDR_Len > ams_length )
- return offset;
-
- offset = TcpAdsParserHDR_Len;
- }
-
if( ams_length < AmsHead_Len )
return offset;
@@ -854,6 +845,19 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
return offset;
}
+/*ams*/
+static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+{
+ return dissect_ams_pdu(tvb, pinfo, tree, 0);
+}
+
+static gint dissect_amstcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+{
+ if( TcpAdsParserHDR_Len > tvb_reported_length(tvb))
+ return 0;
+
+ return dissect_ams_pdu(tvb, pinfo, tree, TcpAdsParserHDR_Len);
+}
void proto_register_ams(void)
{
@@ -1232,9 +1236,10 @@ void proto_register_ams(void)
void proto_reg_handoff_ams(void)
{
- dissector_handle_t ams_handle;
+ dissector_handle_t ams_handle, amstcp_handle;
ams_handle = find_dissector("ams");
- dissector_add_uint("tcp.port", 0xbf02, ams_handle);
+ amstcp_handle = new_create_dissector_handle( dissect_amstcp, proto_ams );
+ dissector_add_uint("tcp.port", 0xbf02, amstcp_handle);
dissector_add_uint("ecatf.type", 2, ams_handle);
}