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 714e115012SGarrett Wollman #define alloc(size) malloc((unsigned)(size)) 724e115012SGarrett Wollman #define ALLOC(object) (object *) malloc(sizeof(object)) 734e115012SGarrett Wollman 744e115012SGarrett Wollman #define s_print (void) sprintf 754e115012SGarrett Wollman #define f_print (void) fprintf 764e115012SGarrett Wollman 774e115012SGarrett Wollman struct list { 78ff49530fSBill Paul definition *val; 794e115012SGarrett Wollman struct list *next; 804e115012SGarrett Wollman }; 814e115012SGarrett Wollman typedef struct list list; 824e115012SGarrett Wollman 83ff49530fSBill Paul struct xdrfunc { 84ff49530fSBill Paul char *name; 85ff49530fSBill Paul int pointerp; 86ff49530fSBill Paul struct xdrfunc *next; 87ff49530fSBill Paul }; 88ff49530fSBill Paul typedef struct xdrfunc xdrfunc; 89ff49530fSBill Paul 90ff49530fSBill Paul struct commandline { 91ff49530fSBill Paul int cflag; /* xdr C routines */ 92ff49530fSBill Paul int hflag; /* header file */ 93ff49530fSBill Paul int lflag; /* client side stubs */ 94ff49530fSBill Paul int mflag; /* server side stubs */ 95ff49530fSBill Paul int nflag; /* netid flag */ 96ff49530fSBill Paul int sflag; /* server stubs for the given transport */ 97ff49530fSBill Paul int tflag; /* dispatch Table file */ 98ff49530fSBill Paul int Ssflag; /* produce server sample code */ 99ff49530fSBill Paul int Scflag; /* produce client sample code */ 100ff49530fSBill Paul int makefileflag; /* Generate a template Makefile */ 101ff49530fSBill Paul char *infile; /* input module name */ 102ff49530fSBill Paul char *outfile; /* output module name */ 103ff49530fSBill Paul }; 104ff49530fSBill Paul 105ff49530fSBill Paul #define PUT 1 106ff49530fSBill Paul #define GET 2 107ff49530fSBill Paul 1084e115012SGarrett Wollman /* 1094e115012SGarrett Wollman * Global variables 1104e115012SGarrett Wollman */ 1114e115012SGarrett Wollman #define MAXLINESIZE 1024 1124e115012SGarrett Wollman extern char curline[MAXLINESIZE]; 1134e115012SGarrett Wollman extern char *where; 1144e115012SGarrett Wollman extern int linenum; 1154e115012SGarrett Wollman 1164e115012SGarrett Wollman extern char *infilename; 1174e115012SGarrett Wollman extern FILE *fout; 1184e115012SGarrett Wollman extern FILE *fin; 1194e115012SGarrett Wollman 1204e115012SGarrett Wollman extern list *defined; 1214e115012SGarrett Wollman 122ff49530fSBill Paul 123ff49530fSBill Paul extern bas_type *typ_list_h; 124ff49530fSBill Paul extern bas_type *typ_list_t; 125ff49530fSBill Paul extern xdrfunc *xdrfunc_head, *xdrfunc_tail; 126ff49530fSBill Paul 127ff49530fSBill Paul /* 128ff49530fSBill Paul * All the option flags 129ff49530fSBill Paul */ 130ff49530fSBill Paul extern int inetdflag; 131ff49530fSBill Paul extern int pmflag; 132ff49530fSBill Paul extern int tblflag; 133ff49530fSBill Paul extern int logflag; 134ff49530fSBill Paul extern int newstyle; 135ff49530fSBill Paul extern int Cflag; /* ANSI-C/C++ flag */ 136ff49530fSBill Paul extern int CCflag; /* C++ flag */ 137ff49530fSBill Paul extern int tirpcflag; /* flag for generating tirpc code */ 138ff49530fSBill Paul extern int inline; /* if this is 0, then do not generate inline code */ 139ff49530fSBill Paul extern int mtflag; 140ff49530fSBill Paul 141ff49530fSBill Paul /* 142ff49530fSBill Paul * Other flags related with inetd jumpstart. 143ff49530fSBill Paul */ 144ff49530fSBill Paul extern int indefinitewait; 145ff49530fSBill Paul extern int exitnow; 146ff49530fSBill Paul extern int timerflag; 147ff49530fSBill Paul 148ff49530fSBill Paul extern int nonfatalerrors; 149ff49530fSBill Paul 150ff49530fSBill Paul extern pid_t childpid; 151ff49530fSBill Paul 1524e115012SGarrett Wollman /* 1534e115012SGarrett Wollman * rpc_util routines 1544e115012SGarrett Wollman */ 155526195adSJordan K. Hubbard void reinitialize(); 156526195adSJordan K. Hubbard void crash(); 157526195adSJordan K. Hubbard void add_type(int len, char *type); 158526195adSJordan K. Hubbard 1594e115012SGarrett Wollman void storeval(); 1604e115012SGarrett Wollman 1614e115012SGarrett Wollman #define STOREVAL(list,item) \ 162ff49530fSBill Paul storeval(list,item) 1634e115012SGarrett Wollman 164ff49530fSBill Paul definition *findval(); 1654e115012SGarrett Wollman 1664e115012SGarrett Wollman #define FINDVAL(list,item,finder) \ 167ff49530fSBill Paul findval(list, item, finder) 1684e115012SGarrett Wollman 1694e115012SGarrett Wollman char *fixtype(); 1704e115012SGarrett Wollman char *stringfix(); 171ff49530fSBill Paul char *locase(); 172ff49530fSBill Paul void pvname_svc(); 1734e115012SGarrett Wollman void pvname(); 1744e115012SGarrett Wollman void ptype(); 1754e115012SGarrett Wollman int isvectordef(); 1764e115012SGarrett Wollman int streq(); 1774e115012SGarrett Wollman void error(); 1784e115012SGarrett Wollman void expected1(); 1794e115012SGarrett Wollman void expected2(); 1804e115012SGarrett Wollman void expected3(); 1814e115012SGarrett Wollman void tabify(); 1824e115012SGarrett Wollman void record_open(); 183ff49530fSBill Paul bas_type *find_type(); 1844e115012SGarrett Wollman /* 1854e115012SGarrett Wollman * rpc_cout routines 1864e115012SGarrett Wollman */ 1874e115012SGarrett Wollman void cprint(); 1884e115012SGarrett Wollman void emit(); 1894e115012SGarrett Wollman 1904e115012SGarrett Wollman /* 1914e115012SGarrett Wollman * rpc_hout routines 1924e115012SGarrett Wollman */ 1934e115012SGarrett Wollman void print_datadef(); 194ff49530fSBill Paul void print_funcdef(); 195ff49530fSBill Paul void print_xdr_func_def(); 1964e115012SGarrett Wollman 1974e115012SGarrett Wollman /* 1984e115012SGarrett Wollman * rpc_svcout routines 1994e115012SGarrett Wollman */ 2004e115012SGarrett Wollman void write_most(); 2014e115012SGarrett Wollman void write_register(); 2024e115012SGarrett Wollman void write_rest(); 203ff49530fSBill Paul void write_programs(); 204ff49530fSBill Paul void write_svc_aux(); 205ff49530fSBill Paul void write_inetd_register(); 206ff49530fSBill Paul void write_netid_register(); 207ff49530fSBill Paul void write_nettype_register(); 2084e115012SGarrett Wollman /* 2094e115012SGarrett Wollman * rpc_clntout routines 2104e115012SGarrett Wollman */ 2114e115012SGarrett Wollman void write_stubs(); 212ff49530fSBill Paul 213ff49530fSBill Paul /* 214ff49530fSBill Paul * rpc_tblout routines 215ff49530fSBill Paul */ 216ff49530fSBill Paul void write_tables(); 217