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