|
AquilaOS documentation
How it works, and its code
|
Go to the source code of this file.
Data Structures | |
| struct | netif |
| A network interface (net/netif.c): a device that sends and receives Ethernet frames, and its IPv4 configuration. More... | |
Macros | |
| #define | NETIF_UP 0x0001 |
| #define | NETIF_RUNNING 0x0002 |
| #define | NETIF_LOOPBACK 0x0004 |
Functions | |
| int | netif_register (struct netif *netif) |
| Registers a network interface. | |
| struct netif * | netif_find (const char *name) |
| Finds an interface by its name. | |
| void | netif_input (struct netif *netif, struct netbuf *nb) |
| Hands the stack a frame that a driver received, possibly from an interrupt. | |
| void | netif_loopback (struct netif *netif, struct netbuf *nb) |
| Hands the stack an IPv4 packet sent to one of our own addresses, as if it had come in through an interface. | |
| int | netif_output (struct netif *netif, struct netbuf *nb) |
| Sends a frame through an interface's driver. | |
| void | net_callout_set (struct callout *c, uint64_t ns, void(*fn)(void *), void *arg) |
| Sets a callout that the network's thread runs: fn(arg) is called once ns ns have passed. | |
Variables | |
| struct netif * | netifs |
| #define NETIF_LOOPBACK 0x0004 |
Definition at line 10 of file netif.h.
Referenced by ifreq_request(), ipv4_input(), ipv4_route(), loopback_init(), and netif_register().
| #define NETIF_RUNNING 0x0002 |
Definition at line 9 of file netif.h.
Referenced by e1000_probe(), ifreq_request(), link_check(), and loopback_init().
| #define NETIF_UP 0x0001 |
Definition at line 8 of file netif.h.
Referenced by ifreq_request(), ipv4_route(), loopback_init(), netif_config(), rx_queue(), and socket_inet_send().
Sets a callout that the network's thread runs: fn(arg) is called once ns ns have passed.
TCP's timers use it.
| c | the callout |
| ns | the delay, in ns |
| fn | the function to call |
| arg | its argument |
Definition at line 137 of file netif.c.
References callout_set_on(), net_callout_set(), net_callouts, net_thread, and thread_wakeup().
Referenced by arp_resolve(), arp_retry(), keepalive_timeout(), net_callout_set(), rexmt_timeout(), tcp_dack(), tcp_fin_wait_2(), tcp_keepalive_reset(), tcp_output(), tcp_rexmt_start(), and tcp_time_wait().
| struct netif * netif_find | ( | const char * | name | ) |
Finds an interface by its name.
| name | the name (at most 16 characters, IFNAMSIZ) |
Definition at line 186 of file netif.c.
References netif::name, netif_find(), netifs, netif::next, and NULL.
Referenced by ifreq_request(), netif_find(), and socket_inet_setsockopt().
Hands the stack a frame that a driver received, possibly from an interrupt.
The netbuf is the stack's from now on.
| netif | the interface it came in on |
| nb | the frame |
Definition at line 323 of file netif.c.
References netbuf::len, netbuf::loopback, netbuf::netif, netif_input(), rx_queue(), and netif::stats.
Referenced by loopback_transmit(), netif_input(), and rx_poll().
Hands the stack an IPv4 packet sent to one of our own addresses, as if it had come in through an interface.
| netif | the interface it is received on |
| nb | the packet, from its IPv4 header |
Definition at line 340 of file netif.c.
References netbuf::len, netbuf::loopback, netbuf::netif, netif_loopback(), rx_queue(), and netif::stats.
Referenced by ipv4_output(), and netif_loopback().
Sends a frame through an interface's driver.
The netbuf stays the caller's.
| netif | the interface |
| nb | the frame |
Definition at line 358 of file netif.c.
References netbuf::len, netif_output(), netif::stats, and netif::transmit.
Referenced by ether_output(), and netif_output().
| int netif_register | ( | struct netif * | netif | ) |
Registers a network interface.
An interface without a name gets the next "ethN". The first Ethernet interface is configured from the kernel's ip= argument. The network's thread is started with the first interface.
| netif | the interface, with its MAC address and transmit set |
Definition at line 206 of file netif.c.
References ethers_nr, netif::flags, kthread_create(), loopback, loopback_init(), netif::mac, mac_string(), netif::mtu, netif::name, net_main(), net_thread, netif_config(), NETIF_LOOPBACK, netif_register(), netifs, netif::next, NULL, panic, printk(), snprintf(), netif::transmit, and thread::urgent.
Referenced by e1000_probe(), loopback_init(), and netif_register().
|
extern |
Definition at line 34 of file netif.c.
Referenced by ifconf(), ipv4_is_local(), ipv4_route(), netif_find(), netif_index(), netif_register(), and route().