diff options
author | Tomas Kukosa <tomas.kukosa@siemens.com> | 2005-09-22 14:40:26 +0000 |
---|---|---|
committer | Tomas Kukosa <tomas.kukosa@siemens.com> | 2005-09-22 14:40:26 +0000 |
commit | 81a2feddabc6ef32a06276bbbb5c1fe2ba95d161 (patch) | |
tree | 752b2e97b16ae1fbfa6e9a287fbb29bb8ddfff10 /epan/dissectors/packet-h225.c | |
parent | 1c0667858e11e9461ad69e755739512dbc8bd93e (diff) |
Call H245 decoding and tunelled protocols decoding at the end of H225 dissector. I makes less confusion in info column.
svn path=/trunk/; revision=15958
Diffstat (limited to 'epan/dissectors/packet-h225.c')
-rw-r--r-- | epan/dissectors/packet-h225.c | 89 |
1 files changed, 80 insertions, 9 deletions
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c index a9831c1282..aca3cf85e1 100644 --- a/epan/dissectors/packet-h225.c +++ b/epan/dissectors/packet-h225.c @@ -62,6 +62,69 @@ #include "packet-h245.h" #include "packet-q931.h" +/*---------------------------------------------------------------------------*/ +/* next tvb list - can be moved to some more common file if other dissector needs it */ + +#include <epan/emem.h> + +typedef struct next_tvb_item { + struct next_tvb_item *next; + struct next_tvb_item *previous; + dissector_handle_t handle; + tvbuff_t *tvb; + proto_tree *tree; +} next_tvb_item_t; + +typedef struct { + next_tvb_item_t *first; + next_tvb_item_t *last; + int count; +} next_tvb_list_t; + +void next_tvb_init(next_tvb_list_t *list); +void next_tvb_add(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle); +void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle); + +void next_tvb_init(next_tvb_list_t *list) { + list->first = NULL; + list->last = NULL; + list->count = 0; +} + +void next_tvb_add(next_tvb_list_t *list, tvbuff_t *tvb, proto_tree *tree, dissector_handle_t handle) { + next_tvb_item_t *item; + + item = ep_alloc(sizeof(next_tvb_item_t)); + + item->handle = handle; + item->tvb = tvb; + item->tree = tree; + + if (list->last) { + list->last->next = item; + } else { + list->first = item; + } + item->next = NULL; + item->previous = list->last; + list->last = item; + list->count++; +} + +void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, dissector_handle_t handle, dissector_handle_t data_handle) { + next_tvb_item_t *item; + + item = list->first; + while (item) { + if (item->tvb && tvb_length(item->tvb)) { + call_dissector((item->handle) ? item->handle : ((handle) ? handle : data_handle), item->tvb, pinfo, (item->tree) ? item->tree : tree); + } + item = item->next; + } +} + +/*---------------------------------------------------------------------------*/ + #define PNAME "H323-MESSAGES" #define PSNAME "H.225.0" #define PFNAME "h225" @@ -94,6 +157,9 @@ static dissector_handle_t h4501_handle=NULL; static dissector_handle_t nsp_handle; static dissector_handle_t tp_handle; +static next_tvb_list_t h245_list; +static next_tvb_list_t tp_list; + /* Initialize the protocol and registered fields */ static int h225_tap = -1; static int proto_h225 = -1; @@ -5397,9 +5463,7 @@ dissect_h225_ParallelH245Control_item(tvbuff_t *tvb, int offset, packet_info *pi offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index, -1, -1, &h245_tvb); - if (h245_tvb && tvb_length(h245_tvb)) { - call_dissector(h245dg_handle, h245_tvb, pinfo, tree); - } + next_tvb_add(&h245_list, h245_tvb, tree, h245dg_handle); return offset; } @@ -6237,9 +6301,7 @@ dissect_h225_H245Control_item(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index, -1, -1, &h245_tvb); - if (h245_tvb && tvb_length(h245_tvb)) { - call_dissector(h245dg_handle, h245_tvb, pinfo, tree); - } + next_tvb_add(&h245_list, h245_tvb, tree, h245dg_handle); return offset; } @@ -6312,9 +6374,7 @@ dissect_h225_T_messageContent_item(tvbuff_t *tvb, int offset, packet_info *pinfo offset = dissect_per_octet_string(tvb, offset, pinfo, tree, hf_index, -1, -1, &next_tvb); - if (next_tvb && tvb_length(next_tvb)) { - call_dissector((tp_handle)?tp_handle:data_handle, next_tvb, pinfo, tree); - } + next_tvb_add(&tp_list, next_tvb, tree, tp_handle); return offset; } @@ -9273,6 +9333,9 @@ dissect_h225_H323UserInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree * reset_h225_packet_info(h225_pi); h225_pi->msg_type = H225_CS; + next_tvb_init(&h245_list); + next_tvb_init(&tp_list); + if (check_col(pinfo->cinfo, COL_PROTOCOL)){ col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); } @@ -9285,6 +9348,14 @@ dissect_h225_H323UserInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree * offset = dissect_h225_H323_UserInformation(tvb, offset,pinfo, tr, hf_h225_H323_UserInformation); + if (h245_list.count && check_col(pinfo->cinfo, COL_PROTOCOL)){ + col_append_str(pinfo->cinfo, COL_PROTOCOL, "/"); + col_set_fence(pinfo->cinfo, COL_PROTOCOL); + } + + next_tvb_call(&h245_list, pinfo, tree, h245dg_handle, data_handle); + next_tvb_call(&tp_list, pinfo, tree, NULL, data_handle); + tap_queue_packet(h225_tap, pinfo, h225_pi); return offset; |