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
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
[] = {
58 {1, "+1 hour adjustment for Daylight Saving Time"},
59 {2, "+2 hours adjustment for Daylight Saving Time"},
67 static const value_string gprscdr_rat_type_vals
[] = {
73 {5, "HSPA Evolution"},
79 /* 11-100 Spare for future use TS 29.061 */
80 {101, "IEEE 802.16e"},
83 /* 104-255 Spare for future use TS 29.061 */
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
;
92 length
= tvb_reported_length(tvb
);
93 ext_tree_uli
= proto_tree_add_subtree(tree
, tvb
, 0, length
, ett_gprscdr_userlocationinformation
, NULL
, "UserLocationInformation");
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
);
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
);
111 proto_tree_add_expert(ext_tree_uli
, actx
->pinfo
, &ei_gprscdr_not_dissected
, tvb
, 0, length
);
118 #include "packet-gprscdr-fn.c"
122 /* Register all the bits needed with the filtering engine */
124 proto_register_gprscdr(void)
127 static hf_register_info hf
[] = {
128 #include "packet-gprscdr-hfarr.c"
131 /* List of subtrees */
132 static int *ett
[] = {
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 */
166 * indent-tabs-mode: nil
169 * ex: set shiftwidth=2 tabstop=8 expandtab:
170 * :indentSize=2:tabSize=8:noTabs=true: