From bc5a0374bfd162d08834f5f7503bebd33d8ec943 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 23 Jan 2016 19:40:51 -0800 Subject: Add the packet number to the packet_info structure, and use it. That removes most of the uses of the frame number field in the frame_data structure. Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22 Reviewed-on: https://code.wireshark.org/review/13509 Reviewed-by: Guy Harris --- plugins/ethercat/packet-esl.c | 4 +-- plugins/irda/packet-irda.c | 28 +++++++++---------- plugins/mate/mate_runtime.c | 8 +++--- plugins/mate/packet-mate.c | 2 +- plugins/profinet/packet-dcom-cba-acco.c | 48 ++++++++++++++++----------------- plugins/profinet/packet-pn-rt.c | 6 ++--- plugins/unistim/packet-unistim.c | 4 +-- plugins/wimax/mac_hd_generic_decoder.c | 12 ++++----- 8 files changed, 56 insertions(+), 56 deletions(-) (limited to 'plugins') diff --git a/plugins/ethercat/packet-esl.c b/plugins/ethercat/packet-esl.c index df96742717..aed683517c 100644 --- a/plugins/ethercat/packet-esl.c +++ b/plugins/ethercat/packet-esl.c @@ -229,7 +229,7 @@ static void modify_times(tvbuff_t *tvb, gint offset, packet_info *pinfo) { ref_time_frame.esl_ts = tvb_get_letoh64(tvb, offset+8); ref_time_frame.fd = pinfo->fd; - ref_time_frame.num = pinfo->fd->num; + ref_time_frame.num = pinfo->num; ref_time_frame.abs_ts = pinfo->abs_ts; } else if ( !pinfo->fd->flags.visited ) @@ -268,7 +268,7 @@ dissect_esl_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data in_heur = TRUE; /*TRY */ { - if ( ref_time_frame.fd != NULL && !pinfo->fd->flags.visited && pinfo->fd->num <= ref_time_frame.num ) + if ( ref_time_frame.fd != NULL && !pinfo->fd->flags.visited && pinfo->num <= ref_time_frame.num ) ref_time_frame.fd = NULL; /* Check that there's enough data */ diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c index 88213b42b1..1e2d070ee6 100644 --- a/plugins/irda/packet-irda.c +++ b/plugins/irda/packet-irda.c @@ -537,13 +537,13 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r destaddr.len = 1; destaddr.data = (guint8*)&circuit_id; - conv = find_conversation(pinfo->fd->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { iap_conv = (iap_conversation_t*)conversation_get_proto_data(conv, proto_iap); while (1) { - if (iap_conv->iap_query_frame == pinfo->fd->num) + if (iap_conv->iap_query_frame == pinfo->num) { iap_conv = NULL; break; @@ -559,7 +559,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r } else { - conv = conversation_new(pinfo->fd->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); + conv = conversation_new(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); iap_conv = wmem_new(wmem_file_scope(), iap_conversation_t); conversation_add_proto_data(conv, proto_iap, (void*)iap_conv); } @@ -573,7 +573,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r iap_conv->pnext = NULL; - iap_conv->iap_query_frame = pinfo->fd->num; + iap_conv->iap_query_frame = pinfo->num; iap_conv->pattr_dissector = NULL; tvb_memcpy(tvb, class_name, offset + 1 + 1, clen); @@ -691,10 +691,10 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro destaddr.data = (guint8*)&circuit_id; /* Find result value dissector */ - conv = find_conversation(pinfo->fd->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { - num = pinfo->fd->num; + num = pinfo->num; iap_conv = (iap_conversation_t*)conversation_get_proto_data(conv, proto_iap); while (iap_conv && (iap_conv->iap_query_frame >= num)) @@ -976,10 +976,10 @@ static void dissect_appl_proto(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro destaddr.data = (guint8*)&circuit_id; /* Find result value dissector */ - conv = find_conversation(pinfo->fd->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { - num = pinfo->fd->num; + num = pinfo->num; lmp_conv = (lmp_conversation_t*)conversation_get_proto_data(conv, proto_irlmp); while (lmp_conv && (lmp_conv->iap_result_frame >= num)) @@ -1004,7 +1004,7 @@ static void dissect_appl_proto(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro if (lmp_conv) { /*g_message("%x:%d->%x:%d = %p\n", src, pinfo->srcport, circuit_id, pinfo->destport, lmp_conv); */ -/*g_message("->%d: %d %d %p\n", pinfo->fd->num, lmp_conv->iap_result_frame, lmp_conv->ttp, lmp_conv->proto_dissector); */ +/*g_message("->%d: %d %d %p\n", pinfo->num, lmp_conv->iap_result_frame, lmp_conv->ttp, lmp_conv->proto_dissector); */ if ((lmp_conv->ttp) && (pdu_type != DISCONNECT_PDU)) { offset += dissect_ttp(tvb, pinfo, root, (pdu_type == DATA_PDU)); @@ -1199,7 +1199,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec lmp_conversation_t* lmp_conv = NULL; -/*g_message("%d: add_lmp_conversation(%p, %d, %d, %p) = ", pinfo->fd->num, pinfo, dlsap, ttp, proto_dissector); */ +/*g_message("%d: add_lmp_conversation(%p, %d, %d, %p) = ", pinfo->num, pinfo, dlsap, ttp, proto_dissector); */ srcaddr.type = AT_NONE; srcaddr.len = 1; srcaddr.data = (guint8*)&circuit_id; @@ -1209,14 +1209,14 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec destaddr.len = 1; destaddr.data = (guint8*)&dest; - conv = find_conversation(pinfo->fd->num, &destaddr, &srcaddr, PT_NONE, dlsap, 0, NO_PORT_B); + conv = find_conversation(pinfo->num, &destaddr, &srcaddr, PT_NONE, dlsap, 0, NO_PORT_B); if (conv) { lmp_conv = (lmp_conversation_t*)conversation_get_proto_data(conv, proto_irlmp); while (1) { /* Does entry already exist? */ - if (lmp_conv->iap_result_frame == pinfo->fd->num) + if (lmp_conv->iap_result_frame == pinfo->num) return; if (lmp_conv->pnext == NULL) @@ -1230,13 +1230,13 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec } else { - conv = conversation_new(pinfo->fd->num, &destaddr, &srcaddr, PT_NONE, dlsap, 0, NO_PORT_B); + conv = conversation_new(pinfo->num, &destaddr, &srcaddr, PT_NONE, dlsap, 0, NO_PORT_B); lmp_conv = wmem_new(wmem_file_scope(), lmp_conversation_t); conversation_add_proto_data(conv, proto_irlmp, (void*)lmp_conv); } lmp_conv->pnext = NULL; - lmp_conv->iap_result_frame = pinfo->fd->num; + lmp_conv->iap_result_frame = pinfo->num; lmp_conv->ttp = ttp; lmp_conv->dissector = dissector; diff --git a/plugins/mate/mate_runtime.c b/plugins/mate/mate_runtime.c index 2fbd0db5aa..1c7f651cbc 100644 --- a/plugins/mate/mate_runtime.c +++ b/plugins/mate/mate_runtime.c @@ -846,7 +846,7 @@ extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree) { rd->now = (float) nstime_to_sec(&pinfo->rel_ts); if ( proto_tracking_interesting_fields(tree) - && rd->highest_analyzed_frame < pinfo->fd->num ) { + && rd->highest_analyzed_frame < pinfo->num ) { for ( i = 0; i < mc->pducfglist->len; i++ ) { cfg = (mate_cfg_pdu *)g_ptr_array_index(mc->pducfglist,i); @@ -862,7 +862,7 @@ extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree) { dbg_print (dbg_pdu,3,dbg_facility,"mate_analyze_frame: found matching proto, extracting: %s",cfg->name); proto = (field_info*) g_ptr_array_index(protos,j); - pdu = new_pdu(cfg, pinfo->fd->num, proto, tree); + pdu = new_pdu(cfg, pinfo->num, proto, tree); if (cfg->criterium) { criterium_match = new_avpl_from_match(cfg->criterium_match_mode,"",pdu->avpl,cfg->criterium,FALSE); @@ -897,7 +897,7 @@ extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree) { } if (!last) { - g_hash_table_insert(rd->frames,GINT_TO_POINTER(pinfo->fd->num),pdu); + g_hash_table_insert(rd->frames,GINT_TO_POINTER(pinfo->num),pdu); last = pdu; } else { last->next_in_frame = pdu; @@ -910,7 +910,7 @@ extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree) { } } - rd->highest_analyzed_frame = pinfo->fd->num; + rd->highest_analyzed_frame = pinfo->num; } } diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c index 3b5bfa3a7b..5ece48b188 100644 --- a/plugins/mate/packet-mate.c +++ b/plugins/mate/packet-mate.c @@ -306,7 +306,7 @@ mate_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) mate_analyze_frame(pinfo,tree); - if (( pdus = mate_get_pdus(pinfo->fd->num) )) { + if (( pdus = mate_get_pdus(pinfo->num) )) { for ( ; pdus; pdus = pdus->next_in_frame) { mate_i = proto_tree_add_protocol_format(tree,mc->hfid_mate,tvb,0,0,"MATE"); mate_t = proto_item_add_subtree(mate_i, mc->ett_root); diff --git a/plugins/profinet/packet-dcom-cba-acco.c b/plugins/profinet/packet-dcom-cba-acco.c index 4e28c25a52..5f6a92fa70 100644 --- a/plugins/profinet/packet-dcom-cba-acco.c +++ b/plugins/profinet/packet-dcom-cba-acco.c @@ -508,7 +508,7 @@ cba_pdev_add(packet_info *pinfo, const address *addr) /* not found, create a new */ pdev = (cba_pdev_t *)wmem_alloc(wmem_file_scope(), sizeof(cba_pdev_t)); memcpy( (void *) (pdev->ip), addr->data, 4); - pdev->first_packet = pinfo->fd->num; + pdev->first_packet = pinfo->num; pdev->ldevs = NULL; pdev->object = NULL; cba_pdevs = g_list_append(cba_pdevs, pdev); @@ -574,7 +574,7 @@ cba_ldev_add(packet_info *pinfo, cba_pdev_t *pdev, const char *name) /* not found, create a new */ ldev = (cba_ldev_t *)wmem_alloc(wmem_file_scope(), sizeof(cba_ldev_t)); ldev->name = wmem_strdup(wmem_file_scope(), name); - ldev->first_packet = pinfo->fd->num; + ldev->first_packet = pinfo->num; ldev->ldev_object = NULL; ldev->acco_object = NULL; ldev->parent = pdev; @@ -658,16 +658,16 @@ cba_packet_in_range(packet_info *pinfo, guint packet_connect, guint packet_disco { if (packet_connect == 0) { - g_warning("cba_packet_in_range#%u: packet_connect not set?", pinfo->fd->num); + g_warning("cba_packet_in_range#%u: packet_connect not set?", pinfo->num); } - if (packet_connect == 0 || pinfo->fd->num < packet_connect) { + if (packet_connect == 0 || pinfo->num < packet_connect) { return FALSE; } - if (packet_disconnect != 0 && pinfo->fd->num > packet_disconnect) { + if (packet_disconnect != 0 && pinfo->num > packet_disconnect) { return FALSE; } - if (packet_disconnectme != 0 && pinfo->fd->num > packet_disconnectme) { + if (packet_disconnectme != 0 && pinfo->num > packet_disconnectme) { return FALSE; } @@ -752,7 +752,7 @@ cba_frame_connect(packet_info *pinfo, cba_ldev_t *cons_ldev, cba_ldev_t *prov_ld frame->consparent = cons_ldev; frame->provparent = prov_ldev; - frame->packet_connect = pinfo->fd->num; + frame->packet_connect = pinfo->num; frame->packet_disconnect = 0; frame->packet_disconnectme = 0; frame->packet_first = 0; @@ -782,12 +782,12 @@ cba_frame_disconnect(packet_info *pinfo, cba_frame_t *frame) { if (frame->packet_disconnect == 0) { - frame->packet_disconnect = pinfo->fd->num; + frame->packet_disconnect = pinfo->num; } - if (frame->packet_disconnect != pinfo->fd->num) { + if (frame->packet_disconnect != pinfo->num) { g_warning("cba_frame_disconnect#%u: frame already disconnected in #%u", - pinfo->fd->num, frame->packet_disconnect); + pinfo->num, frame->packet_disconnect); } } @@ -808,12 +808,12 @@ cba_frame_disconnectme(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cba_ cba_frame_info(tvb, pinfo, tree, frame); if (frame->packet_disconnectme == 0) { - frame->packet_disconnectme = pinfo->fd->num; + frame->packet_disconnectme = pinfo->num; } - if (frame->packet_disconnectme != pinfo->fd->num) { + if (frame->packet_disconnectme != pinfo->num) { g_warning("cba_frame_disconnectme#%u: frame already disconnectme'd in #%u", - pinfo->fd->num, frame->packet_disconnectme); + pinfo->num, frame->packet_disconnectme); } } } @@ -886,12 +886,12 @@ static void cba_frame_incoming_data(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree _U_, cba_frame_t *frame) { if (frame->packet_first == 0) { - frame->packet_first = pinfo->fd->num; + frame->packet_first = pinfo->num; } - if ( pinfo->fd->num > frame->packet_last && + if ( pinfo->num > frame->packet_last && cba_packet_in_range(pinfo, frame->packet_connect, frame->packet_disconnect, frame->packet_disconnectme)) { - frame->packet_last = pinfo->fd->num; + frame->packet_last = pinfo->num; } } @@ -987,7 +987,7 @@ cba_connection_connect(packet_info *pinfo, cba_ldev_t *cons_ldev, cba_ldev_t *pr conn->provparentacco = prov_ldev; conn->parentframe = cons_frame; - conn->packet_connect = pinfo->fd->num; + conn->packet_connect = pinfo->num; conn->packet_disconnect = 0; conn->packet_disconnectme = 0; conn->packet_first = 0; @@ -1024,10 +1024,10 @@ cba_connection_disconnect(packet_info *pinfo, cba_connection_t *conn) { /* XXX - detect multiple disconnects? */ if (conn->packet_disconnect == 0) { - conn->packet_disconnect = pinfo->fd->num; + conn->packet_disconnect = pinfo->num; } - if (conn->packet_disconnect != pinfo->fd->num) { + if (conn->packet_disconnect != pinfo->num) { g_warning("connection_disconnect#%u: already disconnected", conn->packet_disconnect); } @@ -1050,10 +1050,10 @@ cba_connection_disconnectme(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cba_connection_info(tvb, pinfo, tree, conn); if (conn->packet_disconnectme == 0) { - conn->packet_disconnectme = pinfo->fd->num; + conn->packet_disconnectme = pinfo->num; } - if (conn->packet_disconnectme != pinfo->fd->num) { + if (conn->packet_disconnectme != pinfo->num) { g_warning("connection_disconnectme#%u: already disconnectme'd", conn->packet_disconnectme); } @@ -1084,12 +1084,12 @@ static void cba_connection_incoming_data(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree _U_, cba_connection_t *conn) { if (conn->packet_first == 0) { - conn->packet_first = pinfo->fd->num; + conn->packet_first = pinfo->num; } - if ( pinfo->fd->num > conn->packet_last && + if ( pinfo->num > conn->packet_last && cba_packet_in_range(pinfo, conn->packet_connect, conn->packet_disconnect, conn->packet_disconnectme)) { - conn->packet_last = pinfo->fd->num; + conn->packet_last = pinfo->num; } } diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c index 78007d9138..011ca3867e 100644 --- a/plugins/profinet/packet-pn-rt.c +++ b/plugins/profinet/packet-pn-rt.c @@ -416,7 +416,7 @@ dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (uFragNumber == 0) { /* this is the first "new" fragment, so set up a new key Id */ guint32 u32FrameKey; - u32FrameKey = (pinfo->fd->num << 2) | u32FragID; + u32FrameKey = (pinfo->num << 2) | u32FragID; /* store it in the array */ start_frag_OR_ID[u32FragID] = u32FrameKey; } @@ -428,12 +428,12 @@ dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void if (pdu_frag && !bMoreFollows) /* PDU is complete! and last fragment */ { /* 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); + g_hash_table_insert(reasembled_frag_table, GUINT_TO_POINTER(pinfo->num), pdu_frag); start_frag_OR_ID[u32FragID] = 0; /* reset the starting frame counter */ } if (!bMoreFollows) /* last fragment */ { - pdu_frag = (fragment_head *)g_hash_table_lookup(reasembled_frag_table, GUINT_TO_POINTER(pinfo->fd->num)); + pdu_frag = (fragment_head *)g_hash_table_lookup(reasembled_frag_table, GUINT_TO_POINTER(pinfo->num)); if (pdu_frag) /* found a matching fragment; dissect it */ { guint16 type; diff --git a/plugins/unistim/packet-unistim.c b/plugins/unistim/packet-unistim.c index 9bc39aa84f..78e99c9bba 100644 --- a/plugins/unistim/packet-unistim.c +++ b/plugins/unistim/packet-unistim.c @@ -2317,10 +2317,10 @@ dissect_audio_switch(proto_tree *msg_tree,packet_info *pinfo, set_address(&far_addr, AT_IPv4, 4, &far_ip_addr); far_port = tvb_get_ntohs(tvb, offset-8); - rtp_add_address(pinfo, &far_addr, far_port, 0, "UNISTIM", pinfo->fd->num, FALSE, NULL); + rtp_add_address(pinfo, &far_addr, far_port, 0, "UNISTIM", pinfo->num, FALSE, NULL); far_port = tvb_get_ntohs(tvb, offset-6); - rtcp_add_address(pinfo, &far_addr, far_port, 0, "UNISTIM", pinfo->fd->num); + rtcp_add_address(pinfo, &far_addr, far_port, 0, "UNISTIM", pinfo->num); } } break; diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c index 8d70c6718d..d2d644d94d 100644 --- a/plugins/wimax/mac_hd_generic_decoder.c +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -1027,7 +1027,7 @@ static int dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, } } cid_index = i; - while (pinfo->fd->num > cid_adj_array_size) + while (pinfo->num > cid_adj_array_size) { cid_adj_array_size += 1024; cid_adj_array = (guint *)g_realloc(cid_adj_array, (int)sizeof(guint) * cid_adj_array_size); @@ -1048,21 +1048,21 @@ static int dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, { frag_number[cid_index] = 0; } - if (cid_adj_array[pinfo->fd->num]) + if (cid_adj_array[pinfo->num]) { /* We apparently just clicked on the packet again. */ - cid_adjust[cid_index] = cid_adj_array[pinfo->fd->num]; + cid_adjust[cid_index] = cid_adj_array[pinfo->num]; /* Set the frag_number at start of packet. */ if (first_gmh) { - frag_number[cid_index] = frag_num_array[pinfo->fd->num]; + frag_number[cid_index] = frag_num_array[pinfo->num]; } } else { /* Save for next time we click on this packet. */ - cid_adj_array[pinfo->fd->num] = cid_adjust[cid_index]; + cid_adj_array[pinfo->num] = cid_adjust[cid_index]; if (first_gmh) { - frag_num_array[pinfo->fd->num] = frag_number[cid_index]; + frag_num_array[pinfo->num] = frag_number[cid_index]; } } /* Reset in case we stay in this while() loop to finish the packet. */ -- cgit v1.2.3