Annotation of src/usr.bin/rpcgen/rpc_util.h, Revision 1.17
1.17 ! krw 1: /* $OpenBSD: rpc_util.h,v 1.16 2015/08/20 22:32:41 deraadt Exp $ */
1.1 deraadt 2: /* $NetBSD: rpc_util.h,v 1.3 1995/06/11 21:50:10 pk Exp $ */
1.15 millert 3:
1.1 deraadt 4: /*
1.15 millert 5: * Copyright (c) 2010, Oracle America, Inc.
1.1 deraadt 6: *
1.15 millert 7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions are
9: * met:
1.1 deraadt 10: *
1.15 millert 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.
1.1 deraadt 20: *
1.15 millert 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.
1.1 deraadt 33: */
34:
35: /* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */
36:
37: /*
1.17 ! krw 38: * rpc_util.h, Useful definitions for the RPC protocol compiler
1.1 deraadt 39: */
40:
41: struct list {
42: definition *val;
43: struct list *next;
44: };
45: typedef struct list list;
46:
47: #define PUT 1
48: #define GET 2
49:
50: /*
1.17 ! krw 51: * Global variables
1.1 deraadt 52: */
53: #define MAXLINESIZE 1024
54: extern char curline[MAXLINESIZE];
55: extern char *where;
56: extern int linenum;
57:
58: extern char *infilename;
59: extern FILE *fout;
60: extern FILE *fin;
61:
62: extern list *defined;
63:
64:
65: extern bas_type *typ_list_h;
66: extern bas_type *typ_list_t;
67:
68: /*
69: * All the option flags
70: */
71: extern int inetdflag;
1.13 deraadt 72: extern int pmflag;
1.1 deraadt 73: extern int tblflag;
74: extern int logflag;
75: extern int newstyle;
76: extern int Cflag; /* C++ flag */
77: extern int tirpcflag; /* flag for generating tirpc code */
1.3 deraadt 78: extern int doinline; /* if this is 0, then do not generate inline code */
1.1 deraadt 79: extern int callerflag;
80:
81: /*
82: * Other flags related with inetd jumpstart.
83: */
84: extern int indefinitewait;
85: extern int exitnow;
86: extern int timerflag;
87:
88: extern int nonfatalerrors;
89:
90: /*
1.17 ! krw 91: * rpc_util routines
1.1 deraadt 92: */
1.12 deraadt 93: void storeval(list **, definition *);
1.1 deraadt 94:
95: #define STOREVAL(list,item) \
96: storeval(list,item)
97:
1.12 deraadt 98: definition *findval(list *, char *, int (*)(definition *, char *));
1.1 deraadt 99:
100: #define FINDVAL(list,item,finder) \
101: findval(list, item, finder)
102:
1.9 millert 103: void crash(void);
104: char *fixtype(char *);
105: char *stringfix(char *);
106: char *locase(char *);
107: void pvname_svc(char *, char *);
108: void pvname(char *, char *);
109: void ptype(char *, char *, int);
110: int isvectordef(char *, relation);
111: int streq(char *, char *);
112: void error(char *);
113: void tabify(FILE *, int);
114: void record_open(char *);
115: bas_type *find_type(char *);
116: char *make_argname(char *, char *);
1.1 deraadt 117: /*
1.17 ! krw 118: * rpc_cout routines
1.1 deraadt 119: */
1.9 millert 120: void emit(definition *);
1.1 deraadt 121:
122: /*
1.17 ! krw 123: * rpc_hout routines
1.1 deraadt 124: */
1.9 millert 125: void print_datadef(definition *);
126: void print_funcdef(definition *);
1.1 deraadt 127:
128: /*
1.17 ! krw 129: * rpc_svcout routines
1.1 deraadt 130: */
1.9 millert 131: void write_most(char *, int, int);
132: void write_rest(void);
133: void write_programs(char *);
134: void write_svc_aux(int);
135: void write_inetd_register(char *);
136: void write_netid_register(char *);
137: void write_nettype_register(char *);
1.14 weingart 138: int nullproc(proc_list *);
139:
1.1 deraadt 140: /*
141: * rpc_clntout routines
142: */
1.9 millert 143: void write_stubs(void);
144: void printarglist(proc_list *, char *, char *);
1.1 deraadt 145:
146:
147: /*
148: * rpc_tblout routines
149: */
1.9 millert 150: void write_tables(void);
1.1 deraadt 151:
152: /*
153: * rpc_sample routines
154: */
1.9 millert 155: void write_sample_svc(definition *);
156: int write_sample_clnt(definition *);
157: void write_sample_clnt_main(void);
1.11 deraadt 158:
159: void add_type(int len, char *type);
160:
1.13 deraadt 161: void pdeclaration(char *, declaration *, int, char *);
162: void add_sample_msg(void);