Include <epan/oid_resolv.h> to declare get_oid_str_name().
[obnox/wireshark/wip.git] / asn1 / x420 / packet-x420-template.c
1 /* packet-x420.c
2  * Routines for X.420 (X.400 Message Transfer)  packet dissection
3  * Graeme Lunt 2005
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 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <glib.h>
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
33 #include <epan/oid_resolv.h>
34
35 #include <stdio.h>
36 #include <string.h>
37
38 #include "packet-ber.h"
39 #include "packet-acse.h"
40 #include "packet-ros.h"
41
42 #include "packet-x509af.h"
43 #include "packet-x509ce.h"
44 #include "packet-x411.h"
45
46 #include "packet-x420.h"
47
48 #define PNAME  "X.420 Information Object"
49 #define PSNAME "X420"
50 #define PFNAME "x420"
51
52 /* Initialize the protocol and registered fields */
53 int proto_x420 = -1;
54
55 static const char *object_identifier_id; /* content type identifier */
56
57 static const value_string charsetreg_vals [] = {
58   { 1, "C0: (ISO/IEC 6429)"},
59   { 6, "G0: ASCII (ISO/IEC 646)"},
60   { 77, "C1: (ISO/IEC 6429)"},
61   { 100, "Gn: Latin Alphabet No.1, Western European Supplementary Set (GR area of ISO-8859-1)"},
62   { 101, "Gn: Latin Alphabet No.2, Central EuropeanSupplementary Set (GR area of ISO-8859-2)"},
63   { 104, "C0: (ISO/IEC 4873)"},
64   { 105, "C1: (ISO/IEC 4873)"},
65   { 106, "C0: Teletex (CCITT T.61)"},
66   { 107, "C1: Teletex (CCITT T.61)"},
67   { 109, "Gn: Latin Alphabet No.3, Southern European Supplementary Set (GR area of ISO-8859-3)"},
68   { 110, "Gn: Latin Alphabet No.4, Baltic Supplementary Set (GR area of ISO-8859-4)"},
69   { 126, "Gn: Greek Supplementary Set (GR area of ISO-8859-7)"},
70   { 127, "Gn: Arabic Supplementary Set (GR area of ISO-8859-6)"},
71   { 138, "Gn: Hebrew Supplementary Set (GR area of ISO-8859-8)"},
72   { 144, "Gn: Cyrillic Supplementary Set (GR area of ISO-8859-5)"},
73   { 148, "Gn: Latin Alphabet No.5, Cyrillic Supplementary Set (GR area of ISO-8859-9)"},
74   { 154, "Gn: Supplementary Set for Latin Alphabets No.1 or No.5, and No.2"},
75   { 157, "Gn: Latin Alphabet No.6, Arabic Supplementary Set (GR area of ISO-8859-10)"},
76   { 158, "Gn: Supplementary Set for Sami (Lappish) to complement Latin Alphabet No.6 (from Annex A  of ISO-8859-10)"},
77   { 166, "Gn: Thai Supplementary Set (GR area of ISO-8859-11)"},
78   { 179, "Gn: Latin Alphabet No.7, Baltic Rim Supplementary Set (GR area of ISO-8859-13)"},
79   { 182, "Gn: Welsh Variant of Latin Alphabet No.1, Supplementary Set (GR area of ISO-8859-1)"},
80   { 197, "Gn: Supplementary Set for Sami to complement Latin Alphabet No.6 (from Annex A  of ISO-8859-10)"},
81   { 199, "Gn: Latin Alphabet No.8, Celtic Supplementary Set (GR area of ISO-8859-14)"},
82   { 203, "Gn: Latin Alphabet No.9, European Rim Supplementary Set (GR area of ISO-8859-15)"},
83   { 0, NULL}
84 };
85
86 #include "packet-x420-hf.c"
87
88 /* Initialize the subtree pointers */
89 static gint ett_x420 = -1;
90 #include "packet-x420-ett.c"
91
92 #include "packet-x420-fn.c"
93
94 /*
95 * Dissect X420 PDUs inside a PPDU.
96 */
97 static void
98 dissect_x420(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
99 {
100         int offset = 0;
101         proto_item *item=NULL;
102         proto_tree *tree=NULL;
103
104         if(parent_tree){
105                 item = proto_tree_add_item(parent_tree, proto_x420, tvb, 0, -1, FALSE);
106                 tree = proto_item_add_subtree(item, ett_x420);
107         }
108
109         if (check_col(pinfo->cinfo, COL_PROTOCOL))
110                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "P22");
111         if (check_col(pinfo->cinfo, COL_INFO))
112           col_add_str(pinfo->cinfo, COL_INFO, "InterPersonal");
113
114         dissect_x420_InformationObject(TRUE, tvb, offset, pinfo , tree, -1);
115 }
116
117
118 /*--- proto_register_x420 -------------------------------------------*/
119 void proto_register_x420(void) {
120
121   /* List of fields */
122   static hf_register_info hf[] =
123   {
124 #include "packet-x420-hfarr.c"
125   };
126
127   /* List of subtrees */
128   static gint *ett[] = {
129     &ett_x420,
130 #include "packet-x420-ettarr.c"
131   };
132
133   /* Register protocol */
134   proto_x420 = proto_register_protocol(PNAME, PSNAME, PFNAME);
135   register_dissector("x420", dissect_x420, proto_x420);
136   /* Register fields and subtrees */
137   proto_register_field_array(proto_x420, hf, array_length(hf));
138   proto_register_subtree_array(ett, array_length(ett));
139
140 }
141
142
143 /*--- proto_reg_handoff_x420 --- */
144 void proto_reg_handoff_x420(void) {
145
146 #include "packet-x420-dis-tab.c" 
147
148   register_ber_oid_dissector("2.6.1.10.0", dissect_x420, proto_x420, "InterPersonal Message (1984)");
149   register_ber_oid_dissector("2.6.1.10.1", dissect_x420, proto_x420, "InterPersonal Message (1988)");
150
151
152 }