/src/wireshark/epan/dissectors/packet-pkixproxy.c
Line | Count | Source |
1 | | /* Do not modify this file. Changes will be overwritten. */ |
2 | | /* Generated automatically by the ASN.1 to Wireshark dissector compiler */ |
3 | | /* packet-pkixproxy.c */ |
4 | | /* asn2wrs.py -b -q -L -p pkixproxy -c ./pkixproxy.cnf -s ./packet-pkixproxy-template -D . -O ../.. PKIXProxy.asn */ |
5 | | |
6 | | /* packet-pkixproxy.c |
7 | | * Routines for RFC3820 PKIXProxy packet dissection |
8 | | * Ronnie Sahlberg 2004 |
9 | | * |
10 | | * Wireshark - Network traffic analyzer |
11 | | * By Gerald Combs <gerald@wireshark.org> |
12 | | * Copyright 1998 Gerald Combs |
13 | | * |
14 | | * SPDX-License-Identifier: GPL-2.0-or-later |
15 | | */ |
16 | | |
17 | | #include "config.h" |
18 | | |
19 | | #include <epan/packet.h> |
20 | | #include <epan/oids.h> |
21 | | #include <epan/asn1.h> |
22 | | #include <wsutil/array.h> |
23 | | |
24 | | #include "packet-ber.h" |
25 | | |
26 | | void proto_register_pkixproxy(void); |
27 | | void proto_reg_handoff_pkixproxy(void); |
28 | | |
29 | | /* Initialize the protocol and registered fields */ |
30 | | static int proto_pkixproxy; |
31 | | static int hf_pkixproxy_ProxyCertInfoExtension_PDU; /* ProxyCertInfoExtension */ |
32 | | static int hf_pkixproxy_pCPathLenConstraint; /* ProxyCertPathLengthConstraint */ |
33 | | static int hf_pkixproxy_proxyPolicy; /* ProxyPolicy */ |
34 | | static int hf_pkixproxy_policyLanguage; /* OBJECT_IDENTIFIER */ |
35 | | static int hf_pkixproxy_policy; /* OCTET_STRING */ |
36 | | |
37 | | /* Initialize the subtree pointers */ |
38 | | static int ett_pkixproxy_ProxyCertInfoExtension; |
39 | | static int ett_pkixproxy_ProxyPolicy; |
40 | | |
41 | | |
42 | | |
43 | | static unsigned |
44 | 0 | dissect_pkixproxy_ProxyCertPathLengthConstraint(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
45 | 0 | offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, |
46 | 0 | NULL); |
47 | |
|
48 | 0 | return offset; |
49 | 0 | } |
50 | | |
51 | | |
52 | | |
53 | | static unsigned |
54 | 0 | dissect_pkixproxy_OBJECT_IDENTIFIER(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
55 | 0 | offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL); |
56 | |
|
57 | 0 | return offset; |
58 | 0 | } |
59 | | |
60 | | |
61 | | |
62 | | static unsigned |
63 | 0 | dissect_pkixproxy_OCTET_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
64 | 0 | offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, |
65 | 0 | NULL); |
66 | |
|
67 | 0 | return offset; |
68 | 0 | } |
69 | | |
70 | | |
71 | | static const ber_sequence_t ProxyPolicy_sequence[] = { |
72 | | { &hf_pkixproxy_policyLanguage, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_pkixproxy_OBJECT_IDENTIFIER }, |
73 | | { &hf_pkixproxy_policy , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixproxy_OCTET_STRING }, |
74 | | { NULL, 0, 0, 0, NULL } |
75 | | }; |
76 | | |
77 | | static unsigned |
78 | 0 | dissect_pkixproxy_ProxyPolicy(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
79 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
80 | 0 | ProxyPolicy_sequence, hf_index, ett_pkixproxy_ProxyPolicy); |
81 | |
|
82 | 0 | return offset; |
83 | 0 | } |
84 | | |
85 | | |
86 | | static const ber_sequence_t ProxyCertInfoExtension_sequence[] = { |
87 | | { &hf_pkixproxy_pCPathLenConstraint, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixproxy_ProxyCertPathLengthConstraint }, |
88 | | { &hf_pkixproxy_proxyPolicy, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkixproxy_ProxyPolicy }, |
89 | | { NULL, 0, 0, 0, NULL } |
90 | | }; |
91 | | |
92 | | static unsigned |
93 | 0 | dissect_pkixproxy_ProxyCertInfoExtension(bool implicit_tag _U_, tvbuff_t *tvb _U_, unsigned offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { |
94 | 0 | offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, |
95 | 0 | ProxyCertInfoExtension_sequence, hf_index, ett_pkixproxy_ProxyCertInfoExtension); |
96 | |
|
97 | 0 | return offset; |
98 | 0 | } |
99 | | |
100 | | /*--- PDUs ---*/ |
101 | | |
102 | 0 | static int dissect_ProxyCertInfoExtension_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { |
103 | 0 | unsigned offset = 0; |
104 | 0 | asn1_ctx_t asn1_ctx; |
105 | 0 | asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo); |
106 | 0 | offset = dissect_pkixproxy_ProxyCertInfoExtension(false, tvb, offset, &asn1_ctx, tree, hf_pkixproxy_ProxyCertInfoExtension_PDU); |
107 | 0 | return offset; |
108 | 0 | } |
109 | | |
110 | | |
111 | | |
112 | | /*--- proto_register_pkixproxy ----------------------------------------------*/ |
113 | 15 | void proto_register_pkixproxy(void) { |
114 | | |
115 | | /* List of fields */ |
116 | 15 | static hf_register_info hf[] = { |
117 | 15 | { &hf_pkixproxy_ProxyCertInfoExtension_PDU, |
118 | 15 | { "ProxyCertInfoExtension", "pkixproxy.ProxyCertInfoExtension_element", |
119 | 15 | FT_NONE, BASE_NONE, NULL, 0, |
120 | 15 | NULL, HFILL }}, |
121 | 15 | { &hf_pkixproxy_pCPathLenConstraint, |
122 | 15 | { "pCPathLenConstraint", "pkixproxy.pCPathLenConstraint", |
123 | 15 | FT_INT32, BASE_DEC, NULL, 0, |
124 | 15 | "ProxyCertPathLengthConstraint", HFILL }}, |
125 | 15 | { &hf_pkixproxy_proxyPolicy, |
126 | 15 | { "proxyPolicy", "pkixproxy.proxyPolicy_element", |
127 | 15 | FT_NONE, BASE_NONE, NULL, 0, |
128 | 15 | NULL, HFILL }}, |
129 | 15 | { &hf_pkixproxy_policyLanguage, |
130 | 15 | { "policyLanguage", "pkixproxy.policyLanguage", |
131 | 15 | FT_OID, BASE_NONE, NULL, 0, |
132 | 15 | "OBJECT_IDENTIFIER", HFILL }}, |
133 | 15 | { &hf_pkixproxy_policy, |
134 | 15 | { "policy", "pkixproxy.policy", |
135 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
136 | 15 | "OCTET_STRING", HFILL }}, |
137 | 15 | }; |
138 | | |
139 | | /* List of subtrees */ |
140 | 15 | static int *ett[] = { |
141 | 15 | &ett_pkixproxy_ProxyCertInfoExtension, |
142 | 15 | &ett_pkixproxy_ProxyPolicy, |
143 | 15 | }; |
144 | | |
145 | | /* Register protocol */ |
146 | 15 | proto_pkixproxy = proto_register_protocol("PKIXProxy (RFC3820)", "PKIXPROXY", "pkixproxy"); |
147 | | |
148 | | /* Register fields and subtrees */ |
149 | 15 | proto_register_field_array(proto_pkixproxy, hf, array_length(hf)); |
150 | 15 | proto_register_subtree_array(ett, array_length(ett)); |
151 | | |
152 | 15 | } |
153 | | |
154 | | |
155 | | /*--- proto_reg_handoff_pkixproxy -------------------------------------------*/ |
156 | 15 | void proto_reg_handoff_pkixproxy(void) { |
157 | 15 | register_ber_oid_dissector("1.3.6.1.5.5.7.1.14", dissect_ProxyCertInfoExtension_PDU, proto_pkixproxy, "id-pe-proxyCertInfo"); |
158 | | |
159 | 15 | oid_add_from_string("id-ppl-anyLanguage","1.3.6.1.5.5.7.21.0"); |
160 | 15 | oid_add_from_string("id-ppl-inheritAll","1.3.6.1.5.5.7.21.1"); |
161 | 15 | oid_add_from_string("id-ppl-independent","1.3.6.1.5.5.7.21.2"); |
162 | 15 | } |
163 | | |