Blame sunrpc/rpc_util.h

Packit 6c4009
/*      @(#)rpc_util.h  1.5  90/08/29  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Copyright (c) 2010, Oracle America, Inc.
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions are
Packit 6c4009
 * met:
Packit 6c4009
 *
Packit 6c4009
 *     * Redistributions of source code must retain the above copyright
Packit 6c4009
 *       notice, this list of conditions and the following disclaimer.
Packit 6c4009
 *     * Redistributions in binary form must reproduce the above
Packit 6c4009
 *       copyright notice, this list of conditions and the following
Packit 6c4009
 *       disclaimer in the documentation and/or other materials
Packit 6c4009
 *       provided with the distribution.
Packit 6c4009
 *     * Neither the name of the "Oracle America, Inc." nor the names of its
Packit 6c4009
 *       contributors may be used to endorse or promote products derived
Packit 6c4009
 *       from this software without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 6c4009
 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 6c4009
 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Packit 6c4009
 *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
Packit 6c4009
 *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Packit 6c4009
 *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
Packit 6c4009
 *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit 6c4009
 *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Packit 6c4009
 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Packit 6c4009
 *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 6c4009
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 * rpc_util.h, Useful definitions for the RPC protocol compiler
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
Packit 6c4009
#define alloc(size)		malloc((unsigned)(size))
Packit 6c4009
#define ALLOC(object)   (object *) malloc(sizeof(object))
Packit 6c4009
Packit 6c4009
#define s_print	(void) sprintf
Packit 6c4009
#define f_print (void) fprintf
Packit 6c4009
Packit 6c4009
struct list {
Packit 6c4009
	definition *val;
Packit 6c4009
	struct list *next;
Packit 6c4009
};
Packit 6c4009
typedef struct list list;
Packit 6c4009
Packit 6c4009
struct xdrfunc {
Packit 6c4009
	char *name;
Packit 6c4009
	int pointerp;
Packit 6c4009
	struct xdrfunc *next;
Packit 6c4009
};
Packit 6c4009
typedef struct xdrfunc xdrfunc;
Packit 6c4009
Packit 6c4009
#define PUT 1
Packit 6c4009
#define GET 2
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Global variables
Packit 6c4009
 */
Packit 6c4009
#define MAXLINESIZE 1024
Packit 6c4009
extern char curline[MAXLINESIZE];
Packit 6c4009
extern const char *where;
Packit 6c4009
extern int linenum;
Packit 6c4009
Packit 6c4009
extern const char *infilename;
Packit 6c4009
extern FILE *fout;
Packit 6c4009
extern FILE *fin;
Packit 6c4009
Packit 6c4009
extern list *defined;
Packit 6c4009
Packit 6c4009
extern bas_type *typ_list_h;
Packit 6c4009
extern bas_type *typ_list_t;
Packit 6c4009
extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * All the option flags
Packit 6c4009
 */
Packit 6c4009
extern int inetdflag;
Packit 6c4009
extern int pmflag;
Packit 6c4009
extern int tblflag;
Packit 6c4009
extern int logflag;
Packit 6c4009
extern int newstyle;
Packit 6c4009
extern int Cflag;      /* C++ flag */
Packit 6c4009
extern int CCflag;     /* C++ flag */
Packit 6c4009
extern int tirpcflag;  /* flag for generating tirpc code */
Packit 6c4009
extern int inlineflag; /* if this is 0, then do not generate inline code */
Packit 6c4009
extern int mtflag;
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Other flags related with inetd jumpstart.
Packit 6c4009
 */
Packit 6c4009
extern int indefinitewait;
Packit 6c4009
extern int exitnow;
Packit 6c4009
extern int timerflag;
Packit 6c4009
Packit 6c4009
extern int nonfatalerrors;
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * rpc_util routines
Packit 6c4009
 */
Packit 6c4009
void storeval(list **lstp, definition *val);
Packit 6c4009
#define STOREVAL(list,item) storeval(list,item)
Packit 6c4009
Packit 6c4009
definition *findval(list *lst, const char *val,
Packit 6c4009
		    int (*cmp)(const definition *, const char *));
Packit 6c4009
#define FINDVAL(list,item,finder) findval(list, item, finder)
Packit 6c4009
Packit 6c4009
const char *fixtype(const char *type);
Packit 6c4009
const char *stringfix(const char *type);
Packit 6c4009
char *locase(const char *str);
Packit 6c4009
void pvname_svc(const char *pname, const char *vnum);
Packit 6c4009
void pvname(const char *pname, const char *vnum);
Packit 6c4009
void ptype(const char *prefix, const char *type, int follow);
Packit 6c4009
int isvectordef(const char *type, relation rel);
Packit 6c4009
int streq(const char *a, const char *b);
Packit 6c4009
void error(const char *msg);
Packit 6c4009
void tabify(FILE *f, int tab);
Packit 6c4009
void record_open(const char *file);
Packit 6c4009
bas_type *find_type(const char *type);
Packit 6c4009
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * rpc_cout routines
Packit 6c4009
 */
Packit 6c4009
void emit(definition *def);
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * rpc_hout routines
Packit 6c4009
 */
Packit 6c4009
void print_datadef(definition *def);
Packit 6c4009
void print_funcdef(definition *def);
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * rpc_svcout routines
Packit 6c4009
 */
Packit 6c4009
void write_most(const char *infile, int netflag, int nomain);
Packit 6c4009
void write_register(void);
Packit 6c4009
void write_rest(void);
Packit 6c4009
void write_programs(const char *storage);
Packit 6c4009
void write_svc_aux(int nomain);
Packit 6c4009
void write_inetd_register(const char *transp);
Packit 6c4009
void write_netid_register(const char *);
Packit 6c4009
void write_nettype_register(const char *);
Packit 6c4009
/*
Packit 6c4009
 * rpc_clntout routines
Packit 6c4009
 */
Packit 6c4009
void write_stubs(void);
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * rpc_tblout routines
Packit 6c4009
 */
Packit 6c4009
void write_tables(void);