Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-pdcp-nr.h
blob5193f770092f69887980e373b8dfce798e9f34e6
1 /* packet-pdcp-nr.h
3 * Martin Mathieson
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
9 */
12 #include "packet-rohc.h"
14 /* Direction */
15 #define PDCP_NR_DIRECTION_UPLINK 0
16 #define PDCP_NR_DIRECTION_DOWNLINK 1
18 enum pdcp_nr_plane
20 NR_SIGNALING_PLANE = 1,
21 NR_USER_PLANE = 2
24 typedef enum NRBearerType
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;
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 */
62 uint8_t direction;
63 uint16_t ueid;
64 NRBearerType bearerType;
65 uint8_t bearerId;
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;
75 /* RoHC settings */
76 rohc_info rohc;
78 uint8_t is_retx;
80 /* Used by heuristic dissector only */
81 uint16_t pdu_length;
82 } pdcp_nr_info;
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 */
86 WS_DLL_PUBLIC
87 pdcp_nr_info *get_pdcp_nr_proto_data(packet_info *pinfo);
88 WS_DLL_PUBLIC
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 */
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 /*****************************************************************/
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"
112 /* Fixed fields:
113 - plane (1 byte) */
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
120 /* 1 byte */
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
127 /* 1 byte */
129 #define PDCP_NR_BEARER_TYPE_TAG 0x04
130 /* 1 byte */
132 #define PDCP_NR_BEARER_ID_TAG 0x05
133 /* 1 byte */
135 #define PDCP_NR_UEID_TAG 0x06
136 /* 2 bytes, network order */
138 #define PDCP_NR_ROHC_COMPRESSION_TAG 0x07
139 /* 0 byte */
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
145 /* 1 byte */
147 #define PDCP_NR_ROHC_CID_INC_INFO_TAG 0x09
148 /* 0 byte */
150 #define PDCP_NR_ROHC_LARGE_CID_PRES_TAG 0x0A
151 /* 0 byte */
153 #define PDCP_NR_ROHC_MODE_TAG 0x0B
154 /* 1 byte */
156 #define PDCP_NR_ROHC_RND_TAG 0x0C
157 /* 0 byte */
159 #define PDCP_NR_ROHC_UDP_CHECKSUM_PRES_TAG 0x0D
160 /* 0 byte */
162 #define PDCP_NR_ROHC_PROFILE_TAG 0x0E
163 /* 2 bytes, network order */
165 #define PDCP_NR_MACI_PRES_TAG 0x0F
166 /* 0 byte */
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
172 /* 0 byte */
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
200 * Local variables:
201 * c-basic-offset: 4
202 * tab-width: 8
203 * indent-tabs-mode: nil
204 * End:
206 * vi: set shiftwidth=4 tabstop=8 expandtab:
207 * :indentSize=4:tabSize=8:noTabs=true: