1N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 1N/A * Use is subject to license terms. 1N/A * The contents of this file are subject to the Netscape Public 1N/A * License Version 1.1 (the "License"); you may not use this file 1N/A * except in compliance with the License. You may obtain a copy of 1N/A * Software distributed under the License is distributed on an "AS 1N/A * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 1N/A * implied. See the License for the specific language governing 1N/A * rights and limitations under the License. 1N/A * The Original Code is Mozilla Communicator client code, released 1N/A * The Initial Developer of the Original Code is Netscape 1N/A * Communications Corporation. Portions created by Netscape are 1N/A * Copyright (C) 1998-1999 Netscape Communications Corporation. All 1N/A * Extended I/O callback functions for libldap that use 1N/A * NSPR (Netscape Portable Runtime) I/O. 1N/A * High level strategy: we use the socket-specific arg to hold our own data 1N/A * structure that includes the NSPR file handle (PRFileDesc *), among other 1N/A * useful information. We use the default argument to hold an LDAP session 1N/A * handle specific data structure. 1N/A * Local function prototypes: 1N/A#
endif /* _SOLARIS_SDK */ 1N/A/* given a socket-specific arg, return the corresponding PRFileDesc * */ 1N/A * Install NSPR I/O functions into ld (if ld is NULL, they are installed 1N/A * as the default functions for new LDAP * handles). 1N/A * Returns 0 if all goes well and -1 if not. 1N/A * If we are dealing with a real ld, we allocate the session specific 1N/A * data structure now. If not allocated here, it will be allocated 1N/A * inside prldap_newhandle() or prldap_shared_newhandle(). 1N/A /* cap at maximum I/O timeout */ 1N/A#
endif /* PRLDAP_DEBUG */ 1N/A * Note the 4th parameter (flags) to PR_Send() has been obsoleted and 1N/A /* allocate or resize NSPR poll descriptor array */ 1N/A /* populate NSPR poll info. based on LDAP info. */ 1N/A /* call PR_Poll() to do the real work */ 1N/A /* populate LDAP info. based on NSPR results */ 1N/A * Utility function to try one TCP connect() 1N/A * Returns 1 if successful and -1 if not. Sets the NSPR fd inside prsockp. 1N/A * Set up address and open a TCP socket: 1N/A * Set nonblocking option if requested: 1N/A /* IPv4 address mapped into IPv6 address space */ 1N/A fmtstr =
"prldap_try_one_address(): Trying %s:%d...\n";
1N/A fmtstr =
"prldap_try_one_address(): Trying [%s]:%d...\n";
1N/A#
endif /* PRLDAP_DEBUG */ 1N/A * Try to open the TCP connection itself: 1N/A#
endif /* PRLDAP_DEBUG */ 1N/A * Success. Return a valid file descriptor (1 is always valid) 1N/A * XXXmcs: At present, this code ignores the timeout when doing DNS lookups. 1N/A#
endif /* _SOLARIS_SDK */ 1N/A#
endif /* _SOLARIS_SDK */ 1N/A rc = -
1;
/* pessimistic */ 1N/A#
endif /* _SOLARIS_SDK */ 1N/A#
endif /* _SOLARIS_SDK */ 1N/A * LDAP session handle creation callback. 1N/A * Allocate a session argument if not already done, and then call the 1N/A * thread's new handle function. 1N/A * Allocate a session argument. 1N/A /* copy global defaults to the new session handle */ 1N/A * Given an LDAP session handle, retrieve a session argument. 1N/A * Returns an LDAP error code. 1N/A /* XXXmcs: NULL ld's are not supported */ 1N/A * Given an LDAP session handle, retrieve a socket argument. 1N/A * Returns an LDAP error code. 1N/A /* XXXmcs: NULL ld's are not supported */ 1N/A * Allocate a socket argument. 1N/A /* copy socket defaults from the session */ 1N/A/* returns an LDAP result code */ 1N/A/* returns an LDAP result code */