10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*9497SJordan.Brown@Sun.COM * Common Development and Distribution License (the "License"). 6*9497SJordan.Brown@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21132Srobinson 220Sstevel@tonic-gate /* 23*9497SJordan.Brown@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 300Sstevel@tonic-gate * The Regents of the University of California 310Sstevel@tonic-gate * All Rights Reserved 320Sstevel@tonic-gate * 330Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 340Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 350Sstevel@tonic-gate * contributors. 360Sstevel@tonic-gate */ 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifndef _RPC_PARSE_H 390Sstevel@tonic-gate #define _RPC_PARSE_H 400Sstevel@tonic-gate 410Sstevel@tonic-gate #ifdef __cplusplus 420Sstevel@tonic-gate extern "C" { 430Sstevel@tonic-gate #endif 440Sstevel@tonic-gate 450Sstevel@tonic-gate /* 460Sstevel@tonic-gate * rpc_parse.h, Definitions for the RPCL parser 470Sstevel@tonic-gate */ 480Sstevel@tonic-gate 490Sstevel@tonic-gate enum defkind { 500Sstevel@tonic-gate DEF_CONST, 510Sstevel@tonic-gate DEF_STRUCT, 520Sstevel@tonic-gate DEF_UNION, 530Sstevel@tonic-gate DEF_ENUM, 540Sstevel@tonic-gate DEF_TYPEDEF, 550Sstevel@tonic-gate DEF_PROGRAM, 560Sstevel@tonic-gate DEF_RESULT 570Sstevel@tonic-gate }; 580Sstevel@tonic-gate typedef enum defkind defkind; 590Sstevel@tonic-gate 600Sstevel@tonic-gate typedef char *const_def; 610Sstevel@tonic-gate 620Sstevel@tonic-gate enum relation { 630Sstevel@tonic-gate REL_VECTOR, /* fixed length array */ 640Sstevel@tonic-gate REL_ARRAY, /* variable length array */ 650Sstevel@tonic-gate REL_POINTER, /* pointer */ 66132Srobinson REL_ALIAS /* simple */ 670Sstevel@tonic-gate }; 680Sstevel@tonic-gate typedef enum relation relation; 690Sstevel@tonic-gate 700Sstevel@tonic-gate struct typedef_def { 710Sstevel@tonic-gate char *old_prefix; 720Sstevel@tonic-gate char *old_type; 730Sstevel@tonic-gate relation rel; 740Sstevel@tonic-gate char *array_max; 750Sstevel@tonic-gate }; 760Sstevel@tonic-gate typedef struct typedef_def typedef_def; 770Sstevel@tonic-gate 780Sstevel@tonic-gate struct enumval_list { 790Sstevel@tonic-gate char *name; 800Sstevel@tonic-gate char *assignment; 810Sstevel@tonic-gate struct enumval_list *next; 820Sstevel@tonic-gate }; 830Sstevel@tonic-gate typedef struct enumval_list enumval_list; 840Sstevel@tonic-gate 850Sstevel@tonic-gate struct enum_def { 860Sstevel@tonic-gate enumval_list *vals; 870Sstevel@tonic-gate }; 880Sstevel@tonic-gate typedef struct enum_def enum_def; 890Sstevel@tonic-gate 900Sstevel@tonic-gate struct declaration { 910Sstevel@tonic-gate char *prefix; 920Sstevel@tonic-gate char *type; 930Sstevel@tonic-gate char *name; 940Sstevel@tonic-gate relation rel; 950Sstevel@tonic-gate char *array_max; 960Sstevel@tonic-gate }; 970Sstevel@tonic-gate typedef struct declaration declaration; 980Sstevel@tonic-gate 990Sstevel@tonic-gate struct decl_list { 1000Sstevel@tonic-gate declaration decl; 1010Sstevel@tonic-gate struct decl_list *next; 1020Sstevel@tonic-gate }; 1030Sstevel@tonic-gate typedef struct decl_list decl_list; 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate struct struct_def { 1060Sstevel@tonic-gate decl_list *decls; 1070Sstevel@tonic-gate decl_list *tail; 1080Sstevel@tonic-gate char self_pointer; 1090Sstevel@tonic-gate }; 1100Sstevel@tonic-gate typedef struct struct_def struct_def; 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate struct case_list { 1130Sstevel@tonic-gate char *case_name; 1140Sstevel@tonic-gate int contflag; 1150Sstevel@tonic-gate declaration case_decl; 1160Sstevel@tonic-gate struct case_list *next; 1170Sstevel@tonic-gate }; 1180Sstevel@tonic-gate typedef struct case_list case_list; 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate struct union_def { 1210Sstevel@tonic-gate declaration enum_decl; 1220Sstevel@tonic-gate case_list *cases; 1230Sstevel@tonic-gate declaration *default_decl; 1240Sstevel@tonic-gate }; 1250Sstevel@tonic-gate typedef struct union_def union_def; 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate struct arg_list { 1280Sstevel@tonic-gate char *argname; /* name of struct for arg */ 1290Sstevel@tonic-gate decl_list *decls; 1300Sstevel@tonic-gate }; 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate typedef struct arg_list arg_list; 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate struct proc_list { 1350Sstevel@tonic-gate char *proc_name; 1360Sstevel@tonic-gate char *proc_num; 1370Sstevel@tonic-gate arg_list args; 1380Sstevel@tonic-gate int arg_num; 1390Sstevel@tonic-gate char *res_type; 1400Sstevel@tonic-gate char *res_prefix; 1410Sstevel@tonic-gate struct proc_list *next; 1420Sstevel@tonic-gate }; 1430Sstevel@tonic-gate typedef struct proc_list proc_list; 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate struct version_list { 1460Sstevel@tonic-gate char *vers_name; 1470Sstevel@tonic-gate char *vers_num; 1480Sstevel@tonic-gate proc_list *procs; 1490Sstevel@tonic-gate struct version_list *next; 1500Sstevel@tonic-gate }; 1510Sstevel@tonic-gate typedef struct version_list version_list; 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate struct program_def { 1540Sstevel@tonic-gate char *prog_num; 1550Sstevel@tonic-gate version_list *versions; 1560Sstevel@tonic-gate }; 1570Sstevel@tonic-gate typedef struct program_def program_def; 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate struct definition { 1600Sstevel@tonic-gate char *def_name; 1610Sstevel@tonic-gate defkind def_kind; 1620Sstevel@tonic-gate union { 1630Sstevel@tonic-gate const_def co; 1640Sstevel@tonic-gate struct_def st; 1650Sstevel@tonic-gate union_def un; 1660Sstevel@tonic-gate enum_def en; 1670Sstevel@tonic-gate typedef_def ty; 1680Sstevel@tonic-gate program_def pr; 1690Sstevel@tonic-gate } def; 1700Sstevel@tonic-gate }; 1710Sstevel@tonic-gate typedef struct definition definition; 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate definition *get_definition(); 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate struct bas_type 1770Sstevel@tonic-gate { 1780Sstevel@tonic-gate char *name; 1790Sstevel@tonic-gate int length; 1800Sstevel@tonic-gate struct bas_type *next; 1810Sstevel@tonic-gate }; 1820Sstevel@tonic-gate 1830Sstevel@tonic-gate typedef struct bas_type bas_type; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate #ifdef __cplusplus 1860Sstevel@tonic-gate } 1870Sstevel@tonic-gate #endif 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate #endif /* !_RPC_PARSE_H */ 190