Initializing a Session
To establish an LDAP session, initialize a connection block (LDAP structure) to its default values. The connection block is created and initialized with a call to ldap_init or to ldap_sslinit, passing in the server name and the system port to use. Either call returns a handle to an LDAP structure (connection block) that maintains state status data for the session. Use the cldap_open function to establish a connectionless UDP-based session.
When a session is created and initialized using ldap_init or ldap_sslinit, all members of the LDAP structure get initialized to default values. For more information, and a description of these members, see Session Options. For more information about setting these options, see Getting and Setting Session Options. For more information about establishing a secure connection, see Using ldap_init and Using ldap_sslinit. For example code, see Example Code for Establishing a Session Without Encryption and Example Code for Establishing a Session over SSL.