aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/gsm_map/gsm_map.cnf
blob: de93a8a296c9cc81c3265207cd6213217ef2f695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
#.OPT
-b
#-d satcom
#-s packet-gsm_map-tmp
#-k
-o gsm_map
#.END

#.MODULE
MAP-BS-Code             gsm_map
MAP-TS-Code             gsm_map
MAP-SS-Code             gsm_map
MAP-ExtensionDataTypes  gsm_map
MAP-CommonDataTypes     gsm_map

MAP-SS-DataTypes        gsm_map.ss
MAP-OM-DataTypes        gsm_map.om
MAP-ER-DataTypes        gsm_map.er
MAP-SM-DataTypes        gsm_map.sm
MAP-MS-DataTypes        gsm_map.ms
MAP-LCS-DataTypes       gsm_map.lcs
MAP-GR-DataTypes        gsm_map.gr
MAP-CH-DataTypes        gsm_map.ch

MAP-Errors              gsm_map
MAP-LocationServiceOperations   gsm_map
MAP-Group-Call-Operations       gsm_map
MAP-ShortMessageServiceOperations  gsm_map
MAP-SupplementaryServiceOperations  gsm_map
MAP-CallHandlingOperations      gsm_map
MAP-OperationAndMaintenanceOperations  gsm_map
MAP-MobileServiceOperations     gsm_map
MAP-Protocol                    gsm_map
MAP-DialogueInformation         gsm_map.dialogue
MAP-ApplicationContexts         gsm_map
SS-DataTypes					gsm_ss
SS-Operations					gsm_ss
DummyMAP						gsm_old
EricssonMAP                     gsm_map.ericsson

Remote-Operations-Information-Objects ROS

#.NO_EMIT ONLY_VALS
CallBarredParam
PW-RegistrationFailureCause
SystemFailureParam
ExtensionType
NumberPorted/_untag

#.OMIT_ASSIGNMENT
Code
Priority
CommonComponentId
SubscriberId
GuidanceInfo
SS-InfoList
# Omitting SubscriberData makes CONTENT OF fail and InsertSubscriberDataArg will not get all its tags
# Not yet used Nokia extensions
SS-DataEmoInExt
EmoInCategoryKey
ANSIIsdArgExt
ANSISriResExt
PrefCarrierIdList
USSD-Extension
CosInfo
AnyTimePO-BarringArg
AnyTimePO-BarringRes
CarrierIdCode
COS-FeatureList
GprsBarring
COS-Feature
CustomerGroupID
SubGroupID
ClassOfServiceID
#.END
#.PDU
LCS-ClientID
ISDN-AddressString

#.USE_VALS_EXT
GSMMAPOperationLocalvalue
OperationLocalvalue

#.EXPORTS
AddressString
Add-GeographicalInformation
AgeOfLocationInformation
AlertingPattern
AreaEventInfo
BasicServiceCode
CallReferenceNumber
CCBS-Feature
CellGlobalIdOrServiceAreaIdOrLAI
CellGlobalIdOrServiceAreaIdFixedLength
CUG-CheckInfo
CUG-Index
CUG-Interlock
CUG-Info
CurrentPassword
D-CSI
DeferredLocationEventType
DefaultGPRS-Handling
DefaultSMS-Handling
EraseCC-EntryArg
EraseCC-EntryRes
Ext-BasicServiceCode
Ext-ForwOptions
Ext-GeographicalInformation EXTERN WS_DLL
Ext-NoRepCondTime
Ext-QoS-Subscribed
Ext2-QoS-Subscribed
Ext3-QoS-Subscribed
ExtensionContainer
ExternalSignalInfo
ForwardingOptions
GeographicalInformation
GetPasswordArg
GlobalCellId EXTERN WS_DLL
GPRSChargingID
GPRSMSClass
GSMMAPLocalErrorcode
GSN-Address
IMEI
IMSI EXTERN WS_DLL
InterrogateSS-Res
ISDN-AddressString EXTERN WS_DLL
ISDN-AddressString_PDU EXTERN WS_DLL
ISDN-SubaddressString
LAIFixedLength
LCSClientExternalID
LCS-ClientID
LCS-ClientID_PDU
LCSClientInternalID
LCSClientName
LCSClientType
LCSRequestorID
LCSCodeword
LCS-Priority
LCSServiceTypeID
LCS-ReferenceNumber
LCS-QoS
LocationInformation
LocationMethod
LocationType
LSAIdentity
MS-Classmark2
NAEA-CIC
NetworkResource
NewPassword
NotificationToMSUser
O-CSI
O-BcsmCamelTDPCriteriaList
OfferedCamel4Functionalities
PositionMethodFailure-Diagnostic
ProtectedPayload
QoS-Subscribed
RAIdentity
RegisterCC-EntryRes
RegisterSS-Arg
SM-RP-DA
SM-RP-OA
SubscriberState
SecurityHeader
ServiceKey
SupportedCamelPhases
SupportedGADShapes
SuppressionOfAnnouncement
SS-Code
SS-Status
SS-Info
SS-ForBS-Code
TBCD-STRING
UnauthorizedLCSClient-Diagnostic
USSD-DataCodingScheme
USSD-String
USSD-Arg
USSD-Res
UU-Data
VelocityEstimate
#.END
#.REGISTER
MAP-DialoguePDU				B "0.4.0.0.1.1.1.1" "map-DialogueAS"

# This table creates the value_sting to name GSM MAP operation codes and errors
# in file packet-camel-table.c which is included in the template file
#
#.TABLE_BODY OPERATION
	{ %(&operationCode)s, "%(_ident)s" },
#.END

#.TABLE2_BODY ERROR
	{ %(&errorCode)s, "%(_ident)s" },
#.END


# Conformance for ROS stuff

#.FN_BODY InvokeParameter
	offset = dissect_invokeData(tree, tvb, offset, actx);

#.FN_BODY ReturnResultParameter
	offset = dissect_returnResultData(tree, tvb, offset, actx);

#.FN_BODY ReturnErrorParameter
	offset = dissect_returnErrorData(tree, tvb, offset, actx);

#.FN_PARS  GSMMAPOperationLocalvalue

  VAL_PTR = &opcode

#.FN_BODY  GSMMAPOperationLocalvalue
  const char *opcode_string;

%(DEFAULT_BODY)s
  /* Retrieve opcode string and eventually update item value */
  opcode_string = gsm_map_opr_code(opcode, actx->created_item);
  col_append_str(actx->pinfo->cinfo, COL_INFO, opcode_string);
  col_append_str(actx->pinfo->cinfo, COL_INFO, " ");

#.FN_PARS  GSMMAPLocalErrorcode

  VAL_PTR = &errorCode
# End ROS
#----------------------------------------------------------------------------------------

#.FN_BODY PrivateExtension/extId  FN_VARIANT = _str  VAL_PTR = &actx->external.direct_reference
%(DEFAULT_BODY)s
  actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;

#.FN_BODY PrivateExtension/extType
  proto_tree *ext_tree;
  ext_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_gsm_map_extension_data, NULL, "Extension Data");
  if (actx->external.direct_ref_present){
	 offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, ext_tree, NULL);
  }else{
	 call_data_dissector(tvb, actx->pinfo, ext_tree);
	 offset = tvb_reported_length_remaining(tvb,offset);
  }

#.FN_PARS  AccessNetworkProtocolId

  VAL_PTR = &AccessNetworkProtocolId

#.FN_BODY AddressString VAL_PTR = &parameter_tvb

  tvbuff_t	*parameter_tvb;
  proto_tree *subtree;

%(DEFAULT_BODY)s

  if (!parameter_tvb)
    return offset;

  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_isdn_address_string);
  dissect_gsm_map_msisdn(parameter_tvb, actx->pinfo , subtree);
  if (!PINFO_FD_VISITED(actx->pinfo))
    actx->private_data = tvb_bytes_to_str(wmem_file_scope(), parameter_tvb, 0, tvb_captured_length(parameter_tvb));

#.FN_BODY IMSI VAL_PTR = &parameter_tvb
  tvbuff_t   *parameter_tvb;
  const char *imsi_str;

  offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &parameter_tvb);

  if (!parameter_tvb)
    return offset;
  if(tvb_reported_length(parameter_tvb)==0)
    return offset;

  /* Hide the octet string default printout */
  PROTO_ITEM_SET_HIDDEN(actx->created_item);
  imsi_str = dissect_e212_imsi(parameter_tvb, actx->pinfo, tree,
                               0, tvb_reported_length(parameter_tvb), FALSE);
  if (!PINFO_FD_VISITED(actx->pinfo))
    actx->private_data = wmem_strdup(wmem_file_scope(), imsi_str);

#.FN_BODY LMSI VAL_PTR = &parameter_tvb
  tvbuff_t *parameter_tvb;
%(DEFAULT_BODY)s
  if (parameter_tvb && !PINFO_FD_VISITED(actx->pinfo)) {
    actx->private_data = tvb_bytes_to_str(wmem_file_scope(), parameter_tvb, 0, tvb_captured_length(parameter_tvb));
  }

#.FN_BODY TBCD-STRING VAL_PTR = &parameter_tvb
 tvbuff_t	*parameter_tvb;
 const char	*digit_str;
 proto_tree *subtree;
 static const dgt_set_t Dgt_tbcd = {
    {
  /*  0   1   2   3   4   5   6   7   8   9   a   b   c   d   e */
     '0','1','2','3','4','5','6','7','8','9','*','#','a','b','c', 0
    }
 };


 %(DEFAULT_BODY)s

 if (!parameter_tvb)
	return offset;
 if(tvb_reported_length(parameter_tvb)==0)
     return offset;

 subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_tbcd_digits);
 digit_str = tvb_bcd_dig_to_wmem_packet_str(parameter_tvb, 0, -1, &Dgt_tbcd, FALSE);
 proto_tree_add_string(subtree, hf_gsm_map_TBCD_digits, parameter_tvb, 0, -1, digit_str);

#----------------------------------------------------------------------------------------
#.FN_BODY LongSignalInfo VAL_PTR = &parameter_tvb
#
#7.6.9.1 AN-apdu
#This parameter includes one or two concatenated complete 3GPP TS 25.413 or 3GPP TS 48.006 [48] messages, as
#described in 3GPP TS 23.009 and 3GPP TS 29.010. The access network protocol ID indicates that the message or
#messages are according to either 3GPP TS 48.006 [48] or 3GPP TS 25.413. For the coding of the messages see 3GPP
#TS 25.413, 3GPP TS 48.006 [48] and 3GPP TS 48.008 [49].

 tvbuff_t	*parameter_tvb;
 guint8		octet;
 tvbuff_t	*next_tvb;
 proto_tree *subtree;
 gsm_map_private_info_t *gsm_map_priv;
 sccp_msg_info_t *sccp_msg_info;


%(DEFAULT_BODY)s

 if (!parameter_tvb)
	return offset;

 gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
 sccp_msg_info = gsm_map_priv ? gsm_map_priv->sccp_msg_info : NULL;
 subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LongSignalInfo);

 switch (AccessNetworkProtocolId){
	/* ts3G-48006 */
	case 1:
		octet = tvb_get_guint8(parameter_tvb,0);
		/* Discrimination parameter */
		proto_tree_add_item(subtree, hf_gsm_map_disc_par, parameter_tvb, 0,1,ENC_BIG_ENDIAN);
		if ( octet == 0) {/* DISCRIMINATION TS 48 006(GSM 08.06 version 5.3.0) */
			/* Strip off discrimination and length */
			proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 1,1,ENC_BIG_ENDIAN);
			next_tvb = tvb_new_subset_remaining(parameter_tvb, 2);
			call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree, sccp_msg_info);
		}else if(octet==1){
			proto_tree_add_item(subtree, hf_gsm_map_dlci, parameter_tvb, 1,1,ENC_BIG_ENDIAN);
			proto_tree_add_item(subtree, hf_gsm_map_len, parameter_tvb, 2,1,ENC_BIG_ENDIAN);
			next_tvb = tvb_new_subset_remaining(parameter_tvb, 3);
			call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
		}
		break;
	/* ts3G-25413 */
	case 2:
		call_dissector(ranap_handle, parameter_tvb, actx->pinfo, tree);
		break;
	default:
		break;

 }
# Set SENT/RECEIVED depending if ISDN-AddressString or AddressString is used.
# as it's a CHOICE only one is present.
#.FN_BODY SM-RP-OAold/serviceCentreAddressOA
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_SENT;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_oa_id = GSM_MAP_SM_RP_OA_SERVICE_CENTER_ADDRESS;
    gsm_map_pi->sm_rp_oa_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-OA/serviceCentreAddressOA
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_SENT;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_oa_id = GSM_MAP_SM_RP_OA_SERVICE_CENTER_ADDRESS;
    gsm_map_pi->sm_rp_oa_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-DAold/imsi
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_SENT;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_da_id = GSM_MAP_SM_RP_DA_IMSI;
    gsm_map_pi->sm_rp_da_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-DAold/lmsi
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_SENT;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_da_id = GSM_MAP_SM_RP_DA_LMSI;
    gsm_map_pi->sm_rp_da_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-DA/imsi
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_SENT;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_da_id = GSM_MAP_SM_RP_DA_IMSI;
    gsm_map_pi->sm_rp_da_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-DA/lmsi
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_SENT;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_da_id = GSM_MAP_SM_RP_DA_LMSI;
    gsm_map_pi->sm_rp_da_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-OAold/msisdn
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_RECV;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_oa_id = GSM_MAP_SM_RP_OA_MSISDN;
    gsm_map_pi->sm_rp_oa_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-OA/msisdn
  actx->pinfo->p2p_dir = P2P_DIR_RECV;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_oa_id = GSM_MAP_SM_RP_OA_MSISDN;
    gsm_map_pi->sm_rp_oa_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-DAold/serviceCentreAddressDA
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_RECV;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_da_id = GSM_MAP_SM_RP_DA_SERVICE_CENTER_ADDRESS;
    gsm_map_pi->sm_rp_da_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-DA/serviceCentreAddressDA
  actx->private_data = NULL;
  actx->pinfo->p2p_dir = P2P_DIR_RECV;
%(DEFAULT_BODY)s
  if (actx->private_data) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, TRUE);
    gsm_map_pi->sm_rp_da_id = GSM_MAP_SM_RP_DA_SERVICE_CENTER_ADDRESS;
    gsm_map_pi->sm_rp_da_str = (const gchar*)actx->private_data;
    actx->private_data = NULL;
  }

#.FN_BODY SM-RP-OAold/noSM-RP-OA
%(DEFAULT_BODY)s
  if (!PINFO_FD_VISITED(actx->pinfo)) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, FALSE);
    gsm_map_packet_info_t *prev_packet_info = gsm_map_get_matching_tcap_info(actx);
    if (prev_packet_info) {
      gsm_map_pi->sm_rp_oa_id = prev_packet_info->sm_rp_oa_id;
      gsm_map_pi->sm_rp_oa_str = wmem_strdup(wmem_file_scope(), prev_packet_info->sm_rp_oa_str);
    }
  }

#.FN_BODY SM-RP-OA/noSM-RP-OA
%(DEFAULT_BODY)s
  if (!PINFO_FD_VISITED(actx->pinfo)) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, FALSE);
    gsm_map_packet_info_t *prev_packet_info = gsm_map_get_matching_tcap_info(actx);
    if (prev_packet_info) {
      gsm_map_pi->sm_rp_oa_id = prev_packet_info->sm_rp_oa_id;
      gsm_map_pi->sm_rp_oa_str = wmem_strdup(wmem_file_scope(), prev_packet_info->sm_rp_oa_str);
    }
  }

#.FN_BODY SM-RP-DAold/noSM-RP-DA
%(DEFAULT_BODY)s
  if (!PINFO_FD_VISITED(actx->pinfo)) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, FALSE);
    gsm_map_packet_info_t *prev_packet_info = gsm_map_get_matching_tcap_info(actx);
    if (prev_packet_info) {
      gsm_map_pi->sm_rp_da_id = prev_packet_info->sm_rp_da_id;
      gsm_map_pi->sm_rp_da_str = wmem_strdup(wmem_file_scope(), prev_packet_info->sm_rp_da_str);
    }
  }

#.FN_BODY SM-RP-DA/noSM-RP-DA
%(DEFAULT_BODY)s
  if (!PINFO_FD_VISITED(actx->pinfo)) {
    gsm_map_packet_info_t *gsm_map_pi = gsm_map_get_packet_info(actx, FALSE);
    gsm_map_packet_info_t *prev_packet_info = gsm_map_get_matching_tcap_info(actx);
    if (prev_packet_info) {
      gsm_map_pi->sm_rp_da_id = prev_packet_info->sm_rp_da_id;
      gsm_map_pi->sm_rp_da_str = wmem_strdup(wmem_file_scope(), prev_packet_info->sm_rp_da_str);
    }
  }

#.FN_BODY SignalInfo VAL_PTR = &parameter_tvb
  tvbuff_t *parameter_tvb;
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;

%(DEFAULT_BODY)s
  if (gsm_map_priv)
	gsm_map_priv->signal_info_tvb = parameter_tvb;


#.FN_BODY SM-DeliveryFailureCause
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  guint8 oct;
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  /* Detailed diagnostic information contains either a SMS-SUBMIT-REPORT or a SMS-DELIVERY-REPORT */
  oct = tvb_get_guint8(gsm_map_priv->signal_info_tvb, 0);
  actx->pinfo->p2p_dir = ((oct & 0x03) == 0) ? P2P_DIR_RECV : P2P_DIR_SENT;
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY ForwardSM-Arg
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    if (gsmmap_pdu_type == 1) {
      actx->pinfo->p2p_dir = P2P_DIR_SENT;
    } else {
      actx->pinfo->p2p_dir = P2P_DIR_RECV;
    }
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY MO-ForwardSM-Arg
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    actx->pinfo->p2p_dir = P2P_DIR_RECV;
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY MO-ForwardSM-Res
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    actx->pinfo->p2p_dir = P2P_DIR_SENT;
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY MT-ForwardSM-Arg
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    actx->pinfo->p2p_dir = P2P_DIR_SENT;
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY MT-ForwardSM-Res
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    actx->pinfo->p2p_dir = P2P_DIR_RECV;
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY MT-ForwardSM-VGCS-Arg
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    actx->pinfo->p2p_dir = P2P_DIR_SENT;
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY MT-ForwardSM-VGCS-Res
  /* dissect_gsm_map_SignalInfo will return parameter_tvb in actx */
  gsm_map_private_info_t *gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
%(DEFAULT_BODY)s

  if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
    return offset;
  if (actx->pinfo->p2p_dir == P2P_DIR_UNKNOWN) {
    actx->pinfo->p2p_dir = P2P_DIR_RECV;
  }
  call_dissector_only(gsm_sms_handle, gsm_map_priv->signal_info_tvb, actx->pinfo, actx->subtree.top_tree, NULL);

#.FN_BODY SS-Status VAL_PTR = &parameter_tvb

 tvbuff_t	*parameter_tvb;
 guint8		octet;

%(DEFAULT_BODY)s

 if (!parameter_tvb)
	return offset;

 octet = tvb_get_guint8(parameter_tvb,0);

 proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
 if ((octet & 0x01)== 1)
	proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);

 proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
 proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
 proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);

#.FN_BODY Ext-SS-Status VAL_PTR = &parameter_tvb
 /* Note Ext-SS-Status can have more than one byte */

 tvbuff_t	*parameter_tvb;
 guint8		octet;

%(DEFAULT_BODY)s

 if (!parameter_tvb)
	return offset;

 octet = tvb_get_guint8(parameter_tvb,0);

 proto_tree_add_uint(tree, hf_gsm_map_Ss_Status_unused, parameter_tvb, 0,1,octet);
 if ((octet & 0x01)== 1)
	proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_q_bit, parameter_tvb, 0,1,octet);

 proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_p_bit, parameter_tvb, 0,1,octet);
 proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_r_bit, parameter_tvb, 0,1,octet);
 proto_tree_add_boolean(tree, hf_gsm_map_Ss_Status_a_bit, parameter_tvb, 0,1,octet);

#.END

#.FN_BODY USSD-DataCodingScheme VAL_PTR = &parameter_tvb
 /*The structure of the USSD-DataCodingScheme is defined by
  * the Cell Broadcast Data Coding Scheme as described in
  * TS 3GPP TS 23.038
  * TODO: Should dissect_cbs_data_coding_scheme return encoding type? - like 7bit Alphabet
  */
  tvbuff_t	*parameter_tvb;
  proto_tree *subtree;

%(DEFAULT_BODY)s
  if (!parameter_tvb)
     return offset;
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_cbs_data_coding);
  dissect_cbs_data_coding_scheme(parameter_tvb, actx->pinfo, subtree, 0);

#.FN_BODY USSD-String VAL_PTR = &parameter_tvb

  tvbuff_t   *parameter_tvb;
  guint       length;
  proto_tree *subtree;

%(DEFAULT_BODY)s
  if (!parameter_tvb)
     return offset;

  length = tvb_ensure_captured_length_remaining(parameter_tvb,0);
  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ussd_string);
  switch(sms_encoding){
    case SMS_ENCODING_7BIT:
    case SMS_ENCODING_7BIT_LANG:
      proto_tree_add_item(subtree, hf_gsm_map_ussd_string, parameter_tvb, 0, length, ENC_3GPP_TS_23_038_7BITS|ENC_NA);
      break;
    case SMS_ENCODING_8BIT:
      /* XXX - ASCII, or some extended ASCII? */
      proto_tree_add_item(subtree, hf_gsm_map_ussd_string, parameter_tvb, 0, length, ENC_ASCII|ENC_NA);
      break;
    case SMS_ENCODING_UCS2:
    case SMS_ENCODING_UCS2_LANG:
      proto_tree_add_item(subtree, hf_gsm_map_ussd_string, parameter_tvb, 0, length, ENC_UCS_2|ENC_BIG_ENDIAN);
      break;
    default:
      break;
  }

#.FN_FTR ForwardingOptions

	proto_tree_add_item(tree, hf_gsm_map_notification_to_forwarding_party, tvb, 0,1,ENC_BIG_ENDIAN);
	proto_tree_add_item(tree, hf_gsm_map_redirecting_presentation, tvb, 0,1,ENC_BIG_ENDIAN);
	proto_tree_add_item(tree, hf_gsm_map_notification_to_calling_party, tvb, 0,1,ENC_BIG_ENDIAN);
	proto_tree_add_item(tree, hf_gsm_map_forwarding_reason, tvb, 0,1,ENC_BIG_ENDIAN);
#.FN_FTR Ext-ForwFeature/forwardingOptions

	proto_tree_add_item(tree, hf_gsm_map_notification_to_forwarding_party, tvb, 0,1,ENC_BIG_ENDIAN);
	proto_tree_add_item(tree, hf_gsm_map_redirecting_presentation, tvb, 0,1,ENC_BIG_ENDIAN);
	proto_tree_add_item(tree, hf_gsm_map_notification_to_calling_party, tvb, 0,1,ENC_BIG_ENDIAN);
	proto_tree_add_item(tree, hf_gsm_map_forwarding_reason, tvb, 0,1,ENC_BIG_ENDIAN);


#.FN_BODY PDP-Type VAL_PTR = &parameter_tvb
	guint8 pdp_type_org;
	tvbuff_t	*parameter_tvb;


%(DEFAULT_BODY)s

 if (!parameter_tvb)
	return offset;
	proto_tree_add_item(tree, hf_gsm_map_pdp_type_org, parameter_tvb, 0,1,ENC_BIG_ENDIAN);
	pdp_type_org = tvb_get_guint8(parameter_tvb,1);
	switch (pdp_type_org){
		case 0: /* ETSI */
			proto_tree_add_item(tree, hf_gsm_map_etsi_pdp_type_number, parameter_tvb, 0,1,ENC_BIG_ENDIAN);
			break;
		case 1: /* IETF */
			proto_tree_add_item(tree, hf_gsm_map_ietf_pdp_type_number, parameter_tvb, 0,1,ENC_BIG_ENDIAN);
			break;
		default:
		break;
	}

#.FN_BODY QoS-Subscribed VAL_PTR = &parameter_tvb


	tvbuff_t	*parameter_tvb;

%(DEFAULT_BODY)s

	 if (!parameter_tvb)
		return offset;
	de_sm_qos(parameter_tvb, tree, actx->pinfo, 0, 3, NULL,0);

#.FN_BODY Ext-QoS-Subscribed VAL_PTR = &parameter_tvb

	tvbuff_t	*parameter_tvb;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
		return offset;
	dissect_gsm_map_ext_qos_subscribed(tvb, actx->pinfo, tree, actx);

#.FN_BODY Ext2-QoS-Subscribed VAL_PTR = &parameter_tvb

	tvbuff_t	*parameter_tvb;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
		return offset;
	dissect_gsm_map_ext2_qos_subscribed(tvb, actx->pinfo, tree, actx);

#.FN_BODY Ext3-QoS-Subscribed VAL_PTR = &parameter_tvb

	tvbuff_t	*parameter_tvb;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
		return offset;
	dissect_gsm_map_ext3_qos_subscribed(tvb, actx->pinfo, tree, actx);

#.FN_BODY Ext4-QoS-Subscribed VAL_PTR = &parameter_tvb

	tvbuff_t	*parameter_tvb;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
		return offset;
	dissect_gsm_map_ext4_qos_subscribed(tvb, actx->pinfo, tree, actx);

#.FN_BODY GSN-Address VAL_PTR = &parameter_tvb

	tvbuff_t	*parameter_tvb;
	guint8		octet;
	proto_tree *subtree;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
		return offset;
	subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_pdptypenumber);

	octet = tvb_get_guint8(parameter_tvb,0);
	switch(octet){
	case 0x04: /* IPv4 */
		proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, 4, ENC_BIG_ENDIAN);
		break;
	case 0x50: /* IPv6 */
		proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv6, parameter_tvb, 1, 16, ENC_NA);
		break;
	default:
		break;
	}

#.FN_BODY RAIdentity VAL_PTR = &parameter_tvb

	tvbuff_t	*parameter_tvb;
	proto_tree *subtree;

%(DEFAULT_BODY)s

	 if (!parameter_tvb)
		return offset;
	subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RAIdentity);
	de_gmm_rai(parameter_tvb, subtree, actx->pinfo, 0, 3, NULL,0);

#.FN_BODY LAIFixedLength VAL_PTR = &parameter_tvb

        tvbuff_t        *parameter_tvb;
        proto_tree *subtree;

%(DEFAULT_BODY)s

         if (!parameter_tvb)
                return offset;
        subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength);
        dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, E212_LAI, TRUE);

#.FN_BODY RadioResourceInformation VAL_PTR = &parameter_tvb
    tvbuff_t        *parameter_tvb;
	proto_tree *subtree;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
                return offset;

    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation);
	be_chan_type(parameter_tvb, subtree, actx->pinfo, 0, tvb_reported_length_remaining(tvb,0), NULL, 0);

#.FN_BODY RANAP-ServiceHandover VAL_PTR = &parameter_tvb
    tvbuff_t        *parameter_tvb;
	asn1_ctx_t		asn1_ctx;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
                return offset;

	asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
	dissect_ranap_Service_Handover(parameter_tvb, 0, &asn1_ctx, tree, hf_gsm_map_ranap_service_Handover);

#.FN_BODY IntegrityProtectionInformation VAL_PTR = &parameter_tvb
    tvbuff_t        *parameter_tvb;
	asn1_ctx_t		asn1_ctx;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
                return offset;

	asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
	dissect_ranap_IntegrityProtectionInformation(parameter_tvb, 0, &asn1_ctx, tree, hf_gsm_map_IntegrityProtectionInformation);

#.FN_BODY EncryptionInformation VAL_PTR = &parameter_tvb
    tvbuff_t        *parameter_tvb;
	asn1_ctx_t		asn1_ctx;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
                return offset;

	asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, actx->pinfo);
	dissect_ranap_EncryptionInformation(parameter_tvb, 0, &asn1_ctx, tree, hf_gsm_map_EncryptionInformation);

#.FN_PARS ProtocolId VAL_PTR = &ProtocolId
#.FN_BODY Bss-APDU
 guint8		octet;
 guint8		length;
 tvbuff_t	*next_tvb;
 proto_tree *subtree;
/*
ETS 300 599: December 2000 (GSM 09.02 version 4.19.1)
5.6.9.1 BSS-apdu
This parameter includes one or two concatenated complete 08.06 messages, as described in GSM 03.09
and GSM 09.10. The Protocol ID indicates that the message or messages are according to GSM 08.06.
For the coding of the messages see GSM 08.06 and GSM 08.08.
*/
 ProtocolId = 0xffffffff;
 gsm_map_private_info_t *gsm_map_priv;
%(DEFAULT_BODY)s
 gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
	return offset;
 subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
 switch (ProtocolId){
	case 1:
	/* gsm-0408 */
		/* As per comment abowe Individual IE:(s) will be found here in TLV format
		 * Unfortunatly a branch for each IE must be made to call the apropriate
		 * function
		 */
		 /* Get tag */
		 octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		 proto_tree_add_item(subtree, hf_gsm_map_ie_tag, gsm_map_priv->signal_info_tvb, 0,1,ENC_BIG_ENDIAN);
		 /* get length */
		 length = tvb_get_guint8(gsm_map_priv->signal_info_tvb,1);
		 proto_tree_add_item(subtree, hf_gsm_map_len, gsm_map_priv->signal_info_tvb, 1,1,ENC_BIG_ENDIAN);
		 /* Branch on tag */
		 switch(octet){
		 case 4:
			/* Dissect the data part */
			de_bearer_cap(gsm_map_priv->signal_info_tvb, subtree, actx->pinfo, 2, length, NULL, 0);
			/* TODO: There may be more than one IE */
			break;
		 default:
			proto_tree_add_expert(subtree, actx->pinfo, &ei_gsm_map_undecoded, gsm_map_priv->signal_info_tvb, 0, length);
			break;
		}/* switch(octet) */
		break;
	case 2:
		/* gsm-0806 */
		octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		/* Discrimination parameter */
		proto_tree_add_item(subtree, hf_gsm_map_disc_par, gsm_map_priv->signal_info_tvb, 0,1,ENC_BIG_ENDIAN);
		if ( octet == 0) {/* DISCRIMINATION TS 48 006(GSM 08.06 version 5.3.0) */
			/* Strip off discrimination and length */
			proto_tree_add_item(subtree, hf_gsm_map_len, gsm_map_priv->signal_info_tvb, 1,1,ENC_BIG_ENDIAN);
			next_tvb = tvb_new_subset_remaining(gsm_map_priv->signal_info_tvb, 2);
			call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree, gsm_map_priv->sccp_msg_info);
		}else if(octet==1){
			proto_tree_add_item(subtree, hf_gsm_map_dlci, gsm_map_priv->signal_info_tvb, 1,1,ENC_BIG_ENDIAN);
			proto_tree_add_item(subtree, hf_gsm_map_len, gsm_map_priv->signal_info_tvb, 2,1,ENC_BIG_ENDIAN);
			next_tvb = tvb_new_subset_remaining(gsm_map_priv->signal_info_tvb, 3);
			call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
		}
		break;
	case 3:
	/* gsm-BSSMAP -- Value 3 is reserved and must not be used*/
		octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		if ( octet == 0) {/* DISCRIMINATION TS 48 006 */
			next_tvb = tvb_new_subset_remaining(gsm_map_priv->signal_info_tvb, 2);
			call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree, gsm_map_priv->sccp_msg_info);
		}
		break;
	/* ets-300102-1 (~Q.931 ) */
	case 4:
		octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		length = tvb_get_guint8(gsm_map_priv->signal_info_tvb,1);
		if ( octet == 4 )
			dissect_q931_bearer_capability_ie(gsm_map_priv->signal_info_tvb, 2, length, subtree);
		break;
	default:
		break;
	}/*switch (ProtocolId)*/

#.FN_BODY ExternalSignalInfo
/*
-- Information about the internal structure is given in
-- clause 7.6.9.
7.6.9.4 External Signal Information
This parameter contains concatenated information elements (including tag and length) which are defined by a common
protocol version, preceded by the associated protocol ID. It is used to transport information of the indicated protocol via
MAP interfaces
*/
 guint8		octet;
 guint8		length;
 tvbuff_t	*next_tvb;
 proto_tree *subtree;
 gsm_map_private_info_t *gsm_map_priv;

 ProtocolId = 0xffffffff;
%(DEFAULT_BODY)s
 gsm_map_priv = (gsm_map_private_info_t*)actx->value_ptr;
 if (!gsm_map_priv || !gsm_map_priv->signal_info_tvb)
	return offset;
 subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_externalsignalinfo);
 switch (ProtocolId){
	case 1:
	/* gsm-0408 */
		/* As per comment abowe Individual IE:(s) will be found here in TLV format
		 * Unfortunatly a branch for each IE must be made to call the apropriate
		 * function
		 */
		 /* Get tag */
		 octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		 proto_tree_add_item(subtree, hf_gsm_map_ie_tag, gsm_map_priv->signal_info_tvb, 0,1,ENC_BIG_ENDIAN);
		 /* get length */
		 length = tvb_get_guint8(gsm_map_priv->signal_info_tvb,1);
		 proto_tree_add_item(subtree, hf_gsm_map_len, gsm_map_priv->signal_info_tvb, 1,1,ENC_BIG_ENDIAN);
		 /* Branch on tag */
		 switch(octet){
		 case 4:
			/* Dissect the data part */
			de_bearer_cap(gsm_map_priv->signal_info_tvb, subtree, actx->pinfo, 2, length, NULL, 0);
			/* TODO: There may be more than one IE */
			break;
		 default:
			proto_tree_add_expert(subtree, actx->pinfo, &ei_gsm_map_undecoded, gsm_map_priv->signal_info_tvb, 0, length);
			break;
		}/* switch(octet) */
		break;
	case 2:
		/* gsm-0806 */
		octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		/* Discrimination parameter */
		proto_tree_add_item(subtree, hf_gsm_map_disc_par, gsm_map_priv->signal_info_tvb, 0,1,ENC_BIG_ENDIAN);
		if ( octet == 0) {/* DISCRIMINATION TS 48 006(GSM 08.06 version 5.3.0) */
			/* Strip off discrimination and length */
			proto_tree_add_item(subtree, hf_gsm_map_len, gsm_map_priv->signal_info_tvb, 1,1,ENC_BIG_ENDIAN);
			next_tvb = tvb_new_subset_remaining(gsm_map_priv->signal_info_tvb, 2);
			call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree, gsm_map_priv->sccp_msg_info);
		}else if(octet==1){
			proto_tree_add_item(subtree, hf_gsm_map_dlci, gsm_map_priv->signal_info_tvb, 1,1,ENC_BIG_ENDIAN);
			proto_tree_add_item(subtree, hf_gsm_map_len, gsm_map_priv->signal_info_tvb, 2,1,ENC_BIG_ENDIAN);
			next_tvb = tvb_new_subset_remaining(gsm_map_priv->signal_info_tvb, 3);
			call_dissector(dtap_handle, next_tvb, actx->pinfo, subtree);
		}
		break;
	case 3:
	/* gsm-BSSMAP TODO Is it correct to stripp off two first octets here?*/
		octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		if ( octet == 0) {/* DISCRIMINATION TS 48 006 */
			next_tvb = tvb_new_subset_remaining(gsm_map_priv->signal_info_tvb, 2);
			call_dissector_with_data(bssap_handle, next_tvb, actx->pinfo, subtree, gsm_map_priv->sccp_msg_info);
		}
		break;
	/* ets-300102-1 (~Q.931 ) */
	case 4:
		octet = tvb_get_guint8(gsm_map_priv->signal_info_tvb,0);
		length = tvb_get_guint8(gsm_map_priv->signal_info_tvb,1);
		if ( octet == 4 )
			dissect_q931_bearer_capability_ie(gsm_map_priv->signal_info_tvb, 2, length, subtree);
		break;
	default:
		break;
	}/*switch (ProtocolId)*/

#.FN_BODY GlobalCellId VAL_PTR = &parameter_tvb
    tvbuff_t	*parameter_tvb;
	proto_tree	*subtree;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
                return offset;

    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId);
	be_cell_id_aux(parameter_tvb, subtree, actx->pinfo, 0, tvb_reported_length_remaining(tvb,0), NULL, 0, 0);

#.FN_BODY Ext-GeographicalInformation VAL_PTR = &parameter_tvb
    tvbuff_t	*parameter_tvb;
	proto_tree	*subtree;

%(DEFAULT_BODY)s

	if (!parameter_tvb)
                return offset;

    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GeographicalInformation);
	dissect_geographical_description(parameter_tvb, actx->pinfo, subtree);


# APN ::=  OCTET STRING (SIZE (2..63))
# Octets are coded according to TS 3GPP TS 23.003
# 9.1 Structure of APN
# :
# The APN consists of one or more labels. Each label is coded as a one octet length field followed by that number of
# octets coded as 8 bit ASCII characters. Following RFC 1035 [19] the labels shall consist only of the alphabetic
# characters (A-Z and a-z), digits (0-9) and the hyphen (-). Following RFC 1123 [20], the label shall begin and end with
# either an alphabetic character or a digit. The case of alphabetic characters is not significant. The APN is not terminated
# by a length byte of zero.
#.FN_BODY APN VAL_PTR = &parameter_tvb
    tvbuff_t	*parameter_tvb;
    proto_tree	*subtree;
    int			length, name_len, tmp;
    guint8		*apn_str = NULL;

%(DEFAULT_BODY)s
	if (!parameter_tvb)
                return offset;

    length = tvb_reported_length(parameter_tvb);
    name_len = tvb_get_guint8(parameter_tvb, 0);
    apn_str = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 1, length - 1, ENC_ASCII|ENC_NA);
    if (name_len < length-1) {
		for (;;) {
			if (name_len >= length - 1)
				break;
			tmp = name_len;
			name_len = name_len + apn_str[tmp] + 1;
			apn_str[tmp] = '.';
		}
	}
	proto_item_append_text(actx->created_item, " - %%s", apn_str);
	subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_apn_str);
	proto_tree_add_string(subtree, hf_gsm_apn_str, parameter_tvb, 0, -1, apn_str);


#.FN_BODY LocationNumber VAL_PTR = &parameter_tvb
 tvbuff_t	*parameter_tvb;
 proto_tree	*subtree;
 const char	*digit_str;
 guint8		na;
 guint8		np;
%(DEFAULT_BODY)s
  if (!parameter_tvb)
      return offset;

  subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LocationNumber);

  proto_tree_add_item(subtree, hf_gsm_map_locationnumber_odd_even, tvb, 0, 1, ENC_BIG_ENDIAN);
  na = tvb_get_guint8(tvb,0) & 0x7f;
  proto_tree_add_item(subtree, hf_gsm_map_locationnumber_nai, tvb, 0, 1, ENC_BIG_ENDIAN);

  proto_tree_add_item(subtree, hf_gsm_map_locationnumber_inn, tvb, 1, 1, ENC_BIG_ENDIAN);
  np = (tvb_get_guint8(tvb,1) & 0x70) >> 4;
  proto_tree_add_item(subtree, hf_gsm_map_locationnumber_npi, tvb, 1, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(subtree, hf_gsm_map_locationnumber_apri, tvb, 1, 1, ENC_BIG_ENDIAN);
  proto_tree_add_item(subtree, hf_gsm_map_locationnumber_screening_ind, tvb, 1, 1, ENC_BIG_ENDIAN);

 digit_str = tvb_bcd_dig_to_wmem_packet_str(tvb, 2, -1, NULL, FALSE);

 proto_tree_add_string(subtree, hf_gsm_map_locationnumber_digits, tvb, 2, -1, digit_str);

 if ((na == 3) && (np==1))/*International Number & E164*/
	dissect_e164_cc(tvb, subtree, 2, E164_ENC_BCD);

#.FN_BODY EnhancedCheckIMEI-Arg/locationInformation VAL_PTR = &parameter_tvb
  tvbuff_t *parameter_tvb;
  proto_tree *subtree;
  guint8 rat;
%(DEFAULT_BODY)s
  if (parameter_tvb) {
    subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ericsson_locationInformation);
    rat = tvb_get_guint8(parameter_tvb, 0);
    proto_tree_add_uint(subtree, hf_gsm_map_ericsson_locationInformation_rat, parameter_tvb, 0, 1, rat);
    switch (rat) {
      case 0:
        /* GSM */
        proto_tree_add_item(subtree, hf_gsm_map_ericsson_locationInformation_lac, parameter_tvb, 1, 2, ENC_BIG_ENDIAN);
        proto_tree_add_item(subtree, hf_gsm_map_ericsson_locationInformation_ci, parameter_tvb, 3, 2, ENC_BIG_ENDIAN);
        break;
      case 1:
        /* UMTS */
        proto_tree_add_item(subtree, hf_gsm_map_ericsson_locationInformation_lac, parameter_tvb, 1, 2, ENC_BIG_ENDIAN);
        proto_tree_add_item(subtree, hf_gsm_map_ericsson_locationInformation_sac, parameter_tvb, 3, 2, ENC_BIG_ENDIAN);
        break;
      default:
        break;
    }
  }

# Make dissector table for V3 messages
#.REGISTER

SendAuthenticationInfoArg						N gsm_map.v3.arg.opcode 56
SendAuthenticationInfoRes						N gsm_map.v3.res.opcode 56

#----------------------------------------------------------------------------------------
#.TYPE_ATTR
SS-Code  TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(ssCode_vals)
Teleservice  TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(Teleservice_vals)
Bearerservice  TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(Bearerservice_vals)
TeleserviceCode  TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(Teleservice_vals)
BearerServiceCode  TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(Bearerservice_vals)
Ext-TeleserviceCode TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(Teleservice_vals)
Ext-BearerServiceCode  TYPE = FT_UINT8  DISPLAY = BASE_DEC  STRINGS = VALS(Bearerservice_vals)
ChargingCharacteristics  TYPE = FT_UINT16  DISPLAY = BASE_DEC  BITMASK = 0x0f00 STRINGS = VALS(chargingcharacteristics_values)
RoutingInfo TYPE = FT_UINT32  DISPLAY = BASE_DEC  STRINGS = VALS(gsm_map_ch_RoutingInfo_vals)

#----------------------------------------------------------------------------------------
#.FIELD_ATTR
RequestedInfo/imei ABBREV = imei_null

#.END