1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef LDAP_RESOURCE_H
30 #define LDAP_RESOURCE_H
31
32 #include "resourcepool.h"
33
34 #include <ldap.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #ifndef LDAP_PORT
41 #define LDAP_PORT 389
42 #endif
43 #ifndef LDAPS_PORT
44 #define LDAPS_PORT 636
45 #endif
46
47 typedef struct LDAPResourcePool {
48
49
50
51 pblock *param;
52
53
54
55
56 pool_handle_t *pool;
57
58
59
60
61 const char *name;
62
63
64
65
66 char *ldap_uri;
67
68
69
70
71
72
73 char *host;
74
75
76
77
78 int port;
79
80
81
82
83 char *binddn;
84
85
86
87
88 char *bindpw;
89
90
91
92
93 WSBool bind;
94
95
96 } LDAPResourcePool;
97
98 typedef struct LDAPResource {
99 LDAP *ldap;
100 LDAPResourcePool *res_pool;
101 } LDAPResource;
102
103 ResourceType* ldap_get_resource_type(
void);
104
105
106 LDAP* ws_ldap_resource_create_connection(
107 const char *hostname,
108 int port,
109 int ssl,
110 int ldap_version);
111
112 LDAP* ws_ldap_resource_create_uri_connection(
113 const char *uri,
114 int ldap_version);
115
116 void ws_ldap_close(
LDAP *ldap);
117
118
119
120 void * ldap_resourcepool_init(
pool_handle_t *pool,
const char *rpname, pblock *pb);
121 void ldap_resourcepool_destroy(LDAPResourcePool *pool);
122 void * ldap_resourcepool_createresource(LDAPResourcePool *respool);
123 void ldap_resourcepool_freeresource(LDAPResourcePool *pool, LDAPResource *res);
124 int ldap_resourcepool_prepare(LDAPResourcePool *pool, LDAPResource *res);
125 int ldap_resourcepool_finish(LDAPResourcePool *pool, LDAPResource *res);
126 void * ldap_resourcepool_getresourcedata(LDAPResource *res);
127
128
129 int ldap_resource_bind(LDAPResourcePool *respool,
LDAP *ldap,
struct berval **server_cred);
130
131 int ws_ldap_bind(
LDAP *ldap,
const char *binddn,
const char *bindpw,
struct berval **server_cred);
132
133
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif
140
141