1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 /*
5  * pkix_pl_ldapdefaultclient.h
6  *
7  * LDAPDefaultClient Object Type Definition
8  *
9  */
10 
11 #ifndef _PKIX_PL_LDAPDEFAULTCLIENT_H
12 #define _PKIX_PL_LDAPDEFAULTCLIENT_H
13 
14 #include "pkix_pl_ldapt.h"
15 #include "pkix_pl_common.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /*
22  * At the time of this version, there are unresolved questions about the LDAP
23  * protocol. Although RFC1777 describes a BIND and UNBIND message, it is not
24  * clear whether they are appropriate to this application. We have tested only
25  * using servers that do not expect authentication, and that reject BIND
26  * messages. It is not clear what values might be appropriate for the bindname
27  * and authentication fields, which are currently implemented as char strings
28  * supplied by the caller. (If this changes, the API and possibly the templates
29  * will have to change.) Therefore the LDAPClient_Create API contains a
30  * BindAPI structure, a union, which will have to be revised and extended when
31  * this area of the protocol is better understood.
32  *
33  */
34 
35 typedef enum {
36         CONNECT_PENDING,
37         CONNECTED,
38         BIND_PENDING,
39         BIND_RESPONSE,
40         BIND_RESPONSE_PENDING,
41         BOUND,
42         SEND_PENDING,
43         RECV,
44         RECV_PENDING,
45         RECV_INITIAL,
46         RECV_NONINITIAL,
47         ABANDON_PENDING
48 } LdapClientConnectStatus;
49 
50 struct PKIX_PL_LdapDefaultClientStruct {
51         PKIX_PL_LdapClient vtable;
52         LdapClientConnectStatus connectStatus;
53         PKIX_UInt32 messageID;
54         PKIX_PL_HashTable *cachePtr;
55         PKIX_PL_Socket *clientSocket;
56         PRPollDesc pollDesc;
57         void *callbackList; /* cast this to (PKIX_PL_Socket_Callback *) */
58         LDAPBindAPI *bindAPI;
59         PLArenaPool *arena;
60         PRTime lastIO;
61         void *sendBuf;
62         PKIX_UInt32 bytesToWrite;
63         void *rcvBuf;
64         PKIX_UInt32 capacity;
65         void *currentInPtr;
66         PKIX_UInt32 currentBytesAvailable;
67         void *bindMsg;
68         PKIX_UInt32 bindMsgLen;
69         PKIX_List *entriesFound;
70         PKIX_PL_LdapRequest *currentRequest;
71         PKIX_PL_LdapResponse *currentResponse;
72 };
73 
74 /* see source file for function documentation */
75 
76 PKIX_Error *pkix_pl_LdapDefaultClient_RegisterSelf(void *plContext);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* _PKIX_PL_LDAPDEFAULTCLIENT_H */
83