dhcp_svc_public.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _DHCP_SVC_PUBLIC_H
#define _DHCP_SVC_PUBLIC_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Contains published interfaces to the DHCP data service.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Errors which can be returned from the defined API
*/
#define DSVC_SUCCESS 0 /* success */
/* public module unavailable */
/*
* Flags that can be passed to open_*
*/
/*
* Query macros - used for initializing query flags to lookup_*
*/
#define DSVC_QINIT(q) ((q) = 0)
#define DSVC_QEQ(q, v) ((q) = ((q) | (v) | ((v) << 16)))
#define DSVC_QNEQ(q, v) ((q) = ((~((v) << 16)) & (q)) | (v))
#define DSVC_QISEQ(q, v) (((q) & (v)) && ((q) & ((v) << 16)))
#define DSVC_QISNEQ(q, v) (((q) & (v)) && (!((q) & ((v) << 16))))
/*
* DHCP Configuration Container (dhcptab(4))
*/
#define DT_SYMBOL 's'
#define DT_MACRO 'm'
/* Query flags for lookup_dt */
#define DT_QKEY 0x01
#define DT_QTYPE 0x02
/*
* Consumer's dhcptab record form. Dynamically allocated by underlying data
* store. dt_sig is set by underlying data store -- it's opaque to the
* DHCP service, and is used by the data store to detect update collisions.
* All fields must be fixed-width types and in host byte order. Note that
* SUNWbinfiles writes these records directly to disk, thus changing its
* definition may introduce binary compatibility problems. Note also that
* fields have been carefully ordered to avoid internal padding and the
* structure's size is 64-bit aligned to avoid capricious trailing padding.
*/
typedef struct {
char *dt_value; /* Value of type dt_type */
char dt_type; /* Type of data */
} dt_rec_t;
typedef struct dt_rec_list {
/*
* DHCP Network Container (dhcp_network(4))
*/
#define DN_MAX_COMMENT_LEN 48
/* Query flags for lookup_dn */
#define DN_QCID 0x0001
#define DN_QCIP 0x0002
#define DN_QSIP 0x0004
#define DN_QLEASE 0x0008
#define DN_QMACRO 0x0010
#define DN_QFDYNAMIC 0x0020
#define DN_QFAUTOMATIC 0x0040
#define DN_QFMANUAL 0x0080
#define DN_QFUNUSABLE 0x0100
#define DN_QFBOOTP_ONLY 0x0200
DN_QFMANUAL | DN_QFUNUSABLE |\
/* dn_flags values */
/*
* Consumer's DHCP network container record form. Dynamically allocated by
* underlying data store. dn_sig is set by underlying data store -- it's
* opaque to the DHCP service, and is used by the data store to detect
* update collisions. All fields must be fixed-width types and in host
* byte order. Note that SUNWbinfiles writes these records directly to
* disk, thus changing its definition may introduce binary compatibility
* problems. Note also that fields have been carefully ordered to avoid
* internal padding and the structure's size is 64-bit aligned to avoid
* capricious trailing padding.
*/
typedef struct {
} dn_rec_t;
typedef struct dn_rec_list {
/*
* Synchronization Service Type and values.
*/
typedef uint32_t dsvc_synchtype_t;
#define DSVC_SYNCH_NONE 0 /* no synch type */
/*
* Generic API provided by SMI
*/
extern dt_rec_t *alloc_dtrec(const char *, char, const char *);
extern void free_dtrec(dt_rec_t *);
extern void free_dnrec(dn_rec_t *);
extern void free_dtrec_list(dt_rec_list_t *);
extern void free_dnrec_list(dn_rec_list_t *);
extern const char *dhcpsvc_errmsg(uint_t);
/*
* The remaining functions are not directly callable by the libdhcpsvc
* implementation; don't expose them to it.
*/
#ifndef _DHCPSVC_IMPL
/*
* Generic Service Provider Layer API provided by data store implementor
*/
extern int status(const char *);
extern int version(int *);
extern int configure(const char *);
extern int mklocation(const char *);
/*
* dhcptab Service Provider Layer API
*/
extern int close_dt(void **);
extern int remove_dt(const char *);
/*
* DHCP Network Service Provider Layer API
* IP address arguments are host order.
*/
const struct in_addr *);
extern int close_dn(void **);
#endif
#ifdef __cplusplus
}
#endif
#endif /* !_DHCP_SVC_PUBLIC_H */