1/* $OpenBSD: rpc_util.h,v 1.17 2017/01/21 08:33:07 krw Exp $ */ 2/* $NetBSD: rpc_util.h,v 1.3 1995/06/11 21:50:10 pk Exp $ */ 3 4/* 5 * Copyright (c) 2010, Oracle America, Inc. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are 9 * met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above 14 * copyright notice, this list of conditions and the following 15 * disclaimer in the documentation and/or other materials 16 * provided with the distribution. 17 * * Neither the name of the "Oracle America, Inc." nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35/* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */ 36 37/* 38 * rpc_util.h, Useful definitions for the RPC protocol compiler 39 */ 40 41struct list { 42 definition *val; 43 struct list *next; 44}; 45typedef struct list list; 46 47#define PUT 1 48#define GET 2 49 50/* 51 * Global variables 52 */ 53#define MAXLINESIZE 1024 54extern char curline[MAXLINESIZE]; 55extern char *where; 56extern int linenum; 57 58extern char *infilename; 59extern FILE *fout; 60extern FILE *fin; 61 62extern list *defined; 63 64 65extern bas_type *typ_list_h; 66extern bas_type *typ_list_t; 67 68/* 69 * All the option flags 70 */ 71extern int inetdflag; 72extern int pmflag; 73extern int tblflag; 74extern int logflag; 75extern int newstyle; 76extern int Cflag; /* C++ flag */ 77extern int tirpcflag; /* flag for generating tirpc code */ 78extern int doinline; /* if this is 0, then do not generate inline code */ 79extern int callerflag; 80 81/* 82 * Other flags related with inetd jumpstart. 83 */ 84extern int indefinitewait; 85extern int exitnow; 86extern int timerflag; 87 88extern int nonfatalerrors; 89 90/* 91 * rpc_util routines 92 */ 93void storeval(list **, definition *); 94 95#define STOREVAL(list,item) \ 96 storeval(list,item) 97 98definition *findval(list *, char *, int (*)(definition *, char *)); 99 100#define FINDVAL(list,item,finder) \ 101 findval(list, item, finder) 102 103void crash(void); 104char *fixtype(char *); 105char *stringfix(char *); 106char *locase(char *); 107void pvname_svc(char *, char *); 108void pvname(char *, char *); 109void ptype(char *, char *, int); 110int isvectordef(char *, relation); 111int streq(char *, char *); 112void error(char *); 113void tabify(FILE *, int); 114void record_open(char *); 115bas_type *find_type(char *); 116char *make_argname(char *, char *); 117/* 118 * rpc_cout routines 119 */ 120void emit(definition *); 121 122/* 123 * rpc_hout routines 124 */ 125void print_datadef(definition *); 126void print_funcdef(definition *); 127 128/* 129 * rpc_svcout routines 130 */ 131void write_most(char *, int, int); 132void write_rest(void); 133void write_programs(char *); 134void write_svc_aux(int); 135void write_inetd_register(char *); 136void write_netid_register(char *); 137void write_nettype_register(char *); 138int nullproc(proc_list *); 139 140/* 141 * rpc_clntout routines 142 */ 143void write_stubs(void); 144void printarglist(proc_list *, char *, char *); 145 146 147/* 148 * rpc_tblout routines 149 */ 150void write_tables(void); 151 152/* 153 * rpc_sample routines 154 */ 155void write_sample_svc(definition *); 156int write_sample_clnt(definition *); 157void write_sample_clnt_main(void); 158 159void add_type(int len, char *type); 160 161void pdeclaration(char *, declaration *, int, char *); 162void add_sample_msg(void); 163