2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _POOL_XML_IMPL_H
2N/A#define _POOL_XML_IMPL_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * This file contains the definitions of types and supporting
2N/A * functions to implement the libpool XML specific data manipulation
2N/A * facility.
2N/A *
2N/A * For more information on the libpool generic data manipulation
2N/A * facility, look at pool_impl.h.
2N/A *
2N/A * The central types for the generic data representation/storage
2N/A * facility are here enhanced to provide additional XML specific
2N/A * information.
2N/A */
2N/A
2N/A/*
2N/A * pool_xml_elem_t is the XML (to be precise, libxml - although this
2N/A * could be easily ported to an alternative C-API xml library)
2N/A * specific representation of the pool_elem_t structure.
2N/A *
2N/A * The pxe_node pointer is a pointer to an XML element which
2N/A * represents the element in the XML document
2N/A */
2N/Atypedef struct pool_xml_elem {
2N/A /*
2N/A * Common to pool_elem_t
2N/A */
2N/A pool_elem_t pxe_elem;
2N/A void *pxe_pad1;
2N/A void *pxe_pad2;
2N/A /*
2N/A * Common to pool_xml_elem_t
2N/A */
2N/A xmlNodePtr pxe_node; /* XML Element */
2N/A} pool_xml_elem_t;
2N/A
2N/Atypedef pool_xml_elem_t pool_xml_system_t;
2N/A
2N/Atypedef struct pool_xml_resource {
2N/A /*
2N/A * Common to pool_elem_t
2N/A */
2N/A pool_elem_t pxe_elem;
2N/A /*
2N/A * Specific to pool_resource_t
2N/A */
2N/A int (*pr_is_system)(const pool_resource_t *);
2N/A int (*pr_can_associate)(const pool_resource_t *);
2N/A /*
2N/A * Common to pool_xml_elem_t
2N/A */
2N/A xmlNodePtr pxe_node; /* XML Element */
2N/A} pool_xml_resource_t;
2N/A
2N/Atypedef struct pool_xml_pool {
2N/A /*
2N/A * Common to pool_elem_t
2N/A */
2N/A pool_elem_t pxe_elem;
2N/A /*
2N/A * Specific to pool_t
2N/A */
2N/A int (*pp_associate)(pool_t *, const pool_resource_t *);
2N/A int (*pp_dissociate)(pool_t *, const pool_resource_t *);
2N/A /*
2N/A * Common to pool_xml_elem_t
2N/A */
2N/A xmlNodePtr pxe_node; /* XML Element */
2N/A} pool_xml_pool_t;
2N/A
2N/Atypedef pool_xml_elem_t pool_xml_component_t;
2N/A
2N/A/*
2N/A * pool_xml_result_set_t is the XML (to be precise, libxml - although
2N/A * this could be easily ported to an alternative C-API xml library)
2N/A * specific representation of the pool_result_set_t structure.
2N/A *
2N/A * The pxr_ctx member is a pointer to an XML XPath Context which
2N/A * represents the context in which this result set is valid. AN
2N/A * alternative way of thinking about this is to envisage the context
2N/A * as the root of the search which is used to build the result set.
2N/A *
2N/A * The pxr_path member is a pointer to the compiled XPath statement
2N/A * used to generate this result set.
2N/A *
2N/A * The prs_index member is a cursor into the result set and is used by
2N/A * the various result set functions to determine which result set
2N/A * member to access.
2N/A *
2N/A */
2N/Atypedef struct pool_xml_result_set {
2N/A const pool_conf_t *prs_conf; /* Configuration */
2N/A int prs_active; /* Query active? */
2N/A int prs_index; /* Result Index */
2N/A pool_elem_t *(*prs_next)(pool_result_set_t *);
2N/A pool_elem_t *(*prs_prev)(pool_result_set_t *);
2N/A pool_elem_t *(*prs_first)(pool_result_set_t *);
2N/A pool_elem_t *(*prs_last)(pool_result_set_t *);
2N/A int (*prs_set_index)(pool_result_set_t *, int);
2N/A int (*prs_get_index)(pool_result_set_t *);
2N/A int (*prs_close)(pool_result_set_t *);
2N/A int (*prs_count)(pool_result_set_t *);
2N/A /*
2N/A * End of common part
2N/A */
2N/A xmlXPathContextPtr pxr_ctx; /* Result Context */
2N/A xmlXPathObjectPtr pxr_path; /* Result Path Object */
2N/A} pool_xml_result_set_t;
2N/A
2N/A/*
2N/A * pool_xml_connection_t is the XML (to be precise, libxml - although
2N/A * this could be easily ported to an alternative C-API xml library)
2N/A * specific representation of the pool_result_set_t structure.
2N/A *
2N/A * The pxc_doc member is a pointer to an XML document structure which
2N/A * contains information about the XML document which acts as the data
2N/A * store for this connection.
2N/A *
2N/A * The pxc_file member is a FILE pointer to the data file used to
2N/A * store the XML document.
2N/A *
2N/A * The pxc_oflags member is the OR'd list of options specified when
2N/A * opening this connection.
2N/A *
2N/A * The pxc_cleanup member is a boolean flag indicating whether a
2N/A * configuration has a backup which needs to be cleaned up. This is
2N/A * used as a means of providing resilient configuration changes in the
2N/A * face of potential failure.
2N/A *
2N/A */
2N/Atypedef struct pool_xml_connection {
2N/A const char *pc_name; /* Provider name */
2N/A int pc_store_type; /* Datastore type */
2N/A int pc_oflags; /* Open flags */
2N/A int (*pc_close)(pool_conf_t *);
2N/A int (*pc_validate)(const pool_conf_t *, pool_valid_level_t);
2N/A int (*pc_commit)(pool_conf_t *);
2N/A int (*pc_export)(const pool_conf_t *, const char *,
2N/A pool_export_format_t);
2N/A int (*pc_rollback)(pool_conf_t *);
2N/A pool_result_set_t *(*pc_exec_query)(const pool_conf_t *,
2N/A const pool_elem_t *, const char *,
2N/A pool_elem_class_t, pool_value_t **);
2N/A pool_elem_t *(*pc_elem_create)(pool_conf_t *, pool_elem_class_t,
2N/A pool_resource_elem_class_t, pool_component_elem_class_t);
2N/A int (*pc_remove)(pool_conf_t *);
2N/A int (*pc_res_xfer)(pool_resource_t *, pool_resource_t *, uint64_t);
2N/A int (*pc_res_xxfer)(pool_resource_t *, pool_resource_t *,
2N/A pool_component_t **);
2N/A char *(*pc_get_binding)(pool_conf_t *, pid_t);
2N/A int (*pc_set_binding)(pool_conf_t *, const char *, idtype_t, id_t);
2N/A char *(*pc_get_resource_binding)(pool_conf_t *,
2N/A pool_resource_elem_class_t, pid_t);
2N/A /*
2N/A * End of common part
2N/A */
2N/A xmlDocPtr pxc_doc; /* XML document */
2N/A FILE *pxc_file; /* XML File */
2N/A} pool_xml_connection_t;
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _POOL_XML_IMPL_H */