net.h File Reference

Back to the index.

Classes | Macros | Functions
net.h File Reference
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

Go to the source code of this file.

Classes

struct  udp_connection
 
struct  tcp_connection
 
struct  net
 
struct  ethernet_packet_link
 
struct  remote_net
 

Macros

#define NET_DEFAULT_IPV4_MASK   "10.0.0.0"
 
#define NET_DEFAULT_IPV4_LEN   8
 
#define ETHERTYPE_SPRITE   0x0500
 
#define ETHERTYPE_IP   0x0800
 
#define ETHERTYPE_ARP   0x0806
 
#define ETHERTYPE_REVARP   0x8035
 
#define ETHERTYPE_IPV6   0x86DD
 
#define MAX_TCP_CONNECTIONS   100
 
#define MAX_UDP_CONNECTIONS   100
 
#define NET_INIT_FLAG_GATEWAY   1
 
#define TCP_OUTSIDE_TRYINGTOCONNECT   1
 
#define TCP_OUTSIDE_CONNECTED   2
 
#define TCP_OUTSIDE_DISCONNECTED   3
 
#define TCP_OUTSIDE_DISCONNECTED2   4
 
#define TCP_INCOMING_BUF_LEN   2000
 
#define NET_ADDR_IPV4   1
 
#define NET_ADDR_IPV6   2
 
#define NET_ADDR_ETHERNET   3
 

Functions

void net_debugaddr (void *addr, int type)
 
void net_generate_unique_mac (struct machine *, unsigned char *macbuf)
 
void send_udp (struct in_addr *addrp, int portnr, unsigned char *packet, size_t len)
 
void net_ip_checksum (unsigned char *ip_header, int chksumoffset, int len)
 
void net_ip_tcp_checksum (unsigned char *tcp_header, int chksumoffset, int tcp_len, unsigned char *srcaddr, unsigned char *dstaddr, int udpflag)
 
void net_ip_tcp_connectionreply (struct net *net, void *extra, int con_id, int connecting, unsigned char *data, int datalen, int rst)
 
void net_ip_broadcast (struct net *net, void *extra, unsigned char *packet, int len)
 
void net_ip (struct net *net, void *extra, unsigned char *packet, int len)
 
void net_udp_rx_avail (struct net *net, void *extra)
 
void net_tcp_rx_avail (struct net *net, void *extra)
 
struct ethernet_packet_linknet_allocate_ethernet_packet_link (struct net *net, void *extra, size_t len)
 
int net_ethernet_rx_avail (struct net *net, void *extra)
 
int net_ethernet_rx (struct net *net, void *extra, unsigned char **packetp, int *lenp)
 
void net_ethernet_tx (struct net *net, void *extra, unsigned char *packet, int len)
 
void net_dumpinfo (struct net *net)
 
void net_add_nic (struct net *net, void *extra, unsigned char *macaddr)
 
struct netnet_init (struct emul *emul, int init_flags, const char *ipv4addr, int netipv4len, char **remote, int n_remote, int local_port, const char *settings_prefix)
 

Macro Definition Documentation

◆ ETHERTYPE_ARP

#define ETHERTYPE_ARP   0x0806

Definition at line 56 of file net.h.

Referenced by net_ethernet_tx().

◆ ETHERTYPE_IP

#define ETHERTYPE_IP   0x0800

Definition at line 55 of file net.h.

Referenced by net_ethernet_tx().

◆ ETHERTYPE_IPV6

#define ETHERTYPE_IPV6   0x86DD

Definition at line 58 of file net.h.

◆ ETHERTYPE_REVARP

#define ETHERTYPE_REVARP   0x8035

Definition at line 57 of file net.h.

◆ ETHERTYPE_SPRITE

#define ETHERTYPE_SPRITE   0x0500

Definition at line 54 of file net.h.

◆ MAX_TCP_CONNECTIONS

#define MAX_TCP_CONNECTIONS   100

Definition at line 116 of file net.h.

Referenced by net_dumpinfo(), and net_tcp_rx_avail().

◆ MAX_UDP_CONNECTIONS

#define MAX_UDP_CONNECTIONS   100

Definition at line 117 of file net.h.

Referenced by net_dumpinfo(), and net_udp_rx_avail().

◆ NET_ADDR_ETHERNET

#define NET_ADDR_ETHERNET   3

Definition at line 220 of file net.h.

Referenced by net_debugaddr(), and net_dumpinfo().

◆ NET_ADDR_IPV4

#define NET_ADDR_IPV4   1

Definition at line 218 of file net.h.

Referenced by net_debugaddr(), and net_dumpinfo().

◆ NET_ADDR_IPV6

#define NET_ADDR_IPV6   2

Definition at line 219 of file net.h.

Referenced by net_debugaddr().

◆ NET_DEFAULT_IPV4_LEN

#define NET_DEFAULT_IPV4_LEN   8

Definition at line 45 of file net.h.

Referenced by emul_simple_init().

◆ NET_DEFAULT_IPV4_MASK

#define NET_DEFAULT_IPV4_MASK   "10.0.0.0"

Definition at line 44 of file net.h.

Referenced by emul_simple_init().

◆ NET_INIT_FLAG_GATEWAY

#define NET_INIT_FLAG_GATEWAY   1

Definition at line 188 of file net.h.

Referenced by emul_simple_init().

◆ TCP_INCOMING_BUF_LEN

#define TCP_INCOMING_BUF_LEN   2000

Definition at line 216 of file net.h.

Referenced by net_tcp_rx_avail().

◆ TCP_OUTSIDE_CONNECTED

#define TCP_OUTSIDE_CONNECTED   2

Definition at line 212 of file net.h.

Referenced by net_ip_tcp_connectionreply(), and net_tcp_rx_avail().

◆ TCP_OUTSIDE_DISCONNECTED

#define TCP_OUTSIDE_DISCONNECTED   3

Definition at line 213 of file net.h.

Referenced by net_ip_tcp_connectionreply(), and net_tcp_rx_avail().

◆ TCP_OUTSIDE_DISCONNECTED2

#define TCP_OUTSIDE_DISCONNECTED2   4

Definition at line 214 of file net.h.

◆ TCP_OUTSIDE_TRYINGTOCONNECT

#define TCP_OUTSIDE_TRYINGTOCONNECT   1

Definition at line 211 of file net.h.

Referenced by net_tcp_rx_avail().

Function Documentation

◆ net_add_nic()

void net_add_nic ( struct net net,
void *  extra,
unsigned char *  macaddr 
)

Definition at line 598 of file net.cc.

References CHECK_ALLOCATION, net::n_nics, and net::nic_extra.

Referenced by dev_le_init(), and DEVINIT().

◆ net_allocate_ethernet_packet_link()

struct ethernet_packet_link* net_allocate_ethernet_packet_link ( struct net net,
void *  extra,
size_t  len 
)

◆ net_debugaddr()

void net_debugaddr ( void *  addr,
int  type 
)

Definition at line 50 of file net_misc.cc.

References debug, fatal(), NET_ADDR_ETHERNET, NET_ADDR_IPV4, and NET_ADDR_IPV6.

Referenced by net_dumpinfo().

◆ net_dumpinfo()

void net_dumpinfo ( struct net net)

◆ net_ethernet_rx()

int net_ethernet_rx ( struct net net,
void *  extra,
unsigned char **  packetp,
int *  lenp 
)

◆ net_ethernet_rx_avail()

int net_ethernet_rx_avail ( struct net net,
void *  extra 
)

◆ net_ethernet_tx()

void net_ethernet_tx ( struct net net,
void *  extra,
unsigned char *  packet,
int  len 
)

◆ net_generate_unique_mac()

void net_generate_unique_mac ( struct machine ,
unsigned char *  macbuf 
)

Definition at line 88 of file net_misc.cc.

References fatal(), machine::nr_of_nics, and machine::serial_nr.

Referenced by dev_le_init(), DEVINIT(), MACHINE_SETUP(), and yamon_machine_setup().

◆ net_init()

struct net* net_init ( struct emul emul,
int  init_flags,
const char *  ipv4addr,
int  netipv4len,
char **  remote,
int  n_remote,
int  local_port,
const char *  settings_prefix 
)

◆ net_ip()

void net_ip ( struct net net,
void *  extra,
unsigned char *  packet,
int  len 
)

Definition at line 885 of file net_ip.cc.

References debug.

Referenced by net_ethernet_tx().

◆ net_ip_broadcast()

void net_ip_broadcast ( struct net net,
void *  extra,
unsigned char *  packet,
int  len 
)

Definition at line 1133 of file net_ip.cc.

References fatal(), ethernet_packet_link::len, net::netmask_ipv4, and net::netmask_ipv4_len.

Referenced by net_ethernet_tx().

◆ net_ip_checksum()

void net_ip_checksum ( unsigned char *  ip_header,
int  chksumoffset,
int  len 
)

Definition at line 55 of file net_ip.cc.

Referenced by net_ip_tcp_connectionreply(), and net_udp_rx_avail().

◆ net_ip_tcp_checksum()

void net_ip_tcp_checksum ( unsigned char *  tcp_header,
int  chksumoffset,
int  tcp_len,
unsigned char *  srcaddr,
unsigned char *  dstaddr,
int  udpflag 
)

Definition at line 91 of file net_ip.cc.

Referenced by net_ip_tcp_connectionreply().

◆ net_ip_tcp_connectionreply()

void net_ip_tcp_connectionreply ( struct net net,
void *  extra,
int  con_id,
int  connecting,
unsigned char *  data,
int  datalen,
int  rst 
)

◆ net_tcp_rx_avail()

void net_tcp_rx_avail ( struct net net,
void *  extra 
)

◆ net_udp_rx_avail()

void net_udp_rx_avail ( struct net net,
void *  extra 
)

◆ send_udp()

void send_udp ( struct in_addr *  addrp,
int  portnr,
unsigned char *  packet,
size_t  len 
)

Definition at line 124 of file net_misc.cc.

Referenced by net_ethernet_tx().


Generated on Sun Sep 30 2018 16:05:18 for GXemul by doxygen 1.8.13