From c9f19e4af767dd80550e795c2ceee52b50db308b Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 25 Sep 2018 17:12:43 -0700 Subject: [PATCH] Rename the pseudo-header for X.25, V.120, and Frame Relay. It's not just for X.25, it's for anything that has the notion of Data Terminal Equipment and Data Communications Equipment; call it "dte_dce", not "x25". Change-Id: I3d51fec8b424e91ffd6d59895f50fc5ece791b08 Reviewed-on: https://code.wireshark.org/review/29834 Reviewed-by: Guy Harris --- epan/dissectors/packet-erf.c | 2 +- epan/dissectors/packet-fr.c | 2 +- epan/dissectors/packet-frame.c | 2 +- epan/dissectors/packet-wcp.c | 2 +- epan/dissectors/packet-x25.c | 4 ++-- wiretap/eyesdn.c | 2 +- wiretap/netxray.c | 4 ++-- wiretap/ngsniffer.c | 8 ++++---- wiretap/radcom.c | 2 +- wiretap/visual.c | 6 +++--- wiretap/wtap.h | 9 +++++---- 11 files changed, 22 insertions(+), 21 deletions(-) diff --git a/epan/dissectors/packet-erf.c b/epan/dissectors/packet-erf.c index a0f4599f2b..f38df3cbce 100644 --- a/epan/dissectors/packet-erf.c +++ b/epan/dissectors/packet-erf.c @@ -3256,7 +3256,7 @@ dissect_erf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) call_dissector(ppp_handle, tvb, pinfo, tree); break; case ERF_HDLC_FRELAY: - memset(&pinfo->pseudo_header->x25, 0, sizeof(pinfo->pseudo_header->x25)); + memset(&pinfo->pseudo_header->dte_dce, 0, sizeof(pinfo->pseudo_header->dte_dce)); call_dissector(frelay_handle, tvb, pinfo, tree); break; case ERF_HDLC_MTP2: diff --git a/epan/dissectors/packet-fr.c b/epan/dissectors/packet-fr.c index e32c21e1a4..95a62d54b6 100644 --- a/epan/dissectors/packet-fr.c +++ b/epan/dissectors/packet-fr.c @@ -378,7 +378,7 @@ dissect_fr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_clear(pinfo->cinfo, COL_INFO); if (has_direction) { - if (pinfo->pseudo_header->x25.flags & FROM_DCE) { + if (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) { col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE"); col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE"); } else { diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 8a61a5a323..55e0cd90ab 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -251,7 +251,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* case WTAP_ENCAP_LAPB: case WTAP_ENCAP_FRELAY_WITH_PHDR: pinfo->p2p_dir = - (pinfo->pseudo_header->x25.flags & FROM_DCE) ? + (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) ? P2P_DIR_RECV : P2P_DIR_SENT; break; diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c index ae19430f79..0a79e2b6ac 100644 --- a/epan/dissectors/packet-wcp.c +++ b/epan/dissectors/packet-wcp.c @@ -435,7 +435,7 @@ wcp_window_t *get_wcp_window_ptr(packet_info *pinfo){ wcp_circuit_data->send.initialized = 0; conversation_add_proto_data(conv, proto_wcp, wcp_circuit_data); } - if (pinfo->pseudo_header->x25.flags & FROM_DCE) + if (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) return &wcp_circuit_data->recv; else return &wcp_circuit_data->send; diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c index 3ca2741425..ae67efb9af 100644 --- a/epan/dissectors/packet-x25.c +++ b/epan/dissectors/packet-x25.c @@ -1988,9 +1988,9 @@ static int dissect_x25_dir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_x25_common(tvb, pinfo, tree, - (pinfo->pseudo_header->x25.flags & FROM_DCE) ? X25_FROM_DCE : + (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) ? X25_FROM_DCE : X25_FROM_DTE, - pinfo->pseudo_header->x25.flags & FROM_DCE); + pinfo->pseudo_header->dte_dce.flags & FROM_DCE); return tvb_captured_length(tvb); } diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 1a4cc73f5e..0c5a8e268c 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -224,7 +224,7 @@ read_eyesdn_rec(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, case EYESDN_ENCAP_LAPB: /* X.25 via LAPB */ rec->rec_header.packet_header.pkt_encap = WTAP_ENCAP_LAPB; - pseudo_header->x25.flags = (direction & 1) ? 0 : 0x80; + pseudo_header->dte_dce.flags = (direction & 1) ? 0 : 0x80; break; case EYESDN_ENCAP_ATM: { /* ATM cells */ diff --git a/wiretap/netxray.c b/wiretap/netxray.c index af2c5f3109..816cf8c766 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -1350,7 +1350,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, wtap_rec *rec, * is the direction flag. (Probably true for other * HDLC encapsulations as well.) */ - rec->rec_header.packet_header.pseudo_header.x25.flags = + rec->rec_header.packet_header.pseudo_header.dte_dce.flags = (hdr.hdr_2_x.xxx[12] & 0x01) ? 0x00 : FROM_DCE; /* @@ -1971,7 +1971,7 @@ netxray_dump_2_0(wtap_dumper *wdh, break; case WTAP_ENCAP_FRELAY_WITH_PHDR: - rec_hdr.xxx[12] |= (pseudo_header->x25.flags & FROM_DCE) ? 0x00 : 0x01; + rec_hdr.xxx[12] |= (pseudo_header->dte_dce.flags & FROM_DCE) ? 0x00 : 0x01; break; } diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index a7f9f3261e..2ccddaa2b9 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -1417,7 +1417,7 @@ set_pseudo_header_frame2(wtap *wth, union wtap_pseudo_header *pseudo_header, case WTAP_ENCAP_LAPB: case WTAP_ENCAP_FRELAY_WITH_PHDR: case WTAP_ENCAP_PER_PACKET: - pseudo_header->x25.flags = (frame2->fs & FS_WAN_DTE) ? 0x00 : FROM_DCE; + pseudo_header->dte_dce.flags = (frame2->fs & FS_WAN_DTE) ? 0x00 : FROM_DCE; break; case WTAP_ENCAP_ISDN: @@ -1830,14 +1830,14 @@ fix_pseudo_header(int encap, Buffer *buf, int len, case WTAP_ENCAP_WFLEET_HDLC: case WTAP_ENCAP_CHDLC_WITH_PHDR: case WTAP_ENCAP_PPP_WITH_PHDR: - if (pseudo_header->x25.flags == 0) + if (pseudo_header->dte_dce.flags == 0) pseudo_header->p2p.sent = TRUE; else pseudo_header->p2p.sent = FALSE; break; case WTAP_ENCAP_ISDN: - if (pseudo_header->x25.flags == 0x00) + if (pseudo_header->dte_dce.flags == 0x00) pseudo_header->isdn.uton = FALSE; else pseudo_header->isdn.uton = TRUE; @@ -2099,7 +2099,7 @@ ngsniffer_dump(wtap_dumper *wdh, const wtap_rec *rec, case WTAP_ENCAP_LAPB: case WTAP_ENCAP_FRELAY_WITH_PHDR: - rec_hdr.fs = (pseudo_header->x25.flags & FROM_DCE) ? 0x00 : FS_WAN_DTE; + rec_hdr.fs = (pseudo_header->dte_dce.flags & FROM_DCE) ? 0x00 : FS_WAN_DTE; break; case WTAP_ENCAP_PPP_WITH_PHDR: diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 797627228c..2b651d6662 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -330,7 +330,7 @@ radcom_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, break; case WTAP_ENCAP_LAPB: - rec->rec_header.packet_header.pseudo_header.x25.flags = (hdr.dce & 0x1) ? + rec->rec_header.packet_header.pseudo_header.dte_dce.flags = (hdr.dce & 0x1) ? 0x00 : FROM_DCE; length -= 2; /* FCS */ real_length -= 2; diff --git a/wiretap/visual.c b/wiretap/visual.c index 433ca684f6..724bdd79ea 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -399,7 +399,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, } rec->rec_header.packet_header.len -= 2; - rec->rec_header.packet_header.pseudo_header.x25.flags = + rec->rec_header.packet_header.pseudo_header.dte_dce.flags = (packet_status & PS_SENT) ? 0x00 : FROM_DCE; break; @@ -414,7 +414,7 @@ visual_read_packet(wtap *wth, FILE_T fh, wtap_rec *rec, } rec->rec_header.packet_header.len -= 2; - rec->rec_header.packet_header.pseudo_header.x25.flags = + rec->rec_header.packet_header.pseudo_header.dte_dce.flags = (packet_status & PS_SENT) ? 0x00 : FROM_DCE; break; @@ -715,7 +715,7 @@ static gboolean visual_dump(wtap_dumper *wdh, const wtap_rec *rec, case WTAP_ENCAP_FRELAY_WITH_PHDR: case WTAP_ENCAP_LAPB: packet_status |= - ((pseudo_header->x25.flags & FROM_DCE) ? 0x00 : PS_SENT); + ((pseudo_header->dte_dce.flags & FROM_DCE) ? 0x00 : PS_SENT); break; } vpkt_hdr.status = GUINT32_TO_LE(packet_status); diff --git a/wiretap/wtap.h b/wiretap/wtap.h index be00f67337..8228347061 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -431,10 +431,11 @@ struct eth_phdr { gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */ }; -/* Packet "pseudo-header" information for X.25 capture files. */ +/* Packet "pseudo-header" information for capture files for traffic + between DTE and DCE. */ #define FROM_DCE 0x80 -struct x25_phdr { - guint8 flags; /* ENCAP_LAPB, ENCAP_V120 : 1st bit means From DCE */ +struct dte_dce_phdr { + guint8 flags; /* ENCAP_LAPB, ENCAP_V120, ENCAP_FRELAY: 1st bit means From DCE */ }; /* Packet "pseudo-header" information for ISDN capture files. */ @@ -1172,7 +1173,7 @@ struct netmon_phdr { union wtap_pseudo_header { struct eth_phdr eth; - struct x25_phdr x25; + struct dte_dce_phdr dte_dce; struct isdn_phdr isdn; struct atm_phdr atm; struct ascend_phdr ascend;