2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/*
2N/A * Common code and structures used by name-service-switch "user" backends.
2N/A */
2N/A
2N/A#ifndef _USER_COMMON_H
2N/A#define _USER_COMMON_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <nss_common.h>
2N/A#include <nss_dbdefs.h>
2N/A#include <stdio.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Atypedef struct user_backend *user_backend_ptr_t;
2N/Atypedef nss_status_t (*user_backend_op_t)(user_backend_ptr_t, void *);
2N/A
2N/A
2N/A
2N/Astruct user_backend {
2N/A user_backend_op_t *ops;
2N/A int n_ops;
2N/A const char *filename;
2N/A FILE *f;
2N/A int minbuf;
2N/A char *buf;
2N/A};
2N/A
2N/A/*
2N/A * Iterator function for _nss_user_do_all()
2N/A * NSS_NOTFOUND means "keep enumerating", NSS_SUCCESS means"return now",
2N/A * other values don't make much sense. In other words we're abusing
2N/A * (overloading) the meaning of nss_status_t, but hey...
2N/A * _nss_user_XY_all() is a wrapper around _nss_user_do_all() that does the
2N/A * generic work for nss_XbyY_args_t backends (calls cstr2ent etc).
2N/A */
2N/Atypedef nss_status_t (*user_do_all_func_t)(const char *, int, void *args);
2N/Atypedef int (*user_XY_check_func)(nss_XbyY_args_t *);
2N/A
2N/A#if defined(__STDC__)
2N/Aextern nss_backend_t *_nss_user_constr(user_backend_op_t *ops,
2N/A int n_ops,
2N/A const char *filename,
2N/A int min_bufsize);
2N/Aextern nss_status_t _nss_user_destr(user_backend_ptr_t, void *dummy);
2N/Aextern nss_status_t _nss_user_setent(user_backend_ptr_t, void *dummy);
2N/Aextern nss_status_t _nss_user_endent(user_backend_ptr_t, void *dummy);
2N/Aextern nss_status_t _nss_user_do_all(user_backend_ptr_t,
2N/A void *func_priv,
2N/A const char *filter,
2N/A user_do_all_func_t func);
2N/Aextern nss_status_t _nss_user_XY_all(user_backend_ptr_t be,
2N/A nss_XbyY_args_t *args,
2N/A int netdb,
2N/A const char *filter,
2N/A user_XY_check_func check);
2N/Aextern int _nss_user_read_line(FILE *f,
2N/A char *buffer,
2N/A int buflen);
2N/A#else
2N/Aextern nss_backend_t *_nss_user_constr();
2N/Aextern nss_status_t _nss_user_destr();
2N/Aextern nss_status_t _nss_user_setent();
2N/Aextern nss_status_t _nss_user_endent();
2N/Aextern nss_status_t _nss_user_do_all();
2N/Aextern nss_status_t _nss_user_XY_all();
2N/Aextern int _nss_user_read_line();
2N/A#endif
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _USER_COMMON_H */