Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/sys
File: socket.h
/* Declarations of socket constants, types, and functions.
[0] Fix | Delete
Copyright (C) 1991-2018 Free Software Foundation, Inc.
[1] Fix | Delete
This file is part of the GNU C Library.
[2] Fix | Delete
[3] Fix | Delete
The GNU C Library is free software; you can redistribute it and/or
[4] Fix | Delete
modify it under the terms of the GNU Lesser General Public
[5] Fix | Delete
License as published by the Free Software Foundation; either
[6] Fix | Delete
version 2.1 of the License, or (at your option) any later version.
[7] Fix | Delete
[8] Fix | Delete
The GNU C Library is distributed in the hope that it will be useful,
[9] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[10] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[11] Fix | Delete
Lesser General Public License for more details.
[12] Fix | Delete
[13] Fix | Delete
You should have received a copy of the GNU Lesser General Public
[14] Fix | Delete
License along with the GNU C Library; if not, see
[15] Fix | Delete
<http://www.gnu.org/licenses/>. */
[16] Fix | Delete
[17] Fix | Delete
#ifndef _SYS_SOCKET_H
[18] Fix | Delete
#define _SYS_SOCKET_H 1
[19] Fix | Delete
[20] Fix | Delete
#include <features.h>
[21] Fix | Delete
[22] Fix | Delete
__BEGIN_DECLS
[23] Fix | Delete
[24] Fix | Delete
#include <bits/types/struct_iovec.h>
[25] Fix | Delete
#define __need_size_t
[26] Fix | Delete
#include <stddef.h>
[27] Fix | Delete
[28] Fix | Delete
/* This operating system-specific header file defines the SOCK_*, PF_*,
[29] Fix | Delete
AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr',
[30] Fix | Delete
`struct msghdr', and `struct linger' types. */
[31] Fix | Delete
#include <bits/socket.h>
[32] Fix | Delete
[33] Fix | Delete
#ifdef __USE_MISC
[34] Fix | Delete
# include <bits/types/struct_osockaddr.h>
[35] Fix | Delete
#endif
[36] Fix | Delete
[37] Fix | Delete
/* The following constants should be used for the second parameter of
[38] Fix | Delete
`shutdown'. */
[39] Fix | Delete
enum
[40] Fix | Delete
{
[41] Fix | Delete
SHUT_RD = 0, /* No more receptions. */
[42] Fix | Delete
#define SHUT_RD SHUT_RD
[43] Fix | Delete
SHUT_WR, /* No more transmissions. */
[44] Fix | Delete
#define SHUT_WR SHUT_WR
[45] Fix | Delete
SHUT_RDWR /* No more receptions or transmissions. */
[46] Fix | Delete
#define SHUT_RDWR SHUT_RDWR
[47] Fix | Delete
};
[48] Fix | Delete
[49] Fix | Delete
/* This is the type we use for generic socket address arguments.
[50] Fix | Delete
[51] Fix | Delete
With GCC 2.7 and later, the funky union causes redeclarations or
[52] Fix | Delete
uses with any of the listed types to be allowed without complaint.
[53] Fix | Delete
G++ 2.7 does not support transparent unions so there we want the
[54] Fix | Delete
old-style declaration, too. */
[55] Fix | Delete
#if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU
[56] Fix | Delete
# define __SOCKADDR_ARG struct sockaddr *__restrict
[57] Fix | Delete
# define __CONST_SOCKADDR_ARG const struct sockaddr *
[58] Fix | Delete
#else
[59] Fix | Delete
/* Add more `struct sockaddr_AF' types here as necessary.
[60] Fix | Delete
These are all the ones I found on NetBSD and Linux. */
[61] Fix | Delete
# define __SOCKADDR_ALLTYPES \
[62] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr) \
[63] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_at) \
[64] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_ax25) \
[65] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_dl) \
[66] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_eon) \
[67] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_in) \
[68] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_in6) \
[69] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_inarp) \
[70] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_ipx) \
[71] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_iso) \
[72] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_ns) \
[73] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_un) \
[74] Fix | Delete
__SOCKADDR_ONETYPE (sockaddr_x25)
[75] Fix | Delete
[76] Fix | Delete
# define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__;
[77] Fix | Delete
typedef union { __SOCKADDR_ALLTYPES
[78] Fix | Delete
} __SOCKADDR_ARG __attribute__ ((__transparent_union__));
[79] Fix | Delete
# undef __SOCKADDR_ONETYPE
[80] Fix | Delete
# define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__;
[81] Fix | Delete
typedef union { __SOCKADDR_ALLTYPES
[82] Fix | Delete
} __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
[83] Fix | Delete
# undef __SOCKADDR_ONETYPE
[84] Fix | Delete
#endif
[85] Fix | Delete
[86] Fix | Delete
#ifdef __USE_GNU
[87] Fix | Delete
/* For `recvmmsg' and `sendmmsg'. */
[88] Fix | Delete
struct mmsghdr
[89] Fix | Delete
{
[90] Fix | Delete
struct msghdr msg_hdr; /* Actual message header. */
[91] Fix | Delete
unsigned int msg_len; /* Number of received or sent bytes for the
[92] Fix | Delete
entry. */
[93] Fix | Delete
};
[94] Fix | Delete
#endif
[95] Fix | Delete
[96] Fix | Delete
[97] Fix | Delete
/* Create a new socket of type TYPE in domain DOMAIN, using
[98] Fix | Delete
protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
[99] Fix | Delete
Returns a file descriptor for the new socket, or -1 for errors. */
[100] Fix | Delete
extern int socket (int __domain, int __type, int __protocol) __THROW;
[101] Fix | Delete
[102] Fix | Delete
/* Create two new sockets, of type TYPE in domain DOMAIN and using
[103] Fix | Delete
protocol PROTOCOL, which are connected to each other, and put file
[104] Fix | Delete
descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
[105] Fix | Delete
one will be chosen automatically. Returns 0 on success, -1 for errors. */
[106] Fix | Delete
extern int socketpair (int __domain, int __type, int __protocol,
[107] Fix | Delete
int __fds[2]) __THROW;
[108] Fix | Delete
[109] Fix | Delete
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
[110] Fix | Delete
extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
[111] Fix | Delete
__THROW;
[112] Fix | Delete
[113] Fix | Delete
/* Put the local address of FD into *ADDR and its length in *LEN. */
[114] Fix | Delete
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
[115] Fix | Delete
socklen_t *__restrict __len) __THROW;
[116] Fix | Delete
[117] Fix | Delete
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
[118] Fix | Delete
For connectionless socket types, just set the default address to send to
[119] Fix | Delete
and the only address from which to accept transmissions.
[120] Fix | Delete
Return 0 on success, -1 for errors.
[121] Fix | Delete
[122] Fix | Delete
This function is a cancellation point and therefore not marked with
[123] Fix | Delete
__THROW. */
[124] Fix | Delete
extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
[125] Fix | Delete
[126] Fix | Delete
/* Put the address of the peer connected to socket FD into *ADDR
[127] Fix | Delete
(which is *LEN bytes long), and its actual length into *LEN. */
[128] Fix | Delete
extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
[129] Fix | Delete
socklen_t *__restrict __len) __THROW;
[130] Fix | Delete
[131] Fix | Delete
[132] Fix | Delete
/* Send N bytes of BUF to socket FD. Returns the number sent or -1.
[133] Fix | Delete
[134] Fix | Delete
This function is a cancellation point and therefore not marked with
[135] Fix | Delete
__THROW. */
[136] Fix | Delete
extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags);
[137] Fix | Delete
[138] Fix | Delete
/* Read N bytes into BUF from socket FD.
[139] Fix | Delete
Returns the number read or -1 for errors.
[140] Fix | Delete
[141] Fix | Delete
This function is a cancellation point and therefore not marked with
[142] Fix | Delete
__THROW. */
[143] Fix | Delete
extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
[144] Fix | Delete
[145] Fix | Delete
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
[146] Fix | Delete
ADDR_LEN bytes long). Returns the number sent, or -1 for errors.
[147] Fix | Delete
[148] Fix | Delete
This function is a cancellation point and therefore not marked with
[149] Fix | Delete
__THROW. */
[150] Fix | Delete
extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
[151] Fix | Delete
int __flags, __CONST_SOCKADDR_ARG __addr,
[152] Fix | Delete
socklen_t __addr_len);
[153] Fix | Delete
[154] Fix | Delete
/* Read N bytes into BUF through socket FD.
[155] Fix | Delete
If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
[156] Fix | Delete
the sender, and store the actual size of the address in *ADDR_LEN.
[157] Fix | Delete
Returns the number of bytes read or -1 for errors.
[158] Fix | Delete
[159] Fix | Delete
This function is a cancellation point and therefore not marked with
[160] Fix | Delete
__THROW. */
[161] Fix | Delete
extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
[162] Fix | Delete
int __flags, __SOCKADDR_ARG __addr,
[163] Fix | Delete
socklen_t *__restrict __addr_len);
[164] Fix | Delete
[165] Fix | Delete
[166] Fix | Delete
/* Send a message described MESSAGE on socket FD.
[167] Fix | Delete
Returns the number of bytes sent, or -1 for errors.
[168] Fix | Delete
[169] Fix | Delete
This function is a cancellation point and therefore not marked with
[170] Fix | Delete
__THROW. */
[171] Fix | Delete
extern ssize_t sendmsg (int __fd, const struct msghdr *__message,
[172] Fix | Delete
int __flags);
[173] Fix | Delete
[174] Fix | Delete
#ifdef __USE_GNU
[175] Fix | Delete
/* Send a VLEN messages as described by VMESSAGES to socket FD.
[176] Fix | Delete
Returns the number of datagrams successfully written or -1 for errors.
[177] Fix | Delete
[178] Fix | Delete
This function is a cancellation point and therefore not marked with
[179] Fix | Delete
__THROW. */
[180] Fix | Delete
extern int sendmmsg (int __fd, struct mmsghdr *__vmessages,
[181] Fix | Delete
unsigned int __vlen, int __flags);
[182] Fix | Delete
#endif
[183] Fix | Delete
[184] Fix | Delete
/* Receive a message as described by MESSAGE from socket FD.
[185] Fix | Delete
Returns the number of bytes read or -1 for errors.
[186] Fix | Delete
[187] Fix | Delete
This function is a cancellation point and therefore not marked with
[188] Fix | Delete
__THROW. */
[189] Fix | Delete
extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
[190] Fix | Delete
[191] Fix | Delete
#ifdef __USE_GNU
[192] Fix | Delete
/* Receive up to VLEN messages as described by VMESSAGES from socket FD.
[193] Fix | Delete
Returns the number of messages received or -1 for errors.
[194] Fix | Delete
[195] Fix | Delete
This function is a cancellation point and therefore not marked with
[196] Fix | Delete
__THROW. */
[197] Fix | Delete
extern int recvmmsg (int __fd, struct mmsghdr *__vmessages,
[198] Fix | Delete
unsigned int __vlen, int __flags,
[199] Fix | Delete
struct timespec *__tmo);
[200] Fix | Delete
#endif
[201] Fix | Delete
[202] Fix | Delete
[203] Fix | Delete
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
[204] Fix | Delete
into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
[205] Fix | Delete
actual length. Returns 0 on success, -1 for errors. */
[206] Fix | Delete
extern int getsockopt (int __fd, int __level, int __optname,
[207] Fix | Delete
void *__restrict __optval,
[208] Fix | Delete
socklen_t *__restrict __optlen) __THROW;
[209] Fix | Delete
[210] Fix | Delete
/* Set socket FD's option OPTNAME at protocol level LEVEL
[211] Fix | Delete
to *OPTVAL (which is OPTLEN bytes long).
[212] Fix | Delete
Returns 0 on success, -1 for errors. */
[213] Fix | Delete
extern int setsockopt (int __fd, int __level, int __optname,
[214] Fix | Delete
const void *__optval, socklen_t __optlen) __THROW;
[215] Fix | Delete
[216] Fix | Delete
[217] Fix | Delete
/* Prepare to accept connections on socket FD.
[218] Fix | Delete
N connection requests will be queued before further requests are refused.
[219] Fix | Delete
Returns 0 on success, -1 for errors. */
[220] Fix | Delete
extern int listen (int __fd, int __n) __THROW;
[221] Fix | Delete
[222] Fix | Delete
/* Await a connection on socket FD.
[223] Fix | Delete
When a connection arrives, open a new socket to communicate with it,
[224] Fix | Delete
set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
[225] Fix | Delete
peer and *ADDR_LEN to the address's actual length, and return the
[226] Fix | Delete
new socket's descriptor, or -1 for errors.
[227] Fix | Delete
[228] Fix | Delete
This function is a cancellation point and therefore not marked with
[229] Fix | Delete
__THROW. */
[230] Fix | Delete
extern int accept (int __fd, __SOCKADDR_ARG __addr,
[231] Fix | Delete
socklen_t *__restrict __addr_len);
[232] Fix | Delete
[233] Fix | Delete
#ifdef __USE_GNU
[234] Fix | Delete
/* Similar to 'accept' but takes an additional parameter to specify flags.
[235] Fix | Delete
[236] Fix | Delete
This function is a cancellation point and therefore not marked with
[237] Fix | Delete
__THROW. */
[238] Fix | Delete
extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
[239] Fix | Delete
socklen_t *__restrict __addr_len, int __flags);
[240] Fix | Delete
#endif
[241] Fix | Delete
[242] Fix | Delete
/* Shut down all or part of the connection open on socket FD.
[243] Fix | Delete
HOW determines what to shut down:
[244] Fix | Delete
SHUT_RD = No more receptions;
[245] Fix | Delete
SHUT_WR = No more transmissions;
[246] Fix | Delete
SHUT_RDWR = No more receptions or transmissions.
[247] Fix | Delete
Returns 0 on success, -1 for errors. */
[248] Fix | Delete
extern int shutdown (int __fd, int __how) __THROW;
[249] Fix | Delete
[250] Fix | Delete
[251] Fix | Delete
#ifdef __USE_XOPEN2K
[252] Fix | Delete
/* Determine wheter socket is at a out-of-band mark. */
[253] Fix | Delete
extern int sockatmark (int __fd) __THROW;
[254] Fix | Delete
#endif
[255] Fix | Delete
[256] Fix | Delete
[257] Fix | Delete
#ifdef __USE_MISC
[258] Fix | Delete
/* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>;
[259] Fix | Delete
returns 1 if FD is open on an object of the indicated type, 0 if not,
[260] Fix | Delete
or -1 for errors (setting errno). */
[261] Fix | Delete
extern int isfdtype (int __fd, int __fdtype) __THROW;
[262] Fix | Delete
#endif
[263] Fix | Delete
[264] Fix | Delete
[265] Fix | Delete
/* Define some macros helping to catch buffer overflows. */
[266] Fix | Delete
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
[267] Fix | Delete
# include <bits/socket2.h>
[268] Fix | Delete
#endif
[269] Fix | Delete
[270] Fix | Delete
__END_DECLS
[271] Fix | Delete
[272] Fix | Delete
#endif /* sys/socket.h */
[273] Fix | Delete
[274] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function