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 DIRECTION_UPLINK 0
16 #define DIRECTION_DOWNLINK 1
24 typedef enum LogicalChannelType
42 #define PDCP_SN_LENGTH_5_BITS 5
43 #define PDCP_SN_LENGTH_7_BITS 7
44 #define PDCP_SN_LENGTH_12_BITS 12
45 #define PDCP_SN_LENGTH_15_BITS 15
46 #define PDCP_SN_LENGTH_18_BITS 18
48 enum lte_security_integrity_algorithm_e
{ eia0
, eia1
, eia2
, eia3
};
49 enum lte_security_ciphering_algorithm_e
{ eea0
, eea1
, eea2
, eea3
};
51 typedef struct pdcp_lte_security_info_t
53 uint32_t configuration_frame
;
54 bool seen_next_ul_pdu
; /* i.e. have we seen SecurityModeResponse */
55 enum lte_security_integrity_algorithm_e integrity
;
56 enum lte_security_ciphering_algorithm_e ciphering
;
58 /* Store previous settings so can revert if get SecurityModeFailure */
59 uint32_t previous_configuration_frame
;
60 enum lte_security_integrity_algorithm_e previous_integrity
;
61 enum lte_security_ciphering_algorithm_e previous_ciphering
;
62 } pdcp_lte_security_info_t
;
65 /* Info attached to each LTE PDCP/RoHC packet */
66 typedef struct pdcp_lte_info
68 /* Channel info is needed for RRC parsing */
71 LogicalChannelType channelType
;
73 BCCHTransportType BCCHTransport
;
75 /* Details of PDCP header */
77 enum pdcp_plane plane
;
78 uint8_t seqnum_length
;
85 /* Used by heuristic dissector only */
91 /***********************************************************************/
92 /* UDP framing format */
93 /* ----------------------- */
94 /* Several people have asked about dissecting PDCP by framing */
95 /* PDUs over IP. A suggested format over UDP has been defined */
96 /* and implemented by this dissector, using the definitions */
97 /* below. A link to an example program showing you how to encode */
98 /* these headers and send LTE PDCP PDUs on a UDP socket is */
99 /* provided at https://gitlab.com/wireshark/wireshark/-/wikis/PDCP-LTE */
101 /* A heuristic dissector (enabled by a preference) will */
102 /* recognise a signature at the beginning of these frames. */
103 /* Until someone is using this format, suggestions for changes */
105 /***********************************************************************/
108 /* Signature. Rather than try to define a port for this, or make the
109 port number a preference, frames will start with this string (with no
111 #define PDCP_LTE_START_STRING "pdcp-lte"
113 /* Fixed fields. This is followed by the following 3 mandatory fields:
114 - no_header_pdu (1 byte)
116 - rohc_compression ( byte)
117 (where the allowed values are defined above) */
119 /* Conditional field. This field is mandatory in case of User Plane PDCP PDU.
120 The format is to have the tag, followed by the value (there is no length field,
121 it's implicit from the tag). The allowed values are defined above. */
123 #define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02
126 /* Optional fields. Attaching this info to frames will allow you
127 to show you display/filter/plot/add-custom-columns on these fields, so should
128 be added if available.
129 The format is to have the tag, followed by the value (there is no length field,
130 it's implicit from the tag) */
132 #define PDCP_LTE_DIRECTION_TAG 0x03
135 #define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04
138 #define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05
141 #define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06
142 /* 2 bytes, network order */
144 #define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07
147 #define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08
150 #define PDCP_LTE_ROHC_MODE_TAG 0x09
153 #define PDCP_LTE_ROHC_RND_TAG 0x0A
156 #define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B
159 #define PDCP_LTE_ROHC_PROFILE_TAG 0x0C
160 /* 2 bytes, network order */
162 #define PDCP_LTE_CHANNEL_ID_TAG 0x0D
163 /* 2 bytes, network order */
165 #define PDCP_LTE_UEID_TAG 0x0E
166 /* 2 bytes, network order */
168 /* PDCP PDU. Following this tag comes the actual PDCP PDU (there is no length, the PDU
169 continues until the end of the frame) */
170 #define PDCP_LTE_PAYLOAD_TAG 0x01
174 /* Called by RRC, or other configuration protocols */
176 /* Function to configure ciphering & integrity algorithms */
177 void set_pdcp_lte_security_algorithms(uint16_t ueid
, pdcp_lte_security_info_t
*security_info
);
179 /* Function to indicate securityModeCommand did not complete */
180 void set_pdcp_lte_security_algorithms_failed(uint16_t ueid
);
183 /* Called by external dissectors */
184 void set_pdcp_lte_rrc_ciphering_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
185 void set_pdcp_lte_rrc_integrity_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
186 void set_pdcp_lte_up_ciphering_key(uint16_t ueid
, const char *key
, uint32_t frame_num
);
188 /* Reset UE's bearers */
189 void pdcp_lte_reset_ue_bearers(packet_info
*pinfo
, uint16_t ueid
, bool including_drb_am
);
192 * Editor modelines - https://www.wireshark.org/tools/modelines.html
197 * indent-tabs-mode: nil
200 * vi: set shiftwidth=4 tabstop=8 expandtab:
201 * :indentSize=4:tabSize=8:noTabs=true: