|
ginnOS
The reference: libc, the libraries and the kernel
|
the interface table and the loopback interface (see netif.h). More...
#include "netif.h"#include "common/memory.h"#include "common/string.h"#include "ethernet.h"#include "ipv4.h"#include "tcp.h"#include "kernel/errno.h"#include "kernel/memory/heap.h"#include "kernel/process/process.h"#include "kernel/usermode/uaccess.h"#include "kernel/sync/spinlock.h"#include "kernel/sync/wait_queue.h"Macros | |
| #define | LOOPBACK_QUEUE 16 |
| #define | AF_INET_K 2 |
| #define | ARPHRD_ETHER 1 |
| #define | ARPHRD_LOOPBACK 772 |
Functions | |
| uint32_t | net_lock (void) |
| take and release the network lock. | |
| void | net_unlock (uint32_t flags) |
| void | net_wait (wait_queue_t *wq) |
| sleep on a wait queue with net_lock held (interruptibly): the lock is let go while the process sleeps and held again on return. | |
| void | net_init (void) |
| set up the network layer and the loopback interface (lo). | |
| netif_t * | netif_register (const char *prefix, const uint8_t mac[ETH_ADDR_LEN], uint32_t mtu, netif_send_fn send, void *driver) |
| add an interface. | |
| void | netif_receive (netif_t *netif, const void *frame, uint32_t length) |
| a frame from the device (called with net_lock held, often from an interrupt). | |
| bool | netif_send (netif_t *netif, const void *frame, uint32_t length) |
| send a frame on an interface and count it (net_lock held). | |
| netif_t * | netif_at (uint32_t index) |
| the interfaces, for /proc/net and the configuration calls. | |
| netif_t * | netif_find (const char *name) |
| the interface with this name, or NULL. | |
| int32_t | netif_ioctl (uint32_t request, void *arg) |
| an interface ioctl (from a socket). | |
the interface table and the loopback interface (see netif.h).
| #define LOOPBACK_QUEUE 16 |
| #define AF_INET_K 2 |
| #define ARPHRD_ETHER 1 |
| #define ARPHRD_LOOPBACK 772 |
| uint32_t net_lock | ( | void | ) |
take and release the network lock.
| void net_unlock | ( | uint32_t | flags | ) |
| void net_wait | ( | wait_queue_t * | wq | ) |
sleep on a wait queue with net_lock held (interruptibly): the lock is let go while the process sleeps and held again on return.
the caller checks its condition and signal_pending in a loop.
| void net_init | ( | void | ) |
set up the network layer and the loopback interface (lo).
| netif_t * netif_register | ( | const char * | prefix, |
| const uint8_t | mac[ETH_ADDR_LEN], | ||
| uint32_t | mtu, | ||
| netif_send_fn | send, | ||
| void * | driver ) |
add an interface.
the name is made from prefix and a number (eth0).
a frame from the device (called with net_lock held, often from an interrupt).
the data is only valid during the call.
send a frame on an interface and count it (net_lock held).
the interfaces, for /proc/net and the configuration calls.
| netif_t * netif_find | ( | const char * | name | ) |
the interface with this name, or NULL.