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-sscf-nni.c
Line
Count
Source
1
/* packet-sscf-nni.c
2
 * Routines for SSCF-NNI (Q.2140) frame disassembly
3
 * Jeff Morriss <jeff.morriss.ws [AT] gmail.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998
8
 *
9
 * Copied from packet-sscop.c
10
 *
11
 * SPDX-License-Identifier: GPL-2.0-or-later
12
 */
13
14
#include "config.h"
15
16
#include <epan/packet.h>
17
18
void proto_register_sscf(void);
19
void proto_reg_handoff_sscf(void);
20
21
static int proto_sscf;
22
23
static int ett_sscf;
24
25
static dissector_handle_t mtp3_handle;
26
27
0
#define SSCF_PDU_LENGTH 4
28
0
#define SSCF_STATUS_OFFSET 3
29
0
#define SSCF_STATUS_LENGTH 1
30
0
#define SSCF_SPARE_OFFSET 0
31
0
#define SSCF_SPARE_LENGTH 3
32
33
static int hf_status;
34
static int hf_spare;
35
36
#define SSCF_STATUS_OOS 0x01
37
#define SSCF_STATUS_PO  0x02
38
#define SSCF_STATUS_IS  0x03
39
#define SSCF_STATUS_NORMAL 0x04
40
#define SSCF_STATUS_EMERGENCY 0x05
41
#define SSCF_STATUS_ALIGNMENT_NOT_SUCCESSFUL 0x7
42
#define SSCF_STATUS_MANAGEMENT_INITIATED 0x08
43
#define SSCF_STATUS_PROTOCOL_ERROR 0x09
44
#define SSCF_STATUS_PROVING_NOT_SUCCESSFUL 0x0a
45
46
static const value_string sscf_status_vals[] = {
47
  { SSCF_STATUS_OOS,                      "Out of Service" },
48
  { SSCF_STATUS_PO,                       "Processor Outage" },
49
  { SSCF_STATUS_IS,                       "In Service" },
50
  { SSCF_STATUS_NORMAL,                   "Normal" },
51
  { SSCF_STATUS_EMERGENCY,                "Emergency" },
52
  { SSCF_STATUS_ALIGNMENT_NOT_SUCCESSFUL, "Alignment Not Successful" },
53
  { SSCF_STATUS_MANAGEMENT_INITIATED,     "Management Initiated" },
54
  { SSCF_STATUS_PROTOCOL_ERROR,           "Protocol Error" },
55
  { SSCF_STATUS_PROVING_NOT_SUCCESSFUL,   "Proving Not Successful" },
56
  { 0,                                    NULL }
57
};
58
59
static int
60
dissect_sscf_nni(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
61
0
{
62
0
  unsigned reported_length;
63
0
  proto_item *sscf_item = NULL;
64
0
  proto_tree *sscf_tree = NULL;
65
0
  uint8_t sscf_status;
66
67
0
  reported_length = tvb_reported_length(tvb);  /* frame length */
68
69
0
  if (tree) {
70
0
    sscf_item = proto_tree_add_item(tree, proto_sscf, tvb, 0, -1, ENC_NA);
71
0
    sscf_tree = proto_item_add_subtree(sscf_item, ett_sscf);
72
0
  }
73
74
0
  if (reported_length > SSCF_PDU_LENGTH)
75
0
  {
76
0
    call_dissector(mtp3_handle, tvb, pinfo, tree);
77
78
0
  } else {
79
80
0
    sscf_status = tvb_get_uint8(tvb, SSCF_STATUS_OFFSET);
81
82
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SSCF-NNI");
83
0
    col_add_fstr(pinfo->cinfo, COL_INFO, "STATUS (%s) ",
84
0
                 val_to_str_const(sscf_status, sscf_status_vals, "Unknown"));
85
86
87
0
    proto_tree_add_item(sscf_tree, hf_status, tvb, SSCF_STATUS_OFFSET,
88
0
                        SSCF_STATUS_LENGTH, ENC_BIG_ENDIAN);
89
0
    proto_tree_add_item(sscf_tree, hf_spare, tvb, SSCF_SPARE_OFFSET,
90
0
                        SSCF_SPARE_LENGTH, ENC_BIG_ENDIAN);
91
0
  }
92
93
0
  return tvb_captured_length(tvb);
94
0
}
95
96
void
97
proto_register_sscf(void)
98
15
{
99
15
  static hf_register_info hf[] =
100
15
  { { &hf_status, { "Status", "sscf-nni.status", FT_UINT8, BASE_HEX,
101
15
                    VALS(sscf_status_vals), 0x0, NULL, HFILL} },
102
15
    { &hf_spare, { "Spare", "sscf-nni.spare", FT_UINT24, BASE_HEX,
103
15
                   NULL, 0x0, NULL, HFILL} }
104
15
  };
105
106
15
  static int *ett[] = {
107
15
    &ett_sscf,
108
15
  };
109
110
15
  proto_sscf = proto_register_protocol("SSCF-NNI", "SSCF-NNI", "sscf-nni");
111
112
15
  proto_register_field_array(proto_sscf, hf, array_length(hf));
113
15
  proto_register_subtree_array(ett, array_length(ett));
114
115
15
  register_dissector("sscf-nni", dissect_sscf_nni, proto_sscf);
116
117
15
}
118
119
void
120
proto_reg_handoff_sscf(void)
121
15
{
122
15
  mtp3_handle = find_dissector_add_dependency("mtp3", proto_sscf);
123
15
}
124
125
/*
126
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
127
 *
128
 * Local Variables:
129
 * c-basic-offset: 2
130
 * tab-width: 8
131
 * indent-tabs-mode: nil
132
 * End:
133
 *
134
 * ex: set shiftwidth=2 tabstop=8 expandtab:
135
 * :indentSize=2:tabSize=8:noTabs=true:
136
 */