3
# The contents of this file are subject to the Mozilla Public
4
# License Version 1.1 (the "License"); you may not use this file
5
# except in compliance with the License. You may obtain a copy of
6
# the License at http://www.mozilla.org/MPL/
8
# Software distributed under the License is distributed on an "AS
9
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
# implied. See the License for the specific language governing
11
# rights and limitations under the License.
13
# The Original Code is the Netscape security libraries.
15
# The Initial Developer of the Original Code is Netscape
16
# Communications Corporation. Portions created by Netscape are
17
# Copyright (C) 1994-2000 Netscape Communications Corporation. All
22
# Alternatively, the contents of this file may be used under the
23
# terms of the GNU General Public License Version 2 or later (the
24
# "GPL"), in which case the provisions of the GPL are applicable
25
# instead of those above. If you wish to allow use of your
26
# version of this file only under the terms of the GPL and not to
27
# allow others to use your version of this file under the MPL,
28
# indicate your decision by deleting the provisions above and
29
# replace them with the notice and other provisions required by
30
# the GPL. If you do not delete the provisions above, a recipient
31
# may use your version of this file under either the MPL or the
34
$cvs_id = '@(#) $RCSfile: oidgen.perl,v $ $Revision: 1.2 $ $Date: 2001/11/08 00:15:25 $ $Name: FIREFOX_1_0_RELEASE $';
39
s/^((?:[^"#]+|"[^"]*")*)(\s*#.*$)/$1/;
42
/^([\S]+)\s+([^"][\S]*|"[^"]*")/;
45
# This is certainly not the best way to dequote the data.
48
if( $name =~ "OID" ) {
50
$x[$count]{$name} = $value;
51
$enc = encodeoid($value);
52
$x[$count]{" encoding"} = escapeoid($enc);
53
$x[$count]{" encoding length"} = length($enc);
58
$x[$count]{$name} = $value;
65
doprint($cfile,$hfile);
68
for( $i = 0; $i <= $count; $i++ ) {
71
while(($n,$v) = each(%y)) {
72
print "\t$n ==> $v\n";
78
open(CFILE, "> $cfile") || die "Can't open $cfile: $!";
79
open(HFILE, "> $hfile") || die "Can't open $hfile: $!";
82
/* THIS IS A GENERATED FILE */
84
* The contents of this file are subject to the Mozilla Public
85
* License Version 1.1 (the "License"); you may not use this file
86
* except in compliance with the License. You may obtain a copy of
87
* the License at http://www.mozilla.org/MPL/
89
* Software distributed under the License is distributed on an "AS
90
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
91
* implied. See the License for the specific language governing
92
* rights and limitations under the License.
94
* The Original Code is the Netscape security libraries.
96
* The Initial Developer of the Original Code is Netscape
97
* Communications Corporation. Portions created by Netscape are
98
* Copyright (C) 1994-2000 Netscape Communications Corporation. All
103
* Alternatively, the contents of this file may be used under the
104
* terms of the GNU General Public License Version 2 or later (the
105
* "GPL"), in which case the provisions of the GPL are applicable
106
* instead of those above. If you wish to allow use of your
107
* version of this file only under the terms of the GPL and not to
108
* allow others to use your version of this file under the MPL,
109
* indicate your decision by deleting the provisions above and
110
* replace them with the notice and other provisions required by
111
* the GPL. If you do not delete the provisions above, a recipient
112
* may use your version of this file under either the MPL or the
116
static const char CVS_ID[] = "$g{CVS_ID} ; $cvs_id";
123
const NSSOID nss_builtin_oids[] = {
127
for( $i = 0; $i <= $count; $i++ ) {
130
print CFILE "#ifdef DEBUG\n";
131
print CFILE " \"$y{TAG}\",\n";
132
print CFILE " \"$y{EXPL}\",\n";
133
print CFILE "#endif /* DEBUG */\n";
134
print CFILE " { \"", $y{" encoding"};
135
print CFILE "\", ", $y{" encoding length"}, " }\n";
144
print CFILE "};\n\n";
146
print CFILE "const PRUint32 nss_builtin_oid_count = ", ($count+1), ";\n\n";
148
for( $i = 0; $i <= $count; $i++ ) {
150
if( defined($y{NAME}) ) {
151
print CFILE "const NSSOID *$y{NAME} = (NSSOID *)&nss_builtin_oids[$i];\n";
158
for( $i = 0; $i <= $count; $i++ ) {
160
if( defined($y{ATTR}) ) {
161
if( defined($y{NAME}) ) {
163
$attr[$attrcount]{ATTR} = $y{ATTR};
164
$attr[$attrcount]{NAME} = $y{NAME};
166
warn "Attribute $y{ATTR} has no name, and will be omitted!";
171
print CFILE "const nssAttributeTypeAliasTable nss_attribute_type_aliases[] = {\n";
173
for( $i = 0; $i <= $attrcount; $i++ ) {
176
print CFILE " \"$y{ATTR}\",\n";
177
print CFILE " &$y{NAME}\n";
179
if( $i == $attrcount ) {
186
print CFILE "};\n\n";
188
print CFILE "const PRUint32 nss_attribute_type_alias_count = ", ($attrcount+1), ";\n\n";
191
/* THIS IS A GENERATED FILE */
193
* The contents of this file are subject to the Mozilla Public
194
* License Version 1.1 (the "License"); you may not use this file
195
* except in compliance with the License. You may obtain a copy of
196
* the License at http://www.mozilla.org/MPL/
198
* Software distributed under the License is distributed on an "AS
199
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
200
* implied. See the License for the specific language governing
201
* rights and limitations under the License.
203
* The Original Code is the Netscape security libraries.
205
* The Initial Developer of the Original Code is Netscape
206
* Communications Corporation. Portions created by Netscape are
207
* Copyright (C) 1994-2000 Netscape Communications Corporation. All
212
* Alternatively, the contents of this file may be used under the
213
* terms of the GNU General Public License Version 2 or later (the
214
* "GPL"), in which case the provisions of the GPL are applicable
215
* instead of those above. If you wish to allow use of your
216
* version of this file only under the terms of the GPL and not to
217
* allow others to use your version of this file under the MPL,
218
* indicate your decision by deleting the provisions above and
219
* replace them with the notice and other provisions required by
220
* the GPL. If you do not delete the provisions above, a recipient
221
* may use your version of this file under either the MPL or the
229
static const char OIDDATA_CVS_ID[] = "$g{CVS_ID} ; $cvs_id";
233
#include "nsspki1t.h"
234
#endif /* NSSPKI1T_H */
236
extern const NSSOID nss_builtin_oids[];
237
extern const PRUint32 nss_builtin_oid_count;
239
/*extern const nssAttributeTypeAliasTable nss_attribute_type_aliases[];*/
240
/*extern const PRUint32 nss_attribute_type_alias_count;*/
245
for( $i = 0; $i <= $count; $i++ ) {
247
if( defined($y{NAME}) ) {
248
print HFILE "extern const NSSOID *$y{NAME};\n";
254
#endif /* OIDDATA_H */
274
for( $i = @d-1; $i > 0; $i-- ) {
275
$rv = $rv . chr(128 + $d[$i]);
278
$rv = $rv . chr($d[0]);
284
my @o = split(/\./, $_[0]);
289
# NSS's special "illegal" encoding
290
return chr(128) . encodenum($o[0]);
293
$rv = encodenum($o[0] * 40 + $o[1]);
297
$rv = $rv . encodenum($i);
304
my @v = unpack("C*", $_[0]);
309
$rv = $rv . sprintf("\\x%02x", $a);