2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2N/A/*
2N/A * Data Types for policy and principal information that
2N/A * exists in the respective databases.
2N/A *
2N/A * $Header$
2N/A *
2N/A * This file was originally created with rpcgen.
2N/A * It has been hacked up since then.
2N/A */
2N/A
2N/A#ifndef __ADB_H__
2N/A#define __ADB_H__
2N/A#include <sys/types.h>
2N/A#include <errno.h>
2N/A#include <krb5.h>
2N/A#include <kdb.h>
2N/A/* Okay, this is a bit obscure. The libdb2 configure script doesn't
2N/A detect it, but on Tru64 5.1, netinet/in.h causes sys/bittypes.h to
2N/A be included, and that has a typedef for u_int32_t. Because the
2N/A configure script doesn't detect it, it causes db-config.h to have a
2N/A #define for u_int32_t, so including db.h and then netinet/in.h
2N/A causes compilation to fail.
2N/A
2N/A Since gssrpc/types.h includes netinet/in.h, including that first
2N/A will cause the typedef to be seen before the macro definition,
2N/A which still isn't quite right, but is close enough for now.
2N/A
2N/A A better fix might be for db.h to include netinet/in.h if that's
2N/A where we find u_int32_t. */
2N/A
2N/A/* Solaris Kerberos: gssrpc not supported */
2N/A#if 0 /************** Begin IFDEF'ed OUT *******************************/
2N/A#include <gssrpc/types.h>
2N/A#include <gssrpc/xdr.h>
2N/A#else
2N/A#include <rpc/types.h>
2N/A#include <rpc/xdr.h>
2N/A#endif /**************** END IFDEF'ed OUT *******************************/
2N/A
2N/A#include <db.h>
2N/A#include "adb_err.h"
2N/A#include <com_err.h>
2N/A
2N/Atypedef long osa_adb_ret_t;
2N/A
2N/A#define OSA_ADB_POLICY_DB_MAGIC 0x12345A00
2N/A
2N/A#define OSA_ADB_POLICY_VERSION_MASK 0x12345D00
2N/A#define OSA_ADB_POLICY_VERSION_1 0x12345D01
2N/A#define OSA_ADB_POLICY_VERSION_2 0x12345D02
2N/A
2N/A
2N/A
2N/Atypedef struct _osa_adb_db_lock_ent_t {
2N/A FILE *lockfile;
2N/A char *filename;
2N/A int refcnt, lockmode, lockcnt;
2N/A krb5_context context;
2N/A} osa_adb_lock_ent, *osa_adb_lock_t;
2N/A
2N/Atypedef struct _osa_adb_db_ent_t {
2N/A int magic;
2N/A DB *db;
2N/A HASHINFO info;
2N/A BTREEINFO btinfo;
2N/A char *filename;
2N/A osa_adb_lock_t lock;
2N/A int opencnt;
2N/A} osa_adb_db_ent, *osa_adb_db_t, *osa_adb_princ_t, *osa_adb_policy_t;
2N/A
2N/A/*
2N/A * Return Code (the rest are in adb_err.h)
2N/A */
2N/A
2N/A#define OSA_ADB_OK 0
2N/A
2N/A/*
2N/A * Functions
2N/A */
2N/A
2N/Akrb5_error_code osa_adb_create_db(char *filename, char *lockfile, int magic);
2N/Akrb5_error_code osa_adb_destroy_db(char *filename, char *lockfile, int magic);
2N/Akrb5_error_code osa_adb_rename_db(char *filefrom, char *lockfrom,
2N/A char *fileto, char *lockto, int magic);
2N/Akrb5_error_code osa_adb_init_db(osa_adb_db_t *dbp, char *filename,
2N/A char *lockfile, int magic);
2N/Akrb5_error_code osa_adb_fini_db(osa_adb_db_t db, int magic);
2N/Akrb5_error_code osa_adb_get_lock(osa_adb_db_t db, int mode);
2N/Akrb5_error_code osa_adb_release_lock(osa_adb_db_t db);
2N/Akrb5_error_code osa_adb_open_and_lock(osa_adb_princ_t db, int locktype);
2N/Akrb5_error_code osa_adb_close_and_unlock(osa_adb_princ_t db);
2N/Akrb5_error_code osa_adb_close_policy(osa_adb_policy_t db);
2N/Akrb5_error_code osa_adb_create_policy(osa_adb_policy_t db,
2N/A osa_policy_ent_t entry);
2N/Akrb5_error_code osa_adb_destroy_policy(osa_adb_policy_t db,
2N/A char * name);
2N/Akrb5_error_code osa_adb_get_policy(osa_adb_policy_t db,
2N/A char * name,
2N/A osa_policy_ent_t *entry,
2N/A int *cnt);
2N/Akrb5_error_code osa_adb_put_policy(osa_adb_policy_t db,
2N/A osa_policy_ent_t entry);
2N/Akrb5_error_code osa_adb_iter_policy(osa_adb_policy_t db,
2N/A osa_adb_iter_policy_func func,
2N/A void * data);
2N/Avoid osa_free_policy_ent(osa_policy_ent_t val);
2N/A
2N/Abool_t xdr_osa_policy_ent_rec(XDR *xdrs, osa_policy_ent_t objp);
2N/A
2N/A/* Solaris Kerberos */
2N/Aextern caddr_t xdralloc_getdata(XDR *xdrs);
2N/Aextern void xdralloc_create(XDR *xdrs, enum xdr_op op);
2N/A#define xdr_u_int32 xdr_u_int /* 3NSL */
2N/A
2N/A#endif /* __ADB_H__ */