2 * Routines for ATM over TCP dissection
3 * Copyright 2011, Alexis La Goutte <alexis.lagoutte at gmail dot com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
13 * http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=include/linux/atm_tcp.h;hb=HEAD
14 * http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=drivers/atm/atmtcp.c;hb=HEAD
19 #include <epan/packet.h>
21 void proto_register_atmtcp(void);
22 void proto_reg_handoff_atmtcp(void);
24 static dissector_handle_t atmtcp_handle
;
26 static int proto_atmtcp
;
27 static int hf_atmtcp_vpi
;
28 static int hf_atmtcp_vci
;
29 static int hf_atmtcp_length
;
31 #define ATMTCP_TCP_PORT 2812
33 static int ett_atmtcp
;
35 #define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */
36 #define ATMTCP_CTRL_OPEN 1 /* request/reply */
37 #define ATMTCP_CTRL_CLOSE 2 /* request/reply */
40 dissect_atmtcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
44 proto_tree
*atmtcp_tree
;
49 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "ATMTCP");
51 col_set_str(pinfo
->cinfo
, COL_INFO
, "ATMTCP");
54 ti
= proto_tree_add_item(tree
, proto_atmtcp
, tvb
, 0, -1, ENC_NA
);
56 atmtcp_tree
= proto_item_add_subtree(ti
, ett_atmtcp
);
59 proto_tree_add_item(atmtcp_tree
, hf_atmtcp_vpi
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
66 proto_tree_add_item(atmtcp_tree
, hf_atmtcp_vci
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
73 proto_tree_add_item(atmtcp_tree
, hf_atmtcp_length
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
75 length
= tvb_get_ntohl(tvb
, offset
);
76 if(length
== ATMTCP_HDR_MAGIC
)
78 col_append_str(pinfo
->cinfo
, COL_INFO
, " Command");
82 col_append_str(pinfo
->cinfo
, COL_INFO
, " Data");
86 /* Data (for the moment...) */
87 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
88 call_data_dissector(next_tvb
, pinfo
, tree
);
89 return tvb_reported_length(tvb
);
94 proto_register_atmtcp(void)
96 static hf_register_info hf
[] = {
98 { "VPI", "atmtcp.vpi", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
99 "Virtual Path Identifier", HFILL
}
102 { "VCI", "atmtcp.vci", FT_UINT16
, BASE_DEC
, NULL
, 0x0,
103 "Virtual Channel Identifier", HFILL
}
106 { "Length", "atmtcp.length", FT_UINT32
, BASE_DEC
, NULL
, 0x0,
107 "length of data", HFILL
}
112 static int *ett
[] = {
117 proto_atmtcp
= proto_register_protocol("ATM over TCP", "ATMTCP", "atmtcp");
119 proto_register_field_array(proto_atmtcp
, hf
, array_length(hf
));
120 proto_register_subtree_array(ett
, array_length(ett
));
122 atmtcp_handle
= register_dissector("atm.tcp", dissect_atmtcp
, proto_atmtcp
);
127 proto_reg_handoff_atmtcp(void)
129 dissector_add_uint_with_preference("tcp.port", ATMTCP_TCP_PORT
, atmtcp_handle
);
133 * Editor modelines - https://www.wireshark.org/tools/modelines.html
138 * indent-tabs-mode: nil
141 * vi: set shiftwidth=4 tabstop=8 expandtab:
142 * :indentSize=4:tabSize=8:noTabs=true: