17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*a2f144d1SJordan Brown * Common Development and Distribution License (the "License"). 6*a2f144d1SJordan Brown * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 2161961e0fSrobinson 227c478bd9Sstevel@tonic-gate /* 23*a2f144d1SJordan Brown * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 307c478bd9Sstevel@tonic-gate * The Regents of the University of California 317c478bd9Sstevel@tonic-gate * All Rights Reserved 327c478bd9Sstevel@tonic-gate * 337c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 347c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 357c478bd9Sstevel@tonic-gate * contributors. 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifndef _RPC_UTIL_H 397c478bd9Sstevel@tonic-gate #define _RPC_UTIL_H 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #include <sys/types.h> 427c478bd9Sstevel@tonic-gate #include <stdlib.h> 4361961e0fSrobinson #include "rpc_scan.h" 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #ifdef __cplusplus 467c478bd9Sstevel@tonic-gate extern "C" { 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 507c478bd9Sstevel@tonic-gate * rpc_util.h, Useful definitions for the RPC protocol compiler 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* Current version number of rpcgen. */ 557c478bd9Sstevel@tonic-gate #define RPCGEN_MAJOR 1 567c478bd9Sstevel@tonic-gate #define RPCGEN_MINOR 1 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate #define f_print (void) fprintf 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate struct list { 617c478bd9Sstevel@tonic-gate definition *val; 627c478bd9Sstevel@tonic-gate struct list *next; 637c478bd9Sstevel@tonic-gate }; 647c478bd9Sstevel@tonic-gate typedef struct list list; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate struct xdrfunc { 677c478bd9Sstevel@tonic-gate char *name; 687c478bd9Sstevel@tonic-gate int pointerp; 697c478bd9Sstevel@tonic-gate struct xdrfunc *next; 707c478bd9Sstevel@tonic-gate }; 717c478bd9Sstevel@tonic-gate typedef struct xdrfunc xdrfunc; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate struct commandline { 747c478bd9Sstevel@tonic-gate int cflag; /* xdr C routines */ 757c478bd9Sstevel@tonic-gate int hflag; /* header file */ 767c478bd9Sstevel@tonic-gate int lflag; /* client side stubs */ 777c478bd9Sstevel@tonic-gate int mflag; /* server side stubs */ 787c478bd9Sstevel@tonic-gate int nflag; /* netid flag */ 797c478bd9Sstevel@tonic-gate int sflag; /* server stubs for the given transport */ 807c478bd9Sstevel@tonic-gate int tflag; /* dispatch Table file */ 817c478bd9Sstevel@tonic-gate int Ssflag; /* produce server sample code */ 827c478bd9Sstevel@tonic-gate int Scflag; /* produce client sample code */ 837c478bd9Sstevel@tonic-gate int makefileflag; /* Generate a template Makefile */ 847c478bd9Sstevel@tonic-gate char *infile; /* input module name */ 857c478bd9Sstevel@tonic-gate char *outfile; /* output module name */ 867c478bd9Sstevel@tonic-gate }; 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate #define PUT 1 897c478bd9Sstevel@tonic-gate #define GET 2 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * Global variables 937c478bd9Sstevel@tonic-gate */ 947c478bd9Sstevel@tonic-gate #define MAXLINESIZE 1024 957c478bd9Sstevel@tonic-gate extern char curline[MAXLINESIZE]; 967c478bd9Sstevel@tonic-gate extern char *where; 977c478bd9Sstevel@tonic-gate extern int linenum; 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate extern char *infilename; 1007c478bd9Sstevel@tonic-gate extern FILE *fout; 1017c478bd9Sstevel@tonic-gate extern FILE *fin; 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate extern list *defined; 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate extern bas_type *typ_list_h; 1067c478bd9Sstevel@tonic-gate extern bas_type *typ_list_t; 1077c478bd9Sstevel@tonic-gate extern xdrfunc *xdrfunc_head, *xdrfunc_tail; 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * All the option flags 1117c478bd9Sstevel@tonic-gate */ 1127c478bd9Sstevel@tonic-gate extern int inetdflag; 1137c478bd9Sstevel@tonic-gate extern int pmflag; 1147c478bd9Sstevel@tonic-gate extern int tblflag; 1157c478bd9Sstevel@tonic-gate extern int logflag; 1167c478bd9Sstevel@tonic-gate extern int newstyle; 1177c478bd9Sstevel@tonic-gate extern int Cflag; /* ANSI-C/C++ flag */ 1187c478bd9Sstevel@tonic-gate extern int CCflag; /* C++ flag */ 1197c478bd9Sstevel@tonic-gate extern int tirpcflag; /* flag for generating tirpc code */ 1207c478bd9Sstevel@tonic-gate extern int inlinelen; /* if this is 0, then do not generate inline code */ 1217c478bd9Sstevel@tonic-gate extern int mtflag; 1227c478bd9Sstevel@tonic-gate extern int mtauto; 1237c478bd9Sstevel@tonic-gate extern int rflag; 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate /* 1267c478bd9Sstevel@tonic-gate * Other flags related with inetd jumpstart. 1277c478bd9Sstevel@tonic-gate */ 1287c478bd9Sstevel@tonic-gate extern int indefinitewait; 1297c478bd9Sstevel@tonic-gate extern int exitnow; 1307c478bd9Sstevel@tonic-gate extern int timerflag; 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate extern int nonfatalerrors; 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate extern pid_t childpid; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* 1377c478bd9Sstevel@tonic-gate * rpc_util routines 1387c478bd9Sstevel@tonic-gate */ 13961961e0fSrobinson extern void storeval(list **, definition *); 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #define STOREVAL(list, item) \ 1427c478bd9Sstevel@tonic-gate storeval(list, item) 1437c478bd9Sstevel@tonic-gate 14461961e0fSrobinson extern definition *findval(list *, char *, int (*)()); 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate #define FINDVAL(list, item, finder) \ 1477c478bd9Sstevel@tonic-gate findval(list, item, finder) 1487c478bd9Sstevel@tonic-gate 14961961e0fSrobinson extern char *fixtype(char *); 15061961e0fSrobinson extern char *stringfix(char *); 15161961e0fSrobinson extern char *locase(char *); 15261961e0fSrobinson extern void pvname_svc(char *, char *); 15361961e0fSrobinson extern void pvname(char *, char *); 15461961e0fSrobinson extern void ptype(char *, char *, int); 15561961e0fSrobinson extern int isvectordef(char *, relation); 15661961e0fSrobinson extern int streq(char *, char *); 15761961e0fSrobinson extern void error(char *); 15861961e0fSrobinson extern void expected1(tok_kind); 15961961e0fSrobinson extern void expected2(tok_kind, tok_kind); 16061961e0fSrobinson extern void expected3(tok_kind, tok_kind, tok_kind); 16161961e0fSrobinson extern void tabify(FILE *, int); 16261961e0fSrobinson extern void record_open(char *); 16361961e0fSrobinson extern bas_type *find_type(char *); 16461961e0fSrobinson 1657c478bd9Sstevel@tonic-gate /* 1667c478bd9Sstevel@tonic-gate * rpc_cout routines 1677c478bd9Sstevel@tonic-gate */ 16861961e0fSrobinson extern void emit(definition *); 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate /* 1717c478bd9Sstevel@tonic-gate * rpc_hout routines 1727c478bd9Sstevel@tonic-gate */ 17361961e0fSrobinson extern void print_datadef(definition *); 17461961e0fSrobinson extern void print_funcdef(definition *); 17561961e0fSrobinson extern void print_xdr_func_def(char *, int, int); 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate /* 1787c478bd9Sstevel@tonic-gate * rpc_svcout routines 1797c478bd9Sstevel@tonic-gate */ 18061961e0fSrobinson extern void write_most(char *, int, int); 18161961e0fSrobinson extern void write_rest(void); 18261961e0fSrobinson extern void write_inetd_register(char *); 18361961e0fSrobinson extern void write_netid_register(char *); 18461961e0fSrobinson extern void write_nettype_register(char *); 18561961e0fSrobinson 1867c478bd9Sstevel@tonic-gate /* 1877c478bd9Sstevel@tonic-gate * rpc_clntout routines 1887c478bd9Sstevel@tonic-gate */ 18961961e0fSrobinson extern void write_stubs(void); 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate /* 1927c478bd9Sstevel@tonic-gate * rpc_tblout routines 1937c478bd9Sstevel@tonic-gate */ 19461961e0fSrobinson extern void write_tables(void); 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1977c478bd9Sstevel@tonic-gate } 1987c478bd9Sstevel@tonic-gate #endif 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate #endif /* !_RPC_UTIL_H */ 201