]>
Commit | Line | Data |
---|---|---|
a7ab6ec8 UD |
1 | /* @(#)rpc_util.h 1.5 90/08/29 */ |
2 | ||
28f540f4 | 3 | /* |
a7ab6ec8 UD |
4 | * Copyright (c) 2010, Oracle America, Inc. |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions are | |
7 | * met: | |
0d204b0a | 8 | * |
a7ab6ec8 UD |
9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * * Redistributions in binary form must reproduce the above | |
12 | * copyright notice, this list of conditions and the following | |
13 | * disclaimer in the documentation and/or other materials | |
14 | * provided with the distribution. | |
15 | * * Neither the name of the "Oracle America, Inc." nor the names of its | |
16 | * contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
0d204b0a | 18 | * |
a7ab6ec8 UD |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
23 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
26 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
0d204b0a | 31 | * |
880f421f | 32 | * rpc_util.h, Useful definitions for the RPC protocol compiler |
28f540f4 | 33 | */ |
0d204b0a UD |
34 | |
35 | #include <stdlib.h> | |
28f540f4 RM |
36 | |
37 | #define alloc(size) malloc((unsigned)(size)) | |
38 | #define ALLOC(object) (object *) malloc(sizeof(object)) | |
39 | ||
28f540f4 RM |
40 | #define s_print (void) sprintf |
41 | #define f_print (void) fprintf | |
42 | ||
43 | struct list { | |
0d204b0a | 44 | definition *val; |
28f540f4 RM |
45 | struct list *next; |
46 | }; | |
47 | typedef struct list list; | |
48 | ||
880f421f | 49 | struct xdrfunc { |
a7ab6ec8 UD |
50 | char *name; |
51 | int pointerp; | |
52 | struct xdrfunc *next; | |
880f421f UD |
53 | }; |
54 | typedef struct xdrfunc xdrfunc; | |
55 | ||
0d204b0a UD |
56 | #define PUT 1 |
57 | #define GET 2 | |
58 | ||
28f540f4 | 59 | /* |
880f421f | 60 | * Global variables |
28f540f4 RM |
61 | */ |
62 | #define MAXLINESIZE 1024 | |
63 | extern char curline[MAXLINESIZE]; | |
0d204b0a | 64 | extern const char *where; |
28f540f4 RM |
65 | extern int linenum; |
66 | ||
0d204b0a | 67 | extern const char *infilename; |
28f540f4 RM |
68 | extern FILE *fout; |
69 | extern FILE *fin; | |
70 | ||
71 | extern list *defined; | |
72 | ||
0d204b0a UD |
73 | extern bas_type *typ_list_h; |
74 | extern bas_type *typ_list_t; | |
880f421f | 75 | extern xdrfunc *xdrfunc_head, *xdrfunc_tail; |
0d204b0a | 76 | |
28f540f4 | 77 | /* |
0d204b0a | 78 | * All the option flags |
28f540f4 | 79 | */ |
0d204b0a | 80 | extern int inetdflag; |
880f421f | 81 | extern int pmflag; |
0d204b0a UD |
82 | extern int tblflag; |
83 | extern int logflag; | |
84 | extern int newstyle; | |
880f421f UD |
85 | extern int Cflag; /* C++ flag */ |
86 | extern int CCflag; /* C++ flag */ | |
87 | extern int tirpcflag; /* flag for generating tirpc code */ | |
0d204b0a | 88 | extern int inlineflag; /* if this is 0, then do not generate inline code */ |
880f421f | 89 | extern int mtflag; |
28f540f4 | 90 | |
0d204b0a UD |
91 | /* |
92 | * Other flags related with inetd jumpstart. | |
93 | */ | |
94 | extern int indefinitewait; | |
95 | extern int exitnow; | |
96 | extern int timerflag; | |
28f540f4 | 97 | |
0d204b0a | 98 | extern int nonfatalerrors; |
28f540f4 | 99 | |
0d204b0a | 100 | /* |
880f421f | 101 | * rpc_util routines |
0d204b0a UD |
102 | */ |
103 | void storeval(list **lstp, definition *val); | |
104 | #define STOREVAL(list,item) storeval(list,item) | |
105 | ||
880f421f | 106 | definition *findval(list *lst, const char *val, |
0d204b0a UD |
107 | int (*cmp)(const definition *, const char *)); |
108 | #define FINDVAL(list,item,finder) findval(list, item, finder) | |
109 | ||
110 | const char *fixtype(const char *type); | |
111 | const char *stringfix(const char *type); | |
112 | char *locase(const char *str); | |
113 | void pvname_svc(const char *pname, const char *vnum); | |
114 | void pvname(const char *pname, const char *vnum); | |
115 | void ptype(const char *prefix, const char *type, int follow); | |
116 | int isvectordef(const char *type, relation rel); | |
117 | int streq(const char *a, const char *b); | |
118 | void error(const char *msg); | |
119 | void tabify(FILE *f, int tab); | |
120 | void record_open(const char *file); | |
121 | bas_type *find_type(const char *type); | |
28f540f4 | 122 | |
28f540f4 RM |
123 | |
124 | /* | |
880f421f | 125 | * rpc_cout routines |
28f540f4 | 126 | */ |
0d204b0a | 127 | void emit(definition *def); |
28f540f4 RM |
128 | |
129 | /* | |
880f421f | 130 | * rpc_hout routines |
28f540f4 | 131 | */ |
0d204b0a UD |
132 | void print_datadef(definition *def); |
133 | void print_funcdef(definition *def); | |
28f540f4 RM |
134 | |
135 | /* | |
880f421f | 136 | * rpc_svcout routines |
28f540f4 | 137 | */ |
0d204b0a UD |
138 | void write_most(const char *infile, int netflag, int nomain); |
139 | void write_register(void); | |
140 | void write_rest(void); | |
141 | void write_programs(const char *storage); | |
142 | void write_svc_aux(int nomain); | |
143 | void write_inetd_register(const char *transp); | |
144 | void write_netid_register(const char *); | |
145 | void write_nettype_register(const char *); | |
28f540f4 RM |
146 | /* |
147 | * rpc_clntout routines | |
148 | */ | |
0d204b0a UD |
149 | void write_stubs(void); |
150 | ||
151 | /* | |
152 | * rpc_tblout routines | |
153 | */ | |
154 | void write_tables(void); |