[BACK]Return to rpc_util.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / rpcgen

Annotation of src/usr.bin/rpcgen/rpc_util.h, Revision 1.15

1.15    ! millert     1: /*     $OpenBSD: rpc_util.h,v 1.14 2007/10/03 15:12:13 weingart 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: /*
                     38:  * rpc_util.h, Useful definitions for the RPC protocol compiler
                     39:  */
                     40:
                     41: #define alloc(size)            (void *)malloc((unsigned)(size))
                     42: #define ALLOC(object)   (object *) malloc(sizeof(object))
                     43:
                     44: struct list {
                     45:        definition *val;
                     46:        struct list *next;
                     47: };
                     48: typedef struct list list;
                     49:
                     50: #define PUT 1
                     51: #define GET 2
                     52:
                     53: /*
                     54:  * Global variables
                     55:  */
                     56: #define MAXLINESIZE 1024
                     57: extern char curline[MAXLINESIZE];
                     58: extern char *where;
                     59: extern int linenum;
                     60:
                     61: extern char *infilename;
                     62: extern FILE *fout;
                     63: extern FILE *fin;
                     64:
                     65: extern list *defined;
                     66:
                     67:
                     68: extern bas_type *typ_list_h;
                     69: extern bas_type *typ_list_t;
                     70:
                     71: /*
                     72:  * All the option flags
                     73:  */
                     74: extern int inetdflag;
1.13      deraadt    75: extern int pmflag;
1.1       deraadt    76: extern int tblflag;
                     77: extern int logflag;
                     78: extern int newstyle;
                     79: extern int Cflag;     /* C++ flag */
                     80: extern int tirpcflag; /* flag for generating tirpc code */
1.3       deraadt    81: extern int doinline; /* if this is 0, then do not generate inline code */
1.1       deraadt    82: extern int callerflag;
                     83:
                     84: /*
                     85:  * Other flags related with inetd jumpstart.
                     86:  */
                     87: extern int indefinitewait;
                     88: extern int exitnow;
                     89: extern int timerflag;
                     90:
                     91: extern int nonfatalerrors;
                     92:
                     93: /*
                     94:  * rpc_util routines
                     95:  */
1.12      deraadt    96: void storeval(list **, definition *);
1.1       deraadt    97:
                     98: #define STOREVAL(list,item)    \
                     99:        storeval(list,item)
                    100:
1.12      deraadt   101: definition *findval(list *, char *, int (*)(definition *, char *));
1.1       deraadt   102:
                    103: #define FINDVAL(list,item,finder) \
                    104:        findval(list, item, finder)
                    105:
1.9       millert   106: void crash(void);
                    107: char *fixtype(char *);
                    108: char *stringfix(char *);
                    109: char *locase(char *);
                    110: void pvname_svc(char *, char *);
                    111: void pvname(char *, char *);
                    112: void ptype(char *, char *, int);
                    113: int isvectordef(char *, relation);
                    114: int streq(char *, char *);
                    115: void error(char *);
                    116: void tabify(FILE *, int);
                    117: void record_open(char *);
                    118: bas_type *find_type(char *);
                    119: char *make_argname(char *, char *);
1.1       deraadt   120: /*
                    121:  * rpc_cout routines
                    122:  */
1.9       millert   123: void emit(definition *);
1.1       deraadt   124:
                    125: /*
                    126:  * rpc_hout routines
                    127:  */
1.9       millert   128: void print_datadef(definition *);
                    129: void print_funcdef(definition *);
1.1       deraadt   130:
                    131: /*
                    132:  * rpc_svcout routines
                    133:  */
1.9       millert   134: void write_most(char *, int, int);
                    135: void write_rest(void);
                    136: void write_programs(char *);
                    137: void write_svc_aux(int);
                    138: void write_inetd_register(char *);
                    139: void write_netid_register(char *);
                    140: void write_nettype_register(char *);
1.14      weingart  141: int nullproc(proc_list *);
                    142:
1.1       deraadt   143: /*
                    144:  * rpc_clntout routines
                    145:  */
1.9       millert   146: void write_stubs(void);
                    147: void printarglist(proc_list *, char *, char *);
1.1       deraadt   148:
                    149:
                    150: /*
                    151:  * rpc_tblout routines
                    152:  */
1.9       millert   153: void write_tables(void);
1.1       deraadt   154:
                    155: /*
                    156:  * rpc_sample routines
                    157:  */
1.9       millert   158: void write_sample_svc(definition *);
                    159: int write_sample_clnt(definition *);
                    160: void write_sample_clnt_main(void);
1.11      deraadt   161:
                    162: void add_type(int len, char *type);
                    163:
1.13      deraadt   164: void pdeclaration(char *, declaration *, int, char *);
                    165: void add_sample_msg(void);