/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _POOL_IMPL_H
#define _POOL_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file contains the definitions of types and supporting
* functions to implement the libpool generic data manipulation
* facility.
*
* libpool is designed so that the data representation/storage method
* used may be easily replaced without affecting core functionality.
* A libpool configuration is connected to a particular data
* representation/storage "driver" via the pool_connection_t
* type. When a configuration is opened (see pool_conf_open) the
* libpool implementation allocates a specific data manipulation type
* and initialises it. For instance, see pool_xml_connection_alloc.
*
* This function represents a cross-over point and all routines used
* for data representation/storage are controlled by the type of
* allocated connection.
*
* Currently, there are two implemented methods of access. Data may be
* retrieved from the kernel, using the pool_knl_connection_t
* function. This implementation relies on a private interface
* the kernel via the standard libpool interface. Alternatively, data
* may be retrieved from an XML file, via pool_xml_connection_t, and
* presented through the standard libpool interface. For details of
* these two implementations, see pool_kernel_impl.h and
*
* In addition to defining a specific connection type for a desired
* data representation/storage medium, several other structures must
* be defined to allow manipulation of configuration elements.
*
* Configuration elements are represented as pool_elem_t instances, or
* as sub-types of this generic type (such as pool_t, which represents
* a pool element) with groups (or sets) of these instances available
* for manipulation via the pool_result_set_t type.
*
* For more information on the implementation of these types, read the
* detailed comments above each structure definition.
*/
/*
* The pool_elem_t is used to represent a configuration element.The
* class of the element is stored within the structure along with a
* pointer to the containing configuration and a pointer to the
* element's specific subtype.
*
* The function pointers are initialised when the element is allocated
* to use the specific functions provided by the concrete data
* representation.
*
* The full set of operations that can be performed on an element
* which require special treatment from the data
* representation/storage medium are defined.
*/
struct pool_elem {
pool_value_t *);
};
/*
* libpool performs many operations against a pool_elem_t. This basic
* type is extended to provide specific functionality and type safety
* for each of the different types of element supported by
* libpool. There are four types of element:
* - pool_system_t, represents an entire configuration
* - pool_t, represents a single pool
* - pool_resource_t, represents a single resource
* - pool_component_t, represents a single resource component
*
* pool_system_t is an internal structure, the other structures are
* externally visible and form a major part of the libpool interface.
*/
typedef struct pool_system
{
void *pe_pad1;
void *pe_pad2;
struct pool
{
/*
* Specific to pool_t
*/
};
struct pool_resource
{
/*
* Specific to pool_resource_t
*/
};
struct pool_component
{
void *pe_pad1;
void *pe_pad2;
};
/*
* The pool_result_set_t is used to represent a collection (set) of
* configuration elements. The configuration to which this result set
* applies is stored along with an indicator as to whether the result
* set is still in use.
*
* The function pointers are initialised when the element is allocated
* to use the specific functions provided by the concrete data
* representation.
*
* The full set of operations that can be performed on an element
* which require special treatment from the data
* representation/storage medium are defined.
*/
typedef struct pool_result_set {
/*
* The pool_connection_t is used to represent a connection between a
* libpool configuration and a particular implementation of the
* libpool interface in a specific data representation/storage medium,
* e.g. XML.
*
* The name of the storage medium is stored along with the type of the
* data store.
*
* The function pointers are initialised when the element is allocated
* to use the specific functions provided by the concrete data
* representation.
*
* The full set of operations that can be performed on an element
* which require special treatment from the data
* representation/storage medium are defined.
*/
typedef struct pool_connection {
const pool_elem_t *, const char *, pool_elem_class_t,
pool_value_t **);
pool_component_t **);
/*
* pool_conf represents a resource management configuration. The
* configuration location is stored in the pc_location member with the
* state of the configuration stored in pc_state.
*
* The pc_prov member provides data representation/storage abstraction
* for the configuration since all access to data is performed through
* this member.
*/
struct pool_conf {
};
/*
* Convert a pool_elem_t to it's appropriate sub-type.
*/
/*
* Convert a pool_system_t to a pool_elem_t.
*/
/*
* association at commit between an element in the dynamic
* configuration and an element in the static configuration. This
* relationship is stored in the pe_pair member of the element.
*/
/*
* Result Set Manipulation
*/
extern int pool_rs_count(pool_result_set_t *);
extern int pool_rs_get_index(pool_result_set_t *);
extern int pool_rs_set_index(pool_result_set_t *, int);
extern int pool_rs_close(pool_result_set_t *);
/*
* General Purpose Query
*/
#ifdef __cplusplus
}
#endif
#endif /* _POOL_IMPL_H */