Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / asn1 / gprscdr / packet-gprscdr-template.c
blobacc4957ee99e46db75dde471552e03161fee2e7d
1 /* packet-gprscdr-template.c
2 * Copyright 2011 , Anders Broman <anders.broman [AT] ericsson.com>
4 * Updates and corrections:
5 * Copyright 2018-2022, Joakim Karlsson <oakimk@gmail.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 * References: 3GPP TS 32.298 V17.4.0
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/expert.h>
19 #include <epan/asn1.h>
20 #include <wsutil/array.h>
22 #include "packet-ber.h"
23 #include "packet-gsm_map.h"
24 #include "packet-gsm_a_common.h"
25 #include "packet-e212.h"
26 #include "packet-gprscdr.h"
27 #include "packet-gtp.h"
28 #include "packet-gtpv2.h"
30 #define PNAME "GPRS CDR"
31 #define PSNAME "GPRSCDR"
32 #define PFNAME "gprscdr"
34 void proto_register_gprscdr(void);
36 /* Define the GPRS CDR proto */
37 static int proto_gprscdr;
39 #include "packet-gprscdr-hf.c"
41 static int ett_gprscdr;
42 static int ett_gprscdr_timestamp;
43 static int ett_gprscdr_plmn_id;
44 static int ett_gprscdr_pdp_pdn_type;
45 static int ett_gprscdr_eps_qos_arp;
46 static int ett_gprscdr_managementextension_information;
47 static int ett_gprscdr_userlocationinformation;
48 #include "packet-gprscdr-ett.c"
50 static expert_field ei_gprscdr_not_dissected;
51 static expert_field ei_gprscdr_choice_not_found;
53 /* Global variables */
54 static const char *obj_id;
56 static const value_string gprscdr_daylight_saving_time_vals[] = {
57 {0, "No adjustment"},
58 {1, "+1 hour adjustment for Daylight Saving Time"},
59 {2, "+2 hours adjustment for Daylight Saving Time"},
60 {3, "Reserved"},
61 {0, NULL}
64 /* 3GPP-RAT-Type
65 * 3GPP TS 29.061
67 static const value_string gprscdr_rat_type_vals[] = {
68 {0, "Reserved"},
69 {1, "UTRAN"},
70 {2, "GERAN"},
71 {3, "WLAN"},
72 {4, "GAN"},
73 {5, "HSPA Evolution"},
74 {6, "EUTRAN"},
75 {7, "Virtual"},
76 {8, "EUTRAN-NB-IoT"},
77 {9, "LTE-M"},
78 {10, "NR"},
79 /* 11-100 Spare for future use TS 29.061 */
80 {101, "IEEE 802.16e"},
81 {102, "3GPP2 eHRPD"},
82 {103, "3GPP2 HRPD"},
83 /* 104-255 Spare for future use TS 29.061 */
84 {0, NULL}
87 static int
88 dissect_gprscdr_uli(tvbuff_t *tvb _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int type) {
89 proto_tree *ext_tree_uli;
90 unsigned length;
92 length = tvb_reported_length(tvb);
93 ext_tree_uli = proto_tree_add_subtree(tree, tvb, 0, length, ett_gprscdr_userlocationinformation, NULL, "UserLocationInformation");
95 switch (type) {
96 case 1:
97 /* For GGSN/EGGSN-CDR,
98 * this octet string is a 1:1 copy of the contents (i.e. starting with octet 4) of the
99 * User Location Information (ULI) information element specified in 29.060, ch7.7.51.
101 dissect_gtp_uli(tvb, 0, actx->pinfo, ext_tree_uli, NULL);
102 break;
103 case 2:
104 /* For SGW/PGW-CDR,
105 * this octet string is a 1:1 copy of the contents (i.e. starting with octet 5) of the
106 * User Location Information (ULI) information element specified in 29.274, ch8.21.
108 dissect_gtpv2_uli(tvb, actx->pinfo, ext_tree_uli, NULL, length, 0, 0, NULL);
109 break;
110 default:
111 proto_tree_add_expert(ext_tree_uli, actx->pinfo, &ei_gprscdr_not_dissected, tvb, 0, length);
112 break;
115 return length;
118 #include "packet-gprscdr-fn.c"
122 /* Register all the bits needed with the filtering engine */
123 void
124 proto_register_gprscdr(void)
126 /* List of fields */
127 static hf_register_info hf[] = {
128 #include "packet-gprscdr-hfarr.c"
131 /* List of subtrees */
132 static int *ett[] = {
133 &ett_gprscdr,
134 &ett_gprscdr_timestamp,
135 &ett_gprscdr_plmn_id,
136 &ett_gprscdr_pdp_pdn_type,
137 &ett_gprscdr_eps_qos_arp,
138 &ett_gprscdr_managementextension_information,
139 &ett_gprscdr_userlocationinformation,
140 #include "packet-gprscdr-ettarr.c"
143 static ei_register_info ei[] = {
144 { &ei_gprscdr_not_dissected, { "gprscdr.not_dissected", PI_UNDECODED, PI_WARN, "Not dissected", EXPFILL }},
145 { &ei_gprscdr_choice_not_found, { "gprscdr.error.choice_not_found", PI_MALFORMED, PI_WARN, "GPRS CDR Error: This choice field(Record type) was not found", EXPFILL }},
148 expert_module_t* expert_gprscdr;
150 proto_gprscdr = proto_register_protocol(PNAME, PSNAME, PFNAME);
152 proto_register_field_array(proto_gprscdr, hf, array_length(hf));
153 proto_register_subtree_array(ett, array_length(ett));
154 expert_gprscdr = expert_register_protocol(proto_gprscdr);
155 expert_register_field_array(expert_gprscdr, ei, array_length(ei));
158 /* The registration hand-off routine */
161 * Editor modelines
163 * Local Variables:
164 * c-basic-offset: 2
165 * tab-width: 8
166 * indent-tabs-mode: nil
167 * End:
169 * ex: set shiftwidth=2 tabstop=8 expandtab:
170 * :indentSize=2:tabSize=8:noTabs=true: