Coverage Report

Created: 2026-07-12 07:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-lapbether.c
Line
Count
Source
1
/* packet-lapbether.c
2
 * Routines for lapbether frame disassembly
3
 * Richard Sharpe <rsharpe@ns.aus.com> based on the lapb module by
4
 * Olivier Abad <oabad@noos.fr>
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998
9
 *
10
 * SPDX-License-Identifier: GPL-2.0-or-later
11
 */
12
13
#include "config.h"
14
15
#include <epan/packet.h>
16
#include <epan/etypes.h>
17
18
void proto_register_lapbether(void);
19
void proto_reg_handoff_lapbether(void);
20
21
static int proto_lapbether;
22
23
static int hf_lapbether_length;
24
25
static int ett_lapbether;
26
27
static dissector_handle_t lapbether_handle;
28
static dissector_handle_t lapb_handle;
29
30
static int
31
dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
32
71
{
33
71
    proto_tree *lapbether_tree, *ti;
34
71
    int         len;
35
71
    tvbuff_t   *next_tvb;
36
37
71
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "LAPBETHER");
38
71
    col_clear(pinfo->cinfo, COL_INFO);
39
40
71
    len = tvb_get_uint8(tvb, 0) + tvb_get_uint8(tvb, 1) * 256;
41
42
71
    if (tree) {
43
44
70
      ti = proto_tree_add_protocol_format(tree, proto_lapbether, tvb, 0, 2,
45
70
                                          "LAPBETHER");
46
47
70
      lapbether_tree = proto_item_add_subtree(ti, ett_lapbether);
48
70
      proto_tree_add_uint_format(lapbether_tree, hf_lapbether_length, tvb, 0, 2,
49
70
                                 len, "Length: %u", len);
50
51
70
    }
52
53
71
    next_tvb = tvb_new_subset_length(tvb, 2, len);
54
71
    call_dissector(lapb_handle, next_tvb, pinfo, tree);
55
56
71
    return tvb_captured_length(tvb);
57
71
}
58
59
void
60
proto_register_lapbether(void)
61
15
{
62
15
    static hf_register_info hf[] = {
63
15
      { &hf_lapbether_length,
64
15
        { "Length Field", "lapbether.length", FT_UINT16, BASE_DEC, NULL, 0x0,
65
15
          "LAPBEther Length Field", HFILL }},
66
67
15
    };
68
15
    static int *ett[] = {
69
15
        &ett_lapbether,
70
15
    };
71
72
15
    proto_lapbether = proto_register_protocol ("Link Access Procedure Balanced Ethernet (LAPBETHER)",
73
15
        "LAPBETHER", "lapbether");
74
15
    proto_register_field_array (proto_lapbether, hf, array_length(hf));
75
15
    proto_register_subtree_array(ett, array_length(ett));
76
77
15
  lapbether_handle = register_dissector("lapbether", dissect_lapbether, proto_lapbether);
78
15
}
79
80
/* The registration hand-off routine */
81
void
82
proto_reg_handoff_lapbether(void)
83
15
{
84
  /*
85
   * Get a handle for the LAPB dissector.
86
   */
87
15
  lapb_handle = find_dissector_add_dependency("lapb", proto_lapbether);
88
89
15
  dissector_add_uint("ethertype", ETHERTYPE_DEC, lapbether_handle);
90
91
15
}
92
93
/*
94
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
95
 *
96
 * Local Variables:
97
 * c-basic-offset: 2
98
 * tab-width: 8
99
 * indent-tabs-mode: nil
100
 * End:
101
 *
102
 * ex: set shiftwidth=2 tabstop=8 expandtab:
103
 * :indentSize=2:tabSize=8:noTabs=true:
104
 */