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