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