db297821e2d5854659ce449e71b8ad96453654ce
[obnox/wireshark/wip.git] / asn1 / t125 / packet-t125-template.c
1 /* packet-t125.c
2  * Routines for t125 packet dissection
3  * Copyright 2007, Ronnie Sahlberg
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  *
25  */
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <glib.h>
32 #include <epan/packet.h>
33
34 #include <string.h>
35
36 #include <epan/asn1.h>
37 #include "packet-ber.h"
38
39 #define PNAME  "MULTIPOINT-COMMUNICATION-SERVICE T.125"
40 #define PSNAME "T.125"
41 #define PFNAME "t125"
42
43
44 /* Initialize the protocol and registered fields */
45 static int proto_t125 = -1;
46 #include "packet-t125-hf.c"
47
48 /* Initialize the subtree pointers */
49 static int ett_t125 = -1;
50 #include "packet-t125-ett.c"
51
52 #include "packet-t125-fn.c"
53
54 static int
55 dissect_t125(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree)
56 {
57   proto_item *item = NULL;
58   proto_tree *tree = NULL;
59   gint8 class;
60   gboolean pc;
61   gint32 tag;
62
63   col_set_str(pinfo->cinfo, COL_PROTOCOL, "T.125");
64   col_clear(pinfo->cinfo, COL_INFO);
65
66   item = proto_tree_add_item(parent_tree, proto_t125, tvb, 0, tvb_length(tvb), FALSE);
67   tree = proto_item_add_subtree(item, ett_t125);
68
69   get_ber_identifier(tvb, 0, &class, &pc, &tag);
70
71   if ( (class==BER_CLASS_APP) && (tag>=101) && (tag<=104) ){
72     dissect_ConnectMCSPDU_PDU(tvb, pinfo, tree);
73   } else {
74     col_set_str(pinfo->cinfo, COL_INFO, "T.125 payload");
75     proto_tree_add_text(tree, tvb, 0, -1, "T.125 payload");
76   }
77
78   return tvb_length(tvb);
79 }
80
81
82 /*--- proto_register_t125 -------------------------------------------*/
83 void proto_register_t125(void) {
84
85   /* List of fields */
86   static hf_register_info hf[] = {
87 #include "packet-t125-hfarr.c"
88   };
89
90   /* List of subtrees */
91   static gint *ett[] = {
92           &ett_t125,
93 #include "packet-t125-ettarr.c"
94   };
95
96   /* Register protocol */
97   proto_t125 = proto_register_protocol(PNAME, PSNAME, PFNAME);
98   /* Register fields and subtrees */
99   proto_register_field_array(proto_t125, hf, array_length(hf));
100   proto_register_subtree_array(ett, array_length(ett));
101
102   new_register_dissector("t125", dissect_t125, proto_t125);
103 }
104
105
106 /*--- proto_reg_handoff_t125 ---------------------------------------*/
107 void proto_reg_handoff_t125(void) {
108 }