PSPSDK 2024-12-16
Loading...
Searching...
No Matches
socket.h File Reference
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
Include dependency graph for socket.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  linger
 
struct  sockaddr
 
struct  sockaddr_storage
 
struct  iovec
 
struct  msghdr
 

Macros

#define SOCK_STREAM   1 /* stream socket */
 
#define SOCK_DGRAM   2 /* datagram socket */
 
#define SOCK_RAW   3 /* raw-protocol interface */
 
#define SOCK_RDM   4 /* reliably-delivered message */
 
#define SOCK_SEQPACKET   5 /* sequenced packet stream */
 
#define SO_DEBUG   0x0001 /* turn on debugging info recording */
 
#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */
 
#define SO_REUSEADDR   0x0004 /* allow local address reuse */
 
#define SO_KEEPALIVE   0x0008 /* keep connections alive */
 
#define SO_DONTROUTE   0x0010 /* just use interface addresses */
 
#define SO_BROADCAST   0x0020 /* permit sending of broadcast msgs */
 
#define SO_USELOOPBACK   0x0040 /* bypass hardware when possible */
 
#define SO_LINGER   0x0080 /* linger on close if data present */
 
#define SO_OOBINLINE   0x0100 /* leave received OOB data in line */
 
#define SO_REUSEPORT   0x0200 /* allow local address & port reuse */
 
#define SO_TIMESTAMP   0x0400 /* timestamp received dgram traffic */
 
#define SO_SNDBUF   0x1001 /* send buffer size */
 
#define SO_RCVBUF   0x1002 /* receive buffer size */
 
#define SO_SNDLOWAT   0x1003 /* send low-water mark */
 
#define SO_RCVLOWAT   0x1004 /* receive low-water mark */
 
#define SO_SNDTIMEO   0x1005 /* send timeout */
 
#define SO_RCVTIMEO   0x1006 /* receive timeout */
 
#define SO_ERROR   0x1007 /* get error status and clear */
 
#define SO_TYPE   0x1008 /* get socket type */
 
#define SO_OVERFLOWED   0x1009 /* datagrams: return packets dropped */
 
#define SO_NONBLOCK   0x1009 /* non-blocking I/O */
 
#define SOL_SOCKET   0xffff /* options for socket level */
 
#define AF_UNSPEC   0 /* unspecified */
 
#define AF_LOCAL   1 /* local to host (pipes, portals) */
 
#define AF_UNIX   AF_LOCAL /* backward compatibility */
 
#define AF_INET   2 /* internetwork: UDP, TCP, etc. */
 
#define AF_IMPLINK   3 /* arpanet imp addresses */
 
#define AF_PUP   4 /* pup protocols: e.g. BSP */
 
#define AF_CHAOS   5 /* mit CHAOS protocols */
 
#define AF_NS   6 /* XEROX NS protocols */
 
#define AF_ISO   7 /* ISO protocols */
 
#define AF_OSI   AF_ISO
 
#define AF_ECMA   8 /* european computer manufacturers */
 
#define AF_DATAKIT   9 /* datakit protocols */
 
#define AF_CCITT   10 /* CCITT protocols, X.25 etc */
 
#define AF_SNA   11 /* IBM SNA */
 
#define AF_DECnet   12 /* DECnet */
 
#define AF_DLI   13 /* DEC Direct data link interface */
 
#define AF_LAT   14 /* LAT */
 
#define AF_HYLINK   15 /* NSC Hyperchannel */
 
#define AF_APPLETALK   16 /* Apple Talk */
 
#define AF_ROUTE   17 /* Internal Routing Protocol */
 
#define AF_LINK   18 /* Link layer interface */
 
#define AF_COIP   20 /* connection-oriented IP, aka ST II */
 
#define AF_CNT   21 /* Computer Network Technology */
 
#define AF_IPX   23 /* Novell Internet Protocol */
 
#define AF_INET6   24 /* IP version 6 */
 
#define AF_ISDN   26 /* Integrated Services Digital Network*/
 
#define AF_E164   AF_ISDN /* CCITT E.164 recommendation */
 
#define AF_NATM   27 /* native ATM access */
 
#define AF_ARP   28 /* (rev.) addr. res. prot. (RFC 826) */
 
#define AF_MAX   31
 
#define _SS_MAXSIZE   128
 
#define _SS_ALIGNSIZE   (sizeof(int64_t))
 
#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - 2)
 
#define _SS_PAD2SIZE   (_SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE)
 
#define PF_UNSPEC   AF_UNSPEC
 
#define PF_LOCAL   AF_LOCAL
 
#define PF_UNIX   PF_LOCAL /* backward compatibility */
 
#define PF_INET   AF_INET
 
#define PF_IMPLINK   AF_IMPLINK
 
#define PF_PUP   AF_PUP
 
#define PF_CHAOS   AF_CHAOS
 
#define PF_NS   AF_NS
 
#define PF_ISO   AF_ISO
 
#define PF_OSI   AF_ISO
 
#define PF_ECMA   AF_ECMA
 
#define PF_DATAKIT   AF_DATAKIT
 
#define PF_CCITT   AF_CCITT
 
#define PF_SNA   AF_SNA
 
#define PF_DECnet   AF_DECnet
 
#define PF_DLI   AF_DLI
 
#define PF_LAT   AF_LAT
 
#define PF_HYLINK   AF_HYLINK
 
#define PF_APPLETALK   AF_APPLETALK
 
#define PF_ROUTE   AF_ROUTE
 
#define PF_LINK   AF_LINK
 
#define PF_COIP   AF_COIP
 
#define PF_CNT   AF_CNT
 
#define PF_INET6   AF_INET6
 
#define PF_IPX   AF_IPX /* same format as AF_NS */
 
#define PF_ISDN   AF_ISDN /* same as E164 */
 
#define PF_E164   AF_E164
 
#define PF_NATM   AF_NATM
 
#define PF_ARP   AF_ARP
 
#define PF_MAX   AF_MAX
 
#define MSG_OOB   0x1 /* process out-of-band data */
 
#define MSG_PEEK   0x2 /* peek at incoming message */
 
#define MSG_DONTROUTE   0x4 /* send without using routing tables */
 
#define MSG_EOR   0x8 /* data completes record */
 
#define MSG_TRUNC   0x10 /* data discarded before delivery */
 
#define MSG_CTRUNC   0x20 /* control data lost before delivery */
 
#define MSG_WAITALL   0x40 /* wait for full request or error */
 
#define MSG_DONTWAIT   0x80 /* this message should be nonblocking */
 
#define MSG_BCAST   0x100 /* this message was rcvd using link-level brdcst */
 
#define MSG_MCAST   0x200 /* this message was rcvd using link-level mcast */
 
#define SHUT_RD   0 /* Disallow further receives. */
 
#define SHUT_WR   1 /* Disallow further sends. */
 
#define SHUT_RDWR   2 /* Disallow further sends/receives. */
 
#define SOMAXCONN   128
 

Typedefs

typedef uint8_t sa_family_t
 
typedef uint32_t socklen_t
 

Functions

int accept (int, struct sockaddr *__restrict, socklen_t *__restrict)
 
int bind (int, const struct sockaddr *, socklen_t)
 
int connect (int, const struct sockaddr *, socklen_t)
 
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict)
 
int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict)
 
int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict)
 
int listen (int, int)
 
ssize_t recv (int, void *, size_t, int)
 
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict)
 
ssize_t recvmsg (int s, struct msghdr *msg, int flags)
 
ssize_t send (int, const void *, size_t, int)
 
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t)
 
ssize_t sendmsg (int s, const struct msghdr *msg, int flags)
 
int setsockopt (int, int, int, const void *, socklen_t)
 
int shutdown (int, int)
 
int socket (int, int, int)
 

Macro Definition Documentation

◆ _SS_ALIGNSIZE

#define _SS_ALIGNSIZE   (sizeof(int64_t))

◆ _SS_MAXSIZE

#define _SS_MAXSIZE   128

◆ _SS_PAD1SIZE

#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - 2)

◆ _SS_PAD2SIZE

#define _SS_PAD2SIZE   (_SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE)

◆ AF_APPLETALK

#define AF_APPLETALK   16 /* Apple Talk */

◆ AF_ARP

#define AF_ARP   28 /* (rev.) addr. res. prot. (RFC 826) */

◆ AF_CCITT

#define AF_CCITT   10 /* CCITT protocols, X.25 etc */

◆ AF_CHAOS

#define AF_CHAOS   5 /* mit CHAOS protocols */

◆ AF_CNT

#define AF_CNT   21 /* Computer Network Technology */

◆ AF_COIP

#define AF_COIP   20 /* connection-oriented IP, aka ST II */

◆ AF_DATAKIT

#define AF_DATAKIT   9 /* datakit protocols */

◆ AF_DECnet

#define AF_DECnet   12 /* DECnet */

◆ AF_DLI

#define AF_DLI   13 /* DEC Direct data link interface */

◆ AF_E164

#define AF_E164   AF_ISDN /* CCITT E.164 recommendation */

◆ AF_ECMA

#define AF_ECMA   8 /* european computer manufacturers */

◆ AF_HYLINK

#define AF_HYLINK   15 /* NSC Hyperchannel */

◆ AF_IMPLINK

#define AF_IMPLINK   3 /* arpanet imp addresses */

◆ AF_INET

#define AF_INET   2 /* internetwork: UDP, TCP, etc. */

◆ AF_INET6

#define AF_INET6   24 /* IP version 6 */

◆ AF_IPX

#define AF_IPX   23 /* Novell Internet Protocol */

◆ AF_ISDN

#define AF_ISDN   26 /* Integrated Services Digital Network*/

◆ AF_ISO

#define AF_ISO   7 /* ISO protocols */

◆ AF_LAT

#define AF_LAT   14 /* LAT */

◆ AF_LINK

#define AF_LINK   18 /* Link layer interface */

◆ AF_LOCAL

#define AF_LOCAL   1 /* local to host (pipes, portals) */

◆ AF_MAX

#define AF_MAX   31

◆ AF_NATM

#define AF_NATM   27 /* native ATM access */

◆ AF_NS

#define AF_NS   6 /* XEROX NS protocols */

◆ AF_OSI

#define AF_OSI   AF_ISO

◆ AF_PUP

#define AF_PUP   4 /* pup protocols: e.g. BSP */

◆ AF_ROUTE

#define AF_ROUTE   17 /* Internal Routing Protocol */

◆ AF_SNA

#define AF_SNA   11 /* IBM SNA */

◆ AF_UNIX

#define AF_UNIX   AF_LOCAL /* backward compatibility */

◆ AF_UNSPEC

#define AF_UNSPEC   0 /* unspecified */

◆ MSG_BCAST

#define MSG_BCAST   0x100 /* this message was rcvd using link-level brdcst */

◆ MSG_CTRUNC

#define MSG_CTRUNC   0x20 /* control data lost before delivery */

◆ MSG_DONTROUTE

#define MSG_DONTROUTE   0x4 /* send without using routing tables */

◆ MSG_DONTWAIT

#define MSG_DONTWAIT   0x80 /* this message should be nonblocking */

◆ MSG_EOR

#define MSG_EOR   0x8 /* data completes record */

◆ MSG_MCAST

#define MSG_MCAST   0x200 /* this message was rcvd using link-level mcast */

◆ MSG_OOB

#define MSG_OOB   0x1 /* process out-of-band data */

◆ MSG_PEEK

#define MSG_PEEK   0x2 /* peek at incoming message */

◆ MSG_TRUNC

#define MSG_TRUNC   0x10 /* data discarded before delivery */

◆ MSG_WAITALL

#define MSG_WAITALL   0x40 /* wait for full request or error */

◆ PF_APPLETALK

#define PF_APPLETALK   AF_APPLETALK

◆ PF_ARP

#define PF_ARP   AF_ARP

◆ PF_CCITT

#define PF_CCITT   AF_CCITT

◆ PF_CHAOS

#define PF_CHAOS   AF_CHAOS

◆ PF_CNT

#define PF_CNT   AF_CNT

◆ PF_COIP

#define PF_COIP   AF_COIP

◆ PF_DATAKIT

#define PF_DATAKIT   AF_DATAKIT

◆ PF_DECnet

#define PF_DECnet   AF_DECnet

◆ PF_DLI

#define PF_DLI   AF_DLI

◆ PF_E164

#define PF_E164   AF_E164

◆ PF_ECMA

#define PF_ECMA   AF_ECMA

◆ PF_HYLINK

#define PF_HYLINK   AF_HYLINK

◆ PF_IMPLINK

#define PF_IMPLINK   AF_IMPLINK

◆ PF_INET

#define PF_INET   AF_INET

◆ PF_INET6

#define PF_INET6   AF_INET6

◆ PF_IPX

#define PF_IPX   AF_IPX /* same format as AF_NS */

◆ PF_ISDN

#define PF_ISDN   AF_ISDN /* same as E164 */

◆ PF_ISO

#define PF_ISO   AF_ISO

◆ PF_LAT

#define PF_LAT   AF_LAT

◆ PF_LINK

#define PF_LINK   AF_LINK

◆ PF_LOCAL

#define PF_LOCAL   AF_LOCAL

◆ PF_MAX

#define PF_MAX   AF_MAX

◆ PF_NATM

#define PF_NATM   AF_NATM

◆ PF_NS

#define PF_NS   AF_NS

◆ PF_OSI

#define PF_OSI   AF_ISO

◆ PF_PUP

#define PF_PUP   AF_PUP

◆ PF_ROUTE

#define PF_ROUTE   AF_ROUTE

◆ PF_SNA

#define PF_SNA   AF_SNA

◆ PF_UNIX

#define PF_UNIX   PF_LOCAL /* backward compatibility */

◆ PF_UNSPEC

#define PF_UNSPEC   AF_UNSPEC

◆ SHUT_RD

#define SHUT_RD   0 /* Disallow further receives. */

◆ SHUT_RDWR

#define SHUT_RDWR   2 /* Disallow further sends/receives. */

◆ SHUT_WR

#define SHUT_WR   1 /* Disallow further sends. */

◆ SO_ACCEPTCONN

#define SO_ACCEPTCONN   0x0002 /* socket has had listen() */

◆ SO_BROADCAST

#define SO_BROADCAST   0x0020 /* permit sending of broadcast msgs */

◆ SO_DEBUG

#define SO_DEBUG   0x0001 /* turn on debugging info recording */

◆ SO_DONTROUTE

#define SO_DONTROUTE   0x0010 /* just use interface addresses */

◆ SO_ERROR

#define SO_ERROR   0x1007 /* get error status and clear */

◆ SO_KEEPALIVE

#define SO_KEEPALIVE   0x0008 /* keep connections alive */

◆ SO_LINGER

#define SO_LINGER   0x0080 /* linger on close if data present */

◆ SO_NONBLOCK

#define SO_NONBLOCK   0x1009 /* non-blocking I/O */

◆ SO_OOBINLINE

#define SO_OOBINLINE   0x0100 /* leave received OOB data in line */

◆ SO_OVERFLOWED

#define SO_OVERFLOWED   0x1009 /* datagrams: return packets dropped */

◆ SO_RCVBUF

#define SO_RCVBUF   0x1002 /* receive buffer size */

◆ SO_RCVLOWAT

#define SO_RCVLOWAT   0x1004 /* receive low-water mark */

◆ SO_RCVTIMEO

#define SO_RCVTIMEO   0x1006 /* receive timeout */

◆ SO_REUSEADDR

#define SO_REUSEADDR   0x0004 /* allow local address reuse */

◆ SO_REUSEPORT

#define SO_REUSEPORT   0x0200 /* allow local address & port reuse */

◆ SO_SNDBUF

#define SO_SNDBUF   0x1001 /* send buffer size */

◆ SO_SNDLOWAT

#define SO_SNDLOWAT   0x1003 /* send low-water mark */

◆ SO_SNDTIMEO

#define SO_SNDTIMEO   0x1005 /* send timeout */

◆ SO_TIMESTAMP

#define SO_TIMESTAMP   0x0400 /* timestamp received dgram traffic */

◆ SO_TYPE

#define SO_TYPE   0x1008 /* get socket type */

◆ SO_USELOOPBACK

#define SO_USELOOPBACK   0x0040 /* bypass hardware when possible */

◆ SOCK_DGRAM

#define SOCK_DGRAM   2 /* datagram socket */

◆ SOCK_RAW

#define SOCK_RAW   3 /* raw-protocol interface */

◆ SOCK_RDM

#define SOCK_RDM   4 /* reliably-delivered message */

◆ SOCK_SEQPACKET

#define SOCK_SEQPACKET   5 /* sequenced packet stream */

◆ SOCK_STREAM

#define SOCK_STREAM   1 /* stream socket */

◆ SOL_SOCKET

#define SOL_SOCKET   0xffff /* options for socket level */

◆ SOMAXCONN

#define SOMAXCONN   128

Typedef Documentation

◆ sa_family_t

◆ socklen_t

Function Documentation

◆ accept()

int accept ( int  ,
struct sockaddr __restrict,
socklen_t __restrict 
)

◆ bind()

int bind ( int  ,
const struct sockaddr ,
socklen_t   
)

◆ connect()

int connect ( int  ,
const struct sockaddr ,
socklen_t   
)

◆ getpeername()

int getpeername ( int  ,
struct sockaddr __restrict,
socklen_t __restrict 
)

◆ getsockname()

int getsockname ( int  ,
struct sockaddr __restrict,
socklen_t __restrict 
)

◆ getsockopt()

int getsockopt ( int  ,
int  ,
int  ,
void __restrict,
socklen_t __restrict 
)

◆ listen()

int listen ( int  ,
int   
)

◆ recv()

ssize_t recv ( int  ,
void ,
size_t  ,
int   
)

◆ recvfrom()

ssize_t recvfrom ( int  ,
void __restrict,
size_t  ,
int  ,
struct sockaddr __restrict,
socklen_t __restrict 
)

◆ recvmsg()

ssize_t recvmsg ( int  s,
struct msghdr msg,
int  flags 
)

◆ send()

ssize_t send ( int  ,
const void ,
size_t  ,
int   
)

◆ sendmsg()

ssize_t sendmsg ( int  s,
const struct msghdr msg,
int  flags 
)

◆ sendto()

ssize_t sendto ( int  ,
const void ,
size_t  ,
int  ,
const struct sockaddr ,
socklen_t   
)

◆ setsockopt()

int setsockopt ( int  ,
int  ,
int  ,
const void ,
socklen_t   
)

◆ shutdown()

int shutdown ( int  ,
int   
)

◆ socket()

int socket ( int  ,
int  ,
int   
)