2 * Routines for decoding Lucent/Ascend packet traces
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
7 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include <epan/packet.h>
13 #include <wiretap/wtap.h>
15 void proto_register_ascend(void);
16 void proto_reg_handoff_ascend(void);
18 static int proto_ascend
;
19 static int hf_link_type
;
20 static int hf_session_id
;
21 static int hf_called_number
;
24 static int hf_user_name
;
28 static const value_string encaps_vals
[] = {
29 {ASCEND_PFX_WDS_X
, "PPP Transmit" },
30 {ASCEND_PFX_WDS_R
, "PPP Receive" },
31 {ASCEND_PFX_WDD
, "Ethernet triggering dialout"},
32 {ASCEND_PFX_ISDN_X
, "ISDN Transmit" },
33 {ASCEND_PFX_ISDN_R
, "ISDN Receive" },
34 {ASCEND_PFX_ETHER
, "Ethernet" },
38 static dissector_handle_t ascend_handle
;
39 static dissector_handle_t eth_withoutfcs_handle
;
40 static dissector_handle_t ppp_hdlc_handle
;
41 static dissector_handle_t lapd_phdr_handle
;
44 dissect_ascend(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
47 proto_item
*ti
, *hidden_item
;
48 union wtap_pseudo_header
*pseudo_header
= pinfo
->pseudo_header
;
49 struct isdn_phdr isdn
;
51 /* load the top pane info. This should be overwritten by
52 the next protocol in the stack */
53 col_set_str(pinfo
->cinfo
, COL_RES_DL_SRC
, "N/A");
54 col_set_str(pinfo
->cinfo
, COL_RES_DL_DST
, "N/A");
55 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "N/A");
56 col_set_str(pinfo
->cinfo
, COL_INFO
, "Lucent/Ascend packet trace");
58 /* If this is a transmitted or received PPP frame, set the PPP direction. */
59 switch (pseudo_header
->ascend
.type
) {
61 case ASCEND_PFX_WDS_X
:
62 pinfo
->p2p_dir
= P2P_DIR_SENT
;
65 case ASCEND_PFX_WDS_R
:
66 pinfo
->p2p_dir
= P2P_DIR_RECV
;
70 /* populate a tree in the second pane with the status of the link
73 ti
= proto_tree_add_protocol_format(tree
, proto_ascend
, tvb
, 0, 0,
74 "Lucent/Ascend packet trace");
75 fh_tree
= proto_item_add_subtree(ti
, ett_raw
);
76 proto_tree_add_uint(fh_tree
, hf_link_type
, tvb
, 0, 0,
77 pseudo_header
->ascend
.type
);
78 switch (pseudo_header
->ascend
.type
) {
81 /* Ethernet packet forcing a call */
82 proto_tree_add_string(fh_tree
, hf_called_number
, tvb
, 0, 0,
83 pseudo_header
->ascend
.call_num
);
84 proto_tree_add_uint(fh_tree
, hf_chunk
, tvb
, 0, 0,
85 pseudo_header
->ascend
.chunk
);
86 hidden_item
= proto_tree_add_uint(fh_tree
, hf_session_id
, tvb
, 0, 0, 0);
87 proto_item_set_hidden(hidden_item
);
90 case ASCEND_PFX_WDS_X
:
91 case ASCEND_PFX_WDS_R
:
92 /* wandsession data */
93 proto_tree_add_string(fh_tree
, hf_user_name
, tvb
, 0, 0,
94 pseudo_header
->ascend
.user
);
95 proto_tree_add_uint(fh_tree
, hf_session_id
, tvb
, 0, 0,
96 pseudo_header
->ascend
.sess
);
97 hidden_item
= proto_tree_add_uint(fh_tree
, hf_chunk
, tvb
, 0, 0, 0);
98 proto_item_set_hidden(hidden_item
);
104 proto_tree_add_uint(fh_tree
, hf_task
, tvb
, 0, 0, pseudo_header
->ascend
.task
);
107 switch (pseudo_header
->ascend
.type
) {
108 case ASCEND_PFX_WDS_X
:
109 case ASCEND_PFX_WDS_R
:
110 call_dissector(ppp_hdlc_handle
, tvb
, pinfo
, tree
);
113 case ASCEND_PFX_ETHER
:
114 call_dissector(eth_withoutfcs_handle
, tvb
, pinfo
, tree
);
116 case ASCEND_PFX_ISDN_X
:
119 call_dissector_with_data(lapd_phdr_handle
, tvb
, pinfo
, tree
, &isdn
);
121 case ASCEND_PFX_ISDN_R
:
124 call_dissector_with_data(lapd_phdr_handle
, tvb
, pinfo
, tree
, &isdn
);
129 return tvb_captured_length(tvb
);
133 proto_register_ascend(void)
135 static hf_register_info hf
[] = {
137 { "Link type", "ascend.type", FT_UINT32
, BASE_DEC
, VALS(encaps_vals
), 0x0,
141 { "Session ID", "ascend.sess", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
145 { "Called number", "ascend.number", FT_STRING
, BASE_NONE
, NULL
, 0x0,
149 { "WDD Chunk", "ascend.chunk", FT_UINT32
, BASE_HEX
, NULL
, 0x0,
153 { "Task", "ascend.task", FT_UINT32
, BASE_HEX
, NULL
, 0x0,
157 { "User name", "ascend.user", FT_STRING
, BASE_NONE
, NULL
, 0x0,
160 static int *ett
[] = {
164 proto_ascend
= proto_register_protocol("Lucent/Ascend debug output",
165 "Lucent/Ascend", "ascend");
166 proto_register_field_array(proto_ascend
, hf
, array_length(hf
));
167 proto_register_subtree_array(ett
, array_length(ett
));
169 ascend_handle
= register_dissector("ascend", dissect_ascend
, proto_ascend
);
173 proto_reg_handoff_ascend(void)
176 * Get handles for the Ethernet, PPP-in-HDLC-like-framing, and
177 * LAPD-with-pseudoheader dissectors.
179 eth_withoutfcs_handle
= find_dissector_add_dependency("eth_withoutfcs", proto_ascend
);
180 ppp_hdlc_handle
= find_dissector_add_dependency("ppp_hdlc", proto_ascend
);
181 lapd_phdr_handle
= find_dissector_add_dependency("lapd-phdr", proto_ascend
);
183 dissector_add_uint("wtap_encap", WTAP_ENCAP_ASCEND
, ascend_handle
);
187 * Editor modelines - https://www.wireshark.org/tools/modelines.html
192 * indent-tabs-mode: nil
195 * ex: set shiftwidth=2 tabstop=8 expandtab:
196 * :indentSize=2:tabSize=8:noTabs=true: