KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
socket.h File Reference

Main sockets header. More...

#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/uio.h>

Go to the source code of this file.

Data Structures

struct  sockaddr
 Socket address structure. More...
 
struct  sockaddr_storage
 Socket address structure of appropriate size to hold any supported socket type's addresses. More...
 

Macros

#define _SS_MAXSIZE   128
 Size of the struct sockaddr_storage.
 
#define _SS_ALIGNSIZE   (sizeof(__uint64_t))
 Desired alignment of struct sockaddr_storage.
 
#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - sizeof(sa_family_t))
 First padding size used within struct sockaddr_storage.
 
#define _SS_PAD2SIZE
 Second padding size used within struct sockaddr_storage.
 
#define SOCK_DGRAM   1
 Datagram socket type.
 
#define SOCK_STREAM   2
 Stream socket type.
 
#define SOL_SOCKET   1
 Socket-level option setting.
 
#define SO_ACCEPTCONN   1
 Socket is accepting connections (get)
 
#define SO_BROADCAST   2
 Support broadcasting (get/set)
 
#define SO_DEBUG   3
 Record debugging info (get/set)
 
#define SO_DONTROUTE   4
 Do not route packets (get/set)
 
#define SO_ERROR   5
 Retrieve error status (get)
 
#define SO_KEEPALIVE   6
 Send keepalive messages (get/set)
 
#define SO_LINGER   7
 Socket lingers on close (get/set)
 
#define SO_OOBINLINE   8
 OOB data is inline (get/set)
 
#define SO_RCVBUF   9
 Receive buffer size (get/set)
 
#define SO_RCVLOWAT   10
 Receive low-water mark (get/set)
 
#define SO_RCVTIMEO   11
 Receive timeout value (get/set)
 
#define SO_REUSEADDR   12
 Reuse local addresses (get/set)
 
#define SO_SNDBUF   13
 Send buffer size (get/set)
 
#define SO_SNDLOWAT   14
 Send low-water mark (get/set)
 
#define SO_SNDTIMEO   15
 Send timeout value (get/set)
 
#define SO_TYPE   16
 Socket type (get)
 
#define MSG_CTRUNC   0x01
 Control data truncated (U)
 
#define MSG_DONTROUTE   0x02
 Send without routing (U)
 
#define MSG_EOR   0x04
 Terminate a record (U)
 
#define MSG_OOB   0x08
 Out-of-band data (U)
 
#define MSG_PEEK   0x10
 Leave received data in queue.
 
#define MSG_TRUNC   0x20
 Normal data truncated (U)
 
#define MSG_WAITALL   0x40
 Attempt to fill read buffer.
 
#define MSG_DONTWAIT   0x80
 Make this call non-blocking (non-standard)
 
#define AF_UNSPEC   0
 Unspecified address family.
 
#define AF_INET   1
 Internet domain sockets for use with IPv4 addresses.
 
#define AF_INET6   2
 Internet domain sockets for use with IPv6 addresses.
 
#define PF_UNSPEC   AF_UNSPEC
 Unspecified protocol family.
 
#define PF_INET   AF_INET
 Protocol family for Internet domain sockets (IPv4).
 
#define PF_INET6   AF_INET6
 Protocol family for Internet domain sockets (IPv6).
 
#define SHUT_RD   0x00000001
 Disable further receive operations.
 
#define SHUT_WR   0x00000002
 Disable further send operations.
 
#define SHUT_RDWR   (SHUT_RD | SHUT_WR)
 Disable further send and receive operations.
 
#define SOMAXCONN   32
 Maximum backlog for a listening socket.
 

Typedefs

typedef __uint32_t socklen_t
 Socket length type.
 
typedef __uint8_t sa_family_t
 Socket address family type.
 

Functions

int accept (int socket, struct sockaddr *address, socklen_t *address_len)
 Accept a new connection on a socket.
 
int bind (int socket, const struct sockaddr *address, socklen_t address_len)
 Bind a name to a socket.
 
int connect (int socket, const struct sockaddr *address, socklen_t address_len)
 Connect a socket.
 
int listen (int socket, int backlog)
 Listen for socket connections and set the queue length.
 
ssize_t recv (int socket, void *buffer, size_t length, int flags)
 Receive a message on a connected socket.
 
ssize_t recvfrom (int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
 Receive a message on a socket.
 
ssize_t send (int socket, const void *message, size_t length, int flags)
 Send a message on a connected socket.
 
ssize_t sendto (int socket, const void *message, size_t length, int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
 Send a message on a socket.
 
int shutdown (int socket, int how)
 Shutdown socket send and receive operations.
 
int socket (int domain, int type, int protocol)
 Create an endpoint for communications.
 
int getsockname (int socket, struct sockaddr *name, socklen_t *name_len)
 Get socket name.
 
int getpeername (int socket, struct sockaddr *__RESTRICT name, socklen_t *__RESTRICT name_len)
 Get the name of the connected peer socket.
 
int getsockopt (int socket, int level, int option_name, void *option_value, socklen_t *option_len)
 Get socket options.
 
int setsockopt (int socket, int level, int option_name, const void *option_value, socklen_t option_len)
 Set socket options.
 

Detailed Description

Main sockets header.

This file contains the standard definitions (as directed by the POSIX 2008 spec) for socket-related functionality in the AF_INET and AF_INET6 address families. This does not include anything related to UNIX domain sockets and is not guaranteed to have everything that one might have in a fully-standards compliant implementation of the POSIX spec.

Author
Lawrence Sebald