Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-ipfc.c
Line
Count
Source
1
/* packet-ipfc.c
2
 * Routines for Decoding Network_Header for IP-over-FC when we only
3
 * capture the frame starting at the Network_Header (as opposed to
4
 * when we have the full FC frame).
5
 * See RFC 2625.
6
 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
7
 *
8
 * Wireshark - Network traffic analyzer
9
 * By Gerald Combs <gerald@wireshark.org>
10
 * Copyright 1998 Gerald Combs
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
#include <epan/capture_dissectors.h>
19
#include <epan/to_str.h>
20
21
#include "packet-llc.h"
22
23
void proto_register_ipfc(void);
24
void proto_reg_handoff_ipfc(void);
25
26
static dissector_handle_t ipfc_handle;
27
static capture_dissector_handle_t ipfc_cap_handle;
28
29
/* Initialize the protocol and registered fields */
30
static int proto_ipfc;
31
static int hf_ipfc_network_da;
32
static int hf_ipfc_network_sa;
33
34
/* Initialize the subtree pointers */
35
static int ett_ipfc;
36
static dissector_handle_t llc_handle;
37
static capture_dissector_handle_t llc_cap_handle;
38
39
static bool
40
capture_ipfc (const unsigned char *pd, int offset _U_, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
41
0
{
42
0
  if (!BYTES_ARE_IN_FRAME(0, len, 16))
43
0
    return false;
44
45
0
  return call_capture_dissector(llc_cap_handle, pd, 16, len, cpinfo, pseudo_header);
46
0
}
47
48
static int
49
dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
50
0
{
51
52
/* Set up structures needed to add the protocol subtree and manage it */
53
0
    proto_item *ti;
54
0
    proto_tree *ipfc_tree;
55
0
    unsigned offset = 0;
56
0
    tvbuff_t *next_tvb;
57
58
    /* Make entries in Protocol column and Info column on summary display */
59
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/FC");
60
61
0
    if (tree) {
62
0
        ti = proto_tree_add_protocol_format (tree, proto_ipfc, tvb, offset, 16,
63
0
                                         "IP Over FC Network_Header");
64
0
        ipfc_tree = proto_item_add_subtree (ti, ett_ipfc);
65
66
0
        proto_tree_add_item (ipfc_tree, hf_ipfc_network_da, tvb, offset, 8, ENC_NA);
67
0
        proto_tree_add_item (ipfc_tree, hf_ipfc_network_sa, tvb, offset+8, 8, ENC_NA);
68
0
    }
69
70
0
    next_tvb = tvb_new_subset_remaining (tvb, 16);
71
0
    call_dissector(llc_handle, next_tvb, pinfo, tree);
72
0
    return tvb_captured_length(tvb);
73
0
}
74
75
/* Register the protocol with Wireshark */
76
77
/* this format is require because a script is used to build the C function
78
   that calls all the protocol registration.
79
*/
80
81
void
82
proto_register_ipfc (void)
83
16
{
84
85
/* Setup list of header fields  See Section 1.6.1 for details*/
86
16
    static hf_register_info hf[] = {
87
16
        { &hf_ipfc_network_da,
88
16
          {"Network DA", "ipfc.nh.da", FT_FCWWN, BASE_NONE, NULL,
89
16
           0x0, NULL, HFILL}},
90
16
        { &hf_ipfc_network_sa,
91
16
          {"Network SA", "ipfc.nh.sa", FT_FCWWN, BASE_NONE, NULL,
92
16
           0x0, NULL, HFILL}},
93
16
    };
94
95
    /* Setup protocol subtree array */
96
16
    static int *ett[] = {
97
16
        &ett_ipfc,
98
16
    };
99
100
    /* Register the protocol name and description */
101
16
    proto_ipfc = proto_register_protocol("IP Over FC", "IPFC", "ipfc");
102
103
    /* Required function calls to register the header fields and subtrees used */
104
16
    proto_register_field_array(proto_ipfc, hf, array_length(hf));
105
16
    proto_register_subtree_array(ett, array_length(ett));
106
107
16
    ipfc_handle = register_dissector("ipfc", dissect_ipfc, proto_ipfc);
108
16
    ipfc_cap_handle = register_capture_dissector("ipfc", capture_ipfc, proto_ipfc);
109
16
}
110
111
/* If this dissector uses sub-dissector registration add a registration routine.
112
   This format is required because a script is used to find these routines and
113
   create the code that calls these routines.
114
*/
115
void
116
proto_reg_handoff_ipfc (void)
117
16
{
118
16
    dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC, ipfc_handle);
119
120
16
    llc_handle = find_dissector_add_dependency("llc", proto_ipfc);
121
16
    llc_cap_handle = find_capture_dissector("llc");
122
123
16
    capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC, ipfc_cap_handle);
124
16
}
125
126
/*
127
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
128
 *
129
 * Local variables:
130
 * c-basic-offset: 4
131
 * tab-width: 8
132
 * indent-tabs-mode: nil
133
 * End:
134
 *
135
 * vi: set shiftwidth=4 tabstop=8 expandtab:
136
 * :indentSize=4:tabSize=8:noTabs=true:
137
 */