Update Free Software Foundation address.
[metze/wireshark/wip.git] / asn1 / pkinit / packet-pkinit-template.c
1 /* packet-pkinit.c
2  * Routines for PKINIT packet dissection
3  *  Ronnie Sahlberg 2004
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/asn1.h>
33
34 #include "packet-ber.h"
35 #include "packet-pkinit.h"
36 #include "packet-cms.h"
37 #include "packet-pkix1explicit.h"
38 #include "packet-kerberos.h"
39
40 #define PNAME  "PKINIT"
41 #define PSNAME "PKInit"
42 #define PFNAME "pkinit"
43
44 /* Initialize the protocol and registered fields */
45 static int proto_pkinit = -1;
46 #include "packet-pkinit-hf.c"
47
48 /* Initialize the subtree pointers */
49 #include "packet-pkinit-ett.c"
50
51 static int dissect_KerberosV5Spec2_KerberosTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,  asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
52 static int dissect_KerberosV5Spec2_Checksum(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,  asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_);
53
54 #include "packet-pkinit-fn.c"
55
56 int
57 dissect_pkinit_PA_PK_AS_REQ(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) {
58   offset = dissect_pkinit_PaPkAsReq(FALSE, tvb, offset, actx, tree, -1);
59   return offset;
60 }
61
62 int
63 dissect_pkinit_PA_PK_AS_REP(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) {
64   offset = dissect_pkinit_PaPkAsRep(FALSE, tvb, offset, actx, tree, -1);
65   return offset;
66 }
67
68 static int
69 dissect_KerberosV5Spec2_KerberosTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
70   offset = dissect_krb5_ctime(tree, tvb, offset, actx);
71   return offset;
72 }
73
74 static int
75 dissect_KerberosV5Spec2_Checksum(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) {
76   offset = dissect_krb5_Checksum(tree, tvb, offset, actx);
77   return offset;
78 }
79
80
81 /*--- proto_register_pkinit ----------------------------------------------*/
82 void proto_register_pkinit(void) {
83
84   /* List of fields */
85   static hf_register_info hf[] = {
86 #include "packet-pkinit-hfarr.c"
87   };
88
89   /* List of subtrees */
90   static gint *ett[] = {
91 #include "packet-pkinit-ettarr.c"
92   };
93
94   /* Register protocol */
95   proto_pkinit = proto_register_protocol(PNAME, PSNAME, PFNAME);
96
97   /* Register fields and subtrees */
98   proto_register_field_array(proto_pkinit, hf, array_length(hf));
99   proto_register_subtree_array(ett, array_length(ett));
100
101 }
102
103
104 /*--- proto_reg_handoff_pkinit -------------------------------------------*/
105 void proto_reg_handoff_pkinit(void) {
106 #include "packet-pkinit-dis-tab.c"
107 }
108