Dissect Name and Certificate and add some extensions pkix1explicit.
[obnox/wireshark/wip.git] / asn1 / pkix1explicit / packet-pkix1explicit-template.c
1 #define BER_UNI_TAG_TeletexString           20  /* workaround bug in asn2wrs */
2
3 /* packet-pkix1explicit.c
4  * Routines for PKIX1Explitic packet dissection
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <glib.h>
32 #include <epan/packet.h>
33 #include <epan/conversation.h>
34 #include <epan/asn1.h>
35 #include <epan/oids.h>
36
37 #include <stdio.h>
38 #include <string.h>
39
40 #include "packet-ber.h"
41 #include "packet-pkix1explicit.h"
42 #include "packet-x509af.h"
43 #include "packet-x509if.h"
44 #include "packet-x509ce.h"
45
46 #define PNAME  "PKIX1Explitit"
47 #define PSNAME "PKIX1EXPLICIT"
48 #define PFNAME "pkix1explicit"
49
50 /* Initialize the protocol and registered fields */
51 static int proto_pkix1explicit = -1;
52 static int hf_pkix1explicit_object_identifier_id = -1;
53 #include "packet-pkix1explicit-hf.c"
54
55 /* Initialize the subtree pointers */
56 #include "packet-pkix1explicit-ett.c"
57
58
59 static const char *object_identifier_id;
60
61 int
62 dissect_pkix1explicit_Certificate(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index) {
63   offset = dissect_x509af_Certificate(implicit_tag, tvb, offset, actx, tree, hf_index);
64
65   return offset;
66 }
67 int
68 dissect_pkix1explicit_CertificateList(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index) {
69   offset = dissect_x509af_CertificateList(implicit_tag, tvb, offset, actx, tree, hf_index);
70
71   return offset;
72 }
73 int
74 dissect_pkix1explicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index) {
75   offset = dissect_x509ce_GeneralName(implicit_tag, tvb, offset, actx, tree, hf_index);
76
77   return offset;
78 }
79 int
80 dissect_pkix1explicit_Name(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index) {
81   offset = dissect_x509if_Name(implicit_tag, tvb, offset, actx, tree, hf_index);
82
83   return offset;
84 }
85 int
86 dissect_pkix1explicit_AlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index) {
87   offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, actx, tree, hf_index);
88
89   return offset;
90 }
91
92 int
93 dissect_pkix1explicit_SubjectPublicKeyInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index) {
94   offset = dissect_x509af_SubjectPublicKeyInfo(implicit_tag, tvb, offset, actx, tree, hf_index);
95
96   return offset;
97 }
98
99
100 #include "packet-pkix1explicit-fn.c"
101
102
103 /*--- proto_register_pkix1explicit ----------------------------------------------*/
104 void proto_register_pkix1explicit(void) {
105
106   /* List of fields */
107   static hf_register_info hf[] = {
108     { &hf_pkix1explicit_object_identifier_id, 
109       { "Id", "pkix1explicit.id", FT_STRING, BASE_NONE, NULL, 0,
110         "Object identifier Id", HFILL }},
111 #include "packet-pkix1explicit-hfarr.c"
112   };
113
114   /* List of subtrees */
115   static gint *ett[] = {
116 #include "packet-pkix1explicit-ettarr.c"
117   };
118
119   /* Register protocol */
120   proto_pkix1explicit = proto_register_protocol(PNAME, PSNAME, PFNAME);
121
122   /* Register fields and subtrees */
123   proto_register_field_array(proto_pkix1explicit, hf, array_length(hf));
124   proto_register_subtree_array(ett, array_length(ett));
125
126 }
127
128
129 /*--- proto_reg_handoff_pkix1explicit -------------------------------------------*/
130 void proto_reg_handoff_pkix1explicit(void) {
131         oid_add_from_string("id-pkix","1.3.6.1.5.5.7");
132 #include "packet-pkix1explicit-dis-tab.c"
133 }
134