ns_cache_door.h revision b57459abfba36eb3068cfe44c6921168b4c4f774
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _NS_CACHE_DOOR_H
#define _NS_CACHE_DOOR_H
/*
* Definitions for client side of doors-based ldap caching
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <netdb.h>
#include <grp.h>
#include <pwd.h>
/*
* statistics & control structure
*/
typedef struct ldap_stat {
int ldap_numbercalls; /* number of times called */
int ldap_ttl; /* time to live for positive entries */
} ldap_stat_t;
/*
* Structure used to transfer arrays of strings.
* Buffer format:
* count
* array of offsets from start of buffer
* array of characters of strings
* charp = buf + ldap_offsets[n];
*/
typedef struct ldap_strlist {
int ldap_count; /* number of strings */
/*
*/
typedef struct ldap_get_chg_cookie {
typedef struct ldap_get_change {
typedef struct ldap_get_change_out {
char data[sizeof (int)]; /* real size is data_size */
typedef struct ldap_config_out {
char config_str[sizeof (int)]; /* real size is data_size */
typedef struct ldap_admin_mod_result {
char msg[sizeof (int)]; /* real size is msg_size */
/*
* structure returned by server for all calls
*/
#define BUFFERSIZE 8192
#define OFFSET 36
typedef struct {
int ldap_bufferbytesused;
int ldap_return_code;
int ldap_errno;
union {
char buff[4];
} ldap_u;
/*
* calls look like this
*/
typedef struct {
int ldap_callnumber;
union {
char domainname[sizeof (int)]; /* size is indeterminate */
struct {
int a_type;
int a_length;
char a_data[sizeof (int)];
} addr;
char servername[sizeof (int)]; /* Format: server:port */
} ldap_u;
} ldap_call_t;
/*
* how the client views the call process
*/
typedef union {
char ldap_buff[sizeof (int)];
} ldap_data_t;
/* Version 1 Cache Manager calls */
/* Cache manager ping */
#define NULLCALL 0
/* NativeLDAP I Get Config */
#define GETLDAPCONFIG 1
#define GETLDAPCONFIGV1 1
/*
* administrative calls
*/
#define KILLSERVER 7
#define GETADMIN 8
#define SETADMIN 9
/*
* debug levels
*/
#define DBG_OFF 0
#define DBG_CANT_FIND 1
#define DBG_NETLOOKUPS 2
#define DBG_ALL 6
/* Version 2 Cache Manager calls */
/* NativeLDAP II Get Server and RootDSE Info */
#define GETLDAPSERVER 21
/* NativeLDAP II Get cached data */
#define GETCACHE 22
/* NativeLDAP II Set cached data */
#define SETCACHE 23
/* NativeLDAP II get cache data statistics */
#define GETCACHESTAT 24
/* Configuration change or server status change notification */
#define GETSTATUSCHANGE 25
/* perform admin modify via ldap_cachemgr */
#define ADMINMODIFY 26
/* get admin credentials for shadow lookups */
#define GETADMINCRED 27
/*
* GETLDAPSERVER request flags
*/
#define NS_CACHE_NEW "0"
#define NS_CACHE_NORESP "1"
#define NS_CACHE_NEXT "2"
#define NS_CACHE_WRITE "3"
#define NS_CACHE_ADDR_HOSTNAME "H"
#define NS_CACHE_ADDR_IP "I"
/*
* GETSTATUSCHANGE operation: start or stop
*/
#define NS_STATUS_CHANGE_OP_START 1
#define NS_STATUS_CHANGE_OP_STOP 2
/*
* GETSTATUSCHANGE change type: config or server
*/
#define NS_STATUS_CHANGE_TYPE_CONFIG 1
#define NS_STATUS_CHANGE_TYPE_SERVER 2
/*
* Server status change
*/
/*
*/
#define NS_CACHE_DN2DOMAIN "DM"
/*
* Max size name we allow to be passed to avoid
* buffer overflow problems
*/
#define LDAPMAXNAMELEN 255
/*
* defines for client-server interaction
*/
#define LDAP_CACHE_DOOR_VERSION 1
#define LDAP_CACHE_DOOR "/var/run/ldap_cache_door"
#define UPDATE_DOOR_COOKIE ((void*)(0xdeadcafe)
#define NS_CACHE_SUCCESS 0
#define NS_CACHE_NOTFOUND -1
#define NS_CACHE_CREDERROR -2
#define NS_CACHE_SERVERERROR -3
#define NS_CACHE_NOSERVER -4
int
int
int
void
#ifdef __cplusplus
}
#endif
#endif /* _NS_CACHE_DOOR_H */