1 /*	$NetBSD: gen_locl.h,v 1.1.1.2 2011/04/14 14:08:21 elric Exp $	*/
2 
3 /*
4  * Copyright (c) 1997-2005 Kungliga Tekniska Högskolan
5  * (Royal Institute of Technology, Stockholm, Sweden).
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the Institute nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35 
36 /* Id */
37 
38 #ifndef __GEN_LOCL_H__
39 #define __GEN_LOCL_H__
40 
41 #include <config.h>
42 
43 #include <assert.h>
44 #include <stdio.h>
45 #include <stdlib.h>
46 #include <string.h>
47 #include <limits.h>
48 #include <ctype.h>
49 #include <time.h>
50 #include <errno.h>
51 #include <err.h>
52 #include <krb5/roken.h>
53 #include "hash.h"
54 #include "symbol.h"
55 #include <krb5/asn1-common.h>
56 #include <krb5/der.h>
57 #include "der-private.h"
58 
59 void generate_type (const Symbol *);
60 void generate_constant (const Symbol *);
61 void generate_type_encode (const Symbol *);
62 void generate_type_decode (const Symbol *);
63 void generate_type_free (const Symbol *);
64 void generate_type_length (const Symbol *);
65 void generate_type_copy (const Symbol *);
66 void generate_type_seq (const Symbol *);
67 void generate_glue (const Type *, const char*);
68 
69 const char *classname(Der_class);
70 const char *valuename(Der_class, int);
71 
72 void gen_compare_defval(const char *, struct value *);
73 void gen_assign_defval(const char *, struct value *);
74 
75 
76 void init_generate (const char *, const char *);
77 const char *get_filename (void);
78 void close_generate(void);
79 void add_import(const char *);
80 void add_export(const char *);
81 int is_export(const char *);
82 int yyparse(void);
83 int is_primitive_type(int);
84 
85 int preserve_type(const char *);
86 int seq_type(const char *);
87 
88 void generate_header_of_codefile(const char *);
89 void close_codefile(void);
90 
91 int is_template_compat (const Symbol *);
92 void generate_template(const Symbol *);
93 void gen_template_import(const Symbol *);
94 
95 
96 extern FILE *privheaderfile, *headerfile, *codefile, *logfile, *templatefile;
97 extern int support_ber;
98 extern int template_flag;
99 extern int rfc1510_bitstring;
100 extern int one_code_file;
101 
102 extern int error_flag;
103 
104 #endif /* __GEN_LOCL_H__ */
105