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