dhcptab.c revision 2
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 * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 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 * Copyright (c) 2001 by Sun Microsystems, Inc. 2N/A * All rights reserved. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * This module contains the public API functions for managing the dhcptab 2N/A * Creates or opens the dhcptab container in ``location'' and initializes 2N/A * ``handlep'' to point to the instance handle. When creating a new dhcptab, the 2N/A * needed by data store. 2N/A * Frees instance handle, cleans up per instance state. 2N/A * Remove dhcptab container in ``location'' from data store. If the underlying 2N/A * data store is busy, this function will block. 2N/A * Searches the dhcptab container for instances that match the query 2N/A * described by the combination of query and targetp. If the partial 2N/A * argument is true, then lookup operations that are unable to 2N/A * complete entirely are allowed (and considered successful). The 2N/A * query argument consists of 2 fields, each 16 bits long. The lower 2N/A * 16 bits selects which fields {key, flags} of targetp are to be 2N/A * considered in the query. The upper 16 bits identifies whether a 2N/A * particular field value must match (bit set) or not match (bit 2N/A * clear). Bits 2-15 in both 16 bit fields are currently unused, and 2N/A * must be set to 0. The count field specifies the maximum number of 2N/A * matching records to return, or -1 if any number of records may be 2N/A * returned. The recordsp argument is set to point to the resulting 2N/A * list of records; if recordsp is passed in as NULL then no records 2N/A * are actually returned. Note that these records are dynamically 2N/A * allocated, thus the caller is responsible for freeing them. The 2N/A * number of records found is returned in nrecordsp; a value of 0 2N/A * means that no records matched the query. 2N/A * Add the record pointed to by ``addp'' to from the dhcptab container referred 2N/A * to by the handle. The underlying public module will set ``addp's'' signature 2N/A * as part of the data store operation. 2N/A * Atomically modify the record ``origp'' with the record ``newp'' in the 2N/A * dhcptab container referred to by the handle. ``newp's'' signature will 2N/A * be set by the underlying public module. If an update collision 2N/A * occurs, either because ``origp's'' signature in the data store has changed 2N/A * or ``newp'' would overwrite an existing record, DSVC_COLLISION is 2N/A * returned and no update of the data store occurs. 2N/A * Delete the record referred to by dtp from the dhcptab container 2N/A * referred to by the handle. If ``dtp's'' signature is zero, the 2N/A * caller is not interested in checking for collisions, and the record 2N/A * should simply be deleted if it exists. If the signature is non-zero, 2N/A * and the signature of the data store version of this record do not match, 2N/A * an update collision occurs, no deletion of matching record in data store 2N/A * is done, and DSVC_COLLISION is returned. 2N/A * List the current number of dhcptab container objects located at 2N/A * ``location'' in ``listppp''. Return number of list elements in ``count''. 2N/A * If no objects exist, then ``count'' is set to 0 and DSVC_SUCCESS is returned. 2N/A * This function will block waiting for a result, if the underlying data store