diff options
author | Michael Mann <mmann78@netscape.net> | 2012-10-26 02:15:20 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2012-10-26 02:15:20 +0000 |
commit | 1fe105a5abdcce808088eb3aaf6ce97ecb5dac4c (patch) | |
tree | 8ab05bb3e95e8c929a9bf7feab3042bdc8f2a4e9 /epan/dissectors/packet-cip.c | |
parent | 361aedec1f819365bd89143185892e2c7fa38efd (diff) |
Improve Modbus/TCP dissector, Part 1
This is a portion of the patch supplied in bug 7902 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7902). Breaking the functionality up into smaller chunks.
This definitively breaks the Modbus dissection into 3 dissectors:
Modbus - real protocol PDU
Modbus/TCP - Encapsulation of Modbus over TCP (with a small header before PDU)
Modbus RTU - Originally an encapsulation of Modbus over serial (with smaller header + CRC), but can also be sent over TCP.
General cleanup/refactoring (including display filter names) based on the 3 dissectors.
Also included:
1. Enhanced dissection to include preferences for register data to be dissected as UINT16, UINT32 or FLOAT
2. Dynamic port registration
3. Additional fields now filterable
svn path=/trunk/; revision=45793
Diffstat (limited to 'epan/dissectors/packet-cip.c')
-rw-r--r-- | epan/dissectors/packet-cip.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c index c5b7e24774..06861ddfcc 100644 --- a/epan/dissectors/packet-cip.c +++ b/epan/dissectors/packet-cip.c @@ -4733,6 +4733,7 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ tvbuff_t *next_tvb; int req_path_size; guint8 gen_status, add_stat_size, service; + modbus_request_info_t* request_info; col_set_str(pinfo->cinfo, COL_PROTOCOL, "CIP MB"); @@ -4804,7 +4805,11 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ next_tvb = tvb_new_subset( tvb, offset+4+add_stat_size, item_length-4-add_stat_size, item_length-4-add_stat_size); /* keep packet context */ - p_add_proto_data(pinfo->fd, proto_modbus, (void*)RESPONSE_PACKET); + request_info = ep_alloc(sizeof(modbus_request_info_t)); + request_info->packet_type = RESPONSE_PACKET; + request_info->register_addr_type = MBTCP_PREF_REGISTER_ADDR_RAW; + request_info->register_format = MBTCP_PREF_REGISTER_FORMAT_UINT16; + p_add_proto_data(pinfo->fd, proto_modbus, request_info); call_dissector(modbus_handle, next_tvb, pinfo, cmd_data_tree); p_remove_proto_data(pinfo->fd, proto_modbus); @@ -4895,7 +4900,11 @@ dissect_cip_mb_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, int item_ next_tvb = tvb_new_subset( tvb, offset+2+req_path_size, item_length-req_path_size-2, item_length-req_path_size-2); /* keep packet context */ - p_add_proto_data(pinfo->fd, proto_modbus, (void*)QUERY_PACKET); + request_info = ep_alloc(sizeof(modbus_request_info_t)); + request_info->packet_type = QUERY_PACKET; + request_info->register_addr_type = MBTCP_PREF_REGISTER_ADDR_RAW; + request_info->register_format = MBTCP_PREF_REGISTER_FORMAT_UINT16; + p_add_proto_data(pinfo->fd, proto_modbus, request_info); call_dissector(modbus_handle, next_tvb, pinfo, cmd_data_tree); p_remove_proto_data(pinfo->fd, proto_modbus); |