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 #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  guint8 radioType;
34  guint8 direction;
35  guint8 rntiType;
36 
37  /* Extra info to display */
38  guint16 rnti;
39  guint16 ueid;
40  guint8 harqid;
41 
42  /* Will these be included in the ME PHR report? */
43  guint8 phr_type2_othercell;
44 
45  /* Timing info */
46  gboolean sfnSlotInfoPresent;
47  guint16 sysframeNumber;
48  guint16 slotNumber;
49 
50  /* Length of DL PDU or UL grant size in bytes */
51  guint16 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 */
58 WS_DLL_PUBLIC
59 mac_nr_info *get_mac_nr_proto_data(packet_info *pinfo);
60 WS_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) */
119 {
120  gboolean active; /* Is set while inside RLC-BearerConfig or DRB-ToAddMod */
121  guint16 ueid; /* Mandatory */
122  gboolean is_drb; /* Mandatory */
123  guint8 rbid; /* Mandatory */
124 
125  gboolean lcid_present;
126  guint8 lcid; /* Part of LogicalChannelConfig - optional */
127  gboolean rlcMode_present;
128  guint8 rlcMode; /* Part of RLC config - optional */
129 
130  guint8 tempDirection; /* So know direction of next SN length... */
131 
132  gboolean rlcUlSnLength_present;
133  guint8 rlcUlSnLength; /* Part of RLC config - optional */
134  gboolean rlcDlSnLength_present;
135  guint8 rlcDlSnLength; /* Part of RLC config - optional */
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(guint16 ueid);
144 void set_mac_nr_srb4_in_use(guint16 ueid);
145 
146 
147 /* Function to attempt to populate p_mac_lte_info using framing definition above */
148 gboolean dissect_mac_nr_context_fields(struct mac_nr_info *p_mac_nr_info, tvbuff_t *tvb,
149  packet_info *pinfo, proto_tree *tree, gint *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  */
Definition: packet_info.h:44
Definition: proto.h:904
Definition: packet-mac-nr.h:31
Definition: packet-mac-nr.h:119
Definition: tvbuff-int.h:35