|
AquilaOS documentation
How it works, and its code
|
Go to the source code of this file.
Data Structures | |
| struct | netbuf |
| A packet (net/netbuf.c). More... | |
Macros | |
| #define | NETBUF_SIZE 2048 |
| #define | NETBUF_HEADROOM 128 |
| #define | NETBUF_END(nb) |
Functions | |
| struct netbuf * | netbuf_alloc (void) |
| Allocates a netbuf, empty, with room for the headers that will be put in front of its data. | |
| void | netbuf_free (struct netbuf *nb) |
| Frees a netbuf. | |
| static void * | netbuf_push (struct netbuf *nb, size_t size) |
| Makes room for a header of size bytes before the data, and returns it. | |
| static void * | netbuf_pull (struct netbuf *nb, size_t size) |
| Takes the header of size bytes off the front of the packet, and returns it, or NULL if the packet is shorter. | |
| static void * | netbuf_put (struct netbuf *nb, size_t size) |
| Adds size bytes at the end of the packet, and returns them, or NULL if there's no room. | |
| #define NETBUF_END | ( | nb | ) |
Definition at line 44 of file netbuf.h.
Referenced by netbuf_put().
| #define NETBUF_HEADROOM 128 |
Definition at line 41 of file netbuf.h.
Referenced by netbuf_alloc().
| #define NETBUF_SIZE 2048 |
Definition at line 40 of file netbuf.h.
Referenced by inet_sock_deliver(), netbuf_alloc(), netbuf_free(), rx_poll(), and socket_inet_recv().
| struct netbuf * netbuf_alloc | ( | void | ) |
Allocates a netbuf, empty, with room for the headers that will be put in front of its data.
Definition at line 58 of file netbuf.c.
References arch_phys_map(), netbuf::data, free_netbufs, free_push(), free_remove(), netbuf::len, mm_page_alloc(), mm_page_dealloc(), mm_page_incref(), netbuf_alloc(), NETBUF_HEADROOM, NETBUF_SIZE, netbuf::netif, netbuf::next, NULL, vm_page::off, vm_page::paddr, netbuf::page, and PAGE_SIZE.
Referenced by arp_request(), icmp_unreachable(), loopback_transmit(), netbuf_alloc(), rx_poll(), segment(), socket_inet_send(), and tcp_reply_rst().
| void netbuf_free | ( | struct netbuf * | nb | ) |
Frees a netbuf.
| nb | the netbuf |
Definition at line 99 of file netbuf.c.
References free_count, free_push(), free_remove(), mm_page_dealloc(), mm_page_decref(), mm_page_ref(), netbuf_free(), NETBUF_KEEP, NETBUF_PER_PAGE, NETBUF_SIZE, netbuf::page, and PAGE_MASK.
Referenced by arp_input(), arp_resolve(), ether_input(), ether_output(), icmp_input(), inet_sock_deliver(), ipv4_input(), ipv4_output(), ipv4_send(), netbuf_free(), ooo_drain(), ooo_insert(), ooo_purge(), pending_drop(), segment_input(), socket_inet_recv(), socket_inet_send(), socket_inet_shutdown(), tcp_input(), tcp_pcb_free(), and udp_input().
Takes the header of size bytes off the front of the packet, and returns it, or NULL if the packet is shorter.
Definition at line 64 of file netbuf.h.
References netbuf::data, netbuf::len, netbuf_pull(), and NULL.
Referenced by ether_input(), ipv4_input(), netbuf_pull(), and udp_input().
Makes room for a header of size bytes before the data, and returns it.
Panics if there's no room: the headroom is always enough.
Definition at line 52 of file netbuf.h.
References netbuf::data, netbuf::len, netbuf_push(), and panic.
Referenced by ether_output(), ipv4_output(), netbuf_push(), segment(), socket_inet_send(), and tcp_reply_rst().
Adds size bytes at the end of the packet, and returns them, or NULL if there's no room.
Definition at line 77 of file netbuf.h.
References netbuf::data, netbuf::len, NETBUF_END, and NULL.