1998-09-06 23:45:24 +00:00
|
|
|
#ifndef _SYS_SOCKET_H
|
1996-07-14 06:04:09 +00:00
|
|
|
#include <socket/sys/socket.h>
|
1998-08-09 17:39:48 +00:00
|
|
|
|
|
|
|
|
/* Now define the internal interfaces. */
|
1999-11-23 17:22:17 +00:00
|
|
|
extern int __socket (int __domain, int __type, int __protocol);
|
1999-10-29 21:40:21 +00:00
|
|
|
|
2000-08-09 21:05:45 +00:00
|
|
|
/* Create two new sockets, of type TYPE in domain DOMAIN and using
|
|
|
|
|
protocol PROTOCOL, which are connected to each other, and put file
|
|
|
|
|
descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
|
|
|
|
|
one will be chosen automatically. Returns 0 on success, -1 for errors. */
|
|
|
|
|
extern int __socketpair (int __domain, int __type, int __protocol,
|
|
|
|
|
int __fds[2]);
|
|
|
|
|
|
1999-10-29 21:40:21 +00:00
|
|
|
/* Return a socket of any type. The socket can be used in subsequent
|
|
|
|
|
ioctl calls to talk to the kernel. */
|
|
|
|
|
extern int __opensock (void) internal_function;
|
|
|
|
|
|
2000-08-21 08:37:43 +00:00
|
|
|
/* Put the address of the peer connected to socket FD into *ADDR
|
|
|
|
|
(which is *LEN bytes long), and its actual length into *LEN. */
|
|
|
|
|
extern int __getpeername (int __fd, __SOCKADDR_ARG __addr, socklen_t *__len);
|
|
|
|
|
|
2000-08-23 17:05:51 +00:00
|
|
|
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
|
2001-04-24 13:36:50 +00:00
|
|
|
extern ssize_t __send (int __fd, __const void *__buf, size_t __n, int __flags);
|
2000-08-23 17:05:51 +00:00
|
|
|
|
|
|
|
|
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
|
|
|
|
|
For connectionless socket types, just set the default address to send to
|
|
|
|
|
and the only address from which to accept transmissions.
|
|
|
|
|
Return 0 on success, -1 for errors. */
|
|
|
|
|
extern int __connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
|
|
|
|
|
|
2001-01-31 06:16:26 +00:00
|
|
|
/* Return the length of a `sockaddr' structure. */
|
|
|
|
|
#ifdef _HAVE_SA_LEN
|
|
|
|
|
# define SA_LEN(_x) (_x)->sa_len
|
|
|
|
|
#else
|
|
|
|
|
# define SA_LEN(_x) __libc_sa_len((_x)->sa_family)
|
|
|
|
|
extern int __libc_sa_len (sa_family_t __af) __THROW;
|
|
|
|
|
#endif
|
|
|
|
|
|
1998-09-06 23:45:24 +00:00
|
|
|
#endif
|