New protocol: RFC2634 ExtendedSecurityServices
[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  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
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
34 #include <stdio.h>
35 #include <string.h>
36
37 #include "packet-ber.h"
38 #include "packet-pkinit.h"
39 #include "packet-cms.h"
40 #include "packet-pkix1explicit.h"
41 #include "packet-kerberos.h"
42
43 #define PNAME  "PKINIT"
44 #define PSNAME "PKInit"
45 #define PFNAME "pkinit"
46
47 /* Initialize the protocol and registered fields */
48 static int proto_pkinit = -1;
49 #include "packet-pkinit-hf.c"
50
51 /* Initialize the subtree pointers */
52 #include "packet-pkinit-ett.c"
53
54 static int dissect_KerberosV5Spec2_KerberosTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index _U_);
55 static int dissect_KerberosV5Spec2_Checksum(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index _U_);
56
57 #include "packet-pkinit-fn.c"
58
59 int
60 dissect_pkinit_PA_PK_AS_REQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
61   offset = dissect_pkinit_PaPkAsReq(FALSE, tvb, offset, pinfo, tree, -1);
62   return offset;
63 }
64
65 int
66 dissect_pkinit_PA_PK_AS_REP(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
67   offset = dissect_pkinit_PaPkAsRep(FALSE, tvb, offset, pinfo, tree, -1);
68   return offset;
69 }
70
71 static int
72 dissect_KerberosV5Spec2_KerberosTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index _U_) {
73   offset = dissect_krb5_ctime(pinfo, tree, tvb, offset);
74   return offset;
75 }
76
77 static int
78 dissect_KerberosV5Spec2_Checksum(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index _U_) {
79   offset = dissect_krb5_Checksum(pinfo, tree, tvb, offset);
80   return offset;
81 }
82
83
84 /*--- proto_register_pkinit ----------------------------------------------*/
85 void proto_register_pkinit(void) {
86
87   /* List of fields */
88   static hf_register_info hf[] = {
89 #include "packet-pkinit-hfarr.c"
90   };
91
92   /* List of subtrees */
93   static gint *ett[] = {
94 #include "packet-pkinit-ettarr.c"
95   };
96
97   /* Register protocol */
98   proto_pkinit = proto_register_protocol(PNAME, PSNAME, PFNAME);
99
100   /* Register fields and subtrees */
101   proto_register_field_array(proto_pkinit, hf, array_length(hf));
102   proto_register_subtree_array(ett, array_length(ett));
103
104 }
105
106
107 /*--- proto_reg_handoff_pkinit -------------------------------------------*/
108 void proto_reg_handoff_pkinit(void) {
109 #include "packet-pkinit-dis-tab.c"
110 }
111