Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-cvspserver.c
blobd5f1c14d7ac7ad9c6b136de1be54222831bf950d
1 /* packet-cvspserver.c
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
12 #include "config.h"
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;
29 static int
30 dissect_cvspserver(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_)
32 proto_tree* cvspserver_tree;
33 proto_item* ti;
34 int length;
35 int next_offset, offset;
36 unsigned lines = 0;
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);
48 lines++;
51 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %u",
52 (pinfo->srcport == pinfo->match_uint) ? "Response lines:" : "Request lines :",
53 lines);
55 proto_item_append_text(ti, " %s",
56 (pinfo->srcport == pinfo->match_uint) ? "Response" : "Request");
58 return tvb_captured_length(tvb);
61 void
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 }}
70 static int *ett[] = {
71 &ett_cvspserver
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);
81 void
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
90 * Local variables:
91 * c-basic-offset: 8
92 * tab-width: 8
93 * indent-tabs-mode: t
94 * End:
96 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
97 * :indentSize=8:tabSize=8:noTabs=false: