#ifndef __CLDAPConfigs_h__
#define __CLDAPConfigs_h__ 1
#include <stdio.h>
#include <CoreFoundation/CoreFoundation.h> //for CF classes and property lists - XML config data
#include <DirectoryServiceCore/PrivateTypes.h>
#include <DirectoryServiceCore/CPlugInRef.h> // config data table
#define kXMLLDAPVersionKey "LDAP PlugIn Version"
#define kXMLConfigArrayKey "LDAP Server Configs"
#define kXMLEnableUseFlagKey "Enable Use"
#define kXMLUserDefinedNameKey "UI Name"
#define kXMLOpenCloseTimeoutSecsKey "OpenClose Timeout in seconds"
#define kXMLPortNumberKey "Port Number"
#define kXMLSearchTimeoutSecsKey "Search Timeout in seconds"
#define kXMLSecureUseFlagKey "Secure Use"
#define kXMLServerKey "Server"
#define kXMLServerAccountKey "Server Account"
#define kXMLServerPasswordKey "Server Password"
#define kXMLStdMapUseFlagKey "Standard Map Use"
#define kXMLDefaultAttrTypeMapArrayKey "Default Attribute Type Map"
#define kXMLDefaultRecordTypeMapArrayKey "Default Record Type Map"
#define kXMLAttrTypeMapArrayKey "Attribute Type Map"
#define kXMLRecordTypeMapArrayKey "Record Type Map"
#define kXMLNativeMapArrayKey "Native Map"
#define kXMLStdNameKey "Standard Name"
typedef struct sPtrString {
char *fName; sPtrString *pNext; } sPtrString;
typedef struct sMapTuple {
char *fStandard; sPtrString *fNative; sMapTuple *pNext; } sMapTuple;
typedef struct sLDAPConfigData {
char *fName; sMapTuple *pAttributeMapTuple; char *fServerName; bool bUseStdMapping; sMapTuple *pRecordMapTuple; int fOpenCloseTimeout; char *fServerPassword; int fSearchTimeout; char *fServerAccount; int fServerPort; bool bSecureUse; bool bAvail; bool bUpdated; } sLDAPConfigData;
class CLDAPConfigs
{
public:
CLDAPConfigs ( void );
sInt32 Init ( CPlugInRef *inConfigTable,
uInt32 &inConfigTableLen,
sMapTuple **inStdAttributeMapTuple,
sMapTuple **inStdRecordMapTuple );
virtual ~CLDAPConfigs ( void );
sInt32 CleanLDAPConfigData ( sLDAPConfigData *inConfig );
sInt32 SetXMLConfig ( CFDataRef xmlData );
CFDataRef GetXMLConfig ( void );
sInt32 WriteXMLConfig ( void );
protected:
bool VerifyXML ( void );
sInt32 BuildDefaultStdAttributeMap
( void );
sInt32 BuildDefaultStdRecordMap
( void );
sInt32 CleanMapTuple ( sMapTuple *inMapTuple );
sLDAPConfigData *MakeLDAPConfigData ( char *inName, char *inServerName, bool inUseStd,
int inOpenCloseTO, int inSearchTO, int inPortNum,
bool inUseSecure, char *inAccount, char *inPassword );
sInt32 ConfigLDAPServers ( void );
char *GetVersion ( CFDictionaryRef configDict );
CFArrayRef GetConfigArray ( CFDictionaryRef configDict );
CFArrayRef GetRecordTypeMapArray
( CFDictionaryRef configDict );
CFArrayRef GetAttributeTypeMapArray
( CFDictionaryRef configDict );
CFArrayRef GetNativeTypeMapArray
( CFDictionaryRef configDict );
CFArrayRef GetDefaultRecordTypeMapArray
( CFDictionaryRef configDict );
CFArrayRef GetDefaultAttrTypeMapArray
( CFDictionaryRef configDict );
sInt32 MakeLDAPConfig ( CFDictionaryRef ldapDict, sInt32 inIndex );
sInt32 BuildLDAPMap ( sLDAPConfigData *inConfig, CFDictionaryRef ldapDict );
sMapTuple *BuildMapTuple ( CFArrayRef inArray );
bool CheckForConfig ( char *inServerName, uInt32 &inConfigTableIndex);
sInt32 ReadXMLConfig ( void );
sInt32 AddDefaultArrays ( CFMutableDictionaryRef inDict );
private:
CPlugInRef *pConfigTable;
sMapTuple *pStdAttributeMapTuple;
sMapTuple *pStdRecordMapTuple;
uInt32 fConfigTableLen;
CFDataRef fXMLData;
};
#endif // __CLDAPConfigs_h__