2 * Routines for decoding Lucent/Ascend packet traces
4 * $Id: packet-ascend.c,v 1.25 2001/03/30 06:10:54 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifdef HAVE_SYS_TYPES_H
29 # include <sys/types.h>
36 static int proto_ascend = -1;
37 static int hf_link_type = -1;
38 static int hf_session_id = -1;
39 static int hf_called_number = -1;
40 static int hf_chunk = -1;
41 static int hf_task = -1;
42 static int hf_user_name = -1;
44 static gint ett_raw = -1;
46 static const value_string encaps_vals[] = {
47 {ASCEND_PFX_WDS_X, "PPP Transmit"},
48 {ASCEND_PFX_WDS_R, "PPP Receive" },
49 {ASCEND_PFX_WDD, "Ethernet" },
52 static dissector_handle_t eth_handle;
53 static dissector_handle_t ppp_hdlc_handle;
56 dissect_ascend(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
60 union wtap_pseudo_header *pseudo_header = pinfo->pseudo_header;
62 /* load the top pane info. This should be overwritten by
63 the next protocol in the stack */
64 if(check_col(pinfo->fd, COL_RES_DL_SRC))
65 col_set_str(pinfo->fd, COL_RES_DL_SRC, "N/A" );
66 if(check_col(pinfo->fd, COL_RES_DL_DST))
67 col_set_str(pinfo->fd, COL_RES_DL_DST, "N/A" );
68 if(check_col(pinfo->fd, COL_PROTOCOL))
69 col_set_str(pinfo->fd, COL_PROTOCOL, "N/A" );
70 if(check_col(pinfo->fd, COL_INFO))
71 col_set_str(pinfo->fd, COL_INFO, "Lucent/Ascend packet trace" );
73 /* populate a tree in the second pane with the status of the link
76 ti = proto_tree_add_protocol_format(tree, proto_ascend, tvb, 0, 0,
77 "Lucent/Ascend packet trace");
78 fh_tree = proto_item_add_subtree(ti, ett_raw);
79 proto_tree_add_uint(fh_tree, hf_link_type, tvb, 0, 0,
80 pseudo_header->ascend.type);
81 if (pseudo_header->ascend.type == ASCEND_PFX_WDD) {
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 proto_tree_add_uint_hidden(fh_tree, hf_session_id, tvb, 0, 0, 0);
87 } else { /* It's wandsession data */
88 proto_tree_add_string(fh_tree, hf_user_name, tvb, 0, 0,
89 pseudo_header->ascend.user);
90 proto_tree_add_uint(fh_tree, hf_session_id, tvb, 0, 0,
91 pseudo_header->ascend.sess);
92 proto_tree_add_uint_hidden(fh_tree, hf_chunk, tvb, 0, 0, 0);
94 proto_tree_add_uint(fh_tree, hf_task, tvb, 0, 0, pseudo_header->ascend.task);
97 switch (pseudo_header->ascend.type) {
98 case ASCEND_PFX_WDS_X:
99 case ASCEND_PFX_WDS_R:
100 call_dissector(ppp_hdlc_handle, tvb, pinfo, tree);
103 call_dissector(eth_handle, tvb, pinfo, tree);
111 proto_register_ascend(void)
113 static hf_register_info hf[] = {
115 { "Link type", "ascend.type", FT_UINT32, BASE_DEC, VALS(encaps_vals), 0x0,
119 { "Session ID", "ascend.sess", FT_UINT32, BASE_DEC, NULL, 0x0,
123 { "Called number", "ascend.number", FT_STRING, BASE_NONE, NULL, 0x0,
127 { "WDD Chunk", "ascend.chunk", FT_UINT32, BASE_HEX, NULL, 0x0,
131 { "Task", "ascend.task", FT_UINT32, BASE_HEX, NULL, 0x0,
135 { "User name", "ascend.user", FT_STRING, BASE_NONE, NULL, 0x0,
138 static gint *ett[] = {
142 proto_ascend = proto_register_protocol("Lucent/Ascend debug output",
143 "Lucent/Ascend", "ascend");
144 proto_register_field_array(proto_ascend, hf, array_length(hf));
145 proto_register_subtree_array(ett, array_length(ett));
149 proto_reg_handoff_ascend(void)
152 * Get handles for the Ethernet and PPP-in-HDLC-like-framing dissectors.
154 eth_handle = find_dissector("eth");
155 ppp_hdlc_handle = find_dissector("ppp_hdlc");
156 dissector_add("wtap_encap", WTAP_ENCAP_ASCEND, dissect_ascend, proto_ascend);