For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
[obnox/wireshark/wip.git] / asn1 / camel / packet-camel-template.c
1 /* packet-camel-template.c
2  * Routines for Camel
3  * Copyright 2004, Tim Endean <endeant@hotmail.com>
4  * Copyright 2005, Olivier Jacques <olivier.jacques@hp.com>
5  * Copyright 2005, Javier Acuna <javier.acuna@sixbell.com>
6  * Updated to ETSI TS 129 078 V6.4.0 (2004-3GPP TS 29.078 version 6.4.0 Release 6 1 12)
7  * Copyright 2005-2010, Anders Broman <anders.broman@ericsson.com>
8  * Updated to 3GPP TS 29.078 version 7.3.0 Release 7 (2006-06)
9  * Built from the gsm-map dissector Copyright 2004, Anders Broman <anders.broman@ericsson.com>
10  *
11  * $Id$
12  *
13  * Wireshark - Network traffic analyzer
14  * By Gerald Combs <gerald@wireshark.org>
15  * Copyright 1998 Gerald Combs
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version 2
20  * of the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
30  * References: ETSI 300 374
31  */
32 /*
33  * Indentation logic: this file is indented with 2 spaces indentation.
34  *                    there are no tabs.
35  */
36 #ifdef HAVE_CONFIG_H
37 # include "config.h"
38 #endif
39
40 #include <glib.h>
41 #include <epan/packet.h>
42 #include <epan/prefs.h>
43 #include <epan/oids.h>
44 #include <epan/tap.h>
45 #include <epan/asn1.h>
46 #include <epan/expert.h>
47
48 #include <string.h>
49
50 #include "packet-ber.h"
51 #include "packet-camel.h"
52 #include "packet-q931.h"
53 #include "packet-e164.h"
54 #include "packet-isup.h"
55 #include "packet-gsm_map.h"
56 #include "packet-gsm_a_common.h"
57 #include "packet-inap.h"
58 #include "packet-tcap.h"
59 #include <epan/camel-persistentdata.h>
60 #include <epan/tcap-persistentdata.h>
61
62 #define PNAME  "Camel"
63 #define PSNAME "CAMEL"
64 #define PFNAME "camel"
65
66 /* Initialize the protocol and registered fields */
67 static int proto_camel = -1;
68 int date_format = 1; /*assume european date format */
69 int camel_tap = -1;
70 /* Global variables */
71 static guint32 opcode=0;
72 static guint32 errorCode=0;
73
74 /* ROSE context */
75 static rose_ctx_t camel_rose_ctx;
76
77 static int hf_digit = -1;
78 static int hf_camel_extension_code_local = -1;
79 static int hf_camel_error_code_local = -1;
80 static int hf_camel_cause_indicator = -1;
81 static int hf_camel_PDPTypeNumber_etsi = -1;
82 static int hf_camel_PDPTypeNumber_ietf = -1;
83 static int hf_camel_PDPAddress_IPv4 = -1;
84 static int hf_camel_PDPAddress_IPv6 = -1;
85 static int hf_camel_cellGlobalIdOrServiceAreaIdFixedLength = -1;
86 static int hf_camel_RP_Cause = -1;
87 static int hf_camel_CAMEL_AChBillingChargingCharacteristics = -1;
88 static int hf_camel_CAMEL_FCIBillingChargingCharacteristics = -1;
89 static int hf_camel_CAMEL_FCIGPRSBillingChargingCharacteristics = -1;
90 static int hf_camel_CAMEL_FCISMSBillingChargingCharacteristics = -1;
91 static int hf_camel_CAMEL_SCIBillingChargingCharacteristics = -1;
92 static int hf_camel_CAMEL_SCIGPRSBillingChargingCharacteristics = -1;
93 static int hf_camel_CAMEL_CallResult = -1;
94
95 /* Used by camel-persistentdata.c */
96 int hf_camelsrt_SessionId=-1;
97 int hf_camelsrt_RequestNumber=-1;
98 int hf_camelsrt_Duplicate=-1;
99 int hf_camelsrt_RequestFrame=-1;
100 int hf_camelsrt_ResponseFrame=-1;
101 int hf_camelsrt_DeltaTime=-1;
102 int hf_camelsrt_SessionTime=-1;
103 int hf_camelsrt_DeltaTime31=-1;
104 int hf_camelsrt_DeltaTime75=-1;
105 int hf_camelsrt_DeltaTime65=-1;
106 int hf_camelsrt_DeltaTime22=-1;
107 int hf_camelsrt_DeltaTime35=-1;
108 int hf_camelsrt_DeltaTime80=-1;
109
110 #include "packet-camel-hf.c"
111
112 static struct camelsrt_info_t * gp_camelsrt_info;
113
114 /* Forward declarations */
115 static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx);
116 static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx);
117 static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset,asn1_ctx_t *actx);
118 static int dissect_camel_CAMEL_AChBillingChargingCharacteristics(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
119 static int dissect_camel_CAMEL_CallResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
120
121 gboolean gcamel_HandleSRT=FALSE;
122 extern gboolean gcamel_PersistentSRT;
123 extern gboolean gcamel_DisplaySRT;
124
125 /* Initialize the subtree pointers */
126 static gint ett_camel = -1;
127 static gint ett_camelisup_parameter = -1;
128 static gint ett_camel_AccessPointName = -1;
129 static gint ett_camel_pdptypenumber = -1;
130 static gint ett_camel_cause = -1;
131 static gint ett_camel_RPcause = -1;
132 static gint ett_camel_stat = -1;
133 static guint ett_camel_calledpartybcdnumber = -1;
134
135 #include "packet-camel-ett.c"
136
137
138 /* Preference settings default */
139 #define MAX_SSN 254
140 static range_t *global_ssn_range;
141 static dissector_handle_t  camel_handle;
142
143 /* Global variables */
144
145 static int application_context_version;
146 static guint8 PDPTypeOrganization;
147 static guint8 PDPTypeNumber;
148 const char *camel_obj_id = NULL;
149 gboolean is_ExtensionField =FALSE;
150
151 static int camel_opcode_type;
152 #define CAMEL_OPCODE_INVOKE        1
153 #define CAMEL_OPCODE_RETURN_RESULT 2
154 #define CAMEL_OPCODE_RETURN_ERROR  3
155 #define CAMEL_OPCODE_REJECT        4
156
157 static const value_string camel_Component_vals[] = {
158   {   1, "invoke" },
159   {   2, "returnResultLast" },
160   {   3, "returnError" },
161   {   4, "reject" },
162   { 0, NULL }
163 };
164
165 static const true_false_string camel_extension_value = {
166   "No Extension",
167   "Extension"
168 };
169 #define EUROPEAN_DATE 1
170 #define AMERICAN_DATE 2
171 #define CAMEL_DATE_AND_TIME_LEN 20 /* 2*5 + 4 + 5 + 1 (HH:MM:SS;mm/dd/yyyy) */
172
173 static enum_val_t date_options[] = {
174   { "european",         "DD/MM/YYYY",       EUROPEAN_DATE },
175   { "american",        "MM/DD/YYYY",        AMERICAN_DATE },
176   { NULL, NULL, 0 }
177 };
178
179 static const value_string digit_value[] = {
180     { 0,  "0"},
181     { 1,  "1"},
182     { 2,  "2"},
183     { 3,  "3"},
184     { 4,  "4"},
185     { 5,  "5"},
186     { 6,  "6"},
187     { 7,  "7"},
188     { 8,  "8"},
189     { 9,  "9"},
190     { 10, "spare"},
191     { 11, "spare"},
192     { 12, "spare"},
193     { 13, "spare"},
194     { 0,  NULL}};
195
196
197 static const value_string camel_nature_of_addr_indicator_values[] = {
198   {   0x00,  "unknown" },
199   {   0x01,  "International Number" },
200   {   0x02,  "National Significant Number" },
201   {   0x03,  "Network Specific Number" },
202   {   0x04,  "Subscriber Number" },
203   {   0x05,  "Reserved" },
204   {   0x06,  "Abbreviated Number" },
205   {   0x07,  "Reserved for extension" },
206   { 0, NULL }
207 };
208 static const value_string camel_number_plan_values[] = {
209   {   0x00,  "unknown" },
210   {   0x01,  "ISDN/Telephony Numbering (Rec ITU-T E.164)" },
211   {   0x02,  "spare" },
212   {   0x03,  "Data Numbering (ITU-T Rec. X.121)" },
213   {   0x04,  "Telex Numbering (ITU-T Rec. F.69)" },
214   {   0x05,  "spare" },
215   {   0x06,  "Land Mobile Numbering (ITU-T Rec. E.212)" },
216   {   0x07,  "spare" },
217   {   0x08,  "National Numbering" },
218   {   0x09,  "Private Numbering" },
219   {   0x0f,  "Reserved for extension" },
220   { 0, NULL }
221 };
222
223 /* End includes from old" packet-camel.c */
224
225 static const value_string camel_RP_Cause_values[] = {
226   { 1, "Unassigned (unallocated) number" },
227   { 8, "Operator determined barring" },
228   { 10, "Call barred" },
229   { 11, "Reserved" },
230   { 21, "Short message transfer rejected" },
231   { 27, "Destination out of order" },
232   { 28, "Unidentified subscriber" },
233   { 29, "Facility Rejected" },
234   { 30, "Unknown subscriber" },
235   { 38, "Network out of order" },
236   { 41, "Temporary failure" },
237   { 42, "Congestion" },
238   { 47, "Resources unavailable, unspecified" },
239   { 50, "Requested facility not subscribed" },
240   { 69, "Requested facility not implemented" },
241   { 81, "Invalid short message transfer reference value" },
242   { 95, "Semantically incorrect message" },
243   { 96, "Invalid mandatory information" },
244   { 97, " Message Type non-existent or not implemented" },
245   { 98, "Message not compatible with short message protocol state" },
246   { 99, "Information element non existent or not implemented" },
247   { 111, "Protocol error, unspecified" },
248   { 127, "Interworking, unspecified" },
249   { 22,"Memory capacity exceeded" },
250   { 0, NULL }
251 };
252
253 static const value_string camel_holdTreatmentIndicator_values[] = {
254   {   0x01,  "acceptHoldRequest" },
255   {   0x02,  "rejectHoldRequest" },
256   { 0, NULL }
257 };
258 static const value_string camel_cwTreatmentIndicator_values[] = {
259   {   0x01,  "acceptCw" },
260   {   0x02,  "rejectCw" },
261   { 0, NULL }
262 };
263 static const value_string camel_ectTreatmentIndicator_values[] = {
264   {   0x01,  "acceptEctRequest" },
265   {   0x02,  "rejectEctRequest" },
266   { 0, NULL }
267 };
268
269 #include "packet-camel-val.h"
270
271 #include "packet-camel-table.c"
272
273 static char camel_number_to_char(int number)
274 {
275    if (number < 10)
276    return (char) (number + 48 ); /* this is ASCII specific */
277    else
278    return (char) (number + 55 );
279 }
280
281 /*
282  * 24.011 8.2.5.4
283  */
284 static guint8
285 dissect_RP_cause_ie(tvbuff_t *tvb, guint32 offset, _U_ guint len,
286                     proto_tree *tree, int hf_cause_value, guint8 *cause_value)
287 {
288   guint8        oct;
289   guint32       curr_offset;
290   static char a_bigbuf[1024];
291
292   curr_offset = offset;
293   oct = tvb_get_guint8(tvb, curr_offset);
294
295   *cause_value = oct & 0x7f;
296
297   other_decode_bitfield_value(a_bigbuf, oct, 0x7f, 8);
298   proto_tree_add_uint_format(tree, hf_cause_value,
299                              tvb, curr_offset, 1, *cause_value,
300                              "%s : %s",
301                              a_bigbuf,
302                              val_to_str(*cause_value, camel_RP_Cause_values,
303                                         "Unknown Cause (%u), treated as (41) \"Temporary failure\" for MO-SMS or (111) \"Protocol error,unspecified\" for MT-SMS"));
304   curr_offset++;
305
306   if ((oct & 0x80)) {
307     oct = tvb_get_guint8(tvb, curr_offset);
308     proto_tree_add_uint_format(tree, hf_cause_value,
309                                tvb, curr_offset, 1, oct,
310                                "Diagnostic : %u", oct);
311     curr_offset++;
312   }
313   return(curr_offset - offset);
314 }
315
316 #include "packet-camel-fn.c"
317
318 #include "packet-camel-table2.c"
319
320
321 static guint8 camel_pdu_type = 0;
322 static guint8 camel_pdu_size = 0;
323
324
325 static int
326 dissect_camel_camelPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_,proto_tree *tree, int hf_index) {
327
328   char *version_ptr;
329   struct tcap_private_t * p_private_tcap;
330
331   opcode = 0;
332   application_context_version = 0;
333   if (actx->pinfo->private_data != NULL){
334     p_private_tcap=actx->pinfo->private_data;
335
336     if (p_private_tcap->acv==TRUE ){
337       version_ptr = strrchr(p_private_tcap->oid,'.');
338       if (version_ptr)
339         application_context_version = atoi(version_ptr+1);
340     }
341     gp_camelsrt_info->tcap_context=p_private_tcap->context;
342     if (p_private_tcap->context)
343       gp_camelsrt_info->tcap_session_id
344
345         = ( (struct tcaphash_context_t *) (p_private_tcap->context))->session_id;
346   }
347
348   camel_pdu_type = tvb_get_guint8(tvb, offset)&0x0f;
349   /* Get the length and add 2 */
350   camel_pdu_size = tvb_get_guint8(tvb, offset+1)+2;
351
352   /* Populate the info column with PDU type*/
353   col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(camel_pdu_type, camel_Component_vals, "Unknown Camel (%u)"));
354   col_append_str(actx->pinfo->cinfo, COL_INFO, " ");
355
356   is_ExtensionField =FALSE;
357   offset = dissect_camel_ROS(TRUE, tvb, offset, actx, tree, hf_index);
358
359   return offset;
360 }
361
362
363 static void
364 dissect_camel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
365 {
366   proto_item    *item=NULL;
367   proto_tree    *tree=NULL;
368   proto_item  *stat_item=NULL;
369   proto_tree  *stat_tree=NULL;
370   asn1_ctx_t asn1_ctx;
371   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
372
373   col_set_str(pinfo->cinfo, COL_PROTOCOL, "Camel");
374
375   /* create display subtree for the protocol */
376   if(parent_tree){
377      item = proto_tree_add_item(parent_tree, proto_camel, tvb, 0, -1, ENC_NA);
378      tree = proto_item_add_subtree(item, ett_camel);
379   }
380   /* camelsrt reset counter, and initialise global pointer
381      to store service response time related data */
382   gp_camelsrt_info=camelsrt_razinfo();
383   dissect_camel_camelPDU(FALSE, tvb, 0, &asn1_ctx , tree, -1);
384
385   /* If a Tcap context is associated to this transaction */
386   if (gcamel_HandleSRT &&
387       gp_camelsrt_info->tcap_context ) {
388     if (gcamel_DisplaySRT && tree) {
389       stat_item = proto_tree_add_text(tree, tvb, 0, 0, "Stat");
390       stat_tree = proto_item_add_subtree(stat_item, ett_camel_stat);
391     }
392     camelsrt_call_matching(tvb, pinfo, stat_tree, gp_camelsrt_info);
393     tap_queue_packet(camel_tap, pinfo, gp_camelsrt_info);
394   }
395 }
396
397 /*--- proto_reg_handoff_camel ---------------------------------------*/
398 static void range_delete_callback(guint32 ssn)
399 {
400   if (ssn) {
401     delete_itu_tcap_subdissector(ssn, camel_handle);
402   }
403 }
404
405 static void range_add_callback(guint32 ssn)
406 {
407   if (ssn) {
408     add_itu_tcap_subdissector(ssn, camel_handle);
409   }
410 }
411
412 void proto_reg_handoff_camel(void) {
413   static gboolean camel_prefs_initialized = FALSE;
414   static range_t *ssn_range;
415
416   if (!camel_prefs_initialized) {
417
418     camel_prefs_initialized = TRUE;
419     camel_handle = find_dissector("camel");
420
421
422     register_ber_oid_dissector_handle("0.4.0.0.1.0.50.0",camel_handle, proto_camel, "CAP-v1-gsmSSF-to-gsmSCF-AC" );
423     register_ber_oid_dissector_handle("0.4.0.0.1.0.50.1",camel_handle, proto_camel, "CAP-v2-gsmSSF-to-gsmSCF-AC" );
424     register_ber_oid_dissector_handle("0.4.0.0.1.0.51.1",camel_handle, proto_camel, "CAP-v2-assist-gsmSSF-to-gsmSCF-AC" );
425     register_ber_oid_dissector_handle("0.4.0.0.1.0.52.1",camel_handle, proto_camel, "CAP-v2-gsmSRF-to-gsmSCF-AC" );
426     register_ber_oid_dissector_handle("0.4.0.0.1.21.3.50",camel_handle, proto_camel, "cap3-gprssf-scfAC" );
427     register_ber_oid_dissector_handle("0.4.0.0.1.21.3.51",camel_handle, proto_camel, "cap3-gsmscf-gprsssfAC" );
428     register_ber_oid_dissector_handle("0.4.0.0.1.21.3.61",camel_handle, proto_camel, "cap3-sms-AC" );
429     register_ber_oid_dissector_handle("0.4.0.0.1.23.3.4",camel_handle, proto_camel, "capssf-scfGenericAC" );
430     register_ber_oid_dissector_handle("0.4.0.0.1.23.3.61",camel_handle, proto_camel, "cap4-sms-AC" );
431
432
433 #include "packet-camel-dis-tab.c"
434   } else {
435     range_foreach(ssn_range, range_delete_callback);
436     g_free(ssn_range);
437   }
438
439   ssn_range = range_copy(global_ssn_range);
440
441   range_foreach(ssn_range, range_add_callback);
442
443 }
444
445 void proto_register_camel(void) {
446   module_t *camel_module;
447   /* List of fields */
448   static hf_register_info hf[] = {
449     { &hf_camel_extension_code_local,
450       { "local", "camel.extension_code_local",
451         FT_INT32, BASE_DEC, NULL, 0,
452         "Extension local code", HFILL }},
453         { &hf_camel_error_code_local,
454       { "local", "camel.error_code_local",
455         FT_INT32, BASE_DEC, VALS(camel_err_code_string_vals), 0,
456         "ERROR code", HFILL }},
457     { &hf_camel_cause_indicator, /* Currently not enabled */
458       { "Cause indicator",  "camel.cause_indicator",
459         FT_UINT8, BASE_DEC|BASE_EXT_STRING, &q850_cause_code_vals_ext, 0x7f,
460         NULL, HFILL }},
461     { &hf_digit,
462       { "Digit Value",  "camel.digit_value",
463         FT_UINT8, BASE_DEC, VALS(digit_value), 0, NULL, HFILL }},
464     { &hf_camel_PDPTypeNumber_etsi,
465       { "ETSI defined PDP Type Value",  "camel.PDPTypeNumber_etsi",
466         FT_UINT8, BASE_HEX, VALS(gsm_map_etsi_defined_pdp_vals), 0,
467         NULL, HFILL }},
468     { &hf_camel_PDPTypeNumber_ietf,
469       { "IETF defined PDP Type Value",  "camel.PDPTypeNumber_ietf",
470         FT_UINT8, BASE_HEX, VALS(gsm_map_ietf_defined_pdp_vals), 0,
471         NULL, HFILL }},
472     { &hf_camel_PDPAddress_IPv4,
473       { "PDPAddress IPv4",  "camel.PDPAddress_IPv4",
474         FT_IPv4, BASE_NONE, NULL, 0,
475         "IPAddress IPv4", HFILL }},
476     { &hf_camel_PDPAddress_IPv6,
477       { "PDPAddress IPv6",  "camel.PDPAddress_IPv6",
478         FT_IPv6, BASE_NONE, NULL, 0,
479         "IPAddress IPv6", HFILL }},
480     { &hf_camel_cellGlobalIdOrServiceAreaIdFixedLength,
481       { "CellGlobalIdOrServiceAreaIdFixedLength", "camel.CellGlobalIdOrServiceAreaIdFixedLength",
482         FT_BYTES, BASE_NONE, NULL, 0,
483         "LocationInformationGPRS/CellGlobalIdOrServiceAreaIdOrLAI", HFILL }},
484     { &hf_camel_RP_Cause,
485       { "RP Cause",  "camel.RP_Cause",
486         FT_UINT8, BASE_DEC, NULL, 0,
487         "RP Cause Value", HFILL }},
488
489     { &hf_camel_CAMEL_AChBillingChargingCharacteristics,
490       { "CAMEL-AChBillingChargingCharacteristics", "camel.CAMEL_AChBillingChargingCharacteristics",
491         FT_UINT32, BASE_DEC,  VALS(camel_CAMEL_AChBillingChargingCharacteristics_vals), 0,
492         NULL, HFILL }},
493
494     { &hf_camel_CAMEL_FCIBillingChargingCharacteristics,
495       { "CAMEL-FCIBillingChargingCharacteristics", "camel.CAMEL_FCIBillingChargingCharacteristics",
496         FT_UINT32, BASE_DEC, VALS(camel_CAMEL_FCIBillingChargingCharacteristics_vals), 0,
497         NULL, HFILL }},
498
499     { &hf_camel_CAMEL_FCIGPRSBillingChargingCharacteristics,
500       { "CAMEL-FCIGPRSBillingChargingCharacteristics", "camel.CAMEL_FCIGPRSBillingChargingCharacteristics",
501         FT_UINT32, BASE_DEC, NULL, 0,
502         NULL, HFILL }},
503
504     { &hf_camel_CAMEL_FCISMSBillingChargingCharacteristics,
505       { "CAMEL-FCISMSBillingChargingCharacteristics", "camel.CAMEL_FCISMSBillingChargingCharacteristics",
506         FT_UINT32, BASE_DEC, VALS(camel_CAMEL_FCISMSBillingChargingCharacteristics_vals), 0,
507         NULL, HFILL }},
508
509     { &hf_camel_CAMEL_SCIBillingChargingCharacteristics,
510       { "CAMEL-SCIBillingChargingCharacteristics", "camel.CAMEL_SCIBillingChargingCharacteristics",
511         FT_UINT32, BASE_DEC, VALS(camel_CAMEL_SCIBillingChargingCharacteristics_vals), 0,
512         NULL, HFILL }},
513
514     { &hf_camel_CAMEL_SCIGPRSBillingChargingCharacteristics,
515       { "CAMEL-SCIGPRSBillingChargingCharacteristics", "camel.CAMEL_SCIGPRSBillingChargingCharacteristics",
516         FT_UINT32, BASE_DEC, NULL, 0,
517         "CAMEL-FSCIGPRSBillingChargingCharacteristics", HFILL }},
518
519     { &hf_camel_CAMEL_CallResult,
520       { "CAMEL-CAMEL_CallResult", "camel.CAMEL_CallResult",
521         FT_UINT32, BASE_DEC, VALS(camel_CAMEL_CallResult_vals), 0,
522         "CAMEL-CallResult", HFILL }},
523
524   /* Camel Service Response Time */
525     { &hf_camelsrt_SessionId,
526       { "Session Id",
527         "camel.srt.session_id",
528         FT_UINT32, BASE_DEC, NULL, 0x0,
529         NULL, HFILL }
530     },
531     { &hf_camelsrt_RequestNumber,
532       { "Request Number",
533         "camel.srt.request_number",
534         FT_UINT64, BASE_DEC, NULL, 0x0,
535         NULL, HFILL }
536     },
537     { &hf_camelsrt_Duplicate,
538       { "Request Duplicate",
539         "camel.srt.duplicate",
540         FT_UINT32, BASE_DEC, NULL, 0x0,
541         NULL, HFILL }
542     },
543     { &hf_camelsrt_RequestFrame,
544       { "Requested Frame",
545         "camel.srt.reqframe",
546         FT_FRAMENUM, BASE_NONE, NULL, 0x0,
547         "SRT Request Frame", HFILL }
548     },
549     { &hf_camelsrt_ResponseFrame,
550       { "Response Frame",
551         "camel.srt.rspframe",
552         FT_FRAMENUM, BASE_NONE, NULL, 0x0,
553         "SRT Response Frame", HFILL }
554     },
555     { &hf_camelsrt_DeltaTime,
556       { "Service Response Time",
557         "camel.srt.deltatime",
558         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
559         "DeltaTime between Request and Response", HFILL }
560     },
561     { &hf_camelsrt_SessionTime,
562       { "Session duration",
563         "camel.srt.sessiontime",
564         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
565         "Duration of the TCAP session", HFILL }
566     },
567     { &hf_camelsrt_DeltaTime31,
568       { "Service Response Time",
569         "camel.srt.deltatime31",
570         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
571         "DeltaTime between InitialDP and Continue", HFILL }
572     },
573     { &hf_camelsrt_DeltaTime65,
574       { "Service Response Time",
575         "camel.srt.deltatime65",
576         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
577         "DeltaTime between InitialDPSMS and ContinueSMS", HFILL }
578     },
579     { &hf_camelsrt_DeltaTime75,
580       { "Service Response Time",
581         "camel.srt.deltatime75",
582         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
583         "DeltaTime between InitialDPGPRS and ContinueGPRS", HFILL }
584     },
585     { &hf_camelsrt_DeltaTime35,
586       { "Service Response Time",
587         "camel.srt.deltatime35",
588         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
589         "DeltaTime between ApplyCharginReport and ApplyCharging", HFILL }
590     },
591     { &hf_camelsrt_DeltaTime22,
592       { "Service Response Time",
593         "camel.srt.deltatime22",
594         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
595         "DeltaTime between EventReport(Disconnect) and Release Call", HFILL }
596     },
597     { &hf_camelsrt_DeltaTime80,
598       { "Service Response Time",
599         "camel.srt.deltatime80",
600         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
601         "DeltaTime between EventReportGPRS and ContinueGPRS", HFILL }
602     },
603
604 #ifdef REMOVED
605 #endif
606 #include "packet-camel-hfarr.c"
607   };
608
609   /* List of subtrees */
610   static gint *ett[] = {
611     &ett_camel,
612     &ett_camelisup_parameter,
613     &ett_camel_AccessPointName,
614     &ett_camel_pdptypenumber,
615     &ett_camel_cause,
616     &ett_camel_RPcause,
617     &ett_camel_stat,
618         &ett_camel_calledpartybcdnumber,
619
620 #include "packet-camel-ettarr.c"
621   };
622   /* Register protocol */
623   proto_camel = proto_register_protocol(PNAME, PSNAME, PFNAME);
624
625   register_dissector("camel", dissect_camel, proto_camel);
626
627   proto_register_field_array(proto_camel, hf, array_length(hf));
628   proto_register_subtree_array(ett, array_length(ett));
629
630   rose_ctx_init(&camel_rose_ctx);
631
632   /* Register dissector tables */
633   camel_rose_ctx.arg_local_dissector_table = register_dissector_table("camel.ros.local.arg",
634                                                                       "CAMEL Operation Argument (local opcode)",
635                                                                       FT_UINT32, BASE_HEX);
636   camel_rose_ctx.res_local_dissector_table = register_dissector_table("camel.ros.local.res",
637                                                                       "CAMEL Operation Result (local opcode)",
638                                                                       FT_UINT32, BASE_HEX);
639   camel_rose_ctx.err_local_dissector_table = register_dissector_table("camel.ros.local.err",
640                                                                       "CAMEL Error (local opcode)",
641                                                                       FT_UINT32, BASE_HEX);
642
643   /* Register our configuration options, particularly our ssn:s */
644   /* Set default SSNs */
645   range_convert_str(&global_ssn_range, "6-9", MAX_SSN);
646
647   camel_module = prefs_register_protocol(proto_camel, proto_reg_handoff_camel);
648
649   prefs_register_enum_preference(camel_module, "date.format", "Date Format",
650                                   "The date format: (DD/MM) or (MM/DD)",
651                                   &date_format, date_options, FALSE);
652
653
654   prefs_register_range_preference(camel_module, "tcap.ssn",
655     "TCAP SSNs",
656     "TCAP Subsystem numbers used for Camel",
657     &global_ssn_range, MAX_SSN);
658
659   prefs_register_bool_preference(camel_module, "srt",
660                                  "Service Response Time Analyse",
661                                  "Activate the analyse for Response Time",
662                                  &gcamel_HandleSRT);
663
664   prefs_register_bool_preference(camel_module, "persistentsrt",
665                                  "Persistent stats for SRT",
666                                  "Statistics for Response Time",
667                                  &gcamel_PersistentSRT);
668
669   /* Routine for statistic */
670   register_init_routine(&camelsrt_init_routine);
671   camel_tap=register_tap(PSNAME);
672 }
673