1N/A/*
1N/A * CDDL HEADER START
1N/A *
1N/A * The contents of this file are subject to the terms of the
1N/A * Common Development and Distribution License, Version 1.0 only
1N/A * (the "License"). You may not use this file except in compliance
1N/A * with the License.
1N/A *
1N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1N/A * or http://www.opensolaris.org/os/licensing.
1N/A * See the License for the specific language governing permissions
1N/A * and limitations under the License.
1N/A *
1N/A * When distributing Covered Code, include this CDDL HEADER in each
1N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1N/A * If applicable, add the following below this CDDL HEADER, with the
1N/A * fields enclosed by brackets "[]" replaced with your own identifying
1N/A * information: Portions Copyright [yyyy] [name of copyright owner]
1N/A *
1N/A * CDDL HEADER END
1N/A */
1N/A/*
1N/A * Copyright (c) 2000 by Sun Microsystems, Inc.
1N/A * All rights reserved.
1N/A */
1N/A
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A
1N/A/*
1N/A * This file contains public API functions for module-level tasks. For the
1N/A * semantics of these functions, please see the Enterprise DHCP
1N/A * Architecture Document.
1N/A */
1N/A
1N/A#include <assert.h>
1N/A#include <stdlib.h>
1N/A#include <unistd.h>
1N/A#include <sys/types.h>
1N/A#include <sys/socket.h>
1N/A#include <netinet/in.h>
1N/A#include <libgen.h>
1N/A#include <errno.h>
1N/A#include <dhcp_svc_public.h>
1N/A
1N/A#include "util.h"
1N/A
1N/A/*
1N/A * This symbol and its value tell the private layer that it must provide
1N/A * synchronization guarantees via dsvclockd(1M) before calling our *_dn()
1N/A * and *_dt() methods. Please see $SRC/lib/libdhcpsvc/private/README.synch
1N/A */
1N/Aint dsvc_synchtype = DSVC_SYNCH_DSVCD;
1N/A
1N/Aint
1N/Astatus(const char *location)
1N/A{
1N/A if (location != NULL) {
1N/A if (access(location, F_OK|R_OK) == -1) {
1N/A if (errno == ENOENT)
1N/A return (DSVC_NO_LOCATION);
1N/A return (syserr_to_dsvcerr(errno));
1N/A }
1N/A }
1N/A return (DSVC_SUCCESS);
1N/A}
1N/A
1N/Aint
1N/Aversion(int *vp)
1N/A{
1N/A *vp = DSVC_PUBLIC_VERSION;
1N/A return (DSVC_SUCCESS);
1N/A}
1N/A
1N/Aint
1N/Amklocation(const char *directory)
1N/A{
1N/A if (mkdirp(directory, 0755) == -1) {
1N/A switch (errno) {
1N/A case ENAMETOOLONG:
1N/A case ENOTDIR:
1N/A return (DSVC_INVAL);
1N/A
1N/A case EEXIST:
1N/A return (DSVC_EXISTS);
1N/A
1N/A case EROFS:
1N/A case EPERM:
1N/A case EACCES:
1N/A return (DSVC_ACCESS);
1N/A
1N/A default:
1N/A return (DSVC_INTERNAL);
1N/A }
1N/A }
1N/A
1N/A return (DSVC_SUCCESS);
1N/A}
1N/A
1N/Aint
1N/Amkloctoken(const char *location, char *token, size_t tokensize)
1N/A{
1N/A assert(tokensize >= MAXPATHLEN);
1N/A if (realpath(location, token) == NULL)
1N/A return (syserr_to_dsvcerr(errno));
1N/A
1N/A return (DSVC_SUCCESS);
1N/A}
1N/A