Adding period to proto filter name for being part of the "diameter" grouping.
[metze/wireshark/wip.git] / epan / dissectors / packet-diameter_3gpp.c
1 /* packet-diameter_3gpp.c
2  * Routines for dissecting 3GPP OctetSting AVP:s
3  * Copyright 2008, Anders Broman <anders.broman[at]ericsson.com>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25
26  /* This dissector registers a dissector table for 3GPP Vendor specific
27   * AVP:s which will be called from the Diameter dissector to dissect
28   * the content of AVP:s of the OctetString type(or similar).
29   */
30
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34
35 #include <glib.h>
36
37 #include <epan/packet.h>
38 #include <epan/asn1.h>
39
40 #include "packet-gsm_map.h"
41 #include "packet-gsm_a_common.h"
42 #include "packet-e164.h"
43 #include "packet-e212.h"
44 #include "packet-ntp.h"
45
46 /* Initialize the protocol and registered fields */
47 static int proto_diameter_3gpp                  = -1;
48
49 static int hf_diameter_3gpp_visited_nw_id                       = -1;
50 static int hf_diameter_3gpp_msisdn                                      = -1;
51 static int hf_diameter_3gpp_path                                        = -1;
52 static int hf_diameter_3gpp_contact                                     = -1;
53 static int hf_diameter_3gpp_user_data                           = -1;
54 static int hf_diameter_3gpp_ipaddr                                      = -1;
55 static int hf_diameter_3gpp_mbms_required_qos_prio      = -1;
56 static int hf_diameter_3gpp_tmgi                                        = -1;
57 static int hf_diameter_3gpp_service_ind                         = -1;
58 static int hf_diameter_mbms_service_id                          = -1;
59 static int hf_diameter_address_digits = -1;
60 static int hf_diameter_3gpp_spare_bits = -1;
61 static int hf_diameter_3gpp_feature_list_flags = -1;
62 static int hf_diameter_3gpp_feature_list_flags_bit0 = -1;
63 static int hf_diameter_3gpp_feature_list_flags_bit1 = -1;
64 static int hf_diameter_3gpp_feature_list_flags_bit2 = -1;
65 static int hf_diameter_3gpp_ulr_flags = -1;
66 static int hf_diameter_3gpp_ulr_flags_bit0 = -1;
67 static int hf_diameter_3gpp_ulr_flags_bit1 = -1;
68 static int hf_diameter_3gpp_ulr_flags_bit2 = -1;
69 static int hf_diameter_3gpp_ulr_flags_bit3 = -1;
70 static int hf_diameter_3gpp_ulr_flags_bit4 = -1;
71 static int hf_diameter_3gpp_ulr_flags_bit5 = -1;
72 static int hf_diameter_3gpp_ulr_flags_bit6 = -1;
73 static int hf_diameter_3gpp_ula_flags = -1;
74 static int hf_diameter_3gpp_ula_flags_bit0 = -1;
75 static int hf_diameter_3gpp_dsr_flags = -1;
76 static int hf_diameter_3gpp_dsr_flags_bit0 = -1;
77 static int hf_diameter_3gpp_dsr_flags_bit1 = -1;
78 static int hf_diameter_3gpp_dsr_flags_bit2 = -1;
79 static int hf_diameter_3gpp_dsr_flags_bit3 = -1;
80 static int hf_diameter_3gpp_dsr_flags_bit4 = -1;
81 static int hf_diameter_3gpp_dsr_flags_bit5 = -1;
82 static int hf_diameter_3gpp_dsr_flags_bit6 = -1;
83 static int hf_diameter_3gpp_dsr_flags_bit7 = -1;
84 static int hf_diameter_3gpp_dsr_flags_bit8 = -1;
85 static int hf_diameter_3gpp_dsr_flags_bit9 = -1;
86 static int hf_diameter_3gpp_dsr_flags_bit10 = -1;
87 static int hf_diameter_3gpp_dsr_flags_bit11 = -1;
88 static int hf_diameter_3gpp_dsr_flags_bit12 = -1;
89 static int hf_diameter_3gpp_dsr_flags_bit13 = -1;
90 static int hf_diameter_3gpp_dsr_flags_bit14 = -1;
91 static int hf_diameter_3gpp_dsr_flags_bit15 = -1;
92 static int hf_diameter_3gpp_dsa_flags = -1;
93 static int hf_diameter_3gpp_dsa_flags_bit0 = -1;
94 static int hf_diameter_3gpp_ida_flags = -1;
95 static int hf_diameter_3gpp_ida_flags_bit0 = -1;
96 static int hf_diameter_3gpp_pua_flags = -1;
97 static int hf_diameter_3gpp_pua_flags_bit0 = -1;
98 static int hf_diameter_3gpp_pua_flags_bit1 = -1;
99 static int hf_diameter_3gpp_nor_flags = -1;
100 static int hf_diameter_3gpp_nor_flags_bit0 = -1;
101 static int hf_diameter_3gpp_nor_flags_bit1 = -1;
102 static int hf_diameter_3gpp_nor_flags_bit2 = -1;
103 static int hf_diameter_3gpp_nor_flags_bit3 = -1;
104 static int hf_diameter_3gpp_nor_flags_bit4 = -1;
105 static int hf_diameter_3gpp_nor_flags_bit5 = -1;
106 static int hf_diameter_3gpp_nor_flags_bit6 = -1;
107 static int hf_diameter_3gpp_idr_flags = -1;
108 static int hf_diameter_3gpp_idr_flags_bit0 = -1;
109 static int hf_diameter_3gpp_idr_flags_bit1 = -1;
110 static int hf_diameter_3gpp_idr_flags_bit2 = -1;
111 static int hf_diameter_3gpp_idr_flags_bit3 = -1;
112 static int hf_diameter_3gpp_idr_flags_bit4 = -1;
113 static int hf_diameter_3gpp_ipv6addr = -1;
114 static int hf_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer = -1;
115 static int hf_diameter_3gpp_udp_port = -1;
116 static gint diameter_3gpp_path_ett = -1;
117 static gint diameter_3gpp_msisdn_ett = -1;
118 static gint diameter_3gpp_feature_list_ett = -1;
119 static gint diameter_3gpp_tmgi_ett      = -1;
120 static gint diameter_3gpp_ulr_flags_ett = -1;
121 static gint diameter_3gpp_ula_flags_ett = -1;
122 static gint diameter_3gpp_dsr_flags_ett = -1;
123 static gint diameter_3gpp_dsa_flags_ett = -1;
124 static gint diameter_3gpp_ida_flags_ett = -1;
125 static gint diameter_3gpp_pua_flags_ett = -1;
126 static gint diameter_3gpp_nor_flags_ett = -1;
127 static gint diameter_3gpp_idr_flags_ett = -1;
128
129 /* Dissector handles */
130 static dissector_handle_t xml_handle;
131
132 /* AVP Code: 15 3GPP-SGSN-IPv6-Address */
133 /* AVP Code: 917 MBMS-GGSN-IPv6-Address */
134 static int
135 dissect_diameter_3gpp_ipv6addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
136 {
137         int offset = 0;
138
139         proto_tree_add_item(tree, hf_diameter_3gpp_ipv6addr, tvb, offset, 16, ENC_BIG_ENDIAN);
140
141         offset += 16;
142
143         return offset;
144 }
145
146
147 /* AVP Code: 600 Visited-Network-Identifier
148  * imscxdx.xml
149  * 6.3.1 Visited-Network-Identifier AVP
150  * The Visited-Network-Identifier AVP is of type OctetString. This AVP contains an identifier that helps the home
151  * network to identify the visited network (e.g. the visited network domain name).
152  */
153
154 static int
155 dissect_diameter_3gpp_visited_nw_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
156
157         proto_item* item;
158         int offset = 0, i;
159         int length = tvb_length(tvb);
160
161         for(i = 0; i < length; i++)
162                 if(!g_ascii_isprint(tvb_get_guint8(tvb, i)))
163                         return length;
164
165         item = proto_tree_add_item(tree, hf_diameter_3gpp_visited_nw_id, tvb, offset, length, ENC_ASCII|ENC_NA);
166         PROTO_ITEM_SET_GENERATED(item);
167
168
169         return length;
170 }
171 /* AVP Code: 630 Feature-List
172  * imscxdx.xml
173  * IMS Cx Dx AVPS 3GPP TS 29.229
174  */
175
176 static int
177 dissect_diameter_3gpp_feature_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
178
179         proto_item* item;
180         proto_tree *sub_tree;
181         int offset = 0;
182     guint32 bit_offset;
183
184         item       = proto_tree_add_item(tree, hf_diameter_3gpp_feature_list_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
185         sub_tree   = proto_item_add_subtree(item, diameter_3gpp_feature_list_ett);
186
187     bit_offset = 0;
188     proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 29, ENC_BIG_ENDIAN);
189     bit_offset+=29;
190     proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_feature_list_flags_bit2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
191     bit_offset++;
192     proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_feature_list_flags_bit1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
193     bit_offset++;
194     proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_feature_list_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
195     bit_offset++;
196
197     offset = bit_offset>>3;
198         return offset;
199
200 }
201
202 /* AVP Code: 640 Path
203  * imscxdx.xml
204  * IMS Cx Dx AVPS 3GPP TS 29.229
205  * 6.3.47 Path AVP
206  * The Path AVP is of type OctetString and it contains a comma separated list of SIP proxies in the Path header as defined
207  * in IETF RFC 3327 [17].
208  */
209 static int
210 dissect_diameter_3gpp_path(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
211
212         proto_item* item;
213         proto_tree *sub_tree;
214         int offset = 0, comma_offset;
215         int end_offset = tvb_length(tvb) - 1;
216
217         item = proto_tree_add_text(tree, tvb, offset, -1,"Paths");
218         sub_tree = proto_item_add_subtree(item,diameter_3gpp_path_ett);
219
220         while (offset < end_offset){
221                 comma_offset = tvb_find_guint8(tvb, offset, -1, ',');
222                 if(comma_offset == -1){
223                         proto_tree_add_item(sub_tree, hf_diameter_3gpp_path, tvb, offset, comma_offset, ENC_ASCII|ENC_NA);
224                         return end_offset;
225                 }
226                 proto_tree_add_item(sub_tree, hf_diameter_3gpp_path, tvb, offset, comma_offset, ENC_ASCII|ENC_NA);
227                 offset = comma_offset+1;
228         }
229
230
231         return tvb_length(tvb);
232 }
233
234 /* AVP Code: 641 Contact
235  * imscxdx.xml
236  * IMS Cx Dx AVPS 3GPP TS 29.229
237  * 6.3.48 Contact AVP
238  * The Contact AVP is of type OctetString and it contains the Contact Addresses and Parameters in the Contact header as
239  * defined in IETF RFC 3261.
240  */
241 static int
242 dissect_diameter_3gpp_contact(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
243
244         proto_item* item;
245         int offset = 0;
246
247         item = proto_tree_add_item(tree, hf_diameter_3gpp_contact, tvb, offset, -1, ENC_ASCII|ENC_NA);
248         PROTO_ITEM_SET_GENERATED(item);
249
250         return tvb_length(tvb);
251 }
252
253 /* AVP Code: 701 MSISDN */
254 static int
255 dissect_diameter_3gpp_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
256
257         proto_item* item;
258         proto_tree *sub_tree;
259         int offset = 0;
260         const char     *digit_str;
261         int length = tvb_length(tvb);
262
263         item = proto_tree_add_item(tree, hf_diameter_3gpp_msisdn, tvb, offset, length, ENC_NA);
264         sub_tree = proto_item_add_subtree(item,diameter_3gpp_msisdn_ett);
265
266         dissect_e164_cc(tvb, sub_tree, offset, TRUE);
267
268         digit_str = unpack_digits(tvb, 1);
269         proto_tree_add_string(sub_tree, hf_diameter_address_digits, tvb, 1, -1, digit_str);
270
271         return tvb_length(tvb);
272
273 }
274
275 /* AVP Code: 702 User-Data 
276  * TGPPSh.xml
277  * The AVP codes from 709 to799 are reserved for TS 29.329
278  */
279 /* AVP Code: 606 User-Data 
280  * imscxdx.xml
281  * IMS Cx Dx AVPS 3GPP TS 29.229
282  */
283 static int
284 dissect_diameter_3gpp_user_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
285
286         guint8          word[6];
287         int length = tvb_length(tvb);
288
289         /* If there is less than 38 characters this is not XML
290          * <?xml version="1.0" encoding="UTF-8"?>
291          */
292         if(length < 38)
293                 return length;
294
295         tvb_get_nstringz0(tvb, 0, sizeof(word),word);
296         if (g_ascii_strncasecmp(word, "<?xml", 5) == 0){
297                 call_dissector(xml_handle, tvb, pinfo, tree);
298         }
299
300         return length;
301
302 }
303
304 /*
305  * AVP Code: 704 Service-Indication
306  */
307 static int
308 dissect_diameter_3gpp_service_ind(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
309
310         proto_item* item;
311         int offset = 0, i;
312         int length = tvb_length(tvb);
313
314         for(i = 0; i < length; i++)
315                 if(!g_ascii_isprint(tvb_get_guint8(tvb, i)))
316                         return length;
317
318         item = proto_tree_add_item(tree, hf_diameter_3gpp_service_ind, tvb, offset, length, ENC_ASCII|ENC_NA);
319         PROTO_ITEM_SET_GENERATED(item);
320
321         return length;
322 }
323
324 /* AVP Code: 900 TMGI */
325 static int
326 dissect_diameter_3gpp_tmgi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
327
328         proto_item* item;
329         proto_tree *sub_tree;
330         int offset = 0;
331
332         item = proto_tree_add_item(tree, hf_diameter_3gpp_tmgi, tvb, offset, 6, ENC_NA);
333         sub_tree = proto_item_add_subtree(item,diameter_3gpp_tmgi_ett);
334
335         /* MBMS Service ID consisting of three octets. MBMS Service ID consists of a 6-digit
336          * fixed-length hexadecimal number between 000000 and FFFFFF.
337          * MBMS Service ID uniquely identifies an MBMS bearer service within a PLMN.
338          */
339
340         proto_tree_add_item(sub_tree, hf_diameter_mbms_service_id, tvb, offset, 3, ENC_BIG_ENDIAN);
341         offset = offset+3;
342         offset = dissect_e212_mcc_mnc(tvb, pinfo, sub_tree, offset, TRUE);
343
344         return offset;
345
346 }
347
348 /* AVP Code: 903 MBMS-Service-Area */
349
350 /* AVP Code: 918 MBMS-BMSC-SSM-IP-Address */
351 static int
352 dissect_diameter_3gpp_ipaddr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
353
354         int offset = 0;
355
356         proto_tree_add_item(tree, hf_diameter_3gpp_ipaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
357         offset += 4;
358
359         return offset;
360
361 }
362
363 /* AVP Code: 913 MBMS-Required-QoS */
364 static int
365 dissect_diameter_3gpp_mbms_required_qos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
366
367         int offset = 0;
368         guint length;
369
370         /* Octet
371          * 1            Allocation/Retention Priority as specified in 3GPP TS 23.107.
372          *                      This octet encodes each priority level defined in 3GPP TS 23.107
373          *                      as the binary value of the priority level. It specifies the relative
374          *                      importance of the actual MBMS bearer service compared to other MBMS
375          *                      and non-MBMS bearer services for allocation and retention of the
376          *                      MBMS bearer service.
377          * 2-N          QoS Profile as specified by the Quality-of-Service information element,
378          *                      from octet 3 onwards, in 3GPP TS 24.008
379          */
380         proto_tree_add_item(tree, hf_diameter_3gpp_mbms_required_qos_prio, tvb, offset, 1, ENC_BIG_ENDIAN);
381         offset++;
382         length = tvb_length(tvb) - 1;
383         de_sm_qos(tvb, tree,  pinfo, offset,length, NULL, 0);
384         return offset+length;
385
386 }
387
388 /* AVP Code: 926 MBMS-BMSC-SSM-UDP-Port */
389 /* AVP Code: 927 MBMS-GW-UDP-Port */
390 static int
391 dissect_diameter_3gpp_udp_port(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
392 {
393         int offset = 0;
394
395         proto_tree_add_item(tree, hf_diameter_3gpp_udp_port, tvb, offset, 1, ENC_BIG_ENDIAN);
396
397         offset += 1;
398
399         return offset;
400 }
401
402 /* AVP Code: 929 MBMS-Data-Transfer-Start */
403 /* AVP Code: 930 MBMS-Data-Transfer-Stop */
404 static int
405 dissect_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
406 {
407         int offset = 0;
408         const gchar *time_str;
409
410         time_str = tvb_ntp_fmt_ts(tvb, offset);
411         proto_tree_add_string(tree, hf_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer, tvb, offset, 8, time_str);
412         offset+=8;
413
414         return offset;
415 }
416
417 /* AVP Code: 1405 ULR-Flags */
418 static int
419 dissect_diameter_3gpp_ulr_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
420
421         proto_item* item;
422         proto_tree *sub_tree;
423         int offset = 0;
424         guint32 bit_offset;
425
426         item = proto_tree_add_item(tree, hf_diameter_3gpp_ulr_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
427         sub_tree = proto_item_add_subtree(item, diameter_3gpp_ulr_flags_ett);
428         bit_offset = 0;
429         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 25, ENC_BIG_ENDIAN);
430         bit_offset+=25;
431         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit6, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
432         bit_offset++;
433         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit5, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
434         bit_offset++;
435         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit4, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
436         bit_offset++;
437         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit3, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
438         bit_offset++;
439         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
440         bit_offset++;
441         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
442         bit_offset++;
443         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ulr_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
444         bit_offset++;
445
446         offset = bit_offset>>3;
447         return offset;
448
449 }
450
451 /* AVP Code: 1406 ULA-Flags */
452 static int
453 dissect_diameter_3gpp_ula_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
454
455         proto_item* item;
456         proto_tree *sub_tree;
457         int offset = 0;
458         guint32 bit_offset;
459
460         item = proto_tree_add_item(tree, hf_diameter_3gpp_ula_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
461         sub_tree = proto_item_add_subtree(item, diameter_3gpp_ula_flags_ett);
462         bit_offset = 0;
463         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 31, ENC_BIG_ENDIAN);
464         bit_offset+=31;
465         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ula_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
466         bit_offset++;
467
468         offset = bit_offset>>3;
469         return offset;
470
471 }
472
473 /* AVP Code: 1421 DSR-Flags */
474 static int
475 dissect_diameter_3gpp_dsr_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
476
477         proto_item* item;
478         proto_tree *sub_tree;
479         int offset = 0;
480         guint32 bit_offset;
481
482         item = proto_tree_add_item(tree, hf_diameter_3gpp_dsr_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
483         sub_tree = proto_item_add_subtree(item, diameter_3gpp_dsr_flags_ett);
484         bit_offset = 0;
485         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 16, ENC_BIG_ENDIAN);
486         bit_offset+=16;
487         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit14, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
488         bit_offset++;
489         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit14, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
490         bit_offset++;
491         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit13, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
492         bit_offset++;
493         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit12, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
494         bit_offset++;
495         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit11, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
496         bit_offset++;
497         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit10, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
498         bit_offset++;
499         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit9, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
500         bit_offset++;
501         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit8, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
502         bit_offset++;
503         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit7, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
504         bit_offset++;
505         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit6, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
506         bit_offset++;
507         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit5, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
508         bit_offset++;
509         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit4, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
510         bit_offset++;
511         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit3, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
512         bit_offset++;
513         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
514         bit_offset++;
515         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
516         bit_offset++;
517         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsr_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
518         bit_offset++;
519
520         offset = bit_offset>>3;
521         return offset;
522
523 }
524
525 /* AVP Code: 1422 DSA-Flags */
526 static int
527 dissect_diameter_3gpp_dsa_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
528
529         proto_item* item;
530         proto_tree *sub_tree;
531         int offset = 0;
532         guint32 bit_offset;
533
534         item = proto_tree_add_item(tree, hf_diameter_3gpp_dsa_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
535         sub_tree = proto_item_add_subtree(item, diameter_3gpp_dsa_flags_ett);
536         bit_offset = 0;
537         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 31, ENC_BIG_ENDIAN);
538         bit_offset+=31;
539         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_dsa_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
540         bit_offset++;
541
542         offset = bit_offset>>3;
543         return offset;
544
545 }
546
547 /* AVP Code: 1441 IDA-Flags */
548 static int
549 dissect_diameter_3gpp_ida_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
550
551         proto_item* item;
552         proto_tree *sub_tree;
553         int offset = 0;
554         guint32 bit_offset;
555
556         item = proto_tree_add_item(tree, hf_diameter_3gpp_ida_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
557         sub_tree = proto_item_add_subtree(item, diameter_3gpp_ida_flags_ett);
558         bit_offset = 0;
559         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 31, ENC_BIG_ENDIAN);
560         bit_offset+=31;
561         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_ida_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
562         bit_offset++;
563
564         offset = bit_offset>>3;
565         return offset;
566
567 }
568
569 /* AVP Code: 1442 PUA-Flags */
570 static int
571 dissect_diameter_3gpp_pua_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
572
573         proto_item* item;
574         proto_tree *sub_tree;
575         int offset = 0;
576         guint32 bit_offset;
577
578         item = proto_tree_add_item(tree, hf_diameter_3gpp_pua_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
579         sub_tree = proto_item_add_subtree(item, diameter_3gpp_pua_flags_ett);
580         bit_offset = 0;
581         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 30, ENC_BIG_ENDIAN);
582         bit_offset+=30;
583         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_pua_flags_bit1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
584         bit_offset++;
585         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_pua_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
586         bit_offset++;
587
588         offset = bit_offset>>3;
589         return offset;
590
591
592 }
593
594 /* AVP Code: 1443 NOR-Flags */
595 static int
596 dissect_diameter_3gpp_nor_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
597
598         proto_item* item;
599         proto_tree *sub_tree;
600         int offset = 0;
601         guint32 bit_offset;
602
603         item = proto_tree_add_item(tree, hf_diameter_3gpp_nor_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
604         sub_tree = proto_item_add_subtree(item, diameter_3gpp_nor_flags_ett);
605         bit_offset = 0;
606         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 25, ENC_BIG_ENDIAN);
607         bit_offset+=25;
608         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit6, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
609         bit_offset++;
610         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit5, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
611         bit_offset++;
612         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit4, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
613         bit_offset++;
614         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit3, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
615         bit_offset++;
616         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
617         bit_offset++;
618         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
619         bit_offset++;
620         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_nor_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
621         bit_offset++;
622
623         offset = bit_offset>>3;
624         return offset;
625
626 }
627
628 /* AVP Code: 1490 IDR-Flags */
629 static int
630 dissect_diameter_3gpp_idr_flags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
631
632         proto_item* item;
633         proto_tree *sub_tree;
634         int offset = 0;
635         guint32 bit_offset;
636
637         item = proto_tree_add_item(tree, hf_diameter_3gpp_idr_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
638         sub_tree = proto_item_add_subtree(item, diameter_3gpp_idr_flags_ett);
639         bit_offset = 0;
640         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_spare_bits, tvb, bit_offset, 27, ENC_BIG_ENDIAN);
641         bit_offset+=27;
642         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_idr_flags_bit4, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
643         bit_offset++;
644         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_idr_flags_bit3, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
645         bit_offset++;
646         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_idr_flags_bit2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
647         bit_offset++;
648         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_idr_flags_bit1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
649         bit_offset++;
650         proto_tree_add_bits_item(sub_tree, hf_diameter_3gpp_idr_flags_bit0, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
651         bit_offset++;
652
653         offset = bit_offset>>3;
654         return offset;
655
656 }
657
658 void
659 proto_reg_handoff_diameter_3gpp(void)
660 {
661
662         /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
663         /* Registered by packet-gtp.c */
664
665         /* AVP Code: 15 3GPP-SGSN-IPv6-Address */
666         dissector_add_uint("diameter.3gpp", 15, new_create_dissector_handle(dissect_diameter_3gpp_ipv6addr, proto_diameter_3gpp));
667
668         /* AVP Code: 22 3GPP-User-Location-Info
669          * Registered by packet-gtpv2.c
670          */
671
672         /* AVP Code: 600 Visited-Network-Identifier */
673         dissector_add_uint("diameter.3gpp", 600, new_create_dissector_handle(dissect_diameter_3gpp_visited_nw_id, proto_diameter_3gpp));
674
675         /* AVP Code: 606 User-Data */
676         dissector_add_uint("diameter.3gpp", 606, new_create_dissector_handle(dissect_diameter_3gpp_user_data, proto_diameter_3gpp));
677
678         /* AVP Code: 630 Feature-List */
679         dissector_add_uint("diameter.3gpp", 630, new_create_dissector_handle(dissect_diameter_3gpp_feature_list, proto_diameter_3gpp));
680
681         /* AVP Code: 640 Path */
682         dissector_add_uint("diameter.3gpp", 640, new_create_dissector_handle(dissect_diameter_3gpp_path, proto_diameter_3gpp));
683
684         /* AVP Code: 641 Contact */
685         dissector_add_uint("diameter.3gpp", 641, new_create_dissector_handle(dissect_diameter_3gpp_contact, proto_diameter_3gpp));
686
687         /* AVP Code: 701 MSISDN */
688         dissector_add_uint("diameter.3gpp", 701, new_create_dissector_handle(dissect_diameter_3gpp_msisdn, proto_diameter_3gpp));
689
690         /* AVP Code: 702 User-Data */
691         dissector_add_uint("diameter.3gpp", 702, new_create_dissector_handle(dissect_diameter_3gpp_user_data, proto_diameter_3gpp));
692
693         /* AVP Code: 704 Service-Indication  */
694         dissector_add_uint("diameter.3gpp", 704, new_create_dissector_handle(dissect_diameter_3gpp_service_ind, proto_diameter_3gpp));
695
696         /* AVP Code: 900 TMGI */
697         dissector_add_uint("diameter.3gpp", 900, new_create_dissector_handle(dissect_diameter_3gpp_tmgi, proto_diameter_3gpp));
698
699         /* AVP Code: 904 MBMS-Session-Duration  Registered by packet-gtp.c */
700         /* AVP Code: 903 MBMS-Service-Area Registered by packet-gtp.c */
701
702         /* AVP Code: 911 MBMS-Time-To-Data-Transfer  Registered by packet-gtp.c */
703         /* Registered by packet-gtp.c */
704
705         /* AVP Code: 913 MBMS-Required-QoS */
706         dissector_add_uint("diameter.3gpp", 913, new_create_dissector_handle(dissect_diameter_3gpp_mbms_required_qos, proto_diameter_3gpp));
707
708         /* AVP Code: 917 MBMS-GGSN-IPv6-Address */
709         dissector_add_uint("diameter.3gpp", 917, new_create_dissector_handle(dissect_diameter_3gpp_ipv6addr, proto_diameter_3gpp));
710
711         /* AVP Code: 918 MBMS-BMSC-SSM-IP-Address */
712         dissector_add_uint("diameter.3gpp", 918, new_create_dissector_handle(dissect_diameter_3gpp_ipaddr, proto_diameter_3gpp));
713
714         /* AVP Code: 926 MBMS-BMSC-SSM-UDP-Port */
715         /* AVP Code: 927 MBMS-GW-UDP-Port */
716         dissector_add_uint("diameter.3gpp", 926, new_create_dissector_handle(dissect_diameter_3gpp_udp_port, proto_diameter_3gpp));
717         dissector_add_uint("diameter.3gpp", 927, new_create_dissector_handle(dissect_diameter_3gpp_udp_port, proto_diameter_3gpp));
718
719         /* AVP Code: 929 MBMS-Data-Transfer-Start */
720         dissector_add_uint("diameter.3gpp", 929, new_create_dissector_handle(dissect_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer, proto_diameter_3gpp));
721
722         /* AVP Code: 930 MBMS-Data-Transfer-Stop */
723         dissector_add_uint("diameter.3gpp", 930, new_create_dissector_handle(dissect_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer, proto_diameter_3gpp));
724
725         /* AVP Code: 1405 ULR-Flags */
726         dissector_add_uint("diameter.3gpp", 1405, new_create_dissector_handle(dissect_diameter_3gpp_ulr_flags, proto_diameter_3gpp));
727
728         /* AVP Code: 1406 ULA-Flags */
729         dissector_add_uint("diameter.3gpp", 1406, new_create_dissector_handle(dissect_diameter_3gpp_ula_flags, proto_diameter_3gpp));
730
731         /* AVP Code: 1421 DSR-Flags */
732         dissector_add_uint("diameter.3gpp", 1421, new_create_dissector_handle(dissect_diameter_3gpp_dsr_flags, proto_diameter_3gpp));
733
734         /* AVP Code: 1422 DSA-Flags */
735         dissector_add_uint("diameter.3gpp", 1422, new_create_dissector_handle(dissect_diameter_3gpp_dsa_flags, proto_diameter_3gpp));
736
737         /* AVP Code: 1441 IDA-Flags */
738         dissector_add_uint("diameter.3gpp", 1441, new_create_dissector_handle(dissect_diameter_3gpp_ida_flags, proto_diameter_3gpp));
739
740         /* AVP Code: 1442 PUA-Flags */
741         dissector_add_uint("diameter.3gpp", 1442, new_create_dissector_handle(dissect_diameter_3gpp_pua_flags, proto_diameter_3gpp));
742
743         /* AVP Code: 1443 NOR-Flags */
744         dissector_add_uint("diameter.3gpp", 1443, new_create_dissector_handle(dissect_diameter_3gpp_nor_flags, proto_diameter_3gpp));
745
746         /* AVP Code: 1490 IDR-Flags */
747         dissector_add_uint("diameter.3gpp", 1490, new_create_dissector_handle(dissect_diameter_3gpp_idr_flags, proto_diameter_3gpp));
748
749         xml_handle = find_dissector("xml");
750 }
751
752 void
753 proto_register_diameter_3gpp(void)
754 {
755
756 /* Setup list of header fields  See Section 1.6.1 for details*/
757         static hf_register_info hf[] = {
758                 { &hf_diameter_3gpp_path,
759                         { "Path",           "diameter.3gpp.path",
760                         FT_STRING, BASE_NONE, NULL, 0x0,
761                         NULL, HFILL }
762                 },
763                 { &hf_diameter_3gpp_contact,
764                         { "Contact",           "diameter.3gpp.contact",
765                         FT_STRING, BASE_NONE, NULL, 0x0,
766                         NULL, HFILL }
767                 },
768                 { &hf_diameter_3gpp_visited_nw_id,
769                         { "Visited-Network-Identifier",           "diameter.3gpp.visited_nw_id",
770                         FT_STRING, BASE_NONE, NULL, 0x0,
771                         NULL, HFILL }
772                 },
773                 { &hf_diameter_3gpp_msisdn,
774                         { "MSISDN",           "diameter.3gpp.msisdn",
775                         FT_BYTES, BASE_NONE, NULL, 0x0,
776                         NULL, HFILL }
777                 },
778                 { &hf_diameter_3gpp_user_data,
779                         { "User data",           "diameter.3gpp.user_data",
780                         FT_STRING, BASE_NONE, NULL, 0x0,
781                         NULL, HFILL }
782                 },
783                 { &hf_diameter_3gpp_ipaddr,
784                         { "IPv4 Address",           "diameter.3gpp.ipaddr",
785                         FT_IPv4, BASE_NONE, NULL, 0x0,
786                         NULL, HFILL }
787                 },
788                 { &hf_diameter_3gpp_mbms_required_qos_prio,
789                         { "Allocation/Retention Priority",           "diameter.3gpp.mbms_required_qos_prio",
790                         FT_UINT8, BASE_DEC, NULL, 0x0,
791                         NULL, HFILL }
792                 },
793                 { &hf_diameter_3gpp_tmgi,
794                         { "TMGI",           "diameter.3gpp.tmgi",
795                         FT_BYTES, BASE_NONE, NULL, 0x0,
796                         NULL, HFILL }
797                 },
798                 { &hf_diameter_3gpp_service_ind,
799                         { "Service-Indication",           "diameter.3gpp.service_ind",
800                         FT_STRING, BASE_NONE, NULL, 0x0,
801                         NULL, HFILL }
802                 },
803                 { &hf_diameter_mbms_service_id,
804                         { "MBMS Service ID",           "diameter.3gpp.mbms_service_id",
805                         FT_UINT24, BASE_HEX, NULL, 0x0,
806                         NULL, HFILL }
807                 },
808                 { &hf_diameter_address_digits,
809                         { "Address digits", "diameter.3gpp.address_digits",
810                         FT_STRING, BASE_NONE, NULL, 0x0,
811                         NULL, HFILL }
812                 },
813                 { &hf_diameter_3gpp_spare_bits,
814                         { "Spare bit(s)", "diameter.3gpp.spare_bits",
815                         FT_UINT32, BASE_HEX, NULL, 0x0,
816                         NULL, HFILL }
817                 },
818                 { &hf_diameter_3gpp_feature_list_flags,
819                         { "Feature-List Flags", "diameter.3gpp.feature_list_flags",
820                         FT_UINT32, BASE_HEX, NULL, 0x0,
821                         NULL, HFILL }
822                 },
823                 { &hf_diameter_3gpp_feature_list_flags_bit0,
824                         { "Shared IFC Sets", "diameter.3gpp.feature_list_flags_bit0",
825                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
826                         NULL, HFILL }
827                 },
828                 { &hf_diameter_3gpp_feature_list_flags_bit1,
829                         { "Alias Indication", "diameter.3gpp.feature_list_flags_bit1",
830                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
831                         NULL, HFILL }
832                 },
833                 { &hf_diameter_3gpp_feature_list_flags_bit2,
834                         { "IMS Restoration Indication", "diameter.3gpp.feature_list_flags_bit2",
835                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
836                         NULL, HFILL }
837                 },
838                 { &hf_diameter_3gpp_ulr_flags,
839                         { "ULR Flags", "diameter.3gpp.ulr_flags",
840                         FT_UINT32, BASE_HEX, NULL, 0x0,
841                         NULL, HFILL }
842                 },
843                 { &hf_diameter_3gpp_ulr_flags_bit0,
844                         { "Single-Registration-Indication", "diameter.3gpp.ulr_flags_bit0",
845                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
846                         NULL, HFILL }
847                 },
848                 { &hf_diameter_3gpp_ulr_flags_bit1,
849                         { "S6a/S6d-Indicator", "diameter.3gpp.ulr_flags_bit1",
850                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
851                         NULL, HFILL }
852                 },
853                 { &hf_diameter_3gpp_ulr_flags_bit2,
854                         { "Skip-Subscriber-Data", "diameter.3gpp.ulr_flags_bit2",
855                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
856                         NULL, HFILL }
857                 },
858                 { &hf_diameter_3gpp_ulr_flags_bit3,
859                         { "GPRS-Subscription-Data-Indicator", "diameter.3gpp.ulr_flags_bit3",
860                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
861                         NULL, HFILL }
862                 },
863                 { &hf_diameter_3gpp_ulr_flags_bit4,
864                         { "Node-Type-Indicator", "diameter.3gpp.ulr_flags_bit4",
865                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
866                         NULL, HFILL }
867                 },
868                 { &hf_diameter_3gpp_ulr_flags_bit5,
869                         { "Initial-Attach-Indicator", "diameter.3gpp.ulr_flags_bit5",
870                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
871                         NULL, HFILL }
872                 },
873                 { &hf_diameter_3gpp_ulr_flags_bit6,
874                         { "PS-LCS-Not-Supported-By-UE", "diameter.3gpp.ulr_flags_bit6",
875                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
876                         NULL, HFILL }
877                 },
878                 { &hf_diameter_3gpp_ula_flags,
879                         { "ULA Flags", "diameter.3gpp.ula_flags",
880                         FT_UINT32, BASE_HEX, NULL, 0x0,
881                         NULL, HFILL }
882                 },
883                 { &hf_diameter_3gpp_ula_flags_bit0,
884                         { "Separation Indication", "diameter.3gpp.ula_flags_bit0",
885                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
886                         NULL, HFILL }
887                 },
888                 { &hf_diameter_3gpp_dsr_flags,
889                         { "DSR Flags", "diameter.3gpp.dsr_flags",
890                         FT_UINT32, BASE_HEX, NULL, 0x0,
891                         NULL, HFILL }
892                 },
893                 { &hf_diameter_3gpp_dsr_flags_bit0,
894                         { "Regional Subscription Withdrawal", "diameter.3gpp.dsr_flags_bit0",
895                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
896                         NULL, HFILL }
897                 },
898                 { &hf_diameter_3gpp_dsr_flags_bit1,
899                         { "Complete APN Configuration Profile Withdrawal", "diameter.3gpp.dsr_flags_bit1",
900                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
901                         NULL, HFILL }
902                 },
903                 { &hf_diameter_3gpp_dsr_flags_bit2,
904                         { "Subscribed Charging Characteristics Withdrawal", "diameter.3gpp.dsr_flags_bit2",
905                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
906                         NULL, HFILL }
907                 },
908                 { &hf_diameter_3gpp_dsr_flags_bit3,
909                         { "PDN subscription contexts Withdrawal", "diameter.3gpp.dsr_flags_bit3",
910                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
911                         NULL, HFILL }
912                 },
913                 { &hf_diameter_3gpp_dsr_flags_bit4,
914                         { "STN-SR", "diameter.3gpp.dsr_flags_bit4",
915                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
916                         NULL, HFILL }
917                 },
918                 { &hf_diameter_3gpp_dsr_flags_bit5,
919                         { "Complete PDP context list Withdrawal", "diameter.3gpp.dsr_flags_bit5",
920                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
921                         NULL, HFILL }
922                 },
923                 { &hf_diameter_3gpp_dsr_flags_bit6,
924                         { "PDP contexts Withdrawal", "diameter.3gpp.dsr_flags_bit6",
925                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
926                         NULL, HFILL }
927                 },
928                 { &hf_diameter_3gpp_dsr_flags_bit7,
929                         { "Roaming Restricted due to unsupported feature", "diameter.3gpp.dsr_flags_bit7",
930                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
931                         NULL, HFILL }
932                 },
933                 { &hf_diameter_3gpp_dsr_flags_bit8,
934                         { "Trace Data Withdrawal", "diameter.3gpp.dsr_flags_bit8",
935                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
936                         NULL, HFILL }
937                 },
938                 { &hf_diameter_3gpp_dsr_flags_bit9,
939                         { "CSG Deleted", "diameter.3gpp.dsr_flags_bit9",
940                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
941                         NULL, HFILL }
942                 },
943                 { &hf_diameter_3gpp_dsr_flags_bit10,
944                         { "APN-OI-Replacement", "diameter.3gpp.dsr_flags_bit10",
945                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
946                         NULL, HFILL }
947                 },
948                 { &hf_diameter_3gpp_dsr_flags_bit11,
949                         { "GMLC List Withdrawal", "diameter.3gpp.dsr_flags_bit11",
950                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
951                         NULL, HFILL }
952                 },
953                 { &hf_diameter_3gpp_dsr_flags_bit12,
954                         { "LCS Withdrawal", "diameter.3gpp.dsr_flags_bit12",
955                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
956                         NULL, HFILL }
957                 },
958                 { &hf_diameter_3gpp_dsr_flags_bit13,
959                         { "SMS Withdrawal", "diameter.3gpp.dsr_flags_bit13",
960                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
961                         NULL, HFILL }
962                 },
963                 { &hf_diameter_3gpp_dsr_flags_bit14,
964                         { "Subscribed VSRVCC Withdrawal", "diameter.3gpp.dsr_flags_bit14",
965                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
966                         NULL, HFILL }
967                 },
968                 { &hf_diameter_3gpp_dsr_flags_bit15,
969                         { "Subscribed periodic RAU-TAU Timer Withdrawal", "diameter.3gpp.dsr_flags_bit15",
970                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
971                         NULL, HFILL }
972                 },
973                 { &hf_diameter_3gpp_dsa_flags,
974                         { "DSA Flags", "diameter.3gpp.dsa_flags",
975                         FT_UINT32, BASE_HEX, NULL, 0x0,
976                         NULL, HFILL }
977                 },
978                 { &hf_diameter_3gpp_dsa_flags_bit0,
979                         { "Network Node area restricted", "diameter.3gpp.dsa_flags_bit0",
980                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
981                         NULL, HFILL }
982                 },
983                 { &hf_diameter_3gpp_ida_flags,
984                         { "IDA Flags", "diameter.3gpp.ida_flags",
985                         FT_UINT32, BASE_HEX, NULL, 0x0,
986                         NULL, HFILL }
987                 },
988                 { &hf_diameter_3gpp_ida_flags_bit0,
989                         { "Network Node area restricted", "diameter.3gpp.ida_flags_bit0",
990                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
991                         NULL, HFILL }
992                 },
993                 { &hf_diameter_3gpp_pua_flags,
994                         { "PUA Flags", "diameter.3gpp.pua_flags",
995                         FT_UINT32, BASE_HEX, NULL, 0x0,
996                         NULL, HFILL }
997                 },
998                 { &hf_diameter_3gpp_pua_flags_bit0,
999                         { "Freeze M-TMSI", "diameter.3gpp.pua_flags_bit0",
1000                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1001                         NULL, HFILL }
1002                 },
1003                 { &hf_diameter_3gpp_pua_flags_bit1,
1004                         { "Freeze P-TMSI", "diameter.3gpp.pua_flags_bit1",
1005                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1006                         NULL, HFILL }
1007                 },
1008                 { &hf_diameter_3gpp_nor_flags,
1009                         { "NOR Flags", "diameter.3gpp.nor_flags",
1010                         FT_UINT32, BASE_HEX, NULL, 0x0,
1011                         NULL, HFILL }
1012                 },
1013                 { &hf_diameter_3gpp_nor_flags_bit0,
1014                         { "Single-Registration-Indication", "diameter.3gpp.nor_flags_bit0",
1015                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1016                         NULL, HFILL }
1017                 },
1018                 { &hf_diameter_3gpp_nor_flags_bit1,
1019                         { "SGSN area restricted", "diameter.3gpp.nor_flags_bit1",
1020                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1021                         NULL, HFILL }
1022                 },
1023                 { &hf_diameter_3gpp_nor_flags_bit2,
1024                         { "Ready for SM", "diameter.3gpp.nor_flags_bit2",
1025                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1026                         NULL, HFILL }
1027                 },
1028                 { &hf_diameter_3gpp_nor_flags_bit3,
1029                         { "UE Reachable", "diameter.3gpp.nor_flags_bit3",
1030                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1031                         NULL, HFILL }
1032                 },
1033                 { &hf_diameter_3gpp_nor_flags_bit4,
1034                         { "Delete all APN and PDN GW identity pairs", "diameter.3gpp.nor_flags_bit4",
1035                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1036                         NULL, HFILL }
1037                 },
1038                 { &hf_diameter_3gpp_nor_flags_bit5,
1039                         { "UE Reachable from SGSN", "diameter.3gpp.nor_flags_bit5",
1040                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1041                         NULL, HFILL }
1042                 },
1043                 { &hf_diameter_3gpp_nor_flags_bit6,
1044                         { "Ready for SM from MME", "diameter.3gpp.nor_flags_bit6",
1045                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1046                         NULL, HFILL }
1047                 },
1048                 { &hf_diameter_3gpp_idr_flags,
1049                         { "IDR Flags", "diameter.3gpp.idr_flags",
1050                         FT_UINT32, BASE_HEX, NULL, 0x0,
1051                         NULL, HFILL }
1052                 },
1053                 { &hf_diameter_3gpp_idr_flags_bit0,
1054                         { "UE Reachability Request", "diameter.3gpp.idr_flags_bit0",
1055                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1056                         NULL, HFILL }
1057                 },
1058                 { &hf_diameter_3gpp_idr_flags_bit1,
1059                         { "T-ADS Data Request", "diameter.3gpp.idr_flags_bit1",
1060                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1061                         NULL, HFILL }
1062                 },
1063                 { &hf_diameter_3gpp_idr_flags_bit2,
1064                         { "EPS User State Request", "diameter.3gpp.idr_flags_bit2",
1065                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1066                         NULL, HFILL }
1067                 },
1068                 { &hf_diameter_3gpp_idr_flags_bit3,
1069                         { "EPS Location Information Request", "diameter.3gpp.idr_flags_bit3",
1070                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1071                         NULL, HFILL }
1072                 },
1073                 { &hf_diameter_3gpp_idr_flags_bit4,
1074                         { "Current Location Request", "diameter.3gpp.idr_flags_bit4",
1075                         FT_BOOLEAN, BASE_NONE, TFS(&tfs_set_notset), 0x0,
1076                         NULL, HFILL }
1077                 },
1078                 { &hf_diameter_3gpp_ipv6addr,
1079                         { "IPv6 Address", "diameter.3gpp.ipv6addr",
1080                         FT_IPv6, BASE_NONE, NULL, 0x0,
1081                         NULL, HFILL }
1082                 },
1083                 { &hf_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer,
1084                         { "Absolute Time of MBMS Data Transfer", "diameter.3gpp.mbms_abs_time_ofmbms_data_tfer",
1085                         FT_STRING, BASE_NONE, NULL, 0x0,
1086                         NULL, HFILL }
1087                 },
1088                 { &hf_diameter_3gpp_udp_port ,
1089                         { "UDP Port", "diameter.3gpp.udp_port",
1090                         FT_UINT8, BASE_DEC, NULL, 0x0,
1091                         NULL, HFILL }
1092                 },
1093         };
1094
1095         /* Setup protocol subtree array */
1096         static gint *ett[] = {
1097                 &diameter_3gpp_path_ett,
1098                 &diameter_3gpp_msisdn_ett,
1099                 &diameter_3gpp_feature_list_ett,
1100                 &diameter_3gpp_tmgi_ett,
1101                 &diameter_3gpp_ulr_flags_ett,
1102                 &diameter_3gpp_ula_flags_ett,
1103                 &diameter_3gpp_dsr_flags_ett,
1104                 &diameter_3gpp_dsa_flags_ett,
1105                 &diameter_3gpp_ida_flags_ett,
1106                 &diameter_3gpp_pua_flags_ett,
1107                 &diameter_3gpp_nor_flags_ett,
1108                 &diameter_3gpp_idr_flags_ett,
1109         };
1110
1111         /* Required function calls to register the header fields and subtrees used */
1112         proto_diameter_3gpp = proto_register_protocol("Diameter 3GPP","Diameter3GPP", "diameter.3gpp");
1113         proto_register_field_array(proto_diameter_3gpp, hf, array_length(hf));
1114         proto_register_subtree_array(ett, array_length(ett));
1115 }