14e115012SGarrett Wollman /* 240ad8885SAlfred Perlstein * $FreeBSD$ 340ad8885SAlfred Perlstein */ 440ad8885SAlfred Perlstein /* 54e115012SGarrett Wollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 64e115012SGarrett Wollman * unrestricted use provided that this legend is included on all tape 74e115012SGarrett Wollman * media and as a part of the software program in whole or part. Users 84e115012SGarrett Wollman * may copy or modify Sun RPC without charge, but are not authorized 94e115012SGarrett Wollman * to license or distribute it to anyone else except as part of a product or 104e115012SGarrett Wollman * program developed by the user. 114e115012SGarrett Wollman * 124e115012SGarrett Wollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 134e115012SGarrett Wollman * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 144e115012SGarrett Wollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 154e115012SGarrett Wollman * 164e115012SGarrett Wollman * Sun RPC is provided with no support and without any obligation on the 174e115012SGarrett Wollman * part of Sun Microsystems, Inc. to assist in its use, correction, 184e115012SGarrett Wollman * modification or enhancement. 194e115012SGarrett Wollman * 204e115012SGarrett Wollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 214e115012SGarrett Wollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 224e115012SGarrett Wollman * OR ANY PART THEREOF. 234e115012SGarrett Wollman * 244e115012SGarrett Wollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue 254e115012SGarrett Wollman * or profits or other special, indirect and consequential damages, even if 264e115012SGarrett Wollman * Sun has been advised of the possibility of such damages. 274e115012SGarrett Wollman * 284e115012SGarrett Wollman * Sun Microsystems, Inc. 294e115012SGarrett Wollman * 2550 Garcia Avenue 304e115012SGarrett Wollman * Mountain View, California 94043 314e115012SGarrett Wollman */ 3240ad8885SAlfred Perlstein /* #pragma ident "@(#)rpc_util.h 1.16 94/05/15 SMI" */ 33ff49530fSBill Paul 34ff49530fSBill Paul /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 35ff49530fSBill Paul /* All Rights Reserved */ 36ff49530fSBill Paul 37ff49530fSBill Paul /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ 38ff49530fSBill Paul /* The copyright notice above does not evidence any */ 39ff49530fSBill Paul /* actual or intended publication of such source code. */ 40ff49530fSBill Paul 41ff49530fSBill Paul 42ff49530fSBill Paul /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 43ff49530fSBill Paul * PROPRIETARY NOTICE (Combined) 44ff49530fSBill Paul * 45ff49530fSBill Paul * This source code is unpublished proprietary information 46ff49530fSBill Paul * constituting, or derived under license from AT&T's UNIX(r) System V. 47ff49530fSBill Paul * In addition, portions of such source code were derived from Berkeley 48ff49530fSBill Paul * 4.3 BSD under license from the Regents of the University of 49ff49530fSBill Paul * California. 50ff49530fSBill Paul * 51ff49530fSBill Paul * 52ff49530fSBill Paul * 53ff49530fSBill Paul * Copyright Notice 54ff49530fSBill Paul * 55ff49530fSBill Paul * Notice of copyright on this source code product does not indicate 56ff49530fSBill Paul * publication. 57ff49530fSBill Paul * 58ff49530fSBill Paul * (c) 1986,1987,1988.1989 Sun Microsystems, Inc 59ff49530fSBill Paul * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. 60ff49530fSBill Paul * All rights reserved. 61ff49530fSBill Paul */ 62ff49530fSBill Paul 63ff49530fSBill Paul /* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */ 644e115012SGarrett Wollman 654e115012SGarrett Wollman /* 664e115012SGarrett Wollman * rpc_util.h, Useful definitions for the RPC protocol compiler 674e115012SGarrett Wollman */ 68ff49530fSBill Paul #include <sys/types.h> 69ff49530fSBill Paul #include <stdlib.h> 704e115012SGarrett Wollman 7175863a6dSPhilippe Charnier #define XALLOC(object) (object *) xmalloc(sizeof(object)) 724e115012SGarrett Wollman 734e115012SGarrett Wollman #define s_print (void) sprintf 744e115012SGarrett Wollman #define f_print (void) fprintf 754e115012SGarrett Wollman 764e115012SGarrett Wollman struct list { 77ff49530fSBill Paul definition *val; 784e115012SGarrett Wollman struct list *next; 794e115012SGarrett Wollman }; 804e115012SGarrett Wollman typedef struct list list; 814e115012SGarrett Wollman 82ff49530fSBill Paul struct xdrfunc { 83ff49530fSBill Paul char *name; 84ff49530fSBill Paul int pointerp; 85ff49530fSBill Paul struct xdrfunc *next; 86ff49530fSBill Paul }; 87ff49530fSBill Paul typedef struct xdrfunc xdrfunc; 88ff49530fSBill Paul 89ff49530fSBill Paul struct commandline { 90ff49530fSBill Paul int cflag; /* xdr C routines */ 91ff49530fSBill Paul int hflag; /* header file */ 92ff49530fSBill Paul int lflag; /* client side stubs */ 93ff49530fSBill Paul int mflag; /* server side stubs */ 94ff49530fSBill Paul int nflag; /* netid flag */ 95ff49530fSBill Paul int sflag; /* server stubs for the given transport */ 96ff49530fSBill Paul int tflag; /* dispatch Table file */ 97ff49530fSBill Paul int Ssflag; /* produce server sample code */ 98ff49530fSBill Paul int Scflag; /* produce client sample code */ 99ff49530fSBill Paul int makefileflag; /* Generate a template Makefile */ 100ff49530fSBill Paul char *infile; /* input module name */ 101ff49530fSBill Paul char *outfile; /* output module name */ 102ff49530fSBill Paul }; 103ff49530fSBill Paul 104ff49530fSBill Paul #define PUT 1 105ff49530fSBill Paul #define GET 2 106ff49530fSBill Paul 1074e115012SGarrett Wollman /* 1084e115012SGarrett Wollman * Global variables 1094e115012SGarrett Wollman */ 1104e115012SGarrett Wollman #define MAXLINESIZE 1024 1114e115012SGarrett Wollman extern char curline[MAXLINESIZE]; 1124e115012SGarrett Wollman extern char *where; 1134e115012SGarrett Wollman extern int linenum; 1144e115012SGarrett Wollman 1154e115012SGarrett Wollman extern char *infilename; 1164e115012SGarrett Wollman extern FILE *fout; 1174e115012SGarrett Wollman extern FILE *fin; 1184e115012SGarrett Wollman 1194e115012SGarrett Wollman extern list *defined; 1204e115012SGarrett Wollman 121ff49530fSBill Paul 122ff49530fSBill Paul extern bas_type *typ_list_h; 123ff49530fSBill Paul extern bas_type *typ_list_t; 124ff49530fSBill Paul extern xdrfunc *xdrfunc_head, *xdrfunc_tail; 125ff49530fSBill Paul 126ff49530fSBill Paul /* 127ff49530fSBill Paul * All the option flags 128ff49530fSBill Paul */ 129ff49530fSBill Paul extern int inetdflag; 130ff49530fSBill Paul extern int pmflag; 131ff49530fSBill Paul extern int tblflag; 132ff49530fSBill Paul extern int logflag; 133ff49530fSBill Paul extern int newstyle; 134ff49530fSBill Paul extern int Cflag; /* ANSI-C/C++ flag */ 135ff49530fSBill Paul extern int CCflag; /* C++ flag */ 136ff49530fSBill Paul extern int tirpcflag; /* flag for generating tirpc code */ 137ff49530fSBill Paul extern int inline; /* if this is 0, then do not generate inline code */ 138ff49530fSBill Paul extern int mtflag; 139ff49530fSBill Paul 140ff49530fSBill Paul /* 141ff49530fSBill Paul * Other flags related with inetd jumpstart. 142ff49530fSBill Paul */ 143ff49530fSBill Paul extern int indefinitewait; 144ff49530fSBill Paul extern int exitnow; 145ff49530fSBill Paul extern int timerflag; 146ff49530fSBill Paul 147ff49530fSBill Paul extern int nonfatalerrors; 148ff49530fSBill Paul 149ff49530fSBill Paul extern pid_t childpid; 150ff49530fSBill Paul 1514e115012SGarrett Wollman /* 1524e115012SGarrett Wollman * rpc_util routines 1534e115012SGarrett Wollman */ 154526195adSJordan K. Hubbard void reinitialize(); 155526195adSJordan K. Hubbard void crash(); 156526195adSJordan K. Hubbard void add_type(int len, char *type); 1574e115012SGarrett Wollman void storeval(); 15875863a6dSPhilippe Charnier void *xmalloc(size_t size); 15975863a6dSPhilippe Charnier void *xrealloc(void *ptr, size_t size); 16075863a6dSPhilippe Charnier char *xstrdup(const char *str); 1614e115012SGarrett Wollman 1624e115012SGarrett Wollman #define STOREVAL(list,item) \ 163ff49530fSBill Paul storeval(list,item) 1644e115012SGarrett Wollman 165ff49530fSBill Paul definition *findval(); 1664e115012SGarrett Wollman 1674e115012SGarrett Wollman #define FINDVAL(list,item,finder) \ 168ff49530fSBill Paul findval(list, item, finder) 1694e115012SGarrett Wollman 1704e115012SGarrett Wollman char *fixtype(); 1714e115012SGarrett Wollman char *stringfix(); 172ff49530fSBill Paul char *locase(); 173ff49530fSBill Paul void pvname_svc(); 1744e115012SGarrett Wollman void pvname(); 1754e115012SGarrett Wollman void ptype(); 1764e115012SGarrett Wollman int isvectordef(); 1774e115012SGarrett Wollman int streq(); 1784e115012SGarrett Wollman void error(); 1794e115012SGarrett Wollman void expected1(); 1804e115012SGarrett Wollman void expected2(); 1814e115012SGarrett Wollman void expected3(); 1824e115012SGarrett Wollman void tabify(); 1834e115012SGarrett Wollman void record_open(); 184ff49530fSBill Paul bas_type *find_type(); 1854e115012SGarrett Wollman /* 1864e115012SGarrett Wollman * rpc_cout routines 1874e115012SGarrett Wollman */ 1884e115012SGarrett Wollman void cprint(); 1894e115012SGarrett Wollman void emit(); 1904e115012SGarrett Wollman 1914e115012SGarrett Wollman /* 1924e115012SGarrett Wollman * rpc_hout routines 1934e115012SGarrett Wollman */ 1944e115012SGarrett Wollman void print_datadef(); 195ff49530fSBill Paul void print_funcdef(); 196ff49530fSBill Paul void print_xdr_func_def(); 1974e115012SGarrett Wollman 1984e115012SGarrett Wollman /* 1994e115012SGarrett Wollman * rpc_svcout routines 2004e115012SGarrett Wollman */ 2014e115012SGarrett Wollman void write_most(); 2024e115012SGarrett Wollman void write_register(); 2034e115012SGarrett Wollman void write_rest(); 204ff49530fSBill Paul void write_programs(); 205ff49530fSBill Paul void write_svc_aux(); 206ff49530fSBill Paul void write_inetd_register(); 207ff49530fSBill Paul void write_netid_register(); 208ff49530fSBill Paul void write_nettype_register(); 2094e115012SGarrett Wollman /* 2104e115012SGarrett Wollman * rpc_clntout routines 2114e115012SGarrett Wollman */ 2124e115012SGarrett Wollman void write_stubs(); 213ff49530fSBill Paul 214ff49530fSBill Paul /* 215ff49530fSBill Paul * rpc_tblout routines 216ff49530fSBill Paul */ 217ff49530fSBill Paul void write_tables(); 218