1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright (c) 2001 by Sun Microsystems, Inc.
  24  * All rights reserved.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * This module contains the public API functions for managing the dhcptab
  31  * container.
  32  */
  33 
  34 #include <dhcp_svc_public.h>
  35 
  36 /*
  37  * Creates or opens the dhcptab container in ``location'' and initializes
  38  * ``handlep'' to point to the instance handle. When creating a new dhcptab, the
  39  * caller's identity is used for owner/permissions. Performs any initialization
  40  * needed by data store.
  41  */
  42 int
  43 open_dt(void **handlep, const char *location, uint_t flags)
  44 {
  45         return (DSVC_UNSUPPORTED);
  46 }
  47 
  48 /*
  49  * Frees instance handle, cleans up per instance state.
  50  */
  51 int
  52 close_dt(void **handlep)
  53 {
  54         return (DSVC_UNSUPPORTED);
  55 }
  56 
  57 /*
  58  * Remove dhcptab container in ``location'' from data store. If the underlying
  59  * data store is busy, this function will block.
  60  */
  61 int
  62 remove_dt(const char *location)
  63 {
  64         return (DSVC_UNSUPPORTED);
  65 }
  66 
  67 /*
  68  * Searches the dhcptab container for instances that match the query
  69  * described by the combination of query and targetp.  If the partial
  70  * argument is true, then lookup operations that are unable to
  71  * complete entirely are allowed (and considered successful).  The
  72  * query argument consists of 2 fields, each 16 bits long.  The lower
  73  * 16 bits selects which fields {key, flags} of targetp are to be
  74  * considered in the query.  The upper 16 bits identifies whether a
  75  * particular field value must match (bit set) or not match (bit
  76  * clear).  Bits 2-15 in both 16 bit fields are currently unused, and
  77  * must be set to 0.  The count field specifies the maximum number of
  78  * matching records to return, or -1 if any number of records may be
  79  * returned.  The recordsp argument is set to point to the resulting
  80  * list of records; if recordsp is passed in as NULL then no records
  81  * are actually returned. Note that these records are dynamically
  82  * allocated, thus the caller is responsible for freeing them.  The
  83  * number of records found is returned in nrecordsp; a value of 0
  84  * means that no records matched the query.
  85  */
  86 int
  87 lookup_dt(void *handle, boolean_t partial, uint_t query, int count,
  88     const dt_rec_t *targetp, dt_rec_list_t **recordsp, uint_t *nrecordsp)
  89 {
  90         return (DSVC_UNSUPPORTED);
  91 }
  92 
  93 /*
  94  * Add the record pointed to by ``addp'' to from the dhcptab container referred
  95  * to by the handle. The underlying public module will set ``addp's'' signature
  96  * as part of the data store operation.
  97  */
  98 int
  99 add_dt(void *handle, dt_rec_t *addp)
 100 {
 101         return (DSVC_UNSUPPORTED);
 102 }
 103 
 104 /*
 105  * Atomically modify the record ``origp'' with the record ``newp'' in the
 106  * dhcptab container referred to by the handle.  ``newp's'' signature will
 107  * be set by the underlying public module.  If an update collision
 108  * occurs, either because ``origp's'' signature in the data store has changed
 109  * or ``newp'' would overwrite an existing record, DSVC_COLLISION is
 110  * returned and no update of the data store occurs.
 111  */
 112 int
 113 modify_dt(void *handle, const dt_rec_t *origp, dt_rec_t *newp)
 114 {
 115         return (DSVC_UNSUPPORTED);
 116 }
 117 
 118 /*
 119  * Delete the record referred to by dtp from the dhcptab container
 120  * referred to by the handle. If ``dtp's'' signature is zero, the
 121  * caller is not interested in checking for collisions, and the record
 122  * should simply be deleted if it exists. If the signature is non-zero,
 123  * and the signature of the data store version of this record do not match,
 124  * an update collision occurs, no deletion of matching record in data store
 125  * is done, and DSVC_COLLISION is returned.
 126  */
 127 int
 128 delete_dt(void *handle, const dt_rec_t *dtp)
 129 {
 130         return (DSVC_UNSUPPORTED);
 131 }
 132 
 133 /*
 134  * List the current number of dhcptab container objects located at
 135  * ``location'' in ``listppp''. Return number of list elements in ``count''.
 136  * If no objects exist, then ``count'' is set to 0 and DSVC_SUCCESS is returned.
 137  *
 138  * This function will block waiting for a result, if the underlying data store
 139  * is busy.
 140  */
 141 int
 142 list_dt(const char *location, char ***listppp, uint_t *count)
 143 {
 144         return (DSVC_UNSUPPORTED);
 145 }