about summary refs log tree commit diff
path: root/nis/rpcsvc
diff options
context:
space:
mode:
Diffstat (limited to 'nis/rpcsvc')
-rw-r--r--nis/rpcsvc/nis_cache.h47
-rw-r--r--nis/rpcsvc/nis_cache.x47
-rw-r--r--nis/rpcsvc/nislib.h6
3 files changed, 99 insertions, 1 deletions
diff --git a/nis/rpcsvc/nis_cache.h b/nis/rpcsvc/nis_cache.h
new file mode 100644
index 0000000000..ca91a22cd4
--- /dev/null
+++ b/nis/rpcsvc/nis_cache.h
@@ -0,0 +1,47 @@
+#ifndef __RPCSVC_NIS_CACHE_H_
+#define __RPCSVC_NIS_CACHE_H_
+
+#include <features.h>
+#include <rpc/rpc.h>
+#include <rpc/types.h>
+#include <rpcsvc/nis.h>
+
+__BEGIN_DECLS
+
+/* default cache file */
+#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE" 
+
+/* clients have to read-lock the cache file, and SVR4 locking requires that */
+/*   the file be writable, but we don't want a world-writable cache file.   */
+/*   So... everyone agrees to use a different, world-writable file for the  */
+/*   locking operations, but the data is in CACHEFILE.                      */
+#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
+
+/* the file containing one trusted XDR'ed directory object.
+ * This has to be present for the system to work.
+ */
+#define COLD_START_FILE "/var/nis/NIS_COLD_START"
+
+enum pc_status {HIT, MISS, NEAR_MISS};
+
+#define CACHEPROG ((u_long)100301)
+#define CACHE_VER_1 ((u_long)1)
+
+#define NIS_CACHE_ADD_ENTRY ((u_long)1)
+#define NIS_CACHE_REMOVE_ENTRY ((u_long)2)
+#define NIS_CACHE_READ_COLDSTART ((u_long)3)
+#define NIS_CACHE_REFRESH_ENTRY ((u_long)4)
+
+extern void *nis_cache_add_entry_1 __P ((fd_result *, CLIENT *));
+extern void *nis_cache_add_entry_1_svc __P ((fd_result *, struct svc_req *));
+extern void *nis_cache_remove_entry_1 __P ((directory_obj *, CLIENT *));
+extern void *nis_cache_remove_entry_1_svc __P ((directory_obj *,
+						struct svc_req *));
+extern void *nis_cache_read_coldstart_1 __P ((void *, CLIENT *));
+extern void *nis_cache_read_coldstart_1_svc __P ((void *, struct svc_req *));
+extern void *nis_cache_refresh_entry_1 __P ((char **, CLIENT *));
+extern void *nis_cache_refresh_entry_1_svc __P ((char **, struct svc_req *));
+
+__END_DECLS
+
+#endif /* !_RPCSVC_NIS_CACHE_H_ */
diff --git a/nis/rpcsvc/nis_cache.x b/nis/rpcsvc/nis_cache.x
new file mode 100644
index 0000000000..91870d8a48
--- /dev/null
+++ b/nis/rpcsvc/nis_cache.x
@@ -0,0 +1,47 @@
+/*
+ *	nis_cache.x
+ *
+ *	Copyright (c) 1988-1992 Sun Microsystems Inc
+ *	All Rights Reserved.
+ */
+
+%#pragma ident	"@(#)nis_cache.x	1.8	92/07/14 SMI"
+
+
+#ifdef RPC_HDR
+%#include <rpc/types.h>
+%#include <rpcsvc/nis.h>
+%
+%/* default cache file */
+%#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE" 
+%
+%/* clients have to read-lock the cache file, and SVR4 locking requires that */
+%/*   the file be writable, but we don't want a world-writable cache file.   */
+%/*   So... everyone agrees to use a different, world-writable file for the  */
+%/*   locking operations, but the data is in CACHEFILE.                      */
+%#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
+%
+%/* the file containing one trusted XDR'ed directory object.
+% * This has to be present for the system to work.
+% */
+%#define COLD_START_FILE "/var/nis/NIS_COLD_START"
+%
+%enum pc_status {HIT, MISS, NEAR_MISS};
+%
+%extern int __nis_debuglevel;
+%
+%
+#endif
+
+#ifdef RPC_CLNT
+%#include "../gen/nis_clnt.h"
+#endif
+
+program CACHEPROG {
+	version CACHE_VER_1 {
+		void NIS_CACHE_ADD_ENTRY(fd_result) = 1;
+		void NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2;
+		void NIS_CACHE_READ_COLDSTART(void) = 3;
+		void NIS_CACHE_REFRESH_ENTRY(string<>) = 4;
+	} = 1;
+} = 100301;
diff --git a/nis/rpcsvc/nislib.h b/nis/rpcsvc/nislib.h
index cbd8fbde51..73b3804e85 100644
--- a/nis/rpcsvc/nislib.h
+++ b/nis/rpcsvc/nislib.h
@@ -254,10 +254,14 @@ extern nis_name __nis_default_owner __P ((char *));
 extern nis_name __nis_default_group __P ((char *));
 extern u_long __nis_default_ttl __P ((char *));
 extern u_long __nis_default_access __P ((char *, u_long));
-extern fd_result *__nis_finddirectory __P ((directory_obj *, nis_name));
+extern fd_result *__nis_finddirectory __P ((directory_obj *, const_nis_name));
+extern u_long __nis_hash __P ((const void *keyarg, register size_t len));
 extern log_result *__nis_dumplog __P ((nis_server *,nis_name, u_long));
 extern log_result *__nis_dump __P ((nis_server *, nis_name,
 				    int (*)(nis_name, nis_object *, void *)));
+/* NIS+ cache locking */
+extern int __nis_lock_cache __P ((void));
+extern int __nis_unlock_cache __P ((void));
 
 __END_DECLS