aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pkix1implicit.c
blob: 5830f6ac2c3df9e02e950966cda35149ba789326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/* Do not modify this file.                                                   */
/* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
/* ./packet-pkix1implicit.c                                                   */
/* ../../tools/asn2eth.py -e -X -b -p pkix1implicit -c pkix1implicit.cnf -s packet-pkix1implicit-template PKIX1IMPLICIT93.asn */

/* Input file: packet-pkix1implicit-template.c */

/* packet-pkix1implicit.c
 * Routines for PKIX1Implitic packet dissection
 *
 * $Id: packet-pkix1implicit-template.c 12203 2004-10-05 09:18:55Z guy $
 *
 * Ethereal - Network traffic analyzer
 * By Gerald Combs <gerald@ethereal.com>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <glib.h>
#include <epan/packet.h>
#include <epan/conversation.h>

#include <stdio.h>
#include <string.h>

#include "packet-ber.h"
#include "packet-pkix1implicit.h"

#define PNAME  "PKIX1Implitit"
#define PSNAME "PKIX1IMPLICIT"
#define PFNAME "pkix1implicit"

/* Initialize the protocol and registered fields */
static int proto_pkix1implicit = -1;

/*--- Included file: packet-pkix1implicit-hf.c ---*/

static int hf_pkix1implicit_Dummy_PDU = -1;       /* Dummy */
static int hf_pkix1implicit_noticeRef = -1;       /* NoticeReference */
static int hf_pkix1implicit_explicitText = -1;    /* DisplayText */
static int hf_pkix1implicit_organization = -1;    /* DisplayText */
static int hf_pkix1implicit_noticeNumbers = -1;   /* SEQUNCE_OF_INTEGER */
static int hf_pkix1implicit_noticeNumbers_item = -1;  /* INTEGER */
static int hf_pkix1implicit_visibleString = -1;   /* VisibleString */
static int hf_pkix1implicit_bmpString = -1;       /* BMPString */
static int hf_pkix1implicit_utf8String = -1;      /* UTF8String */

/*--- End of included file: packet-pkix1implicit-hf.c ---*/


/* Initialize the subtree pointers */

/*--- Included file: packet-pkix1implicit-ett.c ---*/

static gint ett_pkix1implicit_UserNotice = -1;
static gint ett_pkix1implicit_NoticeReference = -1;
static gint ett_pkix1implicit_SEQUNCE_OF_INTEGER = -1;
static gint ett_pkix1implicit_DisplayText = -1;

/*--- End of included file: packet-pkix1implicit-ett.c ---*/




/*--- Included file: packet-pkix1implicit-fn.c ---*/

/*--- Fields for imported types ---*/



static int
dissect_pkix1implicit_Dummy(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  { proto_item *ti_tmp;
  ti_tmp = proto_tree_add_item(tree, hf_index, tvb, offset>>8, 0, FALSE);
  proto_item_append_text(ti_tmp, ": NULL");
  }

  return offset;
}


static int
dissect_pkix1implicit_VisibleString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_VisibleString,
                                         pinfo, tree, tvb, offset, hf_index,
                                         NULL);

  return offset;
}
static int dissect_visibleString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_VisibleString(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_visibleString);
}


static int
dissect_pkix1implicit_BMPString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_BMPString,
                                         pinfo, tree, tvb, offset, hf_index,
                                         NULL);

  return offset;
}
static int dissect_bmpString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_BMPString(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_bmpString);
}


static int
dissect_pkix1implicit_UTF8String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
                                         pinfo, tree, tvb, offset, hf_index,
                                         NULL);

  return offset;
}
static int dissect_utf8String(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_UTF8String(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_utf8String);
}


static const value_string DisplayText_vals[] = {
  {   0, "visibleString" },
  {   1, "bmpString" },
  {   2, "utf8String" },
  { 0, NULL }
};

static const ber_choice DisplayText_choice[] = {
  {   0, BER_CLASS_UNI, BER_UNI_TAG_VisibleString, BER_FLAGS_NOOWNTAG, dissect_visibleString },
  {   1, BER_CLASS_UNI, BER_UNI_TAG_BMPString, BER_FLAGS_NOOWNTAG, dissect_bmpString },
  {   2, BER_CLASS_UNI, BER_UNI_TAG_UTF8String, BER_FLAGS_NOOWNTAG, dissect_utf8String },
  { 0, 0, 0, 0, NULL }
};

static int
dissect_pkix1implicit_DisplayText(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_choice(pinfo, tree, tvb, offset,
                              DisplayText_choice, hf_index, ett_pkix1implicit_DisplayText);

  return offset;
}
static int dissect_explicitText(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_DisplayText(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_explicitText);
}
static int dissect_organization(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_DisplayText(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_organization);
}



static int
dissect_pkix1implicit_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);

  return offset;
}
static int dissect_noticeNumbers_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_noticeNumbers_item);
}

static const ber_sequence SEQUNCE_OF_INTEGER_sequence_of[1] = {
  { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_noticeNumbers_item },
};

static int
dissect_pkix1implicit_SEQUNCE_OF_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
                                   SEQUNCE_OF_INTEGER_sequence_of, hf_index, ett_pkix1implicit_SEQUNCE_OF_INTEGER);

  return offset;
}
static int dissect_noticeNumbers(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_SEQUNCE_OF_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_noticeNumbers);
}

static const ber_sequence NoticeReference_sequence[] = {
  { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_organization },
  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_noticeNumbers },
  { 0, 0, 0, NULL }
};

static int
dissect_pkix1implicit_NoticeReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
                                NoticeReference_sequence, hf_index, ett_pkix1implicit_NoticeReference);

  return offset;
}
static int dissect_noticeRef(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
  return dissect_pkix1implicit_NoticeReference(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_noticeRef);
}

static const ber_sequence UserNotice_sequence[] = {
  { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_noticeRef },
  { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_explicitText },
  { 0, 0, 0, NULL }
};

int
dissect_pkix1implicit_UserNotice(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
                                UserNotice_sequence, hf_index, ett_pkix1implicit_UserNotice);

  return offset;
}

/*--- PDUs ---*/

static void dissect_Dummy_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
  dissect_pkix1implicit_Dummy(FALSE, tvb, 0, pinfo, tree, hf_pkix1implicit_Dummy_PDU);
}


/*--- End of included file: packet-pkix1implicit-fn.c ---*/



/*--- proto_register_pkix1implicit ----------------------------------------------*/
void proto_register_pkix1implicit(void) {

  /* List of fields */
  static hf_register_info hf[] = {

/*--- Included file: packet-pkix1implicit-hfarr.c ---*/

    { &hf_pkix1implicit_Dummy_PDU,
      { "Dummy", "pkix1implicit.Dummy",
        FT_NONE, BASE_NONE, NULL, 0,
        "Dummy", HFILL }},
    { &hf_pkix1implicit_noticeRef,
      { "noticeRef", "pkix1implicit.noticeRef",
        FT_NONE, BASE_NONE, NULL, 0,
        "UserNotice/noticeRef", HFILL }},
    { &hf_pkix1implicit_explicitText,
      { "explicitText", "pkix1implicit.explicitText",
        FT_UINT32, BASE_DEC, VALS(DisplayText_vals), 0,
        "UserNotice/explicitText", HFILL }},
    { &hf_pkix1implicit_organization,
      { "organization", "pkix1implicit.organization",
        FT_UINT32, BASE_DEC, VALS(DisplayText_vals), 0,
        "NoticeReference/organization", HFILL }},
    { &hf_pkix1implicit_noticeNumbers,
      { "noticeNumbers", "pkix1implicit.noticeNumbers",
        FT_UINT32, BASE_DEC, NULL, 0,
        "NoticeReference/noticeNumbers", HFILL }},
    { &hf_pkix1implicit_noticeNumbers_item,
      { "Item", "pkix1implicit.noticeNumbers_item",
        FT_INT32, BASE_DEC, NULL, 0,
        "NoticeReference/noticeNumbers/_item", HFILL }},
    { &hf_pkix1implicit_visibleString,
      { "visibleString", "pkix1implicit.visibleString",
        FT_STRING, BASE_NONE, NULL, 0,
        "DisplayText/visibleString", HFILL }},
    { &hf_pkix1implicit_bmpString,
      { "bmpString", "pkix1implicit.bmpString",
        FT_STRING, BASE_NONE, NULL, 0,
        "DisplayText/bmpString", HFILL }},
    { &hf_pkix1implicit_utf8String,
      { "utf8String", "pkix1implicit.utf8String",
        FT_STRING, BASE_NONE, NULL, 0,
        "DisplayText/utf8String", HFILL }},

/*--- End of included file: packet-pkix1implicit-hfarr.c ---*/

  };

  /* List of subtrees */
  static gint *ett[] = {

/*--- Included file: packet-pkix1implicit-ettarr.c ---*/

    &ett_pkix1implicit_UserNotice,
    &ett_pkix1implicit_NoticeReference,
    &ett_pkix1implicit_SEQUNCE_OF_INTEGER,
    &ett_pkix1implicit_DisplayText,

/*--- End of included file: packet-pkix1implicit-ettarr.c ---*/

  };

  /* Register protocol */
  proto_pkix1implicit = proto_register_protocol(PNAME, PSNAME, PFNAME);

  /* Register fields and subtrees */
  proto_register_field_array(proto_pkix1implicit, hf, array_length(hf));
  proto_register_subtree_array(ett, array_length(ett));

}


/*--- proto_reg_handoff_pkix1implicit -------------------------------------------*/
void proto_reg_handoff_pkix1implicit(void) {

/*--- Included file: packet-pkix1implicit-dis-tab.c ---*/

 register_ber_oid_dissector("1.3.6.1.5.5.7.3.1", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-serverAuth");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.2", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-clientAuth");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.3", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-codeSigning");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.4", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-emailProtection");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.5", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-ip-kp-ipsecEndSystem");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.6", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-ipsecTunnel");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.7", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-ipsecUser");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.8", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-timeStamping");
 register_ber_oid_dissector("1.3.6.1.5.5.7.3.9", dissect_Dummy_PDU, proto_pkix1implicit, "OCSPSigning");


/*--- End of included file: packet-pkix1implicit-dis-tab.c ---*/

}