Reinitialize _create_xid state after fork.
[platform/upstream/glibc.git] / sunrpc / rpc_util.h
1 /*      @(#)rpc_util.h  1.5  90/08/29  (C) 1987 SMI   */
2
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:
7  *
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.
17  *
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.
30  *
31  * rpc_util.h, Useful definitions for the RPC protocol compiler
32  */
33
34 #include <stdlib.h>
35
36 #define alloc(size)             malloc((unsigned)(size))
37 #define ALLOC(object)   (object *) malloc(sizeof(object))
38
39 #define s_print (void) sprintf
40 #define f_print (void) fprintf
41
42 struct list {
43         definition *val;
44         struct list *next;
45 };
46 typedef struct list list;
47
48 struct xdrfunc {
49         char *name;
50         int pointerp;
51         struct xdrfunc *next;
52 };
53 typedef struct xdrfunc xdrfunc;
54
55 #define PUT 1
56 #define GET 2
57
58 /*
59  * Global variables
60  */
61 #define MAXLINESIZE 1024
62 extern char curline[MAXLINESIZE];
63 extern const char *where;
64 extern int linenum;
65
66 extern const char *infilename;
67 extern FILE *fout;
68 extern FILE *fin;
69
70 extern list *defined;
71
72 extern bas_type *typ_list_h;
73 extern bas_type *typ_list_t;
74 extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
75
76 /*
77  * All the option flags
78  */
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;
89
90 /*
91  * Other flags related with inetd jumpstart.
92  */
93 extern int indefinitewait;
94 extern int exitnow;
95 extern int timerflag;
96
97 extern int nonfatalerrors;
98
99 /*
100  * rpc_util routines
101  */
102 void storeval(list **lstp, definition *val);
103 #define STOREVAL(list,item) storeval(list,item)
104
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)
108
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);
121
122
123 /*
124  * rpc_cout routines
125  */
126 void emit(definition *def);
127
128 /*
129  * rpc_hout routines
130  */
131 void print_datadef(definition *def);
132 void print_funcdef(definition *def);
133
134 /*
135  * rpc_svcout routines
136  */
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 *);
145 /*
146  * rpc_clntout routines
147  */
148 void write_stubs(void);
149
150 /*
151  * rpc_tblout routines
152  */
153 void write_tables(void);