2 * Routines for CVS password server packet dissection
3 * Copyright 2018, Jaap Keuter <jaap.keuter@xs4all.nl>
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
14 #include <epan/packet.h>
16 #define CVSPSERVER_PORT_TCP 2401
18 void proto_register_cvspserver(void);
19 void proto_reg_handoff_cvspserver(void);
21 static dissector_handle_t cvspserver_handle
;
23 static int proto_cvspserver
;
25 static int hf_cvspserver_data
;
27 static int ett_cvspserver
;
30 dissect_cvspserver(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* dissector_data _U_
)
32 proto_tree
* cvspserver_tree
;
35 int next_offset
, offset
;
38 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "CVSPSERVER");
39 col_clear(pinfo
->cinfo
, COL_INFO
);
41 ti
= proto_tree_add_item(tree
, proto_cvspserver
, tvb
, 0, -1, ENC_NA
);
42 cvspserver_tree
= proto_item_add_subtree(ti
, ett_cvspserver
);
44 for (offset
= 0; tvb_offset_exists(tvb
, offset
); offset
= next_offset
)
46 length
= tvb_find_line_end_unquoted(tvb
, offset
, -1, &next_offset
);
47 proto_tree_add_item(cvspserver_tree
, hf_cvspserver_data
, tvb
, offset
, length
, ENC_UTF_8
);
51 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "%s %u",
52 (pinfo
->srcport
== pinfo
->match_uint
) ? "Response lines:" : "Request lines :",
55 proto_item_append_text(ti
, " %s",
56 (pinfo
->srcport
== pinfo
->match_uint
) ? "Response" : "Request");
58 return tvb_captured_length(tvb
);
62 proto_register_cvspserver(void)
64 static hf_register_info hf
[] = {
65 { &hf_cvspserver_data
, {
66 "Data", "cvspserver.data", FT_STRING
, BASE_NONE
,
67 NULL
, 0, NULL
, HFILL
}}
74 proto_cvspserver
= proto_register_protocol("CVS pserver", "cvspserver", "cvspserver");
75 proto_register_field_array(proto_cvspserver
, hf
, array_length(hf
));
76 proto_register_subtree_array(ett
, array_length(ett
));
78 cvspserver_handle
= register_dissector("cvspserver", dissect_cvspserver
, proto_cvspserver
);
82 proto_reg_handoff_cvspserver(void)
84 dissector_add_uint_with_preference("tcp.port", CVSPSERVER_PORT_TCP
, cvspserver_handle
);
88 * Editor modelines - https://www.wireshark.org/tools/modelines.html
96 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
97 * :indentSize=8:tabSize=8:noTabs=false: