1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 27*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 28*7c478bd9Sstevel@tonic-gate /* 29*7c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 30*7c478bd9Sstevel@tonic-gate * The Regents of the University of California 31*7c478bd9Sstevel@tonic-gate * All Rights Reserved 32*7c478bd9Sstevel@tonic-gate * 33*7c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 34*7c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 35*7c478bd9Sstevel@tonic-gate * contributors. 36*7c478bd9Sstevel@tonic-gate */ 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #ifndef _RPC_UTIL_H 39*7c478bd9Sstevel@tonic-gate #define _RPC_UTIL_H 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 44*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 47*7c478bd9Sstevel@tonic-gate extern "C" { 48*7c478bd9Sstevel@tonic-gate #endif 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * rpc_util.h, Useful definitions for the RPC protocol compiler 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate /* Current version number of rpcgen. */ 56*7c478bd9Sstevel@tonic-gate #define RPCGEN_MAJOR 1 57*7c478bd9Sstevel@tonic-gate #define RPCGEN_MINOR 1 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate #define alloc(size) malloc((unsigned)(size)) 60*7c478bd9Sstevel@tonic-gate #define ALLOC(object) (object *) calloc(1, sizeof (object)) 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate #define s_print (void) sprintf 63*7c478bd9Sstevel@tonic-gate #define f_print (void) fprintf 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate struct list { 66*7c478bd9Sstevel@tonic-gate definition *val; 67*7c478bd9Sstevel@tonic-gate struct list *next; 68*7c478bd9Sstevel@tonic-gate }; 69*7c478bd9Sstevel@tonic-gate typedef struct list list; 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate struct xdrfunc { 72*7c478bd9Sstevel@tonic-gate char *name; 73*7c478bd9Sstevel@tonic-gate int pointerp; 74*7c478bd9Sstevel@tonic-gate struct xdrfunc *next; 75*7c478bd9Sstevel@tonic-gate }; 76*7c478bd9Sstevel@tonic-gate typedef struct xdrfunc xdrfunc; 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate struct commandline { 79*7c478bd9Sstevel@tonic-gate int cflag; /* xdr C routines */ 80*7c478bd9Sstevel@tonic-gate int hflag; /* header file */ 81*7c478bd9Sstevel@tonic-gate int lflag; /* client side stubs */ 82*7c478bd9Sstevel@tonic-gate int mflag; /* server side stubs */ 83*7c478bd9Sstevel@tonic-gate int nflag; /* netid flag */ 84*7c478bd9Sstevel@tonic-gate int sflag; /* server stubs for the given transport */ 85*7c478bd9Sstevel@tonic-gate int tflag; /* dispatch Table file */ 86*7c478bd9Sstevel@tonic-gate int Ssflag; /* produce server sample code */ 87*7c478bd9Sstevel@tonic-gate int Scflag; /* produce client sample code */ 88*7c478bd9Sstevel@tonic-gate int makefileflag; /* Generate a template Makefile */ 89*7c478bd9Sstevel@tonic-gate char *infile; /* input module name */ 90*7c478bd9Sstevel@tonic-gate char *outfile; /* output module name */ 91*7c478bd9Sstevel@tonic-gate }; 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate #define PUT 1 94*7c478bd9Sstevel@tonic-gate #define GET 2 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate /* 97*7c478bd9Sstevel@tonic-gate * Global variables 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate #define MAXLINESIZE 1024 100*7c478bd9Sstevel@tonic-gate extern char curline[MAXLINESIZE]; 101*7c478bd9Sstevel@tonic-gate extern char *where; 102*7c478bd9Sstevel@tonic-gate extern int linenum; 103*7c478bd9Sstevel@tonic-gate 104*7c478bd9Sstevel@tonic-gate extern char *infilename; 105*7c478bd9Sstevel@tonic-gate extern FILE *fout; 106*7c478bd9Sstevel@tonic-gate extern FILE *fin; 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate extern list *defined; 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate extern bas_type *typ_list_h; 112*7c478bd9Sstevel@tonic-gate extern bas_type *typ_list_t; 113*7c478bd9Sstevel@tonic-gate extern xdrfunc *xdrfunc_head, *xdrfunc_tail; 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate /* 116*7c478bd9Sstevel@tonic-gate * All the option flags 117*7c478bd9Sstevel@tonic-gate */ 118*7c478bd9Sstevel@tonic-gate extern int inetdflag; 119*7c478bd9Sstevel@tonic-gate extern int pmflag; 120*7c478bd9Sstevel@tonic-gate extern int tblflag; 121*7c478bd9Sstevel@tonic-gate extern int logflag; 122*7c478bd9Sstevel@tonic-gate extern int newstyle; 123*7c478bd9Sstevel@tonic-gate extern int Cflag; /* ANSI-C/C++ flag */ 124*7c478bd9Sstevel@tonic-gate extern int CCflag; /* C++ flag */ 125*7c478bd9Sstevel@tonic-gate extern int tirpcflag; /* flag for generating tirpc code */ 126*7c478bd9Sstevel@tonic-gate extern int inlinelen; /* if this is 0, then do not generate inline code */ 127*7c478bd9Sstevel@tonic-gate extern int mtflag; 128*7c478bd9Sstevel@tonic-gate extern int mtauto; 129*7c478bd9Sstevel@tonic-gate extern int rflag; 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate /* 132*7c478bd9Sstevel@tonic-gate * Other flags related with inetd jumpstart. 133*7c478bd9Sstevel@tonic-gate */ 134*7c478bd9Sstevel@tonic-gate extern int indefinitewait; 135*7c478bd9Sstevel@tonic-gate extern int exitnow; 136*7c478bd9Sstevel@tonic-gate extern int timerflag; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate extern int nonfatalerrors; 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate extern pid_t childpid; 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate /* 143*7c478bd9Sstevel@tonic-gate * rpc_util routines 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate void storeval(); 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate #define STOREVAL(list, item) \ 148*7c478bd9Sstevel@tonic-gate storeval(list, item) 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate definition *findval(); 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate #define FINDVAL(list, item, finder) \ 153*7c478bd9Sstevel@tonic-gate findval(list, item, finder) 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate char *fixtype(); 156*7c478bd9Sstevel@tonic-gate char *stringfix(); 157*7c478bd9Sstevel@tonic-gate char *locase(); 158*7c478bd9Sstevel@tonic-gate void pvname_svc(); 159*7c478bd9Sstevel@tonic-gate void pvname(); 160*7c478bd9Sstevel@tonic-gate void ptype(); 161*7c478bd9Sstevel@tonic-gate int isvectordef(); 162*7c478bd9Sstevel@tonic-gate int streq(); 163*7c478bd9Sstevel@tonic-gate void error(); 164*7c478bd9Sstevel@tonic-gate void expected1(); 165*7c478bd9Sstevel@tonic-gate void expected2(); 166*7c478bd9Sstevel@tonic-gate void expected3(); 167*7c478bd9Sstevel@tonic-gate void tabify(); 168*7c478bd9Sstevel@tonic-gate void record_open(); 169*7c478bd9Sstevel@tonic-gate bas_type *find_type(); 170*7c478bd9Sstevel@tonic-gate /* 171*7c478bd9Sstevel@tonic-gate * rpc_cout routines 172*7c478bd9Sstevel@tonic-gate */ 173*7c478bd9Sstevel@tonic-gate void cprint(); 174*7c478bd9Sstevel@tonic-gate void emit(); 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate /* 177*7c478bd9Sstevel@tonic-gate * rpc_hout routines 178*7c478bd9Sstevel@tonic-gate */ 179*7c478bd9Sstevel@tonic-gate void print_datadef(); 180*7c478bd9Sstevel@tonic-gate void print_funcdef(); 181*7c478bd9Sstevel@tonic-gate void print_xdr_func_def(); 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate /* 184*7c478bd9Sstevel@tonic-gate * rpc_svcout routines 185*7c478bd9Sstevel@tonic-gate */ 186*7c478bd9Sstevel@tonic-gate void write_most(); 187*7c478bd9Sstevel@tonic-gate void write_register(); 188*7c478bd9Sstevel@tonic-gate void write_rest(); 189*7c478bd9Sstevel@tonic-gate void write_programs(); 190*7c478bd9Sstevel@tonic-gate void write_svc_aux(); 191*7c478bd9Sstevel@tonic-gate void write_inetd_register(); 192*7c478bd9Sstevel@tonic-gate void write_netid_register(); 193*7c478bd9Sstevel@tonic-gate void write_nettype_register(); 194*7c478bd9Sstevel@tonic-gate /* 195*7c478bd9Sstevel@tonic-gate * rpc_clntout routines 196*7c478bd9Sstevel@tonic-gate */ 197*7c478bd9Sstevel@tonic-gate void write_stubs(); 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate /* 200*7c478bd9Sstevel@tonic-gate * rpc_tblout routines 201*7c478bd9Sstevel@tonic-gate */ 202*7c478bd9Sstevel@tonic-gate void write_tables(); 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 205*7c478bd9Sstevel@tonic-gate } 206*7c478bd9Sstevel@tonic-gate #endif 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate #endif /* !_RPC_UTIL_H */ 209