#ifndef LDAP_RESOURCE_H
#define LDAP_RESOURCE_H
#include "resourcepool.h"
#include <ldap.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef LDAP_PORT
#define LDAP_PORT 389
#endif
#ifndef LDAPS_PORT
#define LDAPS_PORT 636
#endif
typedef struct LDAPResourcePool {
pblock *param;
pool_handle_t *pool;
const char *name;
char *ldap_uri;
char *host;
int port;
char *binddn;
char *bindpw;
WSBool bind;
} LDAPResourcePool;
typedef struct LDAPResource {
LDAP *ldap;
LDAPResourcePool *res_pool;
} LDAPResource;
ResourceType* ldap_get_resource_type(
void);
LDAP* ws_ldap_resource_create_connection(
const char *hostname,
int port,
int ssl,
int ldap_version);
LDAP* ws_ldap_resource_create_uri_connection(
const char *uri,
int ldap_version);
void ws_ldap_close(
LDAP *ldap);
void * ldap_resourcepool_init(
pool_handle_t *pool,
const char *rpname, pblock *pb);
void ldap_resourcepool_destroy(LDAPResourcePool *pool);
void * ldap_resourcepool_createresource(LDAPResourcePool *respool);
void ldap_resourcepool_freeresource(LDAPResourcePool *pool, LDAPResource *res);
int ldap_resourcepool_prepare(LDAPResourcePool *pool, LDAPResource *res);
int ldap_resourcepool_finish(LDAPResourcePool *pool, LDAPResource *res);
void * ldap_resourcepool_getresourcedata(LDAPResource *res);
int ldap_resource_bind(LDAPResourcePool *respool,
LDAP *ldap,
struct berval **server_cred);
int ws_ldap_bind(
LDAP *ldap,
const char *binddn,
const char *bindpw,
struct berval **server_cred);
#ifdef __cplusplus
}
#endif
#endif