Retro Rocket Kernel
BASIC-Powered Operating System
net.h File Reference
#include "kernel.h"

Data Structures

struct  net_address_t
 Represents an address that is bound to a protocol on an interface. This is kept as flexible as possible, to represent potentially different protocol's forms of addresses, e.g. IPv4, IPv6, IPX, Econet etc. The length indicates the number of bytes in the address, and the bytes field contains the actual address in host byte order. For example in IPv4, length would be 4 and bytes would essentially point at a uint32_t. The name is purely a human readable label for use in commands. The label might be 'ip.address', 'ip.gateway' etc. More...
 
struct  netproto_t
 Represents a protocol, or group of related protocols, that can be attached to an interface and can have addresses. At present only ethernet devices are supported, this covers 99% of the scenarios we might see in the wild on consumer machines. More...
 
struct  netdev_t
 An ethernet network device, this relates directly to a physical network card in the machine. A device may have zero or more attached protocols, each protocol intercepts an ethernet id number. Where a protocol requires another protocol to be of use, e.g. ARP with IPv4, the dependency will be added automatically by other protocols that require it. More...
 

Enumerations

enum  netdev_flags_t { ADMINISTRATIVELY_DOWN = 1 , CONNECTED = 2 }
 Potential flags for the state of a network device. More...
 

Functions

uint8_t htonb (uint8_t byte, int num_bits)
 Host to network byte. More...
 
uint8_t ntohb (uint8_t byte, int num_bits)
 Network to host byte. More...
 
uint16_t htons (uint16_t hostshort)
 Host to network short. More...
 
uint32_t htonl (uint32_t hostlong)
 Host to network long. More...
 
uint16_t ntohs (uint16_t netshort)
 Network to host short. More...
 
uint32_t ntohl (uint32_t netlong)
 Network to host long. More...
 
void network_up ()
 
void network_down ()
 

Detailed Description

Author
Craig Edwards (craig.nosp@m.edwa.nosp@m.rds@b.nosp@m.rain.nosp@m.box.c.nosp@m.c)

Enumeration Type Documentation

◆ netdev_flags_t

Potential flags for the state of a network device.

Enumerator
ADMINISTRATIVELY_DOWN 
CONNECTED 

Function Documentation

◆ htonb()

uint8_t htonb ( uint8_t  byte,
int  num_bits 
)

Host to network byte.

Parameters
byteinput
num_bitsnumber of bits of high nibble
Returns
uint8_t network byte order

◆ htonl()

uint32_t htonl ( uint32_t  hostlong)

Host to network long.

Parameters
hostlonginput
Returns
uint32_t network order

◆ htons()

uint16_t htons ( uint16_t  hostshort)

Host to network short.

Parameters
hostshortinput
Returns
uint16_t network order

◆ network_down()

void network_down ( )

◆ network_up()

void network_up ( )

◆ ntohb()

uint8_t ntohb ( uint8_t  byte,
int  num_bits 
)

Network to host byte.

Parameters
byteinput
num_bitsnumber of bits of high nibble
Returns
uint8_t host byte order

◆ ntohl()

uint32_t ntohl ( uint32_t  netlong)

Network to host long.

Parameters
netlonginput
Returns
uint32_t host order

◆ ntohs()

uint16_t ntohs ( uint16_t  netshort)

Network to host short.

Parameters
netshortinput
Returns
uint16_t host order