Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-fclctl.c
Line
Count
Source
1
/* packet-fclctl.c
2
 * Routines for FC Link Control Frames
3
 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
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
#include "packet-fclctl.h"
16
17
const value_string fc_lctl_proto_val[] = {
18
    {FC_LCTL_ACK1  , "ACK1"},
19
    {FC_LCTL_ACK0  , "ACK0"},
20
    {FC_LCTL_PRJT  , "P_RJT"},
21
    {FC_LCTL_FRJT  , "F_RJT"},
22
    {FC_LCTL_PBSY  , "P_BSY"},
23
    {FC_LCTL_FBSYL , "F_BSY (Data frame)"},
24
    {FC_LCTL_FBSYB , "F_BSY (Link Ctl)"},
25
    {FC_LCTL_LCR   , "LCR"},
26
    {FC_LCTL_NTY   , "NTY"},
27
    {FC_LCTL_END   , "END"},
28
    {0, NULL},
29
};
30
31
static const value_string fc_lctl_fbsy_val[] = {
32
    {FC_LCTL_FBSY_FBSY, "Fabric Busy"},
33
    {FC_LCTL_FBSY_NBSY, "N_Port Busy"},
34
    {0, NULL}
35
};
36
37
static const value_string fc_lctl_pbsy_acode_val[] = {
38
    {FC_LCTL_PBSY_ACODE_SEQBSY, "Sequence Marked Busy"},
39
    {FC_LCTL_PBSY_ACODE_C2BSY, "Class 2 Frame Busy"},
40
    {0, NULL},
41
};
42
43
static const value_string fc_lctl_pbsy_rjt_val[] = {
44
    {FC_LCTL_PBSY_PORTBSY , "Physical N_Port Busy"},
45
    {FC_LCTL_PBSY_RSRCBSY , "N_Port Resource Busy"},
46
    {FC_LCTL_PBSY_MCASTBSY, "Partial Multicast Busy"},
47
    {FC_LCTL_PBSY_VENDBSY , "Vendor unique Busy"},
48
    {0, NULL},
49
};
50
51
static const value_string fc_lctl_rjt_acode_val[] = {
52
    {FC_LCTL_RJT_ACODE_RETRY, "Retryable Error"},
53
    {FC_LCTL_RJT_ACODE_NORETRY, "Non-retryable Error"},
54
    {0, NULL},
55
};
56
57
static const value_string fc_lctl_rjt_val[] = {
58
    {FC_LCTL_RJT_INVDID             , "Invalid D_ID"},
59
    {FC_LCTL_RJT_INVSID             , "Invalid S_ID"},
60
    {FC_LCTL_RJT_NPORT_NOTAVAIL_T   , "N_Port Not Avail (Temporary)"},
61
    {FC_LCTL_RJT_NPORT_NOTAVAIL_P   , "N_Port Not Avail (Permanent)"},
62
    {FC_LCTL_RJT_CLASS_NOTSUPP      , "Class Not Supported"},
63
    {FC_LCTL_RJT_DELIM_USERR        , "Delimiter Usage Error"},
64
    {FC_LCTL_RJT_TYPE_NOTSUPP       , "Type Not Supported"},
65
    {FC_LCTL_RJT_INV_LCTL           , "Invalid Link Ctl Frame"},
66
    {FC_LCTL_RJT_INV_RCTL           , "Invalid R_CTL"},
67
    {FC_LCTL_RJT_INV_FCTL           , "Invalid F_CTL"},
68
    {FC_LCTL_RJT_INV_OXID           , "Invalid OX_ID"},
69
    {FC_LCTL_RJT_INV_RXID           , "Invalid RX_ID"},
70
    {FC_LCTL_RJT_INV_SEQID          , "Invalid SEQID"},
71
    {FC_LCTL_RJT_INV_DFCTL          , "Invalid DF_CTL"},
72
    {FC_LCTL_RJT_INV_SEQCNT         , "Invalid SEQCNT"},
73
    {FC_LCTL_RJT_INV_PARAM          , "Invalid Parameter"},
74
    {FC_LCTL_RJT_EXCHG_ERR          , "Exchange Error"},
75
    {FC_LCTL_RJT_PROTO_ERR          , "Protocol Error"},
76
    {FC_LCTL_RJT_INV_LEN            , "Incorrect Length"},
77
    {FC_LCTL_RJT_UNEXP_ACK          , "Unexpected ACK"},
78
    {FC_LCTL_RJT_CLS_NOTSUPP        , "Class Not Supported by Entity at 0xFFFFFE"},
79
    {FC_LCTL_RJT_LOGI_REQD          , "Login Required"},
80
    {FC_LCTL_RJT_TOOMANY_SEQ        , "Excessive Sequences Attempted"},
81
    {FC_LCTL_RJT_EXCHG_NOTESTD      , "Exchange Not Established"},
82
    {FC_LCTL_RJT_RSVD               , "Reserved"},
83
    {FC_LCTL_RJT_FPATH_NOTAVAIL     , "Fabric Path Not Available"},
84
    {FC_LCTL_RJT_INV_VCID           , "Invalid VC_ID"},
85
    {FC_LCTL_RJT_INV_CSCTL          , "Invalid CS_CTL"},
86
    {FC_LCTL_RJT_OORSRC             , "Insufficient Resources of VC (Class 4)"},
87
    {FC_LCTL_RJT_INV_CLASS          , "Invalid Class of Service"},
88
    {FC_LCTL_RJT_PRMPT_RJT          , "Preemption Request Rejected"},
89
    {FC_LCTL_RJT_PRMPT_DIS          , "Preemption Not Enabled"},
90
    {FC_LCTL_RJT_MCAST_ERR          , "Multicast Error"},
91
    {FC_LCTL_RJT_MCAST_TERM         , "Multicast Error Terminate"},
92
    {FC_LCTL_RJT_PRLI_REQD          , "PRLI Required"},
93
    {FC_LCTL_RJT_VEND_ERR           , "Vendor Unique Error"},
94
    {0, NULL},
95
};
96
static value_string_ext fc_lctl_rjt_val_ext = VALUE_STRING_EXT_INIT(fc_lctl_rjt_val);
97
98
const char *
99
fclctl_get_typestr (wmem_allocator_t* pool, uint8_t linkctl_type, uint8_t type)
100
9
{
101
9
    if ((linkctl_type == FC_LCTL_FBSYB) ||
102
9
        (linkctl_type == FC_LCTL_FBSYL)) {
103
9
        return (val_to_str(pool, (type & 0xF0), fc_lctl_fbsy_val, "0x%x"));
104
9
    }
105
0
    return "";
106
9
}
107
108
const char *
109
fclctl_get_paramstr (wmem_allocator_t *pool, uint32_t linkctl_type, uint32_t param)
110
10
{
111
10
    if (linkctl_type == FC_LCTL_PBSY) {
112
2
      return wmem_strdup_printf(pool, "%s, %s",
113
2
                 val_to_str(pool, ((param & 0xFF000000) >> 24), fc_lctl_pbsy_acode_val, "0x%x"),
114
2
                 val_to_str(pool, ((param & 0x00FF0000) >> 16), fc_lctl_pbsy_rjt_val, "0x%x"));
115
2
    }
116
8
    if ((linkctl_type == FC_LCTL_FRJT) ||
117
8
             (linkctl_type == FC_LCTL_PRJT)) {
118
8
      return wmem_strdup_printf(pool, "%s, %s",
119
8
                 val_to_str(pool, ((param & 0xFF000000) >> 24), fc_lctl_rjt_acode_val, "0x%x"),
120
8
                 val_to_str_ext(pool, ((param & 0x00FF0000) >> 16), &fc_lctl_rjt_val_ext, "%x"));
121
8
    }
122
0
    return "";
123
8
}
124
125
/*
126
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
127
 *
128
 * Local variables:
129
 * c-basic-offset: 4
130
 * tab-width: 8
131
 * indent-tabs-mode: nil
132
 * End:
133
 *
134
 * vi: set shiftwidth=4 tabstop=8 expandtab:
135
 * :indentSize=4:tabSize=8:noTabs=true:
136
 */