diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-07-14 17:27:57 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-07-14 17:27:57 +0000 |
commit | 976cca3f9873c7f5c1c82aebc0b00d825c38e6a7 (patch) | |
tree | d88b16fb2bd62816a1647f35a55321c39552c972 /plugins | |
parent | a1ca4be5ef0814212fd0185245e4f1370e743820 (diff) |
A fragment_data structure now contains a pointer to a tvbuff to the
fragment or reassembled data, not a pointer to the data itself; instead
of having to construct a tvbuffs for the reassembled data, we can now
just use the existing tvbuff.
Spell out "fragment" and "fragmentation" in comments while we're at it.
svn path=/trunk/; revision=50584
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/m2m/packet-m2m.c | 6 | ||||
-rw-r--r-- | plugins/profinet/packet-pn-rt.c | 10 | ||||
-rw-r--r-- | plugins/wimax/mac_hd_generic_decoder.c | 10 |
3 files changed, 12 insertions, 14 deletions
diff --git a/plugins/m2m/packet-m2m.c b/plugins/m2m/packet-m2m.c index f1811895f5..540e806a89 100644 --- a/plugins/m2m/packet-m2m.c +++ b/plugins/m2m/packet-m2m.c @@ -456,12 +456,12 @@ static void pdu_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint pdu_tvb = tvb_new_subset(tvb, offset, length, length); } else /* fragmented PDU */ - { /* add the frag */ + { /* add the fragment */ pdu_frag = fragment_add_seq(&pdu_reassembly_table, tvb, offset, pinfo, burst_number, NULL, frag_number - 1, length, ((frag_type==TLV_LAST_FRAG)?0:1), 0); if(pdu_frag && frag_type == TLV_LAST_FRAG) { - /* create the new tvb for defraged frame */ - pdu_tvb = tvb_new_child_real_data(tvb, pdu_frag->data, pdu_frag->len, pdu_frag->len); + /* get the new tvb for defragmented frame */ + pdu_tvb = pdu_frag->tvb_data; /* add the defragmented data to the data source list */ add_new_data_source(pinfo, pdu_tvb, "Reassembled WiMax PDU Frame"); } diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c index 5d91b49d3a..4ab9a2c90b 100644 --- a/plugins/profinet/packet-pn-rt.c +++ b/plugins/profinet/packet-pn-rt.c @@ -440,22 +440,20 @@ dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void (tvb_length(tvb) - offset)/*u8FragDataLength*8*/, bMoreFollows, 0); if (pdu_frag && !bMoreFollows) /* PDU is complete! and last fragment */ - { /* store this frag as the completed frag in hash table */ + { /* store this fragment as the completed fragment in hash table */ g_hash_table_insert(reasembled_frag_table, GUINT_TO_POINTER(pinfo->fd->num), pdu_frag); start_frag_OR_ID[u32FragID] = 0; /* reset the starting frame counter */ } if (!bMoreFollows) /* last fragment */ { pdu_frag = (fragment_data *)g_hash_table_lookup(reasembled_frag_table, GUINT_TO_POINTER(pinfo->fd->num)); - if (pdu_frag) /* found a matching frag dissect it */ + if (pdu_frag) /* found a matching fragment; dissect it */ { guint16 type; - guint16 pdu_length; tvbuff_t *pdu_tvb; - pdu_length = pdu_frag->len; - /* create the new tvb for defraged frame */ - pdu_tvb = tvb_new_child_real_data(tvb, pdu_frag->data, pdu_length, pdu_length); + /* get the new tvb for defragmented frame */ + pdu_tvb = pdu_frag->tvb_data; /* add the defragmented data to the data source list */ add_new_data_source(pinfo, pdu_tvb, "Reassembled Profinet Frame"); /* PDU is complete: look for the Ethertype and give it to the appropriate dissection routine */ diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c index edd4545ea9..9ae8451faa 100644 --- a/plugins/wimax/mac_hd_generic_decoder.c +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -1010,7 +1010,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto new_payload_len = frag_len; } else /* fragmented payload */ - { /* add the frag */ + { /* add the fragment */ /* Make sure cid will not match a previous packet with different data */ for (i = 0; i < MAX_CID; i++) { @@ -1071,7 +1071,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto /* Save address pointers. */ save_src = pinfo->src; save_dst = pinfo->dst; - /* Use dl_src and dl_dst in defrag. */ + /* Use dl_src and dl_dst in defragmentation. */ pinfo->src = pinfo->dl_src; pinfo->dst = pinfo->dl_dst; payload_frag = fragment_add_seq(&payload_reassembly_table, tvb, offset, pinfo, cid, NULL, frag_number[cid_index], frag_len, ((frag_type==LAST_FRAG)?0:1), 0); @@ -1083,14 +1083,14 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto /* Make sure fragment_add_seq() sees next one as a new frame. */ cid_vernier[cid_index]++; } - /* Don't show reassem packet until last frag. */ + /* Don't show reassembled packet until last fragment. */ proto_tree_add_text(tree, tvb, offset, frag_len, "Payload Fragment (%d bytes)", frag_len); if (payload_frag && frag_type == LAST_FRAG) { /* defragmented completely */ payload_length = payload_frag->len; - /* create the new tvb for defragmented frame */ - payload_tvb = tvb_new_child_real_data(tvb, payload_frag->data, payload_length, payload_length); + /* get the new tvb for defragmented frame */ + payload_tvb = payload_frag->tvb_data; /* add the defragmented data to the data source list */ add_new_data_source(pinfo, payload_tvb, "Reassembled WiMax MAC payload"); /* save the tvb langth */ |