Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
socket.c File Reference
#include "socket.h"
#include "init/init.h"
#include "ioforge/ioforge.h"
#include "ioforge/ioforge_nic.h"
#include "libk/serial.h"
#include <str.h>
#include "memory/slab.h"
#include "ethernet.h"
#include "arp.h"
#include "icmp.h"
#include "ipv4.h"
#include "ip_type.h"
#include "net/netbuff.h"
#include "tcp.h"
#include "netutils.h"
#include "netdev.h"
#include "type.h"

Go to the source code of this file.

Macros

#define MYIP   "192.168.100.80"
 

Functions

static int socket_receive (socket_t *socket, void *buffer, size_t size)
 
static int socket_set_sockopt (socket_t *socket, uint32_t level, uint32_t optname, const void *optval, uint32_t optlen)
 
static int socket_bind (socket_t *socket, sockaddr_in_t *addr, uint32_t len)
 
 INIT (Socket)
 
void vxSocket (sock_family_t family, sock_type_t type, uint16_t protocol, socket_t **socket)
 

Variables

static struct slab_cachesocket_cache = 0
 
static socket_ops_tsocket_ops = 0
 

Macro Definition Documentation

◆ MYIP

#define MYIP   "192.168.100.80"

Definition at line 56 of file socket.c.

Referenced by socket_receive().

Function Documentation

◆ INIT()

◆ socket_bind()

static int socket_bind ( socket_t * socket,
sockaddr_in_t * addr,
uint32_t len )
static

Definition at line 149 of file socket.c.

References addr, len, and UNUSED.

Referenced by INIT().

◆ socket_receive()

◆ socket_set_sockopt()

static int socket_set_sockopt ( socket_t * socket,
uint32_t level,
uint32_t optname,
const void * optval,
uint32_t optlen )
static

Definition at line 127 of file socket.c.

References lookup_netdev(), socket::netdev, SO_BINDTODEVICE, SOCK_ERR_NODEV, SOCK_ERR_NOTCONN, SOCK_OK, SOL_SOCKET, and UNUSED.

Referenced by INIT().

◆ vxSocket()

void vxSocket ( sock_family_t family,
sock_type_t type,
uint16_t protocol,
socket_t ** socket )

Definition at line 35 of file socket.c.

References socket::family, LOG2_WARN, protocol, socket_cache, type, vxCreateSlabCache(), and vxSlabAlloc().

Variable Documentation

◆ socket_cache

struct slab_cache* socket_cache = 0
static

Definition at line 19 of file socket.c.

Referenced by vxSocket().

◆ socket_ops

socket_ops_t* socket_ops = 0
static

Definition at line 20 of file socket.c.