From b2093e3016027d6b5cf06b3f91f30769bfc099e2 Mon Sep 17 00:00:00 2001 From: cvsadm Date: Fri, 21 Jan 2005 00:44:34 +0000 Subject: Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth) --- include/Makefile | 85 + include/base/Makefile | 40 + include/base/crit.h | 209 +++ include/base/dbtbase.h | 217 +++ include/base/ereport.h | 76 + include/base/eventhandler.h | 73 + include/base/eventlog.h | 34 + include/base/file.h | 121 ++ include/base/fsmutex.h | 94 + include/base/lexer.h | 89 + include/base/nterr.h | 21 + include/base/nterrors.h | 67 + include/base/plist.h | 61 + include/base/pool.h | 103 ++ include/base/rwlock.h | 54 + include/base/shexp.h | 114 ++ include/base/systems.h | 565 +++++++ include/base/systhr.h | 91 + include/base/util.h | 210 +++ include/copyrght.h | 6 + include/i18n.h | 245 +++ include/ldaputil/cert.h | 27 + include/ldaputil/certmap.h | 124 ++ include/ldaputil/dbconf.h | 91 + include/ldaputil/encode.h | 29 + include/ldaputil/errors.h | 108 ++ include/ldaputil/extcmap.h | 634 +++++++ include/ldaputil/init.h | 23 + include/ldaputil/ldapauth.h | 94 + include/ldaputil/ldapdb.h | 100 ++ include/ldaputil/ldaputil.h | 132 ++ include/libaccess/acl.h | 41 + include/libaccess/acladmin.h | 79 + include/libaccess/aclbuild.h | 56 + include/libaccess/aclerror.h | 307 ++++ include/libaccess/acleval.h | 37 + include/libaccess/aclglobal.h | 52 + include/libaccess/aclparse.h | 112 ++ include/libaccess/aclproto.h | 156 ++ include/libaccess/aclstruct.h | 264 +++ include/libaccess/attrec.h | 157 ++ include/libaccess/authdb.h | 24 + include/libaccess/ava.h | 40 + include/libaccess/avadb.h | 15 + include/libaccess/avapfile.h | 59 + include/libaccess/dbtlibaccess.h | 161 ++ include/libaccess/dnfstruct.h | 51 + include/libaccess/ipfstruct.h | 81 + include/libaccess/las.h | 184 ++ include/libaccess/ldapacl.h | 62 + include/libaccess/nsadb.h | 87 + include/libaccess/nsamgmt.h | 122 ++ include/libaccess/nsauth.h | 288 ++++ include/libaccess/nsautherr.h | 97 ++ include/libaccess/nscert.h | 102 ++ include/libaccess/nsdb.h | 182 ++ include/libaccess/nsdberr.h | 92 + include/libaccess/nsdbmgmt.h | 52 + include/libaccess/nserror.h | 47 + include/libaccess/nsgmgmt.h | 35 + include/libaccess/nsgroup.h | 73 + include/libaccess/nslock.h | 74 + include/libaccess/nsumgmt.h | 36 + include/libaccess/nsuser.h | 70 + include/libaccess/register.h | 215 +++ include/libaccess/stubs.h | 6 + include/libaccess/symbols.h | 99 ++ include/libaccess/userauth.h | 13 + include/libaccess/usi.h | 81 + include/libaccess/usrcache.h | 104 ++ include/libadmin/dbtlibadmin.h | 20 + include/libadmin/libadmin.h | 1403 +++++++++++++++ include/netsite.h | 312 ++++ include/nt/messages.h | 410 +++++ include/nt/nsapi.h | 346 ++++ include/nt/ntos.h | 155 ++ include/nt/regparms.h | 586 +++++++ include/nt/resource.h | 36 + include/public/Makefile | 59 + include/public/base/Makefile | 40 + include/public/base/crit.h | 21 + include/public/base/ereport.h | 21 + include/public/base/file.h | 21 + include/public/base/pool.h | 22 + include/public/base/shexp.h | 22 + include/public/base/systems.h | 242 +++ include/public/base/systhr.h | 21 + include/public/base/util.h | 21 + include/public/netsite.h | 21 + include/public/nsacl/Makefile | 38 + include/public/nsacl/aclapi.h | 396 +++++ include/public/nsacl/acldef.h | 465 +++++ include/public/nsacl/copyrght.h | 6 + include/public/nsacl/nserrdef.h | 100 ++ include/public/nsacl/plistdef.h | 62 + include/public/nsapi.h | 3481 ++++++++++++++++++++++++++++++++++++++ include/version.h | 53 + 97 files changed, 16130 insertions(+) create mode 100644 include/Makefile create mode 100644 include/base/Makefile create mode 100644 include/base/crit.h create mode 100644 include/base/dbtbase.h create mode 100644 include/base/ereport.h create mode 100644 include/base/eventhandler.h create mode 100644 include/base/eventlog.h create mode 100644 include/base/file.h create mode 100644 include/base/fsmutex.h create mode 100644 include/base/lexer.h create mode 100644 include/base/nterr.h create mode 100644 include/base/nterrors.h create mode 100644 include/base/plist.h create mode 100644 include/base/pool.h create mode 100644 include/base/rwlock.h create mode 100644 include/base/shexp.h create mode 100644 include/base/systems.h create mode 100644 include/base/systhr.h create mode 100644 include/base/util.h create mode 100644 include/copyrght.h create mode 100644 include/i18n.h create mode 100644 include/ldaputil/cert.h create mode 100644 include/ldaputil/certmap.h create mode 100644 include/ldaputil/dbconf.h create mode 100644 include/ldaputil/encode.h create mode 100644 include/ldaputil/errors.h create mode 100644 include/ldaputil/extcmap.h create mode 100644 include/ldaputil/init.h create mode 100644 include/ldaputil/ldapauth.h create mode 100644 include/ldaputil/ldapdb.h create mode 100644 include/ldaputil/ldaputil.h create mode 100644 include/libaccess/acl.h create mode 100644 include/libaccess/acladmin.h create mode 100644 include/libaccess/aclbuild.h create mode 100644 include/libaccess/aclerror.h create mode 100644 include/libaccess/acleval.h create mode 100644 include/libaccess/aclglobal.h create mode 100644 include/libaccess/aclparse.h create mode 100644 include/libaccess/aclproto.h create mode 100644 include/libaccess/aclstruct.h create mode 100644 include/libaccess/attrec.h create mode 100644 include/libaccess/authdb.h create mode 100644 include/libaccess/ava.h create mode 100644 include/libaccess/avadb.h create mode 100644 include/libaccess/avapfile.h create mode 100644 include/libaccess/dbtlibaccess.h create mode 100644 include/libaccess/dnfstruct.h create mode 100644 include/libaccess/ipfstruct.h create mode 100644 include/libaccess/las.h create mode 100644 include/libaccess/ldapacl.h create mode 100644 include/libaccess/nsadb.h create mode 100644 include/libaccess/nsamgmt.h create mode 100644 include/libaccess/nsauth.h create mode 100644 include/libaccess/nsautherr.h create mode 100644 include/libaccess/nscert.h create mode 100644 include/libaccess/nsdb.h create mode 100644 include/libaccess/nsdberr.h create mode 100644 include/libaccess/nsdbmgmt.h create mode 100644 include/libaccess/nserror.h create mode 100644 include/libaccess/nsgmgmt.h create mode 100644 include/libaccess/nsgroup.h create mode 100644 include/libaccess/nslock.h create mode 100644 include/libaccess/nsumgmt.h create mode 100644 include/libaccess/nsuser.h create mode 100644 include/libaccess/register.h create mode 100644 include/libaccess/stubs.h create mode 100644 include/libaccess/symbols.h create mode 100644 include/libaccess/userauth.h create mode 100644 include/libaccess/usi.h create mode 100644 include/libaccess/usrcache.h create mode 100644 include/libadmin/dbtlibadmin.h create mode 100644 include/libadmin/libadmin.h create mode 100644 include/netsite.h create mode 100644 include/nt/messages.h create mode 100644 include/nt/nsapi.h create mode 100644 include/nt/ntos.h create mode 100644 include/nt/regparms.h create mode 100644 include/nt/resource.h create mode 100644 include/public/Makefile create mode 100644 include/public/base/Makefile create mode 100644 include/public/base/crit.h create mode 100644 include/public/base/ereport.h create mode 100644 include/public/base/file.h create mode 100644 include/public/base/pool.h create mode 100644 include/public/base/shexp.h create mode 100644 include/public/base/systems.h create mode 100644 include/public/base/systhr.h create mode 100644 include/public/base/util.h create mode 100644 include/public/netsite.h create mode 100644 include/public/nsacl/Makefile create mode 100644 include/public/nsacl/aclapi.h create mode 100644 include/public/nsacl/acldef.h create mode 100644 include/public/nsacl/copyrght.h create mode 100644 include/public/nsacl/nserrdef.h create mode 100644 include/public/nsacl/plistdef.h create mode 100644 include/public/nsapi.h create mode 100644 include/version.h (limited to 'include') diff --git a/include/Makefile b/include/Makefile new file mode 100644 index 00000000..40e9f063 --- /dev/null +++ b/include/Makefile @@ -0,0 +1,85 @@ +# +# BEGIN COPYRIGHT BLOCK +# Copyright 2001 Sun Microsystems, Inc. +# Portions copyright 1999, 2001-2003 Netscape Communications Corporation. +# All rights reserved. +# END COPYRIGHT BLOCK +# +# Makefile for netsite.h + +MCOM_ROOT = ../.. +MODULE=netsiteInclude + +include ../nsdefs.mk + +HDRDEST=$(OBJDIR)/include + +NSPRDEST=$(HDRDEST) +NSPRHDRS= \ + prio.h \ + prlong.h \ + prtypes.h \ + prtime.h \ + prthread.h \ + prinrval.h \ + md/prcpucfg.h \ + obsolete/protypes.h + +NSPRBINS=$(addprefix $(NSPRDEST)/, $(NSPRHDRS)) + +PREFIX=copyrght.h + + +NOSTDSTRIP=true +NOSTDDEPEND=true + +HDRS=netsite.h version.h + +BINS=$(addprefix $(HDRDEST)/,$(HDRS)) + +all: stuff nspr + +strip: +depend: + +include ../nsconfig.mk + +ifeq ($(NSAPI_CAPABLE), true) + +stuff: $(HDRDEST) $(BINS) sub-hdrs + +$(HDRDEST): + mkdir -p $(HDRDEST) + +ifeq ($(PRODUCT), "Netscape Proxy Server") +sub-hdrs: + cd base; gmake + cd frame; gmake + cd libproxy; gmake +else +sub-hdrs: + cd base; gmake + cd frame; gmake +endif + +$(HDRDEST)/%.h: %.h + cat $(PREFIX) $< > $(HDRDEST)/$*.h + +else +stuff: + +endif + +$(NSPRDEST): + mkdir -p $(NSPRDEST) + +$(NSPRDEST)/md: $(NSPRDEST) + mkdir -p $(NSPRDEST)/md + +$(NSPRDEST)/obsolete: $(NSPRDEST) + mkdir -p $(NSPRDEST)/obsolete + +$(NSPRDEST)/%.h: + cp $(NSCP_DISTDIR)/include/nspr20/pr/$*.h $(NSPRDEST)/$*.h + +nspr: $(NSPRDEST)/md $(NSPRDEST)/obsolete $(NSPRBINS) diff --git a/include/base/Makefile b/include/base/Makefile new file mode 100644 index 00000000..9f2f6a35 --- /dev/null +++ b/include/base/Makefile @@ -0,0 +1,40 @@ +# +# BEGIN COPYRIGHT BLOCK +# Copyright 2001 Sun Microsystems, Inc. +# Portions copyright 1999, 2001-2003 Netscape Communications Corporation. +# All rights reserved. +# END COPYRIGHT BLOCK +# +# Makefile for netsite.h + +MCOM_ROOT = ../../.. +MODULE=netsiteIncludeBase + +include ../../nsdefs.mk + +HDRDEST=$(OBJDIR)/include/base + +PREFIX=../copyrght.h + + +NOSTDSTRIP=true +NOSTDDEPEND=true + +#HDRS=$(wildcard *.h) +HDRS=daemon.h cinfo.h crit.h ereport.h buffer.h net.h pblock.h sem.h session.h shexp.h shmem.h systhr.h util.h file.h pool.h regexp.h systems.h + + +BINS=$(addprefix $(HDRDEST)/,$(HDRS)) + +all: $(HDRDEST) $(BINS) + +$(HDRDEST): + mkdir -p $(HDRDEST) + +strip: +depend: + +include ../../nsconfig.mk + +$(HDRDEST)/%.h: %.h + cat $(PREFIX) $< > $(HDRDEST)/$*.h diff --git a/include/base/crit.h b/include/base/crit.h new file mode 100644 index 00000000..1ff7e957 --- /dev/null +++ b/include/base/crit.h @@ -0,0 +1,209 @@ +/** BEGIN COPYRIGHT BLOCK + * Copyright 2001 Sun Microsystems, Inc. + * Portions copyright 1999, 2001-2003 Netscape Communications Corporation. + * All rights reserved. + * END COPYRIGHT BLOCK **/ +#ifndef BASE_CRIT_H +#define BASE_CRIT_H + +#ifndef NOINTNSAPI +#define INTNSAPI +#endif /* !NOINTNSAPI */ + +/* + * crit.h: Critical section abstraction. Used in threaded servers to protect + * areas where two threads can interfere with each other. + * + * Condvars are condition variables that are used for thread-thread + * synchronization. + * + * Rob McCool + */ + +#ifndef NETSITE_H +#include "netsite.h" +#endif /* !NETSITE_H */ + +/* Define C interface */ +#ifndef PUBLIC_BASE_CRIT_H +#include "public/base/crit.h" +#endif /* !PUBLIC_BASE_CRIT_H */ + +/* Define C++ interface */ +#ifdef __cplusplus + +#ifndef BASE_NSASSERT_H +#include "nsassert.h" +#endif /* !BASE_NSASSERT_H */ + +#ifndef prmon_h___ +#include "prmon.h" +#endif /* !prmon_h___ */ + +class NSAPI_PUBLIC CriticalSection +{ +public: + CriticalSection(); + ~CriticalSection(); + void Acquire(){PR_EnterMonitor(_crtsec);} + void Release(){PR_ExitMonitor(_crtsec);} + +private: + PRMonitor *_crtsec; +}; + +inline CriticalSection::CriticalSection():_crtsec(0) +{ + _crtsec = PR_NewMonitor(); + NS_ASSERT(_crtsec); +} + +inline CriticalSection::~CriticalSection() +{ + if (_crtsec) + PR_DestroyMonitor(_crtsec); +} + +class SafeLock { + public: + SafeLock (CriticalSection&); // acquire lock + ~SafeLock (); // release lock + private: + CriticalSection& lock; +}; + +inline SafeLock::SafeLock (CriticalSection& _lock) : lock(_lock) +{ + lock.Acquire(); +} + +inline SafeLock::~SafeLock () +{ + lock.Release(); +} +#endif /* __cplusplus */ + +/* --- Begin function prototypes --- */ + +#ifdef INTNSAPI + +NSPR_BEGIN_EXTERN_C + +/* ASSERT function only */ +NSAPI_PUBLIC int crit_owner_is_me(CRITICAL id); + +/* + * INTcrit_init creates and returns a new critical section variable. At the + * time of creation no one has entered it. + */ +NSAPI_PUBLIC CRITICAL INTcrit_init(void); + +/* + * INTcrit_enter enters a critical section. If someone is already in the + * section, the calling thread is blocked until that thread exits. + */ +NSAPI_PUBLIC void INTcrit_enter(CRITICAL id); + + +/* + * INTcrit_exit exits a critical section. If another thread is blocked waiting + * to enter, it will be unblocked and given ownership of the section. + */ +NSAPI_PUBLIC void INTcrit_exit(CRITICAL id); + + +/* + * INTcrit_terminate removes a previously allocated critical section variable. + */ +NSAPI_PUBLIC void INTcrit_terminate(CRITICAL id); + + +/* + * INTcondvar_init initializes and returns a new condition variable. You + * must provide a critical section to be associated with this condition + * variable. + */ +NSAPI_PUBLIC CONDVAR INTcondvar_init(CRITICAL id); + + +/* + * INTcondvar_wait blocks on the given condition variable. The calling thread + * will be blocked until another thread calls INTcondvar_notify on this variable. + * The caller must have entered the critical section associated with this + * condition variable prior to waiting for it. + */ +NSAPI_PUBLIC void INTcondvar_wait(CONDVAR cv); +NSAPI_PUBLIC void condvar_timed_wait(CONDVAR _cv, long secs); + + +/* + * INTcondvar_notify awakens any threads blocked on the given condition + * variable. The caller must have entered the critical section associated + * with this variable first. + */ +NSAPI_PUBLIC void INTcondvar_notify(CONDVAR cv); + +/* + * INTcondvar_notifyAll awakens all threads blocked on the given condition + * variable. The caller must have entered the critical section associated + * with this variable first. + */ +NSAPI_PUBLIC void INTcondvar_notifyAll(CONDVAR cv); + +/* + * INTcondvar_terminate frees the given previously allocated condition variable + */ +NSAPI_PUBLIC void INTcondvar_terminate(CONDVAR cv); + + +/* + * Create a counting semaphore. + * Return non-zero on success, 0 on failure. + */ +NSAPI_PUBLIC COUNTING_SEMAPHORE INTcs_init(int initial_count); + +/* + * Destroy a counting semaphore + */ +NSAPI_PUBLIC void INTcs_terminate(COUNTING_SEMAPHORE csp); + +/* + * Wait to "enter" the semaphore. + * Return 0 on success, -1 on failure. + */ +NSAPI_PUBLIC int INTcs_wait(COUNTING_SEMAPHORE csp); + +/* + * Enter the semaphore if the count is > 0. Otherwise return -1. + * + */ +NSAPI_PUBLIC int INTcs_trywait(COUNTING_SEMAPHORE csp); + +/* + * Release the semaphore- allowing a thread to enter. + * Return 0 on success, -1 on failure. + */ +NSAPI_PUBLIC int INTcs_release(COUNTING_SEMAPHORE csp); + +NSPR_END_EXTERN_C + +/* --- End function prototypes --- */ + +#define crit_init INTcrit_init +#define crit_enter INTcrit_enter +#define crit_exit INTcrit_exit +#define crit_terminate INTcrit_terminate +#define condvar_init INTcondvar_init +#define condvar_wait INTcondvar_wait +#define condvar_notify INTcondvar_notify +#define condvar_notifyAll INTcondvar_notifyAll +#define condvar_terminate INTcondvar_terminate +#define cs_init INTcs_init +#define cs_terminate INTcs_terminate +#define cs_wait INTcs_wait +#define cs_trywait INTcs_trywait +#define cs_release INTcs_release + +#endif /* INTNSAPI */ + +#endif /* !BASE_CRIT_H */ diff --git a/include/base/dbtbase.h b/include/base/dbtbase.h new file mode 100644 index 00000000..5f30d374 --- /dev/null +++ b/include/base/dbtbase.h @@ -0,0 +1,217 @@ +/** BEGIN COPYRIGHT BLOCK + * Copyright 2001 Sun Microsystems, Inc. + * Portions copyright 1999, 2001-2003 Netscape Communications Corporation. + * All rights reserved. + * END COPYRIGHT BLOCK **/ + +#define LIBRARY_NAME "base" + +static char dbtbaseid[] = "$DBT: base referenced v1 $"; + +#include "i18n.h" + +BEGIN_STR(base) + ResDef( DBT_LibraryID_, -1, dbtbaseid )/* extracted from dbtbase.h*/ + ResDef( DBT_insufficientMemoryToCreateHashTa_, 1, "insufficient memory to create hash table" )/*extracted from cache.cpp*/ + ResDef( DBT_insufficientMemoryToCreateHashTa_1, 2, "insufficient memory to create hash table" )/*extracted from cache.cpp*/ + ResDef( DBT_cacheDestroyCacheTablesAppearCor_, 3, "cache_destroy: cache tables appear corrupt." )/*extracted from cache.cpp*/ + ResDef( DBT_unableToAllocateHashEntry_, 4, "unable to allocate hash entry" )/*extracted from cache.cpp*/ + ResDef( DBT_cacheInsertUnableToCreateCacheEn_, 5, "cache_insert: unable to create cache entry" )/*extracted from cache.cpp*/ + ResDef( DBT_http10200OkNcontentTypeTextHtmlN_, 6, "HTTP/1.0 200 OK\nContent-type: text/html\n\n" )/*extracted from cache.cpp*/ + ResDef( DBT_H2NetscapeCacheStatusReportH2N_, 7, "

Netscape cache status report

\n" )/*extracted from cache.cpp*/ + ResDef( DBT_noCachesOnSystemP_, 8, "No caches on system

" )/*extracted from cache.cpp*/ + ResDef( DBT_H2SCacheH2N_, 9, "

%s cache

\n" )/*extracted from cache.cpp*/ + ResDef( DBT_cacheHitRatioDDFPNPN_, 10, "Cache hit ratio: %d/%d (%f)

\n

\n" )/*extracted from cache.cpp*/ + ResDef( DBT_cacheSizeDDPNPN_, 11, "Cache size: %d/%d

\n

\n" )/*extracted from cache.cpp*/ + ResDef( DBT_hashTableSizeDPNPN_, 12, "Hash table size: %d

\n

\n" )/*extracted from cache.cpp*/ + ResDef( DBT_mruDPNlruDPN_, 13, "mru : %d

\nlru : %d

\n" )/*extracted from cache.cpp*/ + ResDef( DBT_UlTableBorder4ThBucketThThAddres_, 14, "