diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-16 05:39:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:14 -0500 |
commit | bab977dad76e9204278c7afe0bb905cda064f488 (patch) | |
tree | ff48dba24a28edb88ba6a5485688bf9f920a2928 /source4/libcli/ldap/ldap_client.h | |
parent | 9105bf4054b8ebac0c73b504bf38d49f81661176 (diff) | |
download | samba-bab977dad76e9204278c7afe0bb905cda064f488.tar.gz samba-bab977dad76e9204278c7afe0bb905cda064f488.tar.bz2 samba-bab977dad76e9204278c7afe0bb905cda064f488.zip |
r7626: a new ldap client library. Main features are:
- hooked into events system, so requests can be truly async and won't
interfere with other processing happening at the same time
- uses NTSTATUS codes for errors (previously errors were mostly
ignored). In a similar fashion to the DOS error handling, I have
reserved a range of the NTSTATUS code 32 bit space for LDAP error
codes, so a function can return a LDAP error code in a NTSTATUS
- much cleaner packet handling
(This used to be commit 2e3c660b2fc20e046d82bf1cc296422b6e7dfad0)
Diffstat (limited to 'source4/libcli/ldap/ldap_client.h')
-rw-r--r-- | source4/libcli/ldap/ldap_client.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/source4/libcli/ldap/ldap_client.h b/source4/libcli/ldap/ldap_client.h new file mode 100644 index 0000000000..719c3639c1 --- /dev/null +++ b/source4/libcli/ldap/ldap_client.h @@ -0,0 +1,86 @@ +/* + Unix SMB/CIFS Implementation. + + ldap client side header + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +enum ldap_request_state {LDAP_REQUEST_SEND, LDAP_REQUEST_PENDING, LDAP_REQUEST_DONE}; + +/* this is the handle that the caller gets when an async ldap message + is sent */ +struct ldap_request { + struct ldap_request *next, *prev; + struct ldap_connection *conn; + + enum ldap_request_tag type; + int messageid; + enum ldap_request_state state; + + int num_replies; + struct ldap_message **replies; + + NTSTATUS status; + DATA_BLOB data; + struct { + void (*fn)(struct ldap_request *); + void *private; + } async; +}; + + +/* main context for a ldap client connection */ +struct ldap_connection { + struct socket_context *sock; + char *host; + uint16_t port; + BOOL ldaps; + + const char *auth_dn; + const char *simple_pw; + + /* next message id to assign */ + unsigned next_messageid; + + /* outgoing send queue */ + struct ldap_request *send_queue; + + /* Outstanding LDAP requests that have not yet been replied to */ + struct ldap_request *pending; + + /* Let's support SASL */ + struct gensec_security *gensec; + + /* set if we are wrapping requests */ + BOOL enable_wrap; + + /* partially received packet */ + DATA_BLOB partial; + + /* the default timeout for messages */ + int timeout; + + /* last error message */ + char *last_error; + + struct { + struct event_context *event_ctx; + struct fd_event *fde; + } event; +}; |