#ifndef _TOPO_PARSE_H
#define _TOPO_PARSE_H
#include <sys/types.h>
#include <libxml/parser.h>
#include <libnvpair.h>
#include <fm/libtopo.h>
#include <fm/topo_mod.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TOPO_DTD_PATH "/usr/share/lib/xml/dtd/topology.dtd.1"
#define MAXINSTSTRLEN 64
struct tf_rdata;
struct tf_info;
typedef struct tf_edata {
char *te_name;
topo_stability_t te_stab;
topo_version_t te_vers;
} tf_edata_t;
typedef struct tf_pad {
int tpad_pgcnt;
int tpad_dcnt;
nvlist_t **tpad_pgs;
struct tf_rdata *tpad_child;
struct tf_rdata *tpad_sibs;
} tf_pad_t;
typedef struct tf_idata {
struct tf_idata *ti_next;
topo_instance_t ti_i;
tnode_t *ti_tn;
tf_pad_t *ti_pad;
} tf_idata_t;
typedef struct tf_rdata {
struct tf_rdata *rd_next;
int rd_cnt;
struct tf_info *rd_finfo;
topo_mod_t *rd_mod;
tnode_t *rd_pn;
char *rd_name;
int rd_min;
int rd_max;
tf_edata_t *rd_einfo;
struct tf_idata *rd_instances;
tf_pad_t *rd_pad;
} tf_rdata_t;
typedef struct tf_info {
char *tf_scheme;
uint_t tf_flags;
xmlDocPtr tf_xdoc;
tf_rdata_t *tf_rd;
} tf_info_t;
#define TF_LIVE 0x1
#define TF_BIN 0x2
#define TF_PROPMAP 0x4
#define INV_IMMUTE "prop-immutable"
#define INV_PGRP_ALLPROPS "propgrp-props"
#define INV_PGRP_NAME "propgrp-name"
#define INV_PGRP_NPROP "propgrp-numprops"
#define INV_PGRP_NMSTAB "propgrp-name-stability"
#define INV_PGRP_DSTAB "propgrp-data-stability"
#define INV_PGRP_VER "propgrp-version"
#define INV_PNAME "prop-name"
#define INV_PVAL "prop-val"
#define INV_PVALTYPE "prop-valtype"
#define Argitem "argitem"
#define Argval "argval"
#define Children "children"
#define Dependents "dependents"
#define Double "double"
#define Facility "facility"
#define FMRI "fmri"
#define FMRI_Arr "fmri_array"
#define Grouping "grouping"
#define Immutable "immutable"
#define Indicator "indicator"
#define Instance "instance"
#define Int32 "int32"
#define Int32_Arr "int32_array"
#define Int64 "int64"
#define Int64_Arr "int64_array"
#define Ipmi "ipmi"
#define Mutable "mutable"
#define Name "name"
#define Nonvolatile "nonvolatile"
#define Propitem "propitem"
#define Propname "propname"
#define Proptype "proptype"
#define Provider "provider"
#define Range "range"
#define Scheme "scheme"
#define Set "set"
#define Setlist "setlist"
#define Sensor "sensor"
#define Siblings "siblings"
#define Static "static"
#define String "string"
#define String_Arr "string_array"
#define Topology "topology"
#define Type "type"
#define UInt32 "uint32"
#define UInt32_Arr "uint32_array"
#define UInt64 "uint64"
#define UInt64_Arr "uint64_array"
#define Value "value"
#define Verify "verify"
#define Version "version"
#define Min "min"
#define Max "max"
#define Enum_meth "enum-method"
#define Prop_meth "propmethod"
#define Propgrp "propgroup"
#define Propval "propval"
#define Propmap "propmap"
#define Node "node"
#define Hc "hc"
#define True "true"
#define False "false"
#define Namestab "name-stability"
#define Datastab "data-stability"
#define Evolving "Evolving"
#define External "External"
#define Internal "Internal"
#define Obsolete "Obsolete"
#define Private "Private"
#define Stable "Stable"
#define Standard "Standard"
#define Unstable "Unstable"
extern tf_idata_t *tf_idata_lookup(tf_idata_t *, topo_instance_t);
extern tf_rdata_t *tf_rdata_new(topo_mod_t *,
tf_info_t *, xmlNodePtr, tnode_t *);
extern tf_idata_t *tf_idata_new(topo_mod_t *, topo_instance_t, tnode_t *);
extern tf_info_t *topo_xml_read(topo_mod_t *, const char *, const char *);
extern tf_info_t *tf_info_new(topo_mod_t *, xmlDocPtr, xmlChar *);
extern tf_pad_t *tf_pad_new(topo_mod_t *, int, int);
extern void topo_xml_cleanup(topo_mod_t *, tf_info_t *);
extern void tf_rdata_free(topo_mod_t *, tf_rdata_t *);
extern void tf_edata_free(topo_mod_t *, tf_edata_t *);
extern void tf_idata_free(topo_mod_t *, tf_idata_t *);
extern void tf_info_free(topo_mod_t *, tf_info_t *);
extern void tf_pad_free(topo_mod_t *, tf_pad_t *);
extern int topo_xml_range_process(topo_mod_t *, xmlNodePtr, tf_rdata_t *);
extern int topo_xml_enum(topo_mod_t *, tf_info_t *, tnode_t *);
extern int tf_idata_insert(tf_idata_t **, tf_idata_t *);
extern int xmlattr_to_int(topo_mod_t *, xmlNodePtr, const char *, uint64_t *);
extern int xmlattr_to_stab(topo_mod_t *, xmlNodePtr, const char *,
topo_stability_t *);
#ifdef __cplusplus
}
#endif
#endif