/*
*/
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
*
* os-ip.c -- platform-specific TCP & UDP related code
*/
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
#include <string.h>
#include <errno.h>
#ifdef _WIN32
#include <io.h>
#include "msdos.h"
#else /* _WIN32 */
#include <netdb.h>
#endif /* _WIN32 */
#ifdef _AIX
#endif /* _AIX */
#ifdef VMS
#include "ucx_select.h"
#endif /* VMS */
#include "portable.h"
#include "lber.h"
#include "ldap.h"
#include "ldap-private.h"
#include "ldap-int.h"
#ifdef LDAP_REFERRALS
#ifdef USE_SYSCONF
#include <unistd.h>
#endif /* USE_SYSCONF */
#ifdef notyet
#ifdef NEED_FILIO
#else /* NEED_FILIO */
#endif /* NEED_FILIO */
#endif /* notyet */
#endif /* LDAP_REFERRALS */
#ifdef MACOS
#else /* MACOS */
#ifdef DOS
#ifdef PCNFS
#endif /* PCNFS */
#ifdef NCSA
#endif /* NCSA */
#ifdef WINSOCK
#endif /* WINSOCK */
#else /* DOS */
#endif /* DOS */
#endif /* MACOS */
#ifdef SUN
#include <nss_dbdefs.h>
#endif
#include <fcntl.h>
/*
* Do an async connect or blocking connect depending on the timeout
* value. LDAP_X_IO_TIMEOUT_NO_TIMEOUT means do a blocking connect.
* Otherwise wait for timeout milliseconds for the connection.
* Returns 0 on success and -1 on failure.
*/
static int
{
socklen_t n;
/* set the socket to do non-blocking i/o */
connected = 1;
} else if (errno == EINPROGRESS) {
/* if NO_TIMEOUT is specified do a blocking connect */
if (timeout <= LDAP_X_IO_TIMEOUT_NO_TIMEOUT) {
sel_timeout = NULL;
} else {
/* set the timeout to the specified value */
sel_timeout = &waittime;
}
n = sizeof (error);
error == 0) {
connected = 1;
}
}
/* if we are connected restore the flags for the socket */
if (connected) {
}
return (connected ? 0 : -1);
}
int
/*
* if host == NULL, connect using address
* "address" and "port" must be in network byte order
* zero is returned upon success, -1 if fatal error, -2 EINPROGRESS
* async is only used ifdef LDAP_REFERRALS (non-0 means don't wait for connect)
* XXX async is not used yet!
*/
{
#ifdef notyet
#ifdef LDAP_REFERRALS
#endif /* LDAP_REFERRALS */
#endif /* notyet */
#ifdef SUN
int hperrno;
#endif
#ifdef SUN
#else
#endif
return (-1);
}
use_hp = 1;
}
rc = -1;
return (-1);
}
#ifdef notyet
#ifdef LDAP_REFERRALS
status = 1;
"FIONBIO ioctl failed on %d\n"), s, 0, 0);
}
#endif /* LDAP_REFERRALS */
#endif /* notyet */
connected = 1;
break;
}
#ifdef notyet
#ifdef LDAP_REFERRALS
#ifdef EAGAIN
#else /* EAGAIN */
if (errno == EINPROGRESS) {
#endif /* EAGAIN */
"connect would block...\n"), 0, 0, 0);
rc = -2;
break;
}
#endif /* LDAP_REFERRALS */
#endif /* notyet */
#ifdef LDAP_DEBUG
if (ldap_debug & LDAP_DEBUG_TRACE) {
}
#endif
close(s);
if (!use_hp) {
break;
}
}
if (connected) {
rc = 0;
#ifdef notyet
#ifdef LDAP_REFERRALS
status = 0;
"FIONBIO ioctl failed on %d\n"), s, 0, 0);
}
#endif /* LDAP_REFERRALS */
#endif /* notyet */
"sd %1$d connected to: %2$s\n"), s,
}
return (rc);
}
void
{
#ifdef LDAP_SSL
}
sb->sb_ssl_tls = 0;
#endif
}
#ifdef KERBEROS
char *
{
char *p;
int len;
#ifdef SUN
int hperrno;
#endif
return( NULL );
}
/*
* do a reverse lookup on the addr to get the official hostname.
* this is necessary for kerberos to work right, since the official
* hostname is used as the kerberos instance.
*/
#ifdef SUN
#else
#endif
}
}
return( NULL );
}
#endif /* KERBEROS */
#ifdef LDAP_REFERRALS
#ifdef SUN
/* for UNIX */
#include <stropts.h>
#include <poll.h>
struct selectinfo {
int nbfds;
};
void
{
int i;
/* find if sb is in fds */
return;
}
}
}
else {
/* Should not happen */
Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 206, "Mark for poll : Too many descriptors\n"), 0, 0, 0 );
}
}
void
{
int i;
/* find if sb is in fds */
return;
}
}
}
else {
/* Should not happen */
Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 206, "Mark for poll : Too many descriptors\n"), 0, 0, 0 );
}
}
void
{
int i;
i++;
}
return;
}
}
/* If we reach here, there's a pb. */
Debug( LDAP_DEBUG_TRACE, catgets(slapdcat, 1, 207, "Clear poll : descriptor not found\n"), 0, 0, 0 );
}
long
{
int i;
return (-1);
}
}
}
return(0);
}
long
{
int i;
return (-1);
}
}
}
return(0);
}
void *
{
return( (void *)sip );
}
void
{
}
int
{
int tim;
#if defined( SUN ) && defined( _REENTRANT )
int rv;
#endif
/* sip->fds[0].revents = 0; */
if ( timeout ) {
} else {
} /* end if */
errno=0;
#if defined( SUN ) && defined( _REENTRANT )
/* UNLOCK_LDAP(ld); */
/* LOCK_LDAP(ld); */
return(rv);
#else
#endif
}
#else
/* for UNIX */
struct selectinfo {
};
void
{
}
}
void
{
}
}
void
{
}
long
{
}
long
{
}
void *
{
sizeof( struct selectinfo ))) != NULL ) {
}
return( (void *)sip );
}
void
{
}
int
{
static int tblsize;
#if defined( SUN ) && defined( _REENTRANT )
#endif
if ( tblsize == 0 ) {
#ifdef USE_SYSCONF
#else /* USE_SYSCONF */
tblsize = getdtablesize();
#endif /* USE_SYSCONF */
}
#if defined( SUN ) && defined( _REENTRANT )
#endif
}
#endif /* SUN */
#endif /* LDAP_REFERRALS */