Retro Rocket Kernel BASIC-Powered Operating System

Data Structures | Macros | Typedefs | Functions | Variables
ethernet.h File Reference
`#include "kernel.h"`
`#include <stdint.h>`

## Data Structures
struct | ethernet_frame
| There is actually more to an ethernet frame than this (see the STD documents!) but we don't have access to it from the software. More...

## Macros
#define | HARDWARE_TYPE_ETHERNET 0x01
| Ethernet hardware type. More...

## Typedefs
typedef void(* | ethernet_protocol_t) (void *, int)

## Functions
struct ethernet_frame | __attribute__ ((packed)) ethernet_frame_t
| There is actually more to an ethernet frame than this (see the STD documents!) but we don't have access to it from the software. More...
int | ethernet_send_packet (uint8_t *dst_mac_addr, uint8_t *data, int len, uint16_t protocol)
| Send a raw ethernet packet to the network card driver. More...
void | ethernet_handle_packet (ethernet_frame_t *packet, int len)
| Handle inbound packet via interrupt from network card driver. More...
bool | ethernet_register_iee802_number (uint16_t protocol_number, ethernet_protocol_t handler)
| Register a protocol with the ethernet layer See https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml for a list of protocol numbers. More...

## Variables
uint8_t | dst_mac_addr [6]
uint8_t | src_mac_addr [6]
uint16_t | type
uint8_t | data []

## Detailed Description

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

Copyright
  Copyright (c) 2012-2023

## Macro Definition Documentation

## ◆ HARDWARE_TYPE_ETHERNET

#define HARDWARE_TYPE_ETHERNET 0x01

Ethernet hardware type.

## Typedef Documentation

## ◆ ethernet_protocol_t

typedef void(* ethernet_protocol_t) (void *, int)

## Function Documentation

## ◆ __attribute__()

struct ethernet_frame __attribute__ | ( | (packed) |  | ) |

There is actually more to an ethernet frame than this (see the STD documents!) but we don't have access to it from the software.

## ◆ ethernet_handle_packet()

void ethernet_handle_packet | ( | ethernet_frame_t * | packet,
|  | int | len
| ) |  |

Handle inbound packet via interrupt from network card driver.

Parameters

  packet | raw packet data
  len | packet data length

## ◆ ethernet_register_iee802_number()

bool ethernet_register_iee802_number | ( | uint16_t | protocol_number,
|  | ethernet_protocol_t | handler
| ) |  |

Register a protocol with the ethernet layer See https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml for a list of protocol numbers.

Parameters

  protocol_number | IEE802 protocol number to register
  handler | protocol handler

Returns
  true if registered, false if there was an error

## ◆ ethernet_send_packet()

int ethernet_send_packet | ( | uint8_t * | dst_mac_addr,
|  | uint8_t * | data,
|  | int | len,
|  | uint16_t | protocol
| ) |  |

Send a raw ethernet packet to the network card driver.

Parameters

  dst_mac_addr | destination MAC address (FF:FF:FF:FF:FF:FF for broadcast)
  data | raw packet data
  len | packet data length
  protocol | protocol type

Returns
  int nonzero on successful queue of packet

## Variable Documentation

## ◆ data

uint8_t data[]

## ◆ dst_mac_addr

uint8_t dst_mac_addr[6]

## ◆ src_mac_addr

uint8_t src_mac_addr[6]

## ◆ type

uint16_t type