| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-mac-nr.h
1/* packet-mac-nr.h
2 *
3 * Martin Mathieson
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/* radioType */
13#define FDD_RADIO 1
14#define TDD_RADIO 2
15
16/* Direction */
17#define DIRECTION_UPLINK 0
18#define DIRECTION_DOWNLINK 1
19
20/* rntiType */
21#define NO_RNTI 0
22#define P_RNTI 1
23#define RA_RNTI 2
24#define C_RNTI 3
25#define SI_RNTI 4
26#define CS_RNTI 5
27#define MSGB_RNTI 6
28
29/* Context info attached to each NR MAC frame */
30 typedef struct mac_nr_info
31{
32 /* Needed for decode */
33 uint8_t radioType;
34 uint8_t direction;
35 uint8_t rntiType;
36
37 /* Extra info to display */
38 uint16_t rnti;
39 uint16_t ueid;
40 uint8_t harqid;
41
42 /* Will these be included in the ME PHR report? */
43 uint8_t phr_type2_othercell;
44
45 /* Timing info */
46 bool sfnSlotInfoPresent;
47 uint16_t sysframeNumber;
48 uint16_t slotNumber;
49
50 /* Length of DL PDU or UL grant size in bytes */
51 uint16_t length;
52
53} mac_nr_info;
54
55
56/* Functions to be called from outside this module (e.g. in a plugin, where mac_nr_info
57 isn't available) to get/set per-packet data */
58WS_DLL_PUBLIC
59 mac_nr_info *get_mac_nr_proto_data(packet_info *pinfo);
60WS_DLL_PUBLIC
61 void set_mac_nr_proto_data(packet_info *pinfo, mac_nr_info *p_mac_nr_info);
62
63/*****************************************************************/
64/* UDP framing format */
65/* ----------------------- */
66/* Several people have asked about dissecting MAC by framing */
67/* PDUs over IP. A suggested format over UDP has been created */
68/* and implemented by this dissector, using the definitions */
69/* below. */
70/* */
71/* A heuristic dissector (enabled by a preference) will */
72/* recognise a signature at the beginning of these frames. */
73/*****************************************************************/
74
75
76/* Signature. Rather than try to define a port for this, or make the
77 port number a preference, frames will start with this string (with no
78 terminating NULL */
79#define MAC_NR_START_STRING "mac-nr"
80
81/* Fixed fields. This is followed by the following 3 mandatory fields:
82 - radioType (1 byte)
83 - direction (1 byte)
84 - rntiType (1 byte)
85 (where the allowed values are defined above */
86
87/* Optional fields. Attaching this info to frames will allow you
88 to show you display/filter/plot/add-custom-columns on these fields, so should
89 be added if available.
90 The format is to have the tag, followed by the value (there is no length field,
91 it's implicit from the tag) */
92
93#define MAC_NR_RNTI_TAG 0x02
94/* 2 bytes, network order */
95
96#define MAC_NR_UEID_TAG 0x03
97/* 2 bytes, network order */
98
99#define MAC_NR_FRAME_SUBFRAME_TAG 0x04
100/* 2 bytes, deprecated, do not use it */
101
102#define MAC_NR_PHR_TYPE2_OTHERCELL_TAG 0x05
103/* 1 byte, true/false */
104
105#define MAC_NR_HARQID 0x06
106/* 1 byte */
107
108#define MAC_NR_FRAME_SLOT_TAG 0x07
109/* 4 bytes, network order, SFN is stored in the 2 first bytes and slot number in the 2 last bytes */
110
111/* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
112 continues until the end of the frame) */
113#define MAC_NR_PAYLOAD_TAG 0x01
114
115
116/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
117/* Some are optional, and may not be seen (e.g. on reestablishment) */
118 typedef struct nr_drb_mac_rlc_mapping_t
119{
120 bool active; /* Is set while inside RLC-BearerConfig or DRB-ToAddMod */
121 uint16_t ueid; /* Mandatory */
122 bool is_drb; /* Mandatory */
123 uint8_t rbid; /* Mandatory */
124
125 bool lcid_present;
126 uint8_t lcid; /* Part of LogicalChannelConfig - optional */
127 bool rlcMode_present;
128 uint8_t rlcMode; /* Part of RLC config - optional */
129
130 uint8_t tempDirection; /* So know direction of next SN length... */
131
132 bool rlcUlSnLength_present;
133 uint8_t rlcUlSnLength; /* Part of RLC config - optional */
134 bool rlcDlSnLength_present;
135 uint8_t rlcDlSnLength; /* Part of RLC config - optional */
136} nr_drb_mac_rlc_mapping_t;
137
138
139/* Set details of an LCID -> drb channel mapping. To be called from
140 configuration protocol (i.e. RRC) */
141 void set_mac_nr_bearer_mapping(nr_drb_mac_rlc_mapping_t *drb_mapping);
142
143 void set_mac_nr_srb3_in_use(uint16_t ueid);
144 void set_mac_nr_srb4_in_use(uint16_t ueid);
145
146
147/* Function to attempt to populate p_mac_lte_info using framing definition above */
148 bool dissect_mac_nr_context_fields(struct mac_nr_info *p_mac_nr_info, tvbuff_t *tvb,
149 packet_info *pinfo, proto_tree *tree, int *p_offset);
150
151/*
152 * Editor modelines - https://www.wireshark.org/tools/modelines.html
153 *
154 * Local variables:
155 * c-basic-offset: 4
156 * tab-width: 8
157 * indent-tabs-mode: nil
158 * End:
159 *
160 * vi: set shiftwidth=4 tabstop=8 expandtab:
161 * :indentSize=4:tabSize=8:noTabs=true:
162 */
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:907
mac_nr_info
Definition packet-mac-nr.h:31
nr_drb_mac_rlc_mapping_t
Definition packet-mac-nr.h:119
tvbuff
Definition tvbuff-int.h:35