#ifndef _CNSLDirNodeRep_
#define _CNSLDirNodeRep_ 1
#include <stdio.h>
#include <unistd.h> // for _POSIX_THREADS
#include <pthread.h> // for pthread_*_t
#include <CoreFoundation/CoreFoundation.h>
#include <DirectoryService/DirServicesTypes.h>
#include <DirectoryServiceCore/CBuff.h>
#include <DirectoryServiceCore/CDataBuff.h>
#include <DirectoryServiceCore/CAttributeList.h>
#include <DirectoryServiceCore/CDSServerModule.h>
#include <DirectoryServiceCore/SharedConsts.h>
#include <DirectoryServiceCore/PluginData.h>
class CNSLPlugin;
class CNSLServiceLookupThread;
class CNSLResult;
class CNSLDirNodeRep
{
public:
CNSLDirNodeRep ( CNSLPlugin* parent, const void* ref );
~CNSLDirNodeRep ( void );
void DeleteSelf ( void );
void Initialize ( CFStringRef nodeNameRef, uid_t uid, Boolean isTopLevelNode );
void Initialize ( const char* nodeNamePtr, uid_t uid, Boolean isTopLevelNode );
Boolean IsInitialized ( void ) { return mInitialized; } Boolean IsLookupStarted ( void ) { return mLookupStarted; }
void LookupHasStarted ( void ) { mLookupStarted = true; }
void ResetLookupHasStarted ( void ) { mLookupStarted = false; }
CFStringRef GetNodeName ( void ) { return mNodeName; }
Boolean IsTopLevelNode ( void ) { return mIsTopLevelNode; }
uid_t GetUID ( void ) { return mUID; }
void LimitRecSearch ( unsigned long searchLimit ) { mRecSearchLimit = searchLimit; }
Boolean HaveResults ( void );
Boolean LookupComplete ( void );
const CNSLResult* GetNextResult ( void );
void NeedToRedoLastResult ( void ) { mCurrentIndex--; }
const CNSLResult* GetResult ( CFIndex index );
void AddService ( CNSLResult* newResult );
void StartingNewLookup ( CNSLServiceLookupThread* searchThread );
void ServiceLookupComplete ( CNSLServiceLookupThread* searchThread );
void ResultListQueueLock ( void ) { pthread_mutex_lock( &mResultListQueueLock ); }
void ResultListQueueUnlock ( void ) { pthread_mutex_unlock( &mResultListQueueLock ); }
void SearchListQueueLock ( void ) { pthread_mutex_lock( &mSearchListQueueLock ); }
void SearchListQueueUnlock ( void ) { pthread_mutex_unlock( &mSearchListQueueLock ); }
void Retain ( void ) { mRefCounter++; }
void Release ( void ) { if ( --mRefCounter == 0 ) DeleteSelf(); }
protected:
private:
pthread_mutex_t mResultListQueueLock;
pthread_mutex_t mSearchListQueueLock;
CFStringRef mNodeName;
Boolean mIsTopLevelNode;
uid_t mUID;
CNSLPlugin* mParentPlugin;
const void* mRef; CFIndex mRecSearchLimit;
CFMutableArrayRef mResultList;
CFMutableArrayRef mSearchList;
CFIndex mCurrentIndex;
Boolean mInitialized;
Boolean mLookupStarted;
UInt32 mDelCounter;
UInt32 mRefCounter;
CNSLDirNodeRep* mSelfPtr;
};
#endif // #ifndef