Embedded Xinu Operating System
An ongoing research project and educational operating system.
|
Networking subsystem and protocols. More...
Modules | |
ARP | |
Address Resolution Protocol. | |
DHCP client | |
Client for Dynamic Host Configuration Protocol (IPv4 version) | |
ICMP | |
Internet Control Message Protocol. | |
IPv4 | |
Internet Protocol Version 4. | |
Network Emulation | |
Automatically drop and corrupt packets for testing. | |
Packet snooping | |
View the data of packets being send and received over a network interface. | |
Routing | |
IPv4 routing support. | |
TFTP client | |
Trivial File Transfer Protocol client. | |
Functions | |
ushort | netChksum (void *data, uint len) |
syscall | netDown (int descrp) |
syscall | netFreebuf (struct packet *pkt) |
struct packet * | netGetbuf (void) |
syscall | netInit () |
struct netif * | netLookup (int devnum) |
thread | netRecv (struct netif *netptr) |
syscall | netSend (struct packet *pkt, const struct netaddr *hwaddr, const struct netaddr *praddr, ushort type) |
syscall | netUp (int descrp, const struct netaddr *ip, const struct netaddr *mask, const struct netaddr *gateway) |
bool | netaddrequal (const struct netaddr *a, const struct netaddr *b) |
syscall | netaddrhost (struct netaddr *a, const struct netaddr *mask) |
syscall | netaddrmask (struct netaddr *a, const struct netaddr *mask) |
int | netaddrsprintf (char *str, const struct netaddr *addr) |
Networking subsystem and protocols.
Note: although they are network protocols, UDP and TCP are implemented as device drivers and therefore are not grouped in this section.
bool netaddrequal | ( | const struct netaddr * | a, |
const struct netaddr * | b | ||
) |
Compare two network addresses
a | first network address |
b | second network address |
syscall netaddrhost | ( | struct netaddr * | a, |
const struct netaddr * | mask | ||
) |
Calculate the host portion of a network address, which is essentially the opposite of masking it with netaddrmask(). For example, with IPv4, extracting the host portion of 192.168.0.50 with a mask of 255.255.255.0 will produce 0.0.0.50.
a | Network address from which to extract the host portion. |
mask | The netmask to use. |
a
and mask
are not the same type of network address; otherwise returns OK and modifies a
in place to produce just the host portion of the network address. syscall netaddrmask | ( | struct netaddr * | a, |
const struct netaddr * | mask | ||
) |
Apply a mask to a network address. For example, with IPv4, masking 192.168.0.50 with 255.255.255.0 will produce 192.168.0.0.
a | Network address to mask. |
mask | The mask to apply. |
a
and mask
are not the same type of network address; otherwise returns OK and modifies a
in place to mask it. int netaddrsprintf | ( | char * | str, |
const struct netaddr * | addr | ||
) |
Format a network address and place in a null-terminated string.
str | Pointer to the output string, which must have enough space for the appropriate type of network address, including the null terminator. |
addr | Network address to format. |
int
. syscall netDown | ( | int | descrp | ) |
Bring down a network interface.
descrp | Device descriptor for the underlying network device of the interface. |
syscall netFreebuf | ( | struct packet * | pkt | ) |
file netGetbuf.c
Frees a buffer for storing a packet.
struct packet* netGetbuf | ( | void | ) |
file netGetbuf.c
Provides a buffer for storing a packet.
< pointer to packet
syscall netInit | ( | ) |
Initialize network interfaces
struct netif* netLookup | ( | int | devnum | ) |
Lookup a network interface, given an underlying device.
devnum | device number to find netif for. |
thread netRecv | ( | struct netif * | netptr | ) |
Receive thread to handle one incoming packet at a time
netptr | network interface device to open netRecv on |
< maximum packet length
syscall netSend | ( | struct packet * | pkt, |
const struct netaddr * | hwaddr, | ||
const struct netaddr * | praddr, | ||
ushort | type | ||
) |
file netSend.c
Appends the Link-Level header to a packet and writes to the underlying interface.
pkt | packet to send |
hwaddr | hardware address of the destination, NULL if should lookup |
praddr | protocol address of the destination, NULL if hwaddr is known |
type | type of the packet to put in link level header |
< pointer to network interface
< pointer to Ethernet header
< result of ARP lookup
syscall netUp | ( | int | descrp, |
const struct netaddr * | ip, | ||
const struct netaddr * | mask, | ||
const struct netaddr * | gateway | ||
) |
Starts a network interface using the specified protocol addresses.
descrp | Index of the underlying network device on which to open the interface. |
ip | Protocol address; cannot be NULL. |
mask | Protocol address mask; cannot be NULL. |
gateway | Protocol address of the gateway, or NULL if unspecified. If unspecified, it is interpreted as "no gateway". |