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 <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-09-25 17:12:43 -07:00
parent f9129721b2
commit c9f19e4af7
11 changed files with 22 additions and 21 deletions

View File

@ -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); call_dissector(ppp_handle, tvb, pinfo, tree);
break; break;
case ERF_HDLC_FRELAY: 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); call_dissector(frelay_handle, tvb, pinfo, tree);
break; break;
case ERF_HDLC_MTP2: case ERF_HDLC_MTP2:

View File

@ -378,7 +378,7 @@ dissect_fr_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_clear(pinfo->cinfo, COL_INFO); col_clear(pinfo->cinfo, COL_INFO);
if (has_direction) { 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_DST, "DTE");
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE"); col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
} else { } else {

View File

@ -251,7 +251,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
case WTAP_ENCAP_LAPB: case WTAP_ENCAP_LAPB:
case WTAP_ENCAP_FRELAY_WITH_PHDR: case WTAP_ENCAP_FRELAY_WITH_PHDR:
pinfo->p2p_dir = pinfo->p2p_dir =
(pinfo->pseudo_header->x25.flags & FROM_DCE) ? (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) ?
P2P_DIR_RECV : P2P_DIR_SENT; P2P_DIR_RECV : P2P_DIR_SENT;
break; break;

View File

@ -435,7 +435,7 @@ wcp_window_t *get_wcp_window_ptr(packet_info *pinfo){
wcp_circuit_data->send.initialized = 0; wcp_circuit_data->send.initialized = 0;
conversation_add_proto_data(conv, proto_wcp, wcp_circuit_data); 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; return &wcp_circuit_data->recv;
else else
return &wcp_circuit_data->send; return &wcp_circuit_data->send;

View File

@ -1988,9 +1988,9 @@ static int
dissect_x25_dir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) dissect_x25_dir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{ {
dissect_x25_common(tvb, pinfo, tree, 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, X25_FROM_DTE,
pinfo->pseudo_header->x25.flags & FROM_DCE); pinfo->pseudo_header->dte_dce.flags & FROM_DCE);
return tvb_captured_length(tvb); return tvb_captured_length(tvb);
} }

View File

@ -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 */ case EYESDN_ENCAP_LAPB: /* X.25 via LAPB */
rec->rec_header.packet_header.pkt_encap = WTAP_ENCAP_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; break;
case EYESDN_ENCAP_ATM: { /* ATM cells */ case EYESDN_ENCAP_ATM: { /* ATM cells */

View File

@ -1350,7 +1350,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, wtap_rec *rec,
* is the direction flag. (Probably true for other * is the direction flag. (Probably true for other
* HDLC encapsulations as well.) * 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; (hdr.hdr_2_x.xxx[12] & 0x01) ? 0x00 : FROM_DCE;
/* /*
@ -1971,7 +1971,7 @@ netxray_dump_2_0(wtap_dumper *wdh,
break; break;
case WTAP_ENCAP_FRELAY_WITH_PHDR: 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; break;
} }

View File

@ -1417,7 +1417,7 @@ set_pseudo_header_frame2(wtap *wth, union wtap_pseudo_header *pseudo_header,
case WTAP_ENCAP_LAPB: case WTAP_ENCAP_LAPB:
case WTAP_ENCAP_FRELAY_WITH_PHDR: case WTAP_ENCAP_FRELAY_WITH_PHDR:
case WTAP_ENCAP_PER_PACKET: 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; break;
case WTAP_ENCAP_ISDN: 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_WFLEET_HDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR: case WTAP_ENCAP_CHDLC_WITH_PHDR:
case WTAP_ENCAP_PPP_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; pseudo_header->p2p.sent = TRUE;
else else
pseudo_header->p2p.sent = FALSE; pseudo_header->p2p.sent = FALSE;
break; break;
case WTAP_ENCAP_ISDN: case WTAP_ENCAP_ISDN:
if (pseudo_header->x25.flags == 0x00) if (pseudo_header->dte_dce.flags == 0x00)
pseudo_header->isdn.uton = FALSE; pseudo_header->isdn.uton = FALSE;
else else
pseudo_header->isdn.uton = TRUE; 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_LAPB:
case WTAP_ENCAP_FRELAY_WITH_PHDR: 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; break;
case WTAP_ENCAP_PPP_WITH_PHDR: case WTAP_ENCAP_PPP_WITH_PHDR:

View File

@ -330,7 +330,7 @@ radcom_read_rec(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf,
break; break;
case WTAP_ENCAP_LAPB: 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; 0x00 : FROM_DCE;
length -= 2; /* FCS */ length -= 2; /* FCS */
real_length -= 2; real_length -= 2;

View File

@ -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.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; (packet_status & PS_SENT) ? 0x00 : FROM_DCE;
break; 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.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; (packet_status & PS_SENT) ? 0x00 : FROM_DCE;
break; 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_FRELAY_WITH_PHDR:
case WTAP_ENCAP_LAPB: case WTAP_ENCAP_LAPB:
packet_status |= packet_status |=
((pseudo_header->x25.flags & FROM_DCE) ? 0x00 : PS_SENT); ((pseudo_header->dte_dce.flags & FROM_DCE) ? 0x00 : PS_SENT);
break; break;
} }
vpkt_hdr.status = GUINT32_TO_LE(packet_status); vpkt_hdr.status = GUINT32_TO_LE(packet_status);

View File

@ -431,10 +431,11 @@ struct eth_phdr {
gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */ 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 #define FROM_DCE 0x80
struct x25_phdr { struct dte_dce_phdr {
guint8 flags; /* ENCAP_LAPB, ENCAP_V120 : 1st bit means From DCE */ guint8 flags; /* ENCAP_LAPB, ENCAP_V120, ENCAP_FRELAY: 1st bit means From DCE */
}; };
/* Packet "pseudo-header" information for ISDN capture files. */ /* Packet "pseudo-header" information for ISDN capture files. */
@ -1172,7 +1173,7 @@ struct netmon_phdr {
union wtap_pseudo_header { union wtap_pseudo_header {
struct eth_phdr eth; struct eth_phdr eth;
struct x25_phdr x25; struct dte_dce_phdr dte_dce;
struct isdn_phdr isdn; struct isdn_phdr isdn;
struct atm_phdr atm; struct atm_phdr atm;
struct ascend_phdr ascend; struct ascend_phdr ascend;