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