diff options
author | Anders Broman <anders.broman@ericsson.com> | 2011-12-10 12:50:05 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2011-12-10 12:50:05 +0000 |
commit | 8f480def7c524b148ca448b9b45e743d960acdb0 (patch) | |
tree | 5880d23dbfca9b73c9a26754f216f81233d574a6 | |
parent | 8d4e40559d19030353465f381b2dc954ce5984f6 (diff) |
Dissect the whole IR dyn packet in packet-rohc.c
svn path=/trunk/; revision=40147
-rw-r--r-- | epan/dissectors/packet-pdcp-lte.c | 36 | ||||
-rw-r--r-- | epan/dissectors/packet-rohc.c | 93 | ||||
-rw-r--r-- | epan/dissectors/packet-rohc.h | 2 |
3 files changed, 75 insertions, 56 deletions
diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index 2726f82920..3fd9d13e11 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -833,7 +833,7 @@ static int dissect_pdcp_dynamic_chain(proto_tree *tree, } #endif - +#if 0 static int dissect_pdcp_irdyn_packet(proto_tree *tree, proto_item *root_item, tvbuff_t *tvb, @@ -841,7 +841,6 @@ static int dissect_pdcp_irdyn_packet(proto_tree *tree, struct pdcp_lte_info *p_pdcp_info, packet_info *pinfo) { - rohc_info *p_rohc_info; col_append_str(pinfo->cinfo, COL_INFO, " IRDYN"); proto_item_append_text(root_item, " (IRDYN)"); @@ -859,7 +858,6 @@ static int dissect_pdcp_irdyn_packet(proto_tree *tree, proto_tree_add_item(tree, hf_pdcp_lte_rohc_ir_crc, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; -#if 0 /* Dissect dynamic chain */ offset = dissect_pdcp_dynamic_chain(tree, root_item, @@ -867,23 +865,9 @@ static int dissect_pdcp_irdyn_packet(proto_tree *tree, offset, p_pdcp_info, pinfo); -#endif - /* RoHC settings */ - p_rohc_info = ep_new(rohc_info); - - p_rohc_info->rohc_compression = p_pdcp_info->rohc_compression; - p_rohc_info->rohc_ip_version = p_pdcp_info->rohc_ip_version; - p_rohc_info->cid_inclusion_info = p_pdcp_info->cid_inclusion_info; - p_rohc_info->large_cid_present = p_pdcp_info->large_cid_present; - p_rohc_info->mode = p_pdcp_info->mode; - p_rohc_info->rnd = p_pdcp_info->rnd; - p_rohc_info->udp_checkum_present = p_pdcp_info->udp_checkum_present; - p_rohc_info->profile = p_pdcp_info->profile; - p_rohc_info->last_created_item = root_item; - - offset = dissect_rohc_ir_rtp_profile_dynamic(tvb, tree, offset, p_rohc_info); return offset; } +#endif #if 0 static int dissect_pdcp_ir_packet(proto_tree *tree, @@ -2274,7 +2258,21 @@ static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* IRDYN (11111000) */ else if (base_header_byte == 0xf8) { - offset = dissect_pdcp_irdyn_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo); + /* RoHC settings */ + p_rohc_info = ep_new(rohc_info); + + p_rohc_info->rohc_compression = p_pdcp_info->rohc_compression; + p_rohc_info->rohc_ip_version = p_pdcp_info->rohc_ip_version; + p_rohc_info->cid_inclusion_info = p_pdcp_info->cid_inclusion_info; + p_rohc_info->large_cid_present = p_pdcp_info->large_cid_present; + p_rohc_info->mode = p_pdcp_info->mode; + p_rohc_info->rnd = p_pdcp_info->rnd; + p_rohc_info->udp_checkum_present = p_pdcp_info->udp_checkum_present; + p_rohc_info->profile = p_pdcp_info->profile; + p_rohc_info->last_created_item = NULL; + + /*offset = dissect_pdcp_irdyn_packet(rohc_tree, rohc_ti, tvb, offset, p_pdcp_info, pinfo);*/ + offset = dissect_rohc_ir_dyn_packet(tvb, rohc_tree, pinfo, offset, 0, TRUE/* fool the ROCH dissector */, p_rohc_info); udp_checksum_needed = FALSE; ip_id_needed = FALSE; } diff --git a/epan/dissectors/packet-rohc.c b/epan/dissectors/packet-rohc.c index 8323a6d9ac..f42cf05869 100644 --- a/epan/dissectors/packet-rohc.c +++ b/epan/dissectors/packet-rohc.c @@ -326,7 +326,8 @@ dissect_rohc_feedback_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, break; } } -int + +static int dissect_rohc_ir_rtp_profile_dynamic(tvbuff_t *tvb, proto_tree *tree, int offset, rohc_info *p_rohc_info){ proto_item *item; @@ -598,13 +599,59 @@ dissect_rohc_ir_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int } +int +dissect_rohc_ir_dyn_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, guint8 cid, gboolean is_add_cid, rohc_info *p_rohc_info) +{ + proto_item *ir_item, *item; + proto_tree *ir_tree; + gboolean d = FALSE; + guint8 oct, profile, val_len; + gint16 feedback_data_len = 0; + + oct = tvb_get_guint8(tvb,offset); + + if((p_rohc_info->large_cid_present == FALSE) && (is_add_cid == FALSE)){ + item = proto_tree_add_uint(tree, hf_rohc_small_cid, tvb, 0, 0, cid); + PROTO_ITEM_SET_GENERATED(item); + } + ir_item = proto_tree_add_item(tree, hf_rohc_ir_dyn_packet, tvb, offset, 1, ENC_BIG_ENDIAN); + ir_tree = proto_item_add_subtree(ir_item, ett_rohc_ir_dyn); + if(p_rohc_info->large_cid_present == TRUE){ + /* Handle Large CID:s here */ + get_self_describing_var_len_val(tvb, ir_tree, offset, hf_rohc_large_cid, &val_len); + offset = offset + val_len; + } + profile = tvb_get_guint8(tvb,offset); + item = proto_tree_add_item(ir_tree, hf_rohc_profile, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + if(p_rohc_info->profile != profile){ + expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, + "Configured profile %u, differs from actual profile %u, Dissection of other packets may be faulty", + p_rohc_info->profile, profile); + /* Oweride the configured profile */ + p_rohc_info->profile = profile; + } + proto_tree_add_item(ir_tree, hf_rohc_rtp_crc, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + switch(profile){ + case ROHC_PROFILE_RTP: + /* TODO: Currently IPv4 Hardwired, use conversation info or preference ? */ + dissect_rohc_ir_rtp_profile_dynamic(tvb, ir_tree, offset, p_rohc_info); + break; + default: + proto_tree_add_text(ir_tree, tvb, offset, feedback_data_len, "profile-specific information[Not dissected yet]"); + break; + } + return offset; + +} static void dissect_rohc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti, *ir_item, *item; - proto_tree *rohc_tree, *ir_tree, *sub_tree = NULL; + proto_item *ti, *item; + proto_tree *rohc_tree, *sub_tree = NULL; int offset = 0, length; - guint8 oct, code, size , cid, profile, val_len; + guint8 oct, code, size , cid, val_len; gint16 feedback_data_len = 0; gboolean is_add_cid = FALSE; rohc_info *p_rohc_info = NULL; @@ -758,45 +805,19 @@ start_over: col_append_str(pinfo->cinfo, COL_INFO, "IR packet"); offset = dissect_rohc_ir_packet(tvb, rohc_tree, pinfo, offset, cid, is_add_cid, p_rohc_info); if(offset == -1){ + /* Could not pare header */ return; } proto_tree_add_text(rohc_tree, tvb, offset, -1, "Data"); } if((oct&0xff) == 0xf8){ col_append_str(pinfo->cinfo, COL_INFO, "IR-DYN packet"); - if((p_rohc_info->large_cid_present == FALSE) && (is_add_cid == FALSE)){ - item = proto_tree_add_uint(rohc_tree, hf_rohc_small_cid, tvb, 0, 0, cid); - PROTO_ITEM_SET_GENERATED(item); - } - ir_item = proto_tree_add_item(rohc_tree, hf_rohc_ir_dyn_packet, tvb, offset, 1, ENC_BIG_ENDIAN); - ir_tree = proto_item_add_subtree(ir_item, ett_rohc_ir_dyn); - if(p_rohc_info->large_cid_present == TRUE){ - /* Handle Large CID:s here */ - get_self_describing_var_len_val(tvb, ir_tree, offset, hf_rohc_large_cid, &val_len); - offset = offset + val_len; - } - profile = tvb_get_guint8(tvb,offset); - item = proto_tree_add_item(ir_tree, hf_rohc_profile, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - if(p_rohc_info->profile != profile){ - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, - "Configured profile %u, differs from actual profile %u, Dissection of other packets may be faulty", - p_rohc_info->profile, profile); - /* Oweride the configured profile */ - p_rohc_info->profile = profile; - } - proto_tree_add_item(ir_tree, hf_rohc_rtp_crc, tvb, offset, 1, ENC_BIG_ENDIAN); - offset++; - switch(profile){ - case ROHC_PROFILE_RTP: - /* TODO: Currently IPv4 Hardwired, use conversation info or preference ? */ - dissect_rohc_ir_rtp_profile_dynamic(tvb, ir_tree, offset, p_rohc_info); - break; - default: - proto_tree_add_text(ir_tree, tvb, offset, feedback_data_len, "profile-specific information[Not dissected yet]"); - break; + offset = dissect_rohc_ir_dyn_packet(tvb, rohc_tree, pinfo, offset, cid, is_add_cid, p_rohc_info); + if(offset == -1){ + /* Could not pare header */ + return; } - return; + proto_tree_add_text(rohc_tree, tvb, offset, -1, "Data"); } if((oct&0x80)==0){ diff --git a/epan/dissectors/packet-rohc.h b/epan/dissectors/packet-rohc.h index d9e509c4d5..9b2aae5e55 100644 --- a/epan/dissectors/packet-rohc.h +++ b/epan/dissectors/packet-rohc.h @@ -52,7 +52,7 @@ typedef struct rohc_info proto_item *last_created_item; } rohc_info; -int dissect_rohc_ir_rtp_profile_dynamic(tvbuff_t *tvb, proto_tree *tree, int offset, rohc_info *p_rohc_info); int dissect_rohc_ir_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, guint8 cid, gboolean is_add_cid, rohc_info *p_rohc_info); +int dissect_rohc_ir_dyn_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset, guint8 cid, gboolean is_add_cid, rohc_info *p_rohc_info); #endif /* PACKET_ROHC_H */ |