1998-10-25 09:41:42 +08:00
|
|
|
/*
|
|
|
|
* Generic socket.h
|
|
|
|
*/
|
1998-12-29 03:51:35 +08:00
|
|
|
/*
|
|
|
|
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted only
|
|
|
|
* as authorized by the OpenLDAP Public License. A copy of this
|
|
|
|
* license is available at http://www.OpenLDAP.org/license.html or
|
|
|
|
* in file LICENSE in the top-level directory of the distribution.
|
|
|
|
*/
|
1998-10-25 09:41:42 +08:00
|
|
|
|
|
|
|
#ifndef _AC_SOCKET_H_
|
|
|
|
#define _AC_SOCKET_H_
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
1999-03-13 09:12:54 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_ARPA_INET_H
|
1998-10-25 09:41:42 +08:00
|
|
|
#include <arpa/inet.h>
|
1999-03-13 09:12:54 +08:00
|
|
|
#endif
|
1999-02-05 05:54:38 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_ARPA_NAMESER_H
|
1998-10-25 09:41:42 +08:00
|
|
|
#include <arpa/nameser.h>
|
1999-02-05 05:54:38 +08:00
|
|
|
#endif
|
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#include <netdb.h>
|
1999-02-05 05:54:38 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_RESOLV_H
|
1998-10-25 09:41:42 +08:00
|
|
|
#include <resolv.h>
|
|
|
|
#endif
|
|
|
|
|
1999-02-05 05:54:38 +08:00
|
|
|
#endif /* HAVE_SYS_SOCKET_H */
|
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#ifdef HAVE_WINSOCK2
|
1998-11-17 12:07:31 +08:00
|
|
|
#include <winsock2.h>
|
|
|
|
#elif HAVE_WINSOCK
|
|
|
|
#include <winsock.h>
|
1998-10-25 09:41:42 +08:00
|
|
|
#else
|
1998-11-17 12:07:31 +08:00
|
|
|
#define WSACleanup()
|
1998-10-25 09:41:42 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_PCNFS
|
|
|
|
#include <tklib.h>
|
|
|
|
#endif /* HAVE_PCNFS */
|
|
|
|
|
|
|
|
#ifndef INADDR_LOOPBACK
|
|
|
|
#define INADDR_LOOPBACK ((unsigned long) 0x7f000001)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAXHOSTNAMELEN
|
|
|
|
#define MAXHOSTNAMELEN 64
|
|
|
|
#endif
|
|
|
|
|
1999-03-29 13:15:59 +08:00
|
|
|
#ifdef HAVE_WINSOCK
|
|
|
|
# define tcp_close( s ) closesocket( s );
|
|
|
|
# define ioctl( s, c, a ) ioctlsocket( (s), (c), (a) )
|
1999-03-29 13:28:29 +08:00
|
|
|
# define ioctl_t u_long
|
1999-05-19 04:52:36 +08:00
|
|
|
|
|
|
|
#define EWOULDBLOCK WSAEWOULDBLOCK
|
|
|
|
|
1999-03-29 13:15:59 +08:00
|
|
|
#elif MACOS
|
|
|
|
# define tcp_close( s ) tcpclose( s )
|
|
|
|
#elif DOS
|
|
|
|
# ifdef PCNFS
|
|
|
|
# define tcp_close( s ) close( s )
|
|
|
|
# endif /* PCNFS */
|
|
|
|
# ifdef NCSA
|
|
|
|
# define tcp_close( s ) do { netclose( s ); netshut() } while(0)
|
|
|
|
# endif /* NCSA */
|
|
|
|
#else
|
|
|
|
# define tcp_close( s ) close( s )
|
1998-10-25 09:41:42 +08:00
|
|
|
#endif /* MACOS */
|
|
|
|
|
1999-03-29 13:28:29 +08:00
|
|
|
#ifndef ioctl_t
|
|
|
|
# define ioctl_t int
|
|
|
|
#endif
|
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#if !defined(__alpha) || defined(VMS)
|
|
|
|
#define AC_HTONL( l ) htonl( l )
|
|
|
|
#define AC_NTOHL( l ) ntohl( l )
|
|
|
|
#else /* __alpha && !VMS */
|
|
|
|
/*
|
|
|
|
* htonl and ntohl on the DEC Alpha under OSF 1 seem to only swap the
|
|
|
|
* lower-order 32-bits of a (64-bit) long, so we define correct versions
|
|
|
|
* here.
|
|
|
|
*/
|
|
|
|
#define AC_HTONL( l ) (((long)htonl( (l) & 0x00000000FFFFFFFF )) << 32 \
|
|
|
|
| htonl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 ))
|
|
|
|
|
|
|
|
#define AC_NTOHL( l ) (((long)ntohl( (l) & 0x00000000FFFFFFFF )) << 32 \
|
|
|
|
| ntohl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 ))
|
|
|
|
|
|
|
|
#endif /* __alpha && !VMS */
|
|
|
|
|
|
|
|
#endif /* _AC_SOCKET_H_ */
|