topo_parse.h revision 825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _TOPO_PARSE_H
#define _TOPO_PARSE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libnvpair.h>
#include <fm/topo_mod.h>
#ifdef __cplusplus
extern "C" {
#endif
#define TOPO_DTD_PATH "/usr/share/lib/xml/dtd/topology.dtd.1"
/*
* Plenty of room to hold string representation of an instance
* number
*/
#define MAXINSTSTRLEN 64
/*
* Forward declaration
*/
struct tf_rdata;
struct tf_info;
/*
* This structure summarizes an enumerator as described by an xml
* topology file.
*/
typedef struct tf_edata {
char *te_name; /* name of the enumerator, if any */
} tf_edata_t;
/* properties and dependents off of an instance or a range */
typedef struct tf_pad {
int tpad_pgcnt; /* number of property-groups of node */
int tpad_dcnt; /* number of dependents groups of node */
} tf_pad_t;
typedef struct tf_idata {
} tf_idata_t;
/*
* This structure summarizes a topology node range as described by a
* topology file.
*/
typedef struct tf_rdata {
int rd_cnt; /* number of tf_rdatas in the list */
char *rd_name; /* node name */
int rd_min; /* minimum instance number of node */
int rd_max; /* maximum instance number of node */
/*
* true, if this range xml element contains any child xml
* node elements.
* We use this to determine whether or not we should apply
* property map changes to all of the nodes in a given range
* or just a specific node.
*
*/
int contains_node_ele;
} tf_rdata_t;
/*
* While we're parsing we need a handy way to pass around the data
* related to what we're currently parsing, what topology nodes may be
* affected, etc.
*/
typedef struct tf_info {
char *tf_scheme; /* scheme of topology in file */
/* UUID ? */
} tf_info_t;
/*
* We store properties using nvlists as an intermediate form. The
* following defines are names for fields in this intermediate form.
*/
#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"
/*
* Valid .xml element and attribute names
*/
#define Argval "argval"
#define Children "children"
#define Dependents "dependents"
#define Facility "facility"
#define FMRI "fmri"
#define Grouping "grouping"
#define Immutable "immutable"
#define Indicator "indicator"
#define Instance "instance"
#define Int32 "int32"
#define Int64 "int64"
#define Ipmi "ipmi"
#define Mutable "mutable"
#define Name "name"
#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 Topology "topology"
#define Type "type"
#define UInt32 "uint32"
#define UInt32_Arr "uint32arr"
#define UInt64 "uint64"
#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"
topo_stability_t *);
#ifdef __cplusplus
}
#endif
#endif /* _TOPO_PARSE_H */