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