hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame include/sys/socket.h

Packit 6c4009
#ifndef _SYS_SOCKET_H
Packit 6c4009
#include <socket/sys/socket.h>
Packit 6c4009
Packit 6c4009
#ifndef _ISOMAC
Packit 6c4009
/* Now define the internal interfaces.  */
Packit 6c4009
Packit 6c4009
/* Create a new socket of type TYPE in domain DOMAIN, using
Packit 6c4009
   protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
Packit 6c4009
   Returns a file descriptor for the new socket, or -1 for errors.  */
Packit 6c4009
extern int __socket (int __domain, int __type,
Packit 6c4009
		     int __protocol);
Packit 6c4009
libc_hidden_proto (__socket)
Packit 6c4009
Packit 6c4009
/* Create two new sockets, of type TYPE in domain DOMAIN and using
Packit 6c4009
   protocol PROTOCOL, which are connected to each other, and put file
Packit 6c4009
   descriptors for them in FDS[0] and FDS[1].  If PROTOCOL is zero,
Packit 6c4009
   one will be chosen automatically.  Returns 0 on success, -1 for errors.  */
Packit 6c4009
extern int __socketpair (int __domain, int __type, int __protocol,
Packit 6c4009
			 int __fds[2]) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Return a socket of any type.  The socket can be used in subsequent
Packit 6c4009
   ioctl calls to talk to the kernel.  */
Packit 6c4009
extern int __opensock (void) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Put the address of the peer connected to socket FD into *ADDR
Packit 6c4009
   (which is *LEN bytes long), and its actual length into *LEN.  */
Packit 6c4009
extern int __getpeername (int __fd, __SOCKADDR_ARG __addr,
Packit 6c4009
			  socklen_t *__len) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
Packit 6c4009
extern ssize_t __libc_send (int __fd, const void *__buf, size_t __n,
Packit 6c4009
			    int __flags);
Packit 6c4009
extern ssize_t __send (int __fd, const void *__buf, size_t __n, int __flags);
Packit 6c4009
libc_hidden_proto (__send)
Packit 6c4009
Packit 6c4009
/* Read N bytes into BUF from socket FD.
Packit 6c4009
   Returns the number read or -1 for errors.  */
Packit 6c4009
extern ssize_t __libc_recv (int __fd, void *__buf, size_t __n, int __flags);
Packit 6c4009
Packit 6c4009
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
Packit 6c4009
   ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.  */
Packit 6c4009
extern ssize_t __libc_sendto (int __fd, const void *__buf, size_t __n,
Packit 6c4009
			      int __flags, __CONST_SOCKADDR_ARG __addr,
Packit 6c4009
			      socklen_t __addr_len);
Packit 6c4009
Packit 6c4009
/* Read N bytes into BUF through socket FD.
Packit 6c4009
   If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
Packit 6c4009
   the sender, and store the actual size of the address in *ADDR_LEN.
Packit 6c4009
   Returns the number of bytes read or -1 for errors.  */
Packit 6c4009
extern ssize_t __libc_recvfrom (int __fd, void *__restrict __buf, size_t __n,
Packit 6c4009
				int __flags, __SOCKADDR_ARG __addr,
Packit 6c4009
				socklen_t *__restrict __addr_len);
Packit 6c4009
Packit 6c4009
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
Packit 6c4009
   For connectionless socket types, just set the default address to send to
Packit 6c4009
   and the only address from which to accept transmissions.
Packit 6c4009
   Return 0 on success, -1 for errors.  */
Packit 6c4009
extern int __libc_connect (int __fd, __CONST_SOCKADDR_ARG __addr,
Packit 6c4009
			   socklen_t __len);
Packit 6c4009
extern int __connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
Packit 6c4009
libc_hidden_proto (__connect)
Packit 6c4009
Packit 6c4009
/* Read N bytes into BUF from socket FD.
Packit 6c4009
   Returns the number read or -1 for errors.
Packit 6c4009
Packit 6c4009
   This function is a cancellation point and therefore not marked with
Packit 6c4009
   __THROW.  */
Packit 6c4009
extern ssize_t __recv (int __fd, void *__buf, size_t __n, int __flags);
Packit 6c4009
libc_hidden_proto (__recv)
Packit 6c4009
Packit 6c4009
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
Packit 6c4009
   ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.  */
Packit 6c4009
extern ssize_t __libc_sendto (int __fd, const void *__buf, size_t __n,
Packit 6c4009
			      int __flags, __CONST_SOCKADDR_ARG __addr,
Packit 6c4009
			      socklen_t __addr_len);
Packit 6c4009
extern ssize_t __sendto (int __fd, const void *__buf, size_t __n,
Packit 6c4009
			 int __flags, __CONST_SOCKADDR_ARG __addr,
Packit 6c4009
			 socklen_t __addr_len) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Read N bytes into BUF through socket FD.
Packit 6c4009
   If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
Packit 6c4009
   the sender, and store the actual size of the address in *ADDR_LEN.
Packit 6c4009
   Returns the number of bytes read or -1 for errors.  */
Packit 6c4009
extern ssize_t __recvfrom (int __fd, void *__restrict __buf, size_t __n,
Packit 6c4009
			   int __flags, __SOCKADDR_ARG __addr,
Packit 6c4009
			   socklen_t *__restrict __addr_len) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Send a message described MESSAGE on socket FD.
Packit 6c4009
   Returns the number of bytes sent, or -1 for errors.  */
Packit 6c4009
extern ssize_t __libc_sendmsg (int __fd, const struct msghdr *__message,
Packit 6c4009
			       int __flags);
Packit 6c4009
extern ssize_t __sendmsg (int __fd, const struct msghdr *__message,
Packit 6c4009
			  int __flags) attribute_hidden;
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
extern int __sendmmsg (int __fd, struct mmsghdr *__vmessages,
Packit 6c4009
                       unsigned int __vlen, int __flags);
Packit 6c4009
libc_hidden_proto (__sendmmsg)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Receive a message as described by MESSAGE from socket FD.
Packit 6c4009
   Returns the number of bytes read or -1 for errors.  */
Packit 6c4009
extern ssize_t __libc_recvmsg (int __fd, struct msghdr *__message,
Packit 6c4009
			       int __flags);
Packit 6c4009
extern ssize_t __recvmsg (int __fd, struct msghdr *__message,
Packit 6c4009
			  int __flags) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Set socket FD's option OPTNAME at protocol level LEVEL
Packit 6c4009
   to *OPTVAL (which is OPTLEN bytes long).
Packit 6c4009
   Returns 0 on success, -1 for errors.  */
Packit 6c4009
extern int __setsockopt (int __fd, int __level, int __optname,
Packit 6c4009
			 const void *__optval,
Packit 6c4009
			 socklen_t __optlen) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
Packit 6c4009
   into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
Packit 6c4009
   actual length.  Returns 0 on success, -1 for errors.  */
Packit 6c4009
extern int __getsockopt (int __fd, int __level, int __optname,
Packit 6c4009
			 void *__restrict __optval,
Packit 6c4009
			 socklen_t *__restrict __optlen) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Put the local address of FD into *ADDR and its length in *LEN.  */
Packit 6c4009
extern int __getsockname (int __fd, __SOCKADDR_ARG __addr,
Packit 6c4009
			  socklen_t *__restrict __len) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Give the socket FD the local address ADDR (which is LEN bytes long).  */
Packit 6c4009
extern int __bind (int __fd, __CONST_SOCKADDR_ARG __addr,
Packit 6c4009
		   socklen_t __len) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Prepare to accept connections on socket FD.
Packit 6c4009
   N connection requests will be queued before further requests are refused.
Packit 6c4009
   Returns 0 on success, -1 for errors.  */
Packit 6c4009
extern int __listen (int __fd, int __n) attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Await a connection on socket FD.
Packit 6c4009
   When a connection arrives, open a new socket to communicate with it,
Packit 6c4009
   set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
Packit 6c4009
   peer and *ADDR_LEN to the address's actual length, and return the
Packit 6c4009
   new socket's descriptor, or -1 for errors.  */
Packit 6c4009
extern int __libc_accept (int __fd, __SOCKADDR_ARG __addr,
Packit 6c4009
			  socklen_t *__restrict __addr_len)
Packit 6c4009
     __THROW attribute_hidden;
Packit 6c4009
libc_hidden_proto (accept)
Packit 6c4009
extern int __libc_accept4 (int __fd, __SOCKADDR_ARG __addr,
Packit 6c4009
			   socklen_t *__restrict __addr_len, int __flags)
Packit 6c4009
     __THROW attribute_hidden;
Packit 6c4009
Packit 6c4009
/* Return the length of a `sockaddr' structure.  */
Packit 6c4009
#ifdef _HAVE_SA_LEN
Packit 6c4009
# define SA_LEN(_x)      (_x)->sa_len
Packit 6c4009
#else
Packit 6c4009
extern int __libc_sa_len (sa_family_t __af);
Packit 6c4009
libc_hidden_proto (__libc_sa_len)
Packit 6c4009
# define SA_LEN(_x)      __libc_sa_len((_x)->sa_family)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
libc_hidden_proto (__cmsg_nxthdr)
Packit 6c4009
Packit 6c4009
#endif
Packit 6c4009
#endif