/*
 * $Id: socket.h,v 1.6 2000/09/22 22:05:18 k-abe Exp $
 *
 * This file is part of PTL, Portable Thread Library.
 *
 * Copyright (C) 1997-2000 Kota Abe
 *
 */

#ifndef __PTL_SYS_SOCKET_H__
#define __PTL_SYS_SOCKET_H__

#include <sys/pthread-init.h>

/* ---------------------------------------------------------------- */
#ifdef __PTL_RENAMED__
#define __PTL_ALREADY_RENAMED_SYS_SOCKET_H
#else
#include <sys/pthread-before.h>
#endif

#ifdef __GNUC__
#include <00root-gcc/sys/socket.h>
#else
#include <00root-system/sys/socket.h>
#endif

#include <sys/pthread-after.h>
/* ---------------------------------------------------------------- */

#include <sys/pthread-cdecl.h>

/* struct timeval */
#include <sys/time.h>

/****************************************************************
 *
 *	Socket APIs
 *
 ****************************************************************/
__PTL_BEGIN_DECLS

extern int socket __PTL_P((int, int, int));
extern int accept __PTL_P((int, const struct sockaddr*, int*));
extern int connect __PTL_P((int, const struct sockaddr*, int));
extern ssize_t readv __PTL_P((int, const struct iovec*, int));
extern ssize_t writev __PTL_P((int, const struct iovec*, int));
extern ssize_t send __PTL_P((int, const void*, size_t, int));
extern ssize_t sendto __PTL_P((int, _pthread_const_any_t, size_t, int,
			       const struct sockaddr*, int));
extern ssize_t sendmsg __PTL_P((int, const struct msghdr*, int));
extern ssize_t recv __PTL_P((int, void*, size_t, int));
extern ssize_t recvfrom __PTL_P((int, void*, size_t, int, struct sockaddr*,
				 int*));
extern ssize_t recvmsg __PTL_P((int, struct msghdr*, int));
extern int select __PTL_P((int, fd_set*, fd_set*, fd_set*,
			   const struct timeval*));

/* PTL API */
extern int accept_timedwait __PTL_P((int, const struct sockaddr*, int*,
				     struct timespec*));
extern int connect_timedwait __PTL_P((int, const struct sockaddr*, int,
				      struct timespec*));
extern ssize_t readv_timedwait __PTL_P((int, const struct iovec*, int,
					struct timespec*));
extern ssize_t writev_timedwait __PTL_P((int, const struct iovec*, int,
					 struct timespec*));
extern ssize_t send_timedwait __PTL_P((int, const void*, size_t, int,
				       struct timespec*));
extern ssize_t sendto_timedwait __PTL_P((int, _pthread_const_any_t, size_t, int,
					 const struct sockaddr*, int,
					 struct timespec*));
extern ssize_t sendmsg_timedwait __PTL_P((int, const struct msghdr*, int,
					  struct timespec*));
extern ssize_t recv_timedwait __PTL_P((int, void*, size_t, int,
				       struct timespec*));
extern ssize_t recvfrom_timedwait __PTL_P((int, void*, size_t, int,
					   struct sockaddr*, int*,
					   struct timespec*));
extern ssize_t recvmsg_timedwait __PTL_P((int, struct msghdr*, int,
					  struct timespec*));

__PTL_END_DECLS

/* ---------------------------------------------------------------- */
#ifdef __PTL_ALREADY_RENAMED_SYS_SOCKET_H
#include <sys/pthread-before.h>
#undef __PTL_ALREADY_RENAMED_SYS_SOCKET_H
#else
#include <sys/pthread-after.h>
#endif
/* ---------------------------------------------------------------- */

#endif /*__PTL_SYS_SOCKET_H__*/

