4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "packet-rohc.h"
15 #define PDCP_NR_DIRECTION_UPLINK 0
16 #define PDCP_NR_DIRECTION_DOWNLINK 1
20 NR_SIGNALING_PLANE
= 1,
24 typedef enum NRBearerType
34 #define PDCP_NR_SN_LENGTH_12_BITS 12
35 #define PDCP_NR_SN_LENGTH_18_BITS 18
37 #define PDCP_NR_UL_SDAP_HEADER_PRESENT 0x01
38 #define PDCP_NR_DL_SDAP_HEADER_PRESENT 0x02
40 enum nr_security_integrity_algorithm_e
{ nia0
, nia1
, nia2
, nia3
};
41 enum nr_security_ciphering_algorithm_e
{ nea0
, nea1
, nea2
, nea3
, nea_disabled
=999};
43 typedef struct pdcp_nr_security_info_t
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
;
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
;
55 } pdcp_nr_security_info_t
;
58 /* Info attached to each nr PDCP/RoHC packet */
59 typedef struct pdcp_nr_info
61 /* Bearer info is needed for RRC parsing */
64 NRBearerType bearerType
;
67 /* Details of PDCP header */
68 enum pdcp_nr_plane plane
;
69 uint8_t seqnum_length
;
71 bool ciphering_disabled
;
72 /* PDCP_NR_(U|D)L_SDAP_HEADER_PRESENT bitmask */
80 /* Used by heuristic dissector only */
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 */
87 pdcp_nr_info
*get_pdcp_nr_proto_data(packet_info
*pinfo
);
89 void set_pdcp_nr_proto_data(packet_info
*pinfo
, pdcp_nr_info
*p_pdcp_nr_info
);
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 */
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 */
104 /*****************************************************************/
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
110 #define PDCP_NR_START_STRING "pdcp-nr"
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. */
119 #define PDCP_NR_SEQNUM_LENGTH_TAG 0x02
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) */
126 #define PDCP_NR_DIRECTION_TAG 0x03
129 #define PDCP_NR_BEARER_TYPE_TAG 0x04
132 #define PDCP_NR_BEARER_ID_TAG 0x05
135 #define PDCP_NR_UEID_TAG 0x06
136 /* 2 bytes, network order */
138 #define PDCP_NR_ROHC_COMPRESSION_TAG 0x07
141 /* N.B. The following ROHC values only have significance if rohc_compression
142 is in use for the current channel */
144 #define PDCP_NR_ROHC_IP_VERSION_TAG 0x08
147 #define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09
150 #define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A
153 #define PDCP_NR_ROHC_MODE_TAG 0x0B
156 #define PDCP_NR_ROHC_RND_TAG 0x0C
159 #define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D
162 #define PDCP_NR_ROHC_PROFILE_TAG 0x0E
163 /* 2 bytes, network order */
165 #define PDCP_NR_MACI_PRES_TAG 0x0F
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 */
171 #define PDCP_NR_CIPHER_DISABLED_TAG 0x11
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
179 /* Called by RRC, or other configuration protocols */
181 /* Function to configure ciphering & integrity algorithms */
182 void set_pdcp_nr_security_algorithms(uint16_t ueid
, pdcp_nr_security_info_t
*security_info
);
184 /* Function to indicate securityModeCommand did not complete */
185 void set_pdcp_nr_security_algorithms_failed(uint16_t ueid
);
187 /* Function to indicate rrcReestablishmentRequest.
188 * This results in the next DL SRB1 PDU not being decrypted */
189 void set_pdcp_nr_rrc_reestablishment_request(uint16_t ueid
);
191 /* Called by external dissectors */
192 void set_pdcp_nr_rrc_ciphering_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
193 void set_pdcp_nr_rrc_integrity_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
194 void set_pdcp_nr_up_ciphering_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
195 void set_pdcp_nr_up_integrity_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
198 * Editor modelines - https://www.wireshark.org/tools/modelines.html
203 * indent-tabs-mode: nil
206 * vi: set shiftwidth=4 tabstop=8 expandtab:
207 * :indentSize=4:tabSize=8:noTabs=true: