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