cache.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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CACHE_H
#define _CACHE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include "../gen/nis_local.h"
#include "../gen/nis_clnt.h"
#include "nsl_stdio_prv.h"
#define CLIENT_FILE "/var/nis/client_info"
#define PREF_ALL_VAL 0
#define PREF_ONLY_VAL 1
#define PREF_ALL "all"
#define PREF_ONLY "pref_only"
#define PREF_SRVR "pref_srvr"
#define PREF_TYPE "pref_type"
// Semaphores for cache manager
// in the writer array
#define NIS_SEM_MGR_UP 0 // is the cache manager running?
#define SEM_OWNER_READ 0400
#define SEM_OWNER_ALTER 0200
#define SEM_GROUP_READ 0040
#define SEM_GROUP_ALTER 0020
#define SEM_OTHER_READ 0004
#define SEM_OTHER_ALTER 0002
extern int __nis_debuglevel;
struct HostEnt {
char *name;
char *interface;
int rank;
};
HostList();
~HostList();
void deleteBackupList();
void deleteList();
void backupList();
void restoreList();
int pref_option;
int old_pref_option;
};
NisCache();
~NisCache();
// This set of routines is the primary interface to the
// cache classes. The NisCache class provides default
// implementations of them. The derived classes override
// them if necessary.
// This is a set of helper routines for derived classes to
// use.
int nextGeneration();
void rerankServers();
void mergePreference(char *value);
void mergeOption(char *value);
void resetPreference();
void backupPreference();
void delBackupPref();
void restorePreference();
char *coldStartDir();
// We define a new and delete routine so that we don't
// depend on libC at run time.
int gen;
char *cold_start_dir;
};
#ifdef __cplusplus
}
#endif
#endif /* _CACHE_H */