Coverage Report

Created: 2026-06-30 07:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-cvspserver.c
Line
Count
Source
1
/* packet-cvspserver.c
2
 * Routines for CVS password server packet dissection
3
 * Copyright 2018, Jaap Keuter <jaap.keuter@xs4all.nl>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
16
14
#define CVSPSERVER_PORT_TCP 2401
17
18
void proto_register_cvspserver(void);
19
void proto_reg_handoff_cvspserver(void);
20
21
static dissector_handle_t cvspserver_handle;
22
23
static int proto_cvspserver;
24
25
static int hf_cvspserver_data;
26
27
static int ett_cvspserver;
28
29
static int
30
dissect_cvspserver(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_)
31
11
{
32
11
  proto_tree* cvspserver_tree;
33
11
  proto_item* ti;
34
11
  unsigned length;
35
11
  unsigned next_offset, offset;
36
11
  unsigned lines = 0;
37
38
11
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "CVSPSERVER");
39
11
  col_clear(pinfo->cinfo, COL_INFO);
40
41
11
  ti = proto_tree_add_item(tree, proto_cvspserver, tvb, 0, -1, ENC_NA);
42
11
  cvspserver_tree = proto_item_add_subtree(ti, ett_cvspserver);
43
44
147
  for (offset = 0; tvb_offset_exists(tvb, offset); offset = next_offset)
45
136
  {
46
136
    tvb_find_line_end_unquoted_remaining(tvb, offset, &length, &next_offset);
47
136
    proto_tree_add_item(cvspserver_tree, hf_cvspserver_data, tvb, offset, length, ENC_UTF_8);
48
136
    lines++;
49
136
  }
50
51
11
  col_add_fstr(pinfo->cinfo, COL_INFO, "%s %u",
52
11
               (pinfo->srcport == pinfo->match_uint) ? "Response lines:" : "Request lines :",
53
11
               lines);
54
55
11
  proto_item_append_text(ti, " %s",
56
11
                         (pinfo->srcport == pinfo->match_uint) ? "Response" : "Request");
57
58
11
  return tvb_captured_length(tvb);
59
11
}
60
61
void
62
proto_register_cvspserver(void)
63
14
{
64
14
  static hf_register_info hf[] = {
65
14
    { &hf_cvspserver_data, {
66
14
      "Data", "cvspserver.data", FT_STRING, BASE_NONE,
67
14
      NULL, 0, NULL, HFILL }}
68
14
    };
69
70
14
  static int *ett[] = {
71
14
    &ett_cvspserver
72
14
  };
73
74
14
  proto_cvspserver = proto_register_protocol("CVS pserver", "cvspserver", "cvspserver");
75
14
  proto_register_field_array(proto_cvspserver, hf, array_length(hf));
76
14
  proto_register_subtree_array(ett, array_length(ett));
77
78
14
  cvspserver_handle = register_dissector("cvspserver", dissect_cvspserver, proto_cvspserver);
79
14
}
80
81
void
82
proto_reg_handoff_cvspserver(void)
83
14
{
84
14
  dissector_add_uint_with_preference("tcp.port", CVSPSERVER_PORT_TCP, cvspserver_handle);
85
14
}
86
87
/*
88
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
89
 *
90
 * Local variables:
91
 * c-basic-offset: 8
92
 * tab-width: 8
93
 * indent-tabs-mode: t
94
 * End:
95
 *
96
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
97
 * :indentSize=8:tabSize=8:noTabs=false:
98
 */