diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2015-01-25 14:30:13 -0500 |
---|---|---|
committer | Hadriel Kaplan <hadrielk@yahoo.com> | 2015-01-27 15:14:12 +0000 |
commit | ceb8d954d25211d5cb4766ece277c15aa53578d5 (patch) | |
tree | 859ad1b08e44c140728311e9ed60fd3444cd2054 /epan/dissectors/packet-xot.c | |
parent | 9bbc33730622e117d9edfa3f393da883624510f1 (diff) |
Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.
Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
Diffstat (limited to 'epan/dissectors/packet-xot.c')
-rw-r--r-- | epan/dissectors/packet-xot.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/epan/dissectors/packet-xot.c b/epan/dissectors/packet-xot.c index e3826ce7a7..2647a262fa 100644 --- a/epan/dissectors/packet-xot.c +++ b/epan/dissectors/packet-xot.c @@ -103,7 +103,8 @@ static gboolean xot_desegment = TRUE; /* desegmentation of X.25 packet sequences */ static gboolean x25_desegment = FALSE; -static guint get_xot_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) +static guint get_xot_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, + int offset, void *data _U_) { guint16 plen; int remain = tvb_length_remaining(tvb, offset); @@ -119,7 +120,8 @@ static guint get_xot_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) return XOT_HEADER_LENGTH + plen; } -static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) +static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb, + int offset, void *data _U_) { int offset_before = offset; /* offset where we start this test */ int offset_next = offset + XOT_HEADER_LENGTH + X25_MIN_HEADER_LENGTH; @@ -143,7 +145,7 @@ static guint get_xot_pdu_len_mult(packet_info *pinfo _U_, tvbuff_t *tvb, int off /* * Get the length of the current X.25-over-TCP packet. */ - plen = get_xot_pdu_len(pinfo, tvb, offset); + plen = get_xot_pdu_len(pinfo, tvb, offset, NULL); offset_next = offset + plen; /* Make sure we have enough data */ @@ -277,7 +279,7 @@ static int dissect_xot_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static int dissect_xot_mult(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { int offset = 0; - int len = get_xot_pdu_len_mult(pinfo, tvb, offset); + int len = get_xot_pdu_len_mult(pinfo, tvb, offset, NULL); tvbuff_t *next_tvb; int offset_max = offset+MIN(len,tvb_length_remaining(tvb, offset)); proto_item *ti; @@ -292,7 +294,7 @@ static int dissect_xot_mult(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } while (offset <= offset_max - XOT_HEADER_LENGTH){ - int plen = get_xot_pdu_len(pinfo, tvb, offset); + int plen = get_xot_pdu_len(pinfo, tvb, offset, NULL); next_tvb = tvb_new_subset(tvb, offset,plen, plen); /*MIN(plen,tvb_length_remaining(tvb, offset)),plen*/ @@ -315,14 +317,14 @@ static int dissect_xot_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t XOT_HEADER_LENGTH, get_xot_pdu_len, dissect_xot_pdu, data); - len=get_xot_pdu_len(pinfo, tvb, 0); + len=get_xot_pdu_len(pinfo, tvb, 0, NULL); } else { /* Use length version that "peeks" into X25, possibly several XOT packets */ tcp_dissect_pdus(tvb, pinfo, tree, xot_desegment, XOT_HEADER_LENGTH, get_xot_pdu_len_mult, dissect_xot_mult, data); - len=get_xot_pdu_len_mult(pinfo, tvb, 0); + len=get_xot_pdu_len_mult(pinfo, tvb, 0, NULL); } /*As tcp_dissect_pdus will not report the success/failure, we have to compute again */ |