Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-pdcp-lte.h
1 /* packet-pdcp-lte.h
2  *
3  * Martin Mathieson
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
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 DIRECTION_UPLINK 0
16 #define DIRECTION_DOWNLINK 1
17 
18 enum pdcp_plane
19 {
20  SIGNALING_PLANE = 1,
21  USER_PLANE = 2
22 };
23 
24 typedef enum LogicalChannelType
25 {
26  Channel_DCCH=1,
27  Channel_BCCH=2,
28  Channel_CCCH=3,
29  Channel_PCCH=4,
30  Channel_DCCH_NB=5,
31  Channel_BCCH_NB=6,
32  Channel_CCCH_NB=7,
33  Channel_PCCH_NB=8
34 } LogicalChannelType;
35 
36 typedef enum
37 {
38  BCH_TRANSPORT=1,
39  DLSCH_TRANSPORT=2
40 } BCCHTransportType;
41 
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
47 
48 enum lte_security_integrity_algorithm_e { eia0, eia1, eia2, eia3 };
49 enum lte_security_ciphering_algorithm_e { eea0, eea1, eea2, eea3 };
50 
52 {
53  guint32 configuration_frame;
54  gboolean 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;
57 
58  /* Store previous settings so can revert if get SecurityModeFailure */
59  guint32 previous_configuration_frame;
60  enum lte_security_integrity_algorithm_e previous_integrity;
61  enum lte_security_ciphering_algorithm_e previous_ciphering;
63 
64 
65 /* Info attached to each LTE PDCP/RoHC packet */
66 typedef struct pdcp_lte_info
67 {
68  /* Channel info is needed for RRC parsing */
69  guint8 direction;
70  guint16 ueid;
71  LogicalChannelType channelType;
72  guint16 channelId;
73  BCCHTransportType BCCHTransport;
74 
75  /* Details of PDCP header */
76  gboolean no_header_pdu;
77  enum pdcp_plane plane;
78  guint8 seqnum_length;
79 
80  /* RoHC settings */
81  rohc_info rohc;
82 
83  guint8 is_retx;
84 
85  /* Used by heuristic dissector only */
86  guint16 pdu_length;
88 
89 
90 
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 */
100 /* */
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 */
104 /* are welcome. */
105 /***********************************************************************/
106 
107 
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
110  terminating NULL */
111 #define PDCP_LTE_START_STRING "pdcp-lte"
112 
113 /* Fixed fields. This is followed by the following 3 mandatory fields:
114  - no_header_pdu (1 byte)
115  - plane (1 byte)
116  - rohc_compression ( byte)
117  (where the allowed values are defined above) */
118 
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. */
122 
123 #define PDCP_LTE_SEQNUM_LENGTH_TAG 0x02
124 /* 1 byte */
125 
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) */
131 
132 #define PDCP_LTE_DIRECTION_TAG 0x03
133 /* 1 byte */
134 
135 #define PDCP_LTE_LOG_CHAN_TYPE_TAG 0x04
136 /* 1 byte */
137 
138 #define PDCP_LTE_BCCH_TRANSPORT_TYPE_TAG 0x05
139 /* 1 byte */
140 
141 #define PDCP_LTE_ROHC_IP_VERSION_TAG 0x06
142 /* 2 bytes, network order */
143 
144 #define PDCP_LTE_ROHC_CID_INC_INFO_TAG 0x07
145 /* 1 byte */
146 
147 #define PDCP_LTE_ROHC_LARGE_CID_PRES_TAG 0x08
148 /* 1 byte */
149 
150 #define PDCP_LTE_ROHC_MODE_TAG 0x09
151 /* 1 byte */
152 
153 #define PDCP_LTE_ROHC_RND_TAG 0x0A
154 /* 1 byte */
155 
156 #define PDCP_LTE_ROHC_UDP_CHECKSUM_PRES_TAG 0x0B
157 /* 1 byte */
158 
159 #define PDCP_LTE_ROHC_PROFILE_TAG 0x0C
160 /* 2 bytes, network order */
161 
162 #define PDCP_LTE_CHANNEL_ID_TAG 0x0D
163 /* 2 bytes, network order */
164 
165 #define PDCP_LTE_UEID_TAG 0x0E
166 /* 2 bytes, network order */
167 
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
171 
172 
173 
174 /* Called by RRC, or other configuration protocols */
175 
176 /* Function to configure ciphering & integrity algorithms */
177 void set_pdcp_lte_security_algorithms(guint16 ueid, pdcp_lte_security_info_t *security_info);
178 
179 /* Function to indicate securityModeCommand did not complete */
180 void set_pdcp_lte_security_algorithms_failed(guint16 ueid);
181 
182 
183 /* Called by external dissectors */
184 void set_pdcp_lte_rrc_ciphering_key(guint16 ueid, const char *key, guint32 frame_num);
185 void set_pdcp_lte_rrc_integrity_key(guint16 ueid, const char *key, guint32 frame_num);
186 void set_pdcp_lte_up_ciphering_key(guint16 ueid, const char *key, guint32 frame_num);
187 
188 /* Reset UE's bearers */
189 void pdcp_lte_reset_ue_bearers(packet_info *pinfo, guint16 ueid, gboolean including_drb_am);
190 
191 /*
192  * Editor modelines - https://www.wireshark.org/tools/modelines.html
193  *
194  * Local variables:
195  * c-basic-offset: 4
196  * tab-width: 8
197  * indent-tabs-mode: nil
198  * End:
199  *
200  * vi: set shiftwidth=4 tabstop=8 expandtab:
201  * :indentSize=4:tabSize=8:noTabs=true:
202  */
Definition: packet_info.h:44
Definition: packet-pdcp-lte.h:67
Definition: packet-pdcp-lte.h:52
Definition: packet-rohc.h:40