Back to index

glibc  2.9
rpc_util.h
Go to the documentation of this file.
00001 /*
00002  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
00003  * unrestricted use provided that this legend is included on all tape
00004  * media and as a part of the software program in whole or part.  Users
00005  * may copy or modify Sun RPC without charge, but are not authorized
00006  * to license or distribute it to anyone else except as part of a product or
00007  * program developed by the user or with the express written consent of
00008  * Sun Microsystems, Inc.
00009  *
00010  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
00011  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
00012  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
00013  *
00014  * Sun RPC is provided with no support and without any obligation on the
00015  * part of Sun Microsystems, Inc. to assist in its use, correction,
00016  * modification or enhancement.
00017  *
00018  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
00019  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
00020  * OR ANY PART THEREOF.
00021  *
00022  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
00023  * or profits or other special, indirect and consequential damages, even if
00024  * Sun has been advised of the possibility of such damages.
00025  *
00026  * Sun Microsystems, Inc.
00027  * 2550 Garcia Avenue
00028  * Mountain View, California  94043
00029  */
00030 
00031 /*      @(#)rpc_util.h  1.5  90/08/29  (C) 1987 SMI   */
00032 
00033 /*
00034  * rpc_util.h, Useful definitions for the RPC protocol compiler
00035  */
00036 
00037 #include <stdlib.h>
00038 
00039 #define alloc(size)         malloc((unsigned)(size))
00040 #define ALLOC(object)   (object *) malloc(sizeof(object))
00041 
00042 #define s_print      (void) sprintf
00043 #define f_print (void) fprintf
00044 
00045 struct list {
00046        definition *val;
00047        struct list *next;
00048 };
00049 typedef struct list list;
00050 
00051 struct xdrfunc {
00052         char *name;
00053         int pointerp;
00054         struct xdrfunc *next;
00055 };
00056 typedef struct xdrfunc xdrfunc;
00057 
00058 #define PUT 1
00059 #define GET 2
00060 
00061 /*
00062  * Global variables
00063  */
00064 #define MAXLINESIZE 1024
00065 extern char curline[MAXLINESIZE];
00066 extern const char *where;
00067 extern int linenum;
00068 
00069 extern const char *infilename;
00070 extern FILE *fout;
00071 extern FILE *fin;
00072 
00073 extern list *defined;
00074 
00075 extern bas_type *typ_list_h;
00076 extern bas_type *typ_list_t;
00077 extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
00078 
00079 /*
00080  * All the option flags
00081  */
00082 extern int inetdflag;
00083 extern int pmflag;
00084 extern int tblflag;
00085 extern int logflag;
00086 extern int newstyle;
00087 extern int Cflag;      /* C++ flag */
00088 extern int CCflag;     /* C++ flag */
00089 extern int tirpcflag;  /* flag for generating tirpc code */
00090 extern int inlineflag; /* if this is 0, then do not generate inline code */
00091 extern int mtflag;
00092 
00093 /*
00094  * Other flags related with inetd jumpstart.
00095  */
00096 extern int indefinitewait;
00097 extern int exitnow;
00098 extern int timerflag;
00099 
00100 extern int nonfatalerrors;
00101 
00102 /*
00103  * rpc_util routines
00104  */
00105 void storeval(list **lstp, definition *val);
00106 #define STOREVAL(list,item) storeval(list,item)
00107 
00108 definition *findval(list *lst, const char *val,
00109                   int (*cmp)(const definition *, const char *));
00110 #define FINDVAL(list,item,finder) findval(list, item, finder)
00111 
00112 const char *fixtype(const char *type);
00113 const char *stringfix(const char *type);
00114 char *locase(const char *str);
00115 void pvname_svc(const char *pname, const char *vnum);
00116 void pvname(const char *pname, const char *vnum);
00117 void ptype(const char *prefix, const char *type, int follow);
00118 int isvectordef(const char *type, relation rel);
00119 int streq(const char *a, const char *b);
00120 void error(const char *msg);
00121 void tabify(FILE *f, int tab);
00122 void record_open(const char *file);
00123 bas_type *find_type(const char *type);
00124 
00125 
00126 /*
00127  * rpc_cout routines
00128  */
00129 void emit(definition *def);
00130 
00131 /*
00132  * rpc_hout routines
00133  */
00134 void print_datadef(definition *def);
00135 void print_funcdef(definition *def);
00136 
00137 /*
00138  * rpc_svcout routines
00139  */
00140 void write_most(const char *infile, int netflag, int nomain);
00141 void write_register(void);
00142 void write_rest(void);
00143 void write_programs(const char *storage);
00144 void write_svc_aux(int nomain);
00145 void write_inetd_register(const char *transp);
00146 void write_netid_register(const char *);
00147 void write_nettype_register(const char *);
00148 /*
00149  * rpc_clntout routines
00150  */
00151 void write_stubs(void);
00152 
00153 /*
00154  * rpc_tblout routines
00155  */
00156 void write_tables(void);