Sponge
CS144's user-space TCP library
Functions | Variables
tcp_sponge_socket.cc File Reference
#include "tcp_sponge_socket.hh"
#include "network_interface.hh"
#include "parser.hh"
#include "tun.hh"
#include "util.hh"
#include <cstddef>
#include <exception>
#include <iostream>
#include <stdexcept>
#include <string>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <utility>
Include dependency graph for tcp_sponge_socket.cc:

Go to the source code of this file.

Functions

EthernetAddress random_private_ethernet_address ()
 
static pair< FileDescriptor, FileDescriptorsocket_pair_helper (const int type)
 Call socketpair and return connected Unix-domain sockets of specified type. More...
 

Variables

static const string LOCAL_TAP_IP_ADDRESS = "169.254.10.9"
 
static const string LOCAL_TAP_NEXT_HOP_ADDRESS = "169.254.10.1"
 
static constexpr size_t TCP_TICK_MS = 10
 

Function Documentation

◆ random_private_ethernet_address()

EthernetAddress random_private_ethernet_address ( )

Definition at line 304 of file tcp_sponge_socket.cc.

◆ socket_pair_helper()

static pair<FileDescriptor, FileDescriptor> socket_pair_helper ( const int  type)
inlinestatic

Call socketpair and return connected Unix-domain sockets of specified type.

Parameters
[in]typeis the type of AF_UNIX sockets to create (e.g., SOCK_SEQPACKET)
Returns
a std::pair of connected sockets

Definition at line 168 of file tcp_sponge_socket.cc.

Variable Documentation

◆ LOCAL_TAP_IP_ADDRESS

const string LOCAL_TAP_IP_ADDRESS = "169.254.10.9"
static

Definition at line 301 of file tcp_sponge_socket.cc.

◆ LOCAL_TAP_NEXT_HOP_ADDRESS

const string LOCAL_TAP_NEXT_HOP_ADDRESS = "169.254.10.1"
static

Definition at line 302 of file tcp_sponge_socket.cc.

◆ TCP_TICK_MS

constexpr size_t TCP_TICK_MS = 10
staticconstexpr

Definition at line 21 of file tcp_sponge_socket.cc.