Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-pdcp-nr.h
1/* packet-pdcp-nr.h
2 *
3 * Martin Mathieson
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <[email protected]>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11
12#include "packet-rohc.h"
13
14/* Direction */
15#define PDCP_NR_DIRECTION_UPLINK 0
16#define PDCP_NR_DIRECTION_DOWNLINK 1
17
18enum pdcp_nr_plane
19{
20 NR_SIGNALING_PLANE = 1,
21 NR_USER_PLANE = 2
22};
23
24typedef enum NRBearerType
25{
26 Bearer_DCCH=1,
27 Bearer_BCCH_BCH=2,
28 Bearer_BCCH_DL_SCH=3,
29 Bearer_CCCH=4,
30 Bearer_PCCH=5,
31} NRBearerType;
32
33
34#define PDCP_NR_SN_LENGTH_12_BITS 12
35#define PDCP_NR_SN_LENGTH_18_BITS 18
36
37#define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01
38#define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02
39
40enum nr_security_integrity_algorithm_e { nia0, nia1, nia2, nia3 };
41enum nr_security_ciphering_algorithm_e { nea0, nea1, nea2, nea3, nea_disabled=999};
42
44{
45 uint32_t algorithm_configuration_frame;
46 bool seen_next_ul_pdu; /* i.e. have we seen SecurityModeComplete */
47 bool dl_after_reest_request; /* i.e. waiting for DL after rrcReestablishmentRequest */
48 enum nr_security_integrity_algorithm_e integrity;
49 enum nr_security_ciphering_algorithm_e ciphering;
50
51 /* Store previous settings so can revert if get SecurityModeFailure */
52 uint32_t previous_algorithm_configuration_frame;
53 enum nr_security_integrity_algorithm_e previous_integrity;
54 enum nr_security_ciphering_algorithm_e previous_ciphering;
56
57
58/* Info attached to each nr PDCP/RoHC packet */
59typedef struct pdcp_nr_info
60{
61 /* Bearer info is needed for RRC parsing */
62 uint8_t direction;
63 uint16_t ueid;
64 NRBearerType bearerType;
65 uint8_t bearerId;
66
67 /* Details of PDCP header */
68 enum pdcp_nr_plane plane;
69 uint8_t seqnum_length;
70 bool maci_present;
71 bool ciphering_disabled;
72 /* PDCP_NR_(U|D)L_SDAP_HEADER_PRESENT bitmask */
73 uint8_t sdap_header;
74
75 /* RoHC settings */
76 rohc_info rohc;
77
78 uint8_t is_retx;
79
80 /* Used by heuristic dissector only */
81 uint16_t pdu_length;
83
84/* Functions to be called from outside this module (e.g. in a plugin, where pdcp_nr_info
85 isn't available) to get/set per-packet data */
86WS_DLL_PUBLIC
87pdcp_nr_info *get_pdcp_nr_proto_data(packet_info *pinfo);
88WS_DLL_PUBLIC
89void set_pdcp_nr_proto_data(packet_info *pinfo, pdcp_nr_info *p_pdcp_nr_info);
90
91
92/*****************************************************************/
93/* UDP framing format */
94/* ----------------------- */
95/* Several people have asked about dissecting PDCP by framing */
96/* PDUs over IP. A suggested format over UDP has been defined */
97/* and implemented by this dissector, using the definitions */
98/* below. */
99/* */
100/* A heuristic dissector (enabled by a preference) will */
101/* recognise a signature at the beginning of these frames. */
102/* Until someone is using this format, suggestions for changes */
103/* are welcome. */
104/*****************************************************************/
105
106
107/* Signature. Rather than try to define a port for this, or make the
108 port number a preference, frames will start with this string (with no
109 terminating NULL */
110#define PDCP_NR_START_STRING "pdcp-nr"
111
112/* Fixed fields:
113 - plane (1 byte) */
114
115/* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
116 The format is to have the tag, followed by the value (there is no length field,
117 it's implicit from the tag). The allowed values are defined above. */
118
119#define PDCP_NR_SEQNUM_LENGTH_TAG 0x02
120/* 1 byte */
121
122/* Optional fields. Attaching this info should be added if available.
123 The format is to have the tag, followed by the value (there is no length field,
124 it's implicit from the tag) */
125
126#define PDCP_NR_DIRECTION_TAG 0x03
127/* 1 byte */
128
129#define PDCP_NR_BEARER_TYPE_TAG 0x04
130/* 1 byte */
131
132#define PDCP_NR_BEARER_ID_TAG 0x05
133/* 1 byte */
134
135#define PDCP_NR_UEID_TAG 0x06
136/* 2 bytes, network order */
137
138#define PDCP_NR_ROHC_COMPRESSION_TAG 0x07
139/* 0 byte */
140
141/* N.B. The following ROHC values only have significance if rohc_compression
142 is in use for the current channel */
143
144#define PDCP_NR_ROHC_IP_VERSION_TAG 0x08
145/* 1 byte */
146
147#define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09
148/* 0 byte */
149
150#define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A
151/* 0 byte */
152
153#define PDCP_NR_ROHC_MODE_TAG 0x0B
154/* 1 byte */
155
156#define PDCP_NR_ROHC_RND_TAG 0x0C
157/* 0 byte */
158
159#define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D
160/* 0 byte */
161
162#define PDCP_NR_ROHC_PROFILE_TAG 0x0E
163/* 2 bytes, network order */
164
165#define PDCP_NR_MACI_PRES_TAG 0x0F
166/* 0 byte */
167
168#define PDCP_NR_SDAP_HEADER_TAG 0x10
169/* 1 byte, bitmask with PDCP_NR_UL_SDAP_HEADER_PRESENT and/or PDCP_NR_DL_SDAP_HEADER_PRESENT */
170
171#define PDCP_NR_CIPHER_DISABLED_TAG 0x11
172/* 0 byte */
173
174/* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
175 continues until the end of the frame) */
176#define PDCP_NR_PAYLOAD_TAG 0x01
177
178
179/* Called by RRC, or other configuration protocols */
180
181/* Function to configure ciphering & integrity algorithms */
182void set_pdcp_nr_security_algorithms(uint16_t ueid, pdcp_nr_security_info_t *security_info);
183
184/* Function to indicate securityModeCommand did not complete */
185void set_pdcp_nr_security_algorithms_failed(uint16_t ueid);
186
187/* Function to indicate rrcReestablishmentRequest.
188 * This results in the next DL SRB1 PDU not being decrypted */
189void set_pdcp_nr_rrc_reestablishment_request(uint16_t ueid);
190
191/* Called by external dissectors */
192void set_pdcp_nr_rrc_ciphering_key(uint16_t ueid, const char *key, uint32_t frame_num);
193void set_pdcp_nr_rrc_integrity_key(uint16_t ueid, const char *key, uint32_t frame_num);
194void set_pdcp_nr_up_ciphering_key(uint16_t ueid, const char *key, uint32_t frame_num);
195void set_pdcp_nr_up_integrity_key(uint16_t ueid, const char *key, uint32_t frame_num);
196
197/*
198 * Editor modelines - https://www.wireshark.org/tools/modelines.html
199 *
200 * Local variables:
201 * c-basic-offset: 4
202 * tab-width: 8
203 * indent-tabs-mode: nil
204 * End:
205 *
206 * vi: set shiftwidth=4 tabstop=8 expandtab:
207 * :indentSize=4:tabSize=8:noTabs=true:
208 */
Definition packet_info.h:43
Definition packet-pdcp-nr.h:60
Definition packet-pdcp-nr.h:44
Definition packet-rohc.h:40