Move 3 ASN1 dissectors to 'clean' group; move 1 PIDL dissector to 'dirty' group.
[metze/wireshark/wip.git] / epan / dissectors / packet-smrse.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
3 /* packet-smrse.c                                                             */
4 /* ../../tools/asn2wrs.py -b -p smrse -c ./smrse.cnf -s ./packet-smrse-template -D . -O ../../epan/dissectors SMRSE.asn */
5
6 /* Input file: packet-smrse-template.c */
7
8 #line 1 "../../asn1/smrse/packet-smrse-template.c"
9 /* packet-smrse.c
10  * Routines for SMRSE Short Message Relay Service packet dissection
11  *   Ronnie Sahlberg 2004
12  *
13  * $Id$
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32  */
33
34 #include "config.h"
35
36 #include <glib.h>
37 #include <epan/packet.h>
38 #include <epan/asn1.h>
39
40 #include "packet-ber.h"
41 #include "packet-smrse.h"
42
43 #define PNAME  "Short Message Relaying Service"
44 #define PSNAME "SMRSE"
45 #define PFNAME "smrse"
46
47 #define TCP_PORT_SMRSE 4321
48
49 /* Initialize the protocol and registered fields */
50 static int proto_smrse = -1;
51 static int hf_smrse_reserved = -1;
52 static int hf_smrse_tag = -1;
53 static int hf_smrse_length = -1;
54 static int hf_smrse_Octet_Format = -1;
55
56 /*--- Included file: packet-smrse-hf.c ---*/
57 #line 1 "../../asn1/smrse/packet-smrse-hf.c"
58 static int hf_smrse_sc_address = -1;              /* SMS_Address */
59 static int hf_smrse_password = -1;                /* Password */
60 static int hf_smrse_address_type = -1;            /* T_address_type */
61 static int hf_smrse_numbering_plan = -1;          /* T_numbering_plan */
62 static int hf_smrse_address_value = -1;           /* T_address_value */
63 static int hf_smrse_octet_format = -1;            /* T_octet_format */
64 static int hf_smrse_connect_fail_reason = -1;     /* Connect_fail */
65 static int hf_smrse_mt_priority_request = -1;     /* BOOLEAN */
66 static int hf_smrse_mt_mms = -1;                  /* BOOLEAN */
67 static int hf_smrse_mt_message_reference = -1;    /* RP_MR */
68 static int hf_smrse_mt_originating_address = -1;  /* SMS_Address */
69 static int hf_smrse_mt_destination_address = -1;  /* SMS_Address */
70 static int hf_smrse_mt_user_data = -1;            /* RP_UD */
71 static int hf_smrse_mt_origVMSCAddr = -1;         /* SMS_Address */
72 static int hf_smrse_mt_tariffClass = -1;          /* SM_TC */
73 static int hf_smrse_mo_message_reference = -1;    /* RP_MR */
74 static int hf_smrse_mo_originating_address = -1;  /* SMS_Address */
75 static int hf_smrse_mo_user_data = -1;            /* RP_UD */
76 static int hf_smrse_origVMSCAddr = -1;            /* SMS_Address */
77 static int hf_smrse_moimsi = -1;                  /* IMSI_Address */
78 static int hf_smrse_message_reference = -1;       /* RP_MR */
79 static int hf_smrse_error_reason = -1;            /* Error_reason */
80 static int hf_smrse_msg_waiting_set = -1;         /* BOOLEAN */
81 static int hf_smrse_alerting_MS_ISDN = -1;        /* SMS_Address */
82 static int hf_smrse_sm_diag_info = -1;            /* RP_UD */
83 static int hf_smrse_ms_address = -1;              /* SMS_Address */
84
85 /*--- End of included file: packet-smrse-hf.c ---*/
86 #line 48 "../../asn1/smrse/packet-smrse-template.c"
87
88 /* Initialize the subtree pointers */
89 static gint ett_smrse = -1;
90
91 /*--- Included file: packet-smrse-ett.c ---*/
92 #line 1 "../../asn1/smrse/packet-smrse-ett.c"
93 static gint ett_smrse_SMR_Bind = -1;
94 static gint ett_smrse_SMS_Address = -1;
95 static gint ett_smrse_T_address_value = -1;
96 static gint ett_smrse_SMR_Bind_Confirm = -1;
97 static gint ett_smrse_SMR_Bind_Failure = -1;
98 static gint ett_smrse_SMR_Unbind = -1;
99 static gint ett_smrse_RPDataMT = -1;
100 static gint ett_smrse_RPDataMO = -1;
101 static gint ett_smrse_RPAck = -1;
102 static gint ett_smrse_RPError = -1;
103 static gint ett_smrse_RPAlertSC = -1;
104
105 /*--- End of included file: packet-smrse-ett.c ---*/
106 #line 52 "../../asn1/smrse/packet-smrse-template.c"
107
108
109
110 /*--- Included file: packet-smrse-fn.c ---*/
111 #line 1 "../../asn1/smrse/packet-smrse-fn.c"
112
113 static const value_string smrse_T_address_type_vals[] = {
114   {   0, "unknown-type" },
115   {   1, "internat-number" },
116   {   2, "national-number" },
117   {   3, "net-spec-number" },
118   {   4, "short-number" },
119   { 0, NULL }
120 };
121
122
123 static int
124 dissect_smrse_T_address_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
125   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
126                                                 NULL);
127
128   return offset;
129 }
130
131
132 static const value_string smrse_T_numbering_plan_vals[] = {
133   {   0, "unknown-numbering" },
134   {   1, "iSDN-numbering" },
135   {   3, "data-network-numbering" },
136   {   4, "telex-numbering" },
137   {   8, "national-numbering" },
138   {   9, "private-numbering" },
139   { 0, NULL }
140 };
141
142
143 static int
144 dissect_smrse_T_numbering_plan(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
145   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
146                                                 NULL);
147
148   return offset;
149 }
150
151
152
153
154 static int
155 dissect_smrse_T_octet_format(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
156 #line 21 "../../asn1/smrse/smrse.cnf"
157         char *strp,tmpstr[21];
158         guint32 i, start_offset;
159         gint8 class;
160         gboolean pc, ind;
161         gint32 tag;
162         guint32 len;
163         static char n2a[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
164
165         start_offset=offset;
166
167         /* skip the tag and length */
168         offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
169         offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
170         if(len>10){
171                 len=10;
172         }
173         strp=tmpstr;
174         for(i=0;i<len;i++){
175                 *strp++=n2a[tvb_get_guint8(tvb, offset)&0x0f];
176                 *strp++=n2a[(tvb_get_guint8(tvb, offset)>>4)&0x0f];
177                 offset++;
178         }
179         *strp=0;
180
181         proto_tree_add_string(tree, hf_smrse_Octet_Format, tvb, start_offset, offset-start_offset, tmpstr);
182
183         return offset;
184
185
186
187   return offset;
188 }
189
190
191 static const value_string smrse_T_address_value_vals[] = {
192   {   0, "octet-format" },
193   { 0, NULL }
194 };
195
196 static const ber_choice_t T_address_value_choice[] = {
197   {   0, &hf_smrse_octet_format  , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_smrse_T_octet_format },
198   { 0, NULL, 0, 0, 0, NULL }
199 };
200
201 static int
202 dissect_smrse_T_address_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
203   offset = dissect_ber_choice(actx, tree, tvb, offset,
204                                  T_address_value_choice, hf_index, ett_smrse_T_address_value,
205                                  NULL);
206
207   return offset;
208 }
209
210
211 static const ber_sequence_t SMS_Address_sequence[] = {
212   { &hf_smrse_address_type  , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_T_address_type },
213   { &hf_smrse_numbering_plan, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_T_numbering_plan },
214   { &hf_smrse_address_value , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_smrse_T_address_value },
215   { NULL, 0, 0, 0, NULL }
216 };
217
218 static int
219 dissect_smrse_SMS_Address(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
220   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
221                                    SMS_Address_sequence, hf_index, ett_smrse_SMS_Address);
222
223   return offset;
224 }
225
226
227
228 static int
229 dissect_smrse_Password(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
230   offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_PrintableString,
231                                             actx, tree, tvb, offset, hf_index,
232                                             NULL);
233
234   return offset;
235 }
236
237
238 static const ber_sequence_t SMR_Bind_sequence[] = {
239   { &hf_smrse_sc_address    , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_smrse_SMS_Address },
240   { &hf_smrse_password      , BER_CLASS_UNI, BER_UNI_TAG_PrintableString, BER_FLAGS_NOOWNTAG, dissect_smrse_Password },
241   { NULL, 0, 0, 0, NULL }
242 };
243
244 static int
245 dissect_smrse_SMR_Bind(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
246   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
247                                    SMR_Bind_sequence, hf_index, ett_smrse_SMR_Bind);
248
249   return offset;
250 }
251
252
253
254 static int
255 dissect_smrse_IMSI_Address(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
256   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
257                                        NULL);
258
259   return offset;
260 }
261
262
263 static const ber_sequence_t SMR_Bind_Confirm_sequence[] = {
264   { NULL, 0, 0, 0, NULL }
265 };
266
267 static int
268 dissect_smrse_SMR_Bind_Confirm(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
269   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
270                                    SMR_Bind_Confirm_sequence, hf_index, ett_smrse_SMR_Bind_Confirm);
271
272   return offset;
273 }
274
275
276 static const value_string smrse_Connect_fail_vals[] = {
277   {   0, "not-entitled" },
278   {   1, "tmp-overload" },
279   {   2, "tmp-failure" },
280   {   3, "id-or-passwd" },
281   {   4, "not-supported" },
282   {   5, "inv-SC-addr" },
283   { 0, NULL }
284 };
285
286
287 static int
288 dissect_smrse_Connect_fail(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
289   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
290                                                 NULL);
291
292   return offset;
293 }
294
295
296 static const ber_sequence_t SMR_Bind_Failure_sequence[] = {
297   { &hf_smrse_connect_fail_reason, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_Connect_fail },
298   { NULL, 0, 0, 0, NULL }
299 };
300
301 static int
302 dissect_smrse_SMR_Bind_Failure(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
303   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
304                                    SMR_Bind_Failure_sequence, hf_index, ett_smrse_SMR_Bind_Failure);
305
306   return offset;
307 }
308
309
310 static const ber_sequence_t SMR_Unbind_sequence[] = {
311   { NULL, 0, 0, 0, NULL }
312 };
313
314 static int
315 dissect_smrse_SMR_Unbind(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
316   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
317                                    SMR_Unbind_sequence, hf_index, ett_smrse_SMR_Unbind);
318
319   return offset;
320 }
321
322
323
324 static int
325 dissect_smrse_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
326   offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
327
328   return offset;
329 }
330
331
332
333 static int
334 dissect_smrse_RP_MR(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
335   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
336                                                 NULL);
337
338   return offset;
339 }
340
341
342
343 static int
344 dissect_smrse_RP_UD(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
345   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
346                                        NULL);
347
348   return offset;
349 }
350
351
352
353 static int
354 dissect_smrse_SM_TC(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
355   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
356                                                 NULL);
357
358   return offset;
359 }
360
361
362 static const ber_sequence_t RPDataMT_sequence[] = {
363   { &hf_smrse_mt_priority_request, BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_smrse_BOOLEAN },
364   { &hf_smrse_mt_mms        , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_smrse_BOOLEAN },
365   { &hf_smrse_mt_message_reference, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_MR },
366   { &hf_smrse_mt_originating_address, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_smrse_SMS_Address },
367   { &hf_smrse_mt_destination_address, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_smrse_SMS_Address },
368   { &hf_smrse_mt_user_data  , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_UD },
369   { &hf_smrse_mt_origVMSCAddr, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_smrse_SMS_Address },
370   { &hf_smrse_mt_tariffClass, BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_smrse_SM_TC },
371   { NULL, 0, 0, 0, NULL }
372 };
373
374 static int
375 dissect_smrse_RPDataMT(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
376   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
377                                    RPDataMT_sequence, hf_index, ett_smrse_RPDataMT);
378
379   return offset;
380 }
381
382
383 static const ber_sequence_t RPDataMO_sequence[] = {
384   { &hf_smrse_mo_message_reference, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_MR },
385   { &hf_smrse_mo_originating_address, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_smrse_SMS_Address },
386   { &hf_smrse_mo_user_data  , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_UD },
387   { &hf_smrse_origVMSCAddr  , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_smrse_SMS_Address },
388   { &hf_smrse_moimsi        , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_smrse_IMSI_Address },
389   { NULL, 0, 0, 0, NULL }
390 };
391
392 static int
393 dissect_smrse_RPDataMO(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
394   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
395                                    RPDataMO_sequence, hf_index, ett_smrse_RPDataMO);
396
397   return offset;
398 }
399
400
401 static const ber_sequence_t RPAck_sequence[] = {
402   { &hf_smrse_message_reference, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_MR },
403   { NULL, 0, 0, 0, NULL }
404 };
405
406 static int
407 dissect_smrse_RPAck(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
408   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
409                                    RPAck_sequence, hf_index, ett_smrse_RPAck);
410
411   return offset;
412 }
413
414
415 static const value_string smrse_Error_reason_vals[] = {
416   {   1, "unknown-subscriber" },
417   {   9, "illegal-subscriber" },
418   {  11, "teleservice-not-provisioned" },
419   {  13, "call-barred" },
420   {  15, "cug-reject" },
421   {  19, "sMS-ll-capabilities-not-prov" },
422   {  20, "error-in-MS" },
423   {  21, "facility-not-supported" },
424   {  22, "memory-capacity-exceeded" },
425   {  29, "absent-subscriber" },
426   {  30, "ms-busy-for-MT-sms" },
427   {  36, "system-failure" },
428   {  44, "illegal-equipment" },
429   {  60, "no-resp-to-paging" },
430   {  61, "gMSC-congestion" },
431   {  70, "dublicate-sm" },
432   { 101, "sC-congestion" },
433   { 103, "mS-not-SC-Subscriber" },
434   { 104, "invalid-sme-address" },
435   { 0, NULL }
436 };
437
438
439 static int
440 dissect_smrse_Error_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
441   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
442                                                 NULL);
443
444   return offset;
445 }
446
447
448 static const ber_sequence_t RPError_sequence[] = {
449   { &hf_smrse_error_reason  , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_Error_reason },
450   { &hf_smrse_msg_waiting_set, BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_smrse_BOOLEAN },
451   { &hf_smrse_message_reference, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_MR },
452   { &hf_smrse_alerting_MS_ISDN, BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_smrse_SMS_Address },
453   { &hf_smrse_sm_diag_info  , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_smrse_RP_UD },
454   { NULL, 0, 0, 0, NULL }
455 };
456
457 static int
458 dissect_smrse_RPError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
459   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
460                                    RPError_sequence, hf_index, ett_smrse_RPError);
461
462   return offset;
463 }
464
465
466 static const ber_sequence_t RPAlertSC_sequence[] = {
467   { &hf_smrse_ms_address    , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_smrse_SMS_Address },
468   { &hf_smrse_message_reference, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smrse_RP_MR },
469   { NULL, 0, 0, 0, NULL }
470 };
471
472 static int
473 dissect_smrse_RPAlertSC(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
474   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
475                                    RPAlertSC_sequence, hf_index, ett_smrse_RPAlertSC);
476
477   return offset;
478 }
479
480
481 /*--- End of included file: packet-smrse-fn.c ---*/
482 #line 55 "../../asn1/smrse/packet-smrse-template.c"
483
484 static const value_string tag_vals[] = {
485         {  1,   "AliveTest" },
486         {  2,   "AliveTestRsp" },
487         {  3,   "Bind" },
488         {  4,   "BindRsp" },
489         {  5,   "BindFail" },
490         {  6,   "Unbind" },
491         {  7,   "MT" },
492         {  8,   "MO" },
493         {  9,   "Ack" },
494         { 10,   "Error" },
495         { 11,   "Alert" },
496         { 0, NULL }
497 };
498
499 static int
500 dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
501 {
502         proto_item *item = NULL;
503         proto_tree *tree = NULL;
504         guint8 reserved, tag;
505         int offset=0;
506         asn1_ctx_t asn1_ctx;
507         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
508
509         reserved=tvb_get_guint8(tvb, 0);
510         tag=tvb_get_guint8(tvb, 3);
511
512         if( reserved!= 126 )
513                 return 0;
514         if( (tag<1)||(tag>11) )
515                 return 0;
516
517         if(parent_tree){
518                 item = proto_tree_add_item(parent_tree, proto_smrse, tvb, 0, -1, ENC_NA);
519                 tree = proto_item_add_subtree(item, ett_smrse);
520         }
521
522         col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMRSE");
523         if (check_col(pinfo->cinfo, COL_INFO))
524                 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x"));
525
526         proto_tree_add_item(tree, hf_smrse_reserved, tvb, 0, 1, ENC_BIG_ENDIAN);
527         proto_tree_add_item(tree, hf_smrse_length, tvb, 1, 2, ENC_BIG_ENDIAN);
528         proto_tree_add_item(tree, hf_smrse_tag, tvb, 3, 1, ENC_BIG_ENDIAN);
529
530         switch(tag){
531         case 1:
532         case 2:
533                 offset=4;
534                 break;
535         case 3:
536                 offset=dissect_smrse_SMR_Bind(FALSE, tvb, 4, &asn1_ctx, tree, -1);
537                 break;
538         case 4:
539                 offset=dissect_smrse_SMR_Bind_Confirm(FALSE, tvb, 4, &asn1_ctx, tree, -1);
540                 break;
541         case 5:
542                 offset=dissect_smrse_SMR_Bind_Failure(FALSE, tvb, 4, &asn1_ctx, tree, -1);
543                 break;
544         case 6:
545                 offset=dissect_smrse_SMR_Unbind(FALSE, tvb, 4, &asn1_ctx, tree, -1);
546                 break;
547         case 7:
548                 offset=dissect_smrse_RPDataMT(FALSE, tvb, 4, &asn1_ctx, tree, -1);
549                 break;
550         case 8:
551                 offset=dissect_smrse_RPDataMO(FALSE, tvb, 4, &asn1_ctx, tree, -1);
552                 break;
553         case 9:
554                 offset=dissect_smrse_RPAck(FALSE, tvb, 4, &asn1_ctx, tree, -1);
555                 break;
556         case 10:
557                 offset=dissect_smrse_RPError(FALSE, tvb, 4, &asn1_ctx, tree, -1);
558                 break;
559         case 11:
560                 offset=dissect_smrse_RPAlertSC(FALSE, tvb, 4, &asn1_ctx, tree, -1);
561                 break;
562         }
563
564         return offset;
565 }
566
567 /*--- proto_register_smrse ----------------------------------------------*/
568 void proto_register_smrse(void) {
569
570   /* List of fields */
571   static hf_register_info hf[] = {
572         { &hf_smrse_reserved, {
573                 "Reserved", "smrse.reserved", FT_UINT8, BASE_DEC,
574                 NULL, 0, "Reserved byte, must be 126", HFILL }},
575         { &hf_smrse_tag, {
576                 "Tag", "smrse.tag", FT_UINT8, BASE_DEC,
577                 VALS(tag_vals), 0, NULL, HFILL }},
578         { &hf_smrse_length, {
579                 "Length", "smrse.length", FT_UINT16, BASE_DEC,
580                 NULL, 0, "Length of SMRSE PDU", HFILL }},
581     { &hf_smrse_Octet_Format,
582       { "octet-Format", "smrse.octet_Format",
583         FT_STRING, BASE_NONE, NULL, 0,
584         "SMS-Address/address-value/octet-format", HFILL }},
585
586
587 /*--- Included file: packet-smrse-hfarr.c ---*/
588 #line 1 "../../asn1/smrse/packet-smrse-hfarr.c"
589     { &hf_smrse_sc_address,
590       { "sc-address", "smrse.sc_address",
591         FT_NONE, BASE_NONE, NULL, 0,
592         "SMS_Address", HFILL }},
593     { &hf_smrse_password,
594       { "password", "smrse.password",
595         FT_STRING, BASE_NONE, NULL, 0,
596         NULL, HFILL }},
597     { &hf_smrse_address_type,
598       { "address-type", "smrse.address_type",
599         FT_INT32, BASE_DEC, VALS(smrse_T_address_type_vals), 0,
600         NULL, HFILL }},
601     { &hf_smrse_numbering_plan,
602       { "numbering-plan", "smrse.numbering_plan",
603         FT_INT32, BASE_DEC, VALS(smrse_T_numbering_plan_vals), 0,
604         NULL, HFILL }},
605     { &hf_smrse_address_value,
606       { "address-value", "smrse.address_value",
607         FT_UINT32, BASE_DEC, VALS(smrse_T_address_value_vals), 0,
608         NULL, HFILL }},
609     { &hf_smrse_octet_format,
610       { "octet-format", "smrse.octet_format",
611         FT_BYTES, BASE_NONE, NULL, 0,
612         "T_octet_format", HFILL }},
613     { &hf_smrse_connect_fail_reason,
614       { "connect-fail-reason", "smrse.connect_fail_reason",
615         FT_INT32, BASE_DEC, VALS(smrse_Connect_fail_vals), 0,
616         "Connect_fail", HFILL }},
617     { &hf_smrse_mt_priority_request,
618       { "mt-priority-request", "smrse.mt_priority_request",
619         FT_BOOLEAN, BASE_NONE, NULL, 0,
620         "BOOLEAN", HFILL }},
621     { &hf_smrse_mt_mms,
622       { "mt-mms", "smrse.mt_mms",
623         FT_BOOLEAN, BASE_NONE, NULL, 0,
624         "BOOLEAN", HFILL }},
625     { &hf_smrse_mt_message_reference,
626       { "mt-message-reference", "smrse.mt_message_reference",
627         FT_UINT32, BASE_DEC, NULL, 0,
628         "RP_MR", HFILL }},
629     { &hf_smrse_mt_originating_address,
630       { "mt-originating-address", "smrse.mt_originating_address",
631         FT_NONE, BASE_NONE, NULL, 0,
632         "SMS_Address", HFILL }},
633     { &hf_smrse_mt_destination_address,
634       { "mt-destination-address", "smrse.mt_destination_address",
635         FT_NONE, BASE_NONE, NULL, 0,
636         "SMS_Address", HFILL }},
637     { &hf_smrse_mt_user_data,
638       { "mt-user-data", "smrse.mt_user_data",
639         FT_BYTES, BASE_NONE, NULL, 0,
640         "RP_UD", HFILL }},
641     { &hf_smrse_mt_origVMSCAddr,
642       { "mt-origVMSCAddr", "smrse.mt_origVMSCAddr",
643         FT_NONE, BASE_NONE, NULL, 0,
644         "SMS_Address", HFILL }},
645     { &hf_smrse_mt_tariffClass,
646       { "mt-tariffClass", "smrse.mt_tariffClass",
647         FT_UINT32, BASE_DEC, NULL, 0,
648         "SM_TC", HFILL }},
649     { &hf_smrse_mo_message_reference,
650       { "mo-message-reference", "smrse.mo_message_reference",
651         FT_UINT32, BASE_DEC, NULL, 0,
652         "RP_MR", HFILL }},
653     { &hf_smrse_mo_originating_address,
654       { "mo-originating-address", "smrse.mo_originating_address",
655         FT_NONE, BASE_NONE, NULL, 0,
656         "SMS_Address", HFILL }},
657     { &hf_smrse_mo_user_data,
658       { "mo-user-data", "smrse.mo_user_data",
659         FT_BYTES, BASE_NONE, NULL, 0,
660         "RP_UD", HFILL }},
661     { &hf_smrse_origVMSCAddr,
662       { "origVMSCAddr", "smrse.origVMSCAddr",
663         FT_NONE, BASE_NONE, NULL, 0,
664         "SMS_Address", HFILL }},
665     { &hf_smrse_moimsi,
666       { "moimsi", "smrse.moimsi",
667         FT_BYTES, BASE_NONE, NULL, 0,
668         "IMSI_Address", HFILL }},
669     { &hf_smrse_message_reference,
670       { "message-reference", "smrse.message_reference",
671         FT_UINT32, BASE_DEC, NULL, 0,
672         "RP_MR", HFILL }},
673     { &hf_smrse_error_reason,
674       { "error-reason", "smrse.error_reason",
675         FT_INT32, BASE_DEC, VALS(smrse_Error_reason_vals), 0,
676         NULL, HFILL }},
677     { &hf_smrse_msg_waiting_set,
678       { "msg-waiting-set", "smrse.msg_waiting_set",
679         FT_BOOLEAN, BASE_NONE, NULL, 0,
680         "BOOLEAN", HFILL }},
681     { &hf_smrse_alerting_MS_ISDN,
682       { "alerting-MS-ISDN", "smrse.alerting_MS_ISDN",
683         FT_NONE, BASE_NONE, NULL, 0,
684         "SMS_Address", HFILL }},
685     { &hf_smrse_sm_diag_info,
686       { "sm-diag-info", "smrse.sm_diag_info",
687         FT_BYTES, BASE_NONE, NULL, 0,
688         "RP_UD", HFILL }},
689     { &hf_smrse_ms_address,
690       { "ms-address", "smrse.ms_address",
691         FT_NONE, BASE_NONE, NULL, 0,
692         "SMS_Address", HFILL }},
693
694 /*--- End of included file: packet-smrse-hfarr.c ---*/
695 #line 159 "../../asn1/smrse/packet-smrse-template.c"
696   };
697
698   /* List of subtrees */
699   static gint *ett[] = {
700     &ett_smrse,
701
702 /*--- Included file: packet-smrse-ettarr.c ---*/
703 #line 1 "../../asn1/smrse/packet-smrse-ettarr.c"
704     &ett_smrse_SMR_Bind,
705     &ett_smrse_SMS_Address,
706     &ett_smrse_T_address_value,
707     &ett_smrse_SMR_Bind_Confirm,
708     &ett_smrse_SMR_Bind_Failure,
709     &ett_smrse_SMR_Unbind,
710     &ett_smrse_RPDataMT,
711     &ett_smrse_RPDataMO,
712     &ett_smrse_RPAck,
713     &ett_smrse_RPError,
714     &ett_smrse_RPAlertSC,
715
716 /*--- End of included file: packet-smrse-ettarr.c ---*/
717 #line 165 "../../asn1/smrse/packet-smrse-template.c"
718   };
719
720   /* Register protocol */
721   proto_smrse = proto_register_protocol(PNAME, PSNAME, PFNAME);
722
723   /* Register fields and subtrees */
724   proto_register_field_array(proto_smrse, hf, array_length(hf));
725   proto_register_subtree_array(ett, array_length(ett));
726
727 }
728
729
730 /*--- proto_reg_handoff_smrse -------------------------------------------*/
731 void proto_reg_handoff_smrse(void) {
732   dissector_handle_t smrse_handle;
733
734   smrse_handle = new_create_dissector_handle(dissect_smrse, proto_smrse);
735   dissector_add_uint("tcp.port",TCP_PORT_SMRSE, smrse_handle);
736 }
737