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