remove COPYING* from .gitignore files
[platform/upstream/glibc.git] / sunrpc / rpc_util.h
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user or with the express written consent of
8  * Sun Microsystems, Inc.
9  *
10  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13  *
14  * Sun RPC is provided with no support and without any obligation on the
15  * part of Sun Microsystems, Inc. to assist in its use, correction,
16  * modification or enhancement.
17  *
18  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20  * OR ANY PART THEREOF.
21  *
22  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23  * or profits or other special, indirect and consequential damages, even if
24  * Sun has been advised of the possibility of such damages.
25  *
26  * Sun Microsystems, Inc.
27  * 2550 Garcia Avenue
28  * Mountain View, California  94043
29  */
30
31 /*      @(#)rpc_util.h  1.5  90/08/29  (C) 1987 SMI   */
32
33 /*
34  * rpc_util.h, Useful definitions for the RPC protocol compiler
35  */
36
37 #include <stdlib.h>
38
39 #define alloc(size)             malloc((unsigned)(size))
40 #define ALLOC(object)   (object *) malloc(sizeof(object))
41
42 #define s_print (void) sprintf
43 #define f_print (void) fprintf
44
45 struct list {
46         definition *val;
47         struct list *next;
48 };
49 typedef struct list list;
50
51 struct xdrfunc {
52         char *name;
53         int pointerp;
54         struct xdrfunc *next;
55 };
56 typedef struct xdrfunc xdrfunc;
57
58 #define PUT 1
59 #define GET 2
60
61 /*
62  * Global variables
63  */
64 #define MAXLINESIZE 1024
65 extern char curline[MAXLINESIZE];
66 extern const char *where;
67 extern int linenum;
68
69 extern const char *infilename;
70 extern FILE *fout;
71 extern FILE *fin;
72
73 extern list *defined;
74
75 extern bas_type *typ_list_h;
76 extern bas_type *typ_list_t;
77 extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
78
79 /*
80  * All the option flags
81  */
82 extern int inetdflag;
83 extern int pmflag;
84 extern int tblflag;
85 extern int logflag;
86 extern int newstyle;
87 extern int Cflag;      /* C++ flag */
88 extern int CCflag;     /* C++ flag */
89 extern int tirpcflag;  /* flag for generating tirpc code */
90 extern int inlineflag; /* if this is 0, then do not generate inline code */
91 extern int mtflag;
92
93 /*
94  * Other flags related with inetd jumpstart.
95  */
96 extern int indefinitewait;
97 extern int exitnow;
98 extern int timerflag;
99
100 extern int nonfatalerrors;
101
102 /*
103  * rpc_util routines
104  */
105 void storeval(list **lstp, definition *val);
106 #define STOREVAL(list,item) storeval(list,item)
107
108 definition *findval(list *lst, const char *val,
109                     int (*cmp)(const definition *, const char *));
110 #define FINDVAL(list,item,finder) findval(list, item, finder)
111
112 const char *fixtype(const char *type);
113 const char *stringfix(const char *type);
114 char *locase(const char *str);
115 void pvname_svc(const char *pname, const char *vnum);
116 void pvname(const char *pname, const char *vnum);
117 void ptype(const char *prefix, const char *type, int follow);
118 int isvectordef(const char *type, relation rel);
119 int streq(const char *a, const char *b);
120 void error(const char *msg);
121 void tabify(FILE *f, int tab);
122 void record_open(const char *file);
123 bas_type *find_type(const char *type);
124
125
126 /*
127  * rpc_cout routines
128  */
129 void emit(definition *def);
130
131 /*
132  * rpc_hout routines
133  */
134 void print_datadef(definition *def);
135 void print_funcdef(definition *def);
136
137 /*
138  * rpc_svcout routines
139  */
140 void write_most(const char *infile, int netflag, int nomain);
141 void write_register(void);
142 void write_rest(void);
143 void write_programs(const char *storage);
144 void write_svc_aux(int nomain);
145 void write_inetd_register(const char *transp);
146 void write_netid_register(const char *);
147 void write_nettype_register(const char *);
148 /*
149  * rpc_clntout routines
150  */
151 void write_stubs(void);
152
153 /*
154  * rpc_tblout routines
155  */
156 void write_tables(void);