- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# ethernetif.c File Reference

`#include <ubixos/types.h>`
`#include <ubixos/sched.h>`
`#include <lib/kmalloc.h>`
`#include <lib/kprintf.h>`
`#include <sys/device.old.h>`
`#include <isa/ne2k.h>`
`#include "net/debug.h"`
`#include "net/opt.h"`
`#include "net/def.h"`
`#include "net/mem.h"`
`#include "net/pbuf.h"`
`#include "net/sys.h"`
`#include "netif/arp.h"`

Go to the source code of this file.

## Data Structures
struct | ethernetif
## Defines
#define | IFNAME0 'e'
#define | IFNAME1 'd'
## Functions
static void | arp_timer (void *arg)
void | ethernetif_init (struct netif *netif)
static void | ethernetif_input (struct netif *netif)
static err_t | ethernetif_output (struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
void | ethernetif_thread (void *arg)
static void | ethernetif_thread ()
static void | low_level_init (struct netif *netif)
static struct pbuf * | low_level_input (struct ethernetif *ethernetif)
static err_t | low_level_output (struct ethernetif *ethernetif, struct pbuf *p)
## Variables
device * | dev = 0x0
static struct eth_addr | ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}}
nicBuffer * | tmpBuf = 0x0

## Define Documentation

#define IFNAME0 'e'

Definition at line 62 of file ethernetif.c.

Referenced by ethernetif_init().

#define IFNAME1 'd'

Definition at line 63 of file ethernetif.c.

Referenced by ethernetif_init().

## Function Documentation

static void arp_timer | ( | void * | arg | ) | `[static]`

Definition at line 309 of file ethernetif.c.

References arp_tmr(), ARP_TMR_INTERVAL, NULL, and sys_timeout().

Referenced by ethernetif_init().

void ethernetif_init | ( | struct netif * | netif | ) |

Definition at line 325 of file ethernetif.c.

References arp_init(), arp_timer(), ARP_TMR_INTERVAL, ethernetif_output(), netif::hwaddr, IFNAME0, IFNAME1, netif::linkoutput, low_level_init(), low_level_output(), mem_malloc(), netif::name, NULL, netif::output, netif::state, and sys_timeout().

Referenced by netMainThread().

static void ethernetif_input | ( | struct netif * | netif | ) | `[static]`

Definition at line 275 of file ethernetif.c.

References arp_arp_input(), arp_ip_input(), ethernetif::ethaddr, ETHTYPE_ARP, ETHTYPE_IP, htons, netif::input, low_level_input(), low_level_output(), NULL, pbuf::payload, pbuf_free(), pbuf_header(), and netif::state.

Referenced by ethernetif_thread().

static err_t ethernetif_output | ( | struct netif * | netif,
|  | struct pbuf * | p,
|  | struct ip_addr * | ipaddr |
| ) |  |  | `[static]`

Definition at line 186 of file ethernetif.c.

References arp_lookup(), arp_query(), ERR_MEM, ethernetif::ethaddr, ethbroadcast, ETHTYPE_IP, netif::gw, htons, ip4_addr2, ip4_addr3, ip4_addr4, netif::ip_addr, ip_addr_isany, ip_addr_isbroadcast, ip_addr_ismulticast, ip_addr_maskcmp, low_level_output(), netif::netmask, NULL, pbuf::payload, pbuf_alloc(), pbuf_chain(), pbuf_free(), pbuf_header(), PBUF_LINK, PBUF_RAM, and netif::state.

Referenced by ethernetif_init().

void ethernetif_thread | ( | void * | arg | ) |

Definition at line 345 of file ethernetif.c.

References ethernetif_input(), nicBuffer::length, ne2kFreeBuffer(), ne2kGetBuffer(), and tmpBuf.

static void ethernetif_thread | ( |  | ) | `[static]`

Referenced by low_level_init().

static void low_level_init | ( | struct netif * | netif | ) | `[static]`

Definition at line 81 of file ethernetif.c.

References dev, ethernetif::ethaddr, ethernetif_thread(), device::ioAddr, device::irq, kmalloc(), kprintf(), netif::state, and sys_thread_new().

Referenced by ethernetif_init().

static struct pbuf* low_level_input | ( | struct ethernetif * | ethernetif | ) | `[static]`

Definition at line 142 of file ethernetif.c.

References bcopy(), nicBuffer::buffer, pbuf::len, nicBuffer::length, pbuf::next, NULL, pbuf::payload, pbuf_alloc(), PBUF_LINK, PBUF_POOL, and tmpBuf.

Referenced by ethernetif_input().

static err_t low_level_output | ( | struct ethernetif * | ethernetif,
|  | struct pbuf * | p |
| ) |  |  | `[static]`

Definition at line 113 of file ethernetif.c.

References bcopy(), dev, ERR_OK, device::ioAddr, device::irq, pbuf::len, pbuf::next, NULL, pbuf::payload, PCtoNIC(), and pbuf::tot_len.

Referenced by ethernetif_init(), ethernetif_input(), and ethernetif_output().

## Variable Documentation

struct device* dev = 0x0

Definition at line 78 of file ethernetif.c.

Referenced by dp_pkt2user(), dp_recv(), fdcInit2(), getblock(), hdInit(), low_level_init(), low_level_output(), NICtoPC(), pci_init(), and PCtoNIC().

struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}}`[static]`

Definition at line 72 of file ethernetif.c.

Referenced by ethernetif_output().

struct nicBuffer* tmpBuf = 0x0

Definition at line 65 of file ethernetif.c.

Referenced by dp_pkt2user(), ethernetif_thread(), low_level_input(), ne2kAllocBuffer(), and ne2kGetBuffer().