The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
inet_internal.h File Reference

the parts of the IPv4 sockets that inet_socket.c (datagrams) and tcp_socket.c (streams) share. More...

#include "inet_socket.h"
#include "kernel/sync/wait_queue.h"
#include "tcp.h"

Go to the source code of this file.

Data Structures

struct  datagram
struct  inet_socket

Typedefs

typedef struct datagram datagram_t

Functions

int32_t inet_socket_alloc (uint8_t protocol, uint32_t flags, struct file **out, inet_socket_t **socket)
 make a socket and its file, on the list of all sockets.
bool inet_bind_any_port (inet_socket_t *s)
 give a socket a free port (net_lock held).
int32_t tcp_socket_connect (struct file *file, inet_socket_t *s, const ksockaddr_in_t *addr)
 the TCP side of the socket calls (tcp_socket.c).
int32_t tcp_socket_listen (inet_socket_t *s, uint32_t backlog)
int32_t tcp_socket_accept (struct file *file, uint32_t flags, struct file **out, ksockaddr_in_t *peer)
int32_t tcp_socket_send (struct file *file, inet_socket_t *s, const kiovec_t *iov, uint32_t iov_count, bool dontwait)
int32_t tcp_socket_receive (struct file *file, inet_socket_t *s, const kiovec_t *iov, uint32_t iov_count, uint32_t flags, bool dontwait)
uint32_t tcp_socket_poll (inet_socket_t *s)
int32_t tcp_socket_shutdown (inet_socket_t *s, int32_t how)

Detailed Description

the parts of the IPv4 sockets that inet_socket.c (datagrams) and tcp_socket.c (streams) share.

not for other code.

Typedef Documentation

◆ datagram_t

typedef struct datagram datagram_t

Function Documentation

◆ inet_socket_alloc()

int32_t inet_socket_alloc ( uint8_t protocol,
uint32_t flags,
struct file ** out,
inet_socket_t ** socket )

make a socket and its file, on the list of all sockets.

Parameters
flagsO_NONBLOCK or 0.
Returns
0, or -ENOMEM.

◆ inet_bind_any_port()

bool inet_bind_any_port ( inet_socket_t * s)

give a socket a free port (net_lock held).

Returns
false if all ports are taken.

◆ tcp_socket_connect()

int32_t tcp_socket_connect ( struct file * file,
inet_socket_t * s,
const ksockaddr_in_t * addr )

the TCP side of the socket calls (tcp_socket.c).

those marked "lock held" are called with net_lock held; the others take it.

◆ tcp_socket_listen()

int32_t tcp_socket_listen ( inet_socket_t * s,
uint32_t backlog )

◆ tcp_socket_accept()

int32_t tcp_socket_accept ( struct file * file,
uint32_t flags,
struct file ** out,
ksockaddr_in_t * peer )

◆ tcp_socket_send()

int32_t tcp_socket_send ( struct file * file,
inet_socket_t * s,
const kiovec_t * iov,
uint32_t iov_count,
bool dontwait )

◆ tcp_socket_receive()

int32_t tcp_socket_receive ( struct file * file,
inet_socket_t * s,
const kiovec_t * iov,
uint32_t iov_count,
uint32_t flags,
bool dontwait )

◆ tcp_socket_poll()

uint32_t tcp_socket_poll ( inet_socket_t * s)

◆ tcp_socket_shutdown()

int32_t tcp_socket_shutdown ( inet_socket_t * s,
int32_t how )