1 .TH LDAP_OPEN 3 "2008/07/16" "OpenLDAP 2.4.11"
2 .\" $OpenLDAP: pkg/ldap/doc/man/man3/ldap_open.3,v 1.16.2.3 2008/02/11 23:26:39 kurt Exp $
3 .\" Copyright 1998-2008 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_init, ldap_initialize, ldap_open \- Initialize the LDAP library and open a connection to an LDAP server
8 OpenLDAP LDAP (libldap, -lldap)
15 LDAP *ldap_open(host, port)
21 LDAP *ldap_init(host, port)
27 int ldap_initialize(ldp, uri)
36 int ldap_init_fd(fd, proto, uri, ldp)
45 opens a connection to an LDAP server and allocates an LDAP
46 structure which is used to identify
47 the connection and to maintain per-connection information.
49 allocates an LDAP structure but does not open an initial connection.
51 allocates an LDAP structure but does not open an initial connection.
53 allocates an LDAP structure using an existing connection on the
56 of these routines must be called before any operations are attempted.
59 takes \fIhost\fP, the hostname on which the LDAP server is
60 running, and \fIport\fP, the port number to which to connect. If the default
61 IANA-assigned port of 389 is desired, LDAP_PORT should be specified for
62 \fIport\fP. The \fIhost\fP parameter may contain a blank-separated list
63 of hosts to try to connect to, and each host may optionally by of the form
64 \fIhost:port\fP. If present, the \fI:port\fP overrides the \fIport\fP
67 Upon successfully making a connection to an
70 returns a pointer to an opaque LDAP structure, which should be passed
71 to subsequent calls to
74 etc. Certain fields in the LDAP structure can be set to indicate size limit,
75 time limit, and how aliases are handled during operations; read and write access
76 to those fields must occur by calling
77 .BR ldap_get_option (3)
79 .BR ldap_set_option (3)
80 respectively, whenever possible.
86 but does not open a connection
87 to the LDAP server. The actual connection open will occur when the
88 first operation is attempted.
93 but it returns an integer indicating either success or the failure reason,
94 and it allows to specify details for the connection in the schema portion
101 are deprecated in favor of
102 .BR ldap_initialize() ,
103 essentially because the latter allows to specify a schema in the URI
104 and it explicitly returns an error code.
107 allows an LDAP structure to be initialized using an already-opened
110 parameter should be one of LDAP_PROTO_TCP, LDAP_PROTO_UDP,
112 for a connection using TCP, UDP, or IPC, respectively. The value
114 may also be specified if user-supplied sockbuf handlers are going to
115 be used. Note that support for UDP is not implemented unless libldap
116 was built with LDAP_CONNECTIONLESS defined.
119 parameter may optionally be provided for informational purposes.
121 Note: the first call into the LDAP library also initializes the global
122 options for the library. As such the first call should be single-threaded
123 or otherwise protected to insure that only one call is active. It is
125 .BR ldap_get_option ()
127 .BR ldap_set_option ()
128 be used in the program's main thread before any additional threads are created.
130 .BR ldap_get_option (3).
137 will return NULL and errno should be set appropriately.
141 will directly return the LDAP code associated to the error (or
144 errno should be set as well whenever appropriate.
148 .BR ldap_get_option (3),
149 .BR ldap_set_option (3),
150 .BR lber-sockbuf (3),
153 .\" Shared Project Acknowledgement Text
154 .B "OpenLDAP Software"
155 is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>.
156 .B "OpenLDAP Software"
157 is derived from University of Michigan LDAP 3.3 Release.