ndrgen.h revision d0e518695adc90b82233b99af7dffbb3d3f92c00
/*
* 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
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _NDRGEN_H
#define _NDRGEN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
typedef struct node {
int label;
int line_number;
union {
unsigned long nu_int;
char *nu_str;
void *nu_ptr;
} n_u;
#define n_c_advice n_node[0]
#define n_m_advice n_node[0]
#define n_d_descend n_node[0]
} ndr_node_t;
typedef struct keyword {
char *name;
int token;
long value;
typedef struct symbol {
char *name;
} ndr_symbol_t;
typedef struct integer {
long value;
#define NDLBUFSZ 100
/* This makes certain things much easier */
#define N_ADVICE 18
typedef struct advice {
/* alias for basic types */
#define a_transmit_as a_nodes[0]
/* arg used for size, union or generic purpose */
/* size stuff */
/* union stuff */
/* interface stuff */
} ndr_advice_t;
typedef struct typeinfo {
unsigned int is_conformant : 1;
unsigned int is_varying : 1;
unsigned int is_string : 1;
unsigned int max_given : 1;
unsigned int min_given : 1;
unsigned int complete : 1;
unsigned int has_pointers : 1;
unsigned int is_referenced : 1;
unsigned int is_extern : 1;
unsigned short type_op; /* STAR LB */
/* STRUCT BASIC_TYPE */
struct node *definition;
unsigned int size_fixed_part;
unsigned int size_variable_part;
/* size_is(n_members) */
int n_member;
typedef struct member {
char *name;
int is_conformant;
struct node *definition;
unsigned int pdu_offset;
} ndr_member_t;
extern ndr_typeinfo_t *typeinfo_list;
extern struct node *construct_list;
/* ndr_anal.c */
extern void analyze(void);
extern void show_typeinfo_list(void);
extern void show_advice(ndr_advice_t *, int);
extern void member_fixup(ndr_node_t *);
extern void construct_fixup(ndr_node_t *);
/* ndr_gen.c */
extern void generate(void);
/* ndr_lex.c */
extern ndr_symbol_t *symbol_list;
extern int line_number;
extern int n_compile_error;
extern void set_lex_input(FILE *, char *);
extern int yylex(void);
extern ndr_symbol_t *sym_enter(char *);
extern void compile_error(const char *, ...);
extern void fatal_error(const char *, ...);
/* ndr_print.c */
extern void tdata_dump(void);
extern void print_node(ndr_node_t *);
/* ndr_parse.y */
extern int yyparse(void);
/* ndr_main.c */
extern int yyerror(char *);
#ifdef __cplusplus
}
#endif
#endif /* _NDRGEN_H */