/* sys/socket.h: Communication sockets. */

#ifndef _SYS_SOCKET_H
#define _SYS_SOCKET_H

#include <bits/socket.h>

#ifdef __cplusplus
extern "C"
{
#endif

    /* Create a new socket and return a file descriptor pointing to it. */
    int socket(int domain, int type, int protocol);

    /* Bind a socket to an address. */
    int bind(int sockfd, const struct sockaddr* addr, socklen_t addrlen);

    /* Connect a socket to a remote address. */
    int connect(int sockfd, const struct sockaddr* addr, socklen_t addrlen);

    /* Start listening on a socket. */
    int listen(int sockfd, int backlog);

    /* Wait for an incoming connection on a socket. */
    int accept(int sockfd, struct sockaddr* addr, socklen_t* addrlen);

#ifdef __cplusplus
}
#endif

#endif