|
ginnOS
The reference: libc, the libraries and the kernel
|
IPv4 (RFC 791): the header, the checks, and where a packet goes. More...
#include "netif.h"Go to the source code of this file.
Data Structures | |
| struct | __attribute__ |
| ELF32 file header. More... | |
| struct | ipv4_stats_t |
Macros | |
| #define | IPV4_HEADER_SIZE 20 |
| #define | IPV4_BROADCAST 0xFFFFFFFFu |
| #define | IPV4_PACKET_MAX 65535 |
| #define | IP_PROTO_ICMP 1 |
| #define | IP_PROTO_TCP 6 |
| #define | IP_PROTO_UDP 17 |
Functions | |
| bool | ipv4_init (void) |
| get the send buffer (from net_init). | |
| void | ipv4_receive (netif_t *netif, const uint8_t *packet, uint32_t length) |
| a packet from an interface (net_lock held). | |
| bool | ipv4_send (uint32_t source, uint32_t dst, uint8_t protocol, const void *payload, uint32_t length) |
| send a payload to dst (net_lock held). | |
| uint32_t | ipv4_pseudo_sum (uint32_t source, uint32_t dst, uint8_t protocol, uint32_t length) |
| the sum of the pseudo-header of UDP and TCP (the addresses, the protocol, the length), to start their checksum with. | |
| uint32_t | ipv4_source_for (uint32_t dst) |
| the source address a packet to dst gets (net_lock held), 0 if there is no route. | |
| netif_t * | ipv4_route (uint32_t dst, uint32_t *next_hop) |
| the interface a packet to dst goes out on, and the host it goes to first (dst, or a gateway). | |
Variables | |
| ipv4_stats_t | ipv4_stats |
IPv4 (RFC 791): the header, the checks, and where a packet goes.
routing: 127.0.0.0/8 goes to the loopback interface; an address on the local network of an interface goes straight to it; any other address goes to the gateway of the first interface that has one. 255.255.255.255 goes to all hosts on the first Ethernet interface, also before it has an address (for DHCP).
fragments are not put together: a fragment is dropped and counted, and every packet sent has the "don't fragment" bit set.
| #define IPV4_HEADER_SIZE 20 |
| #define IPV4_BROADCAST 0xFFFFFFFFu |
| #define IPV4_PACKET_MAX 65535 |
| #define IP_PROTO_ICMP 1 |
| #define IP_PROTO_TCP 6 |
| #define IP_PROTO_UDP 17 |
| bool ipv4_init | ( | void | ) |
get the send buffer (from net_init).
a packet from an interface (net_lock held).
| bool ipv4_send | ( | uint32_t | source, |
| uint32_t | dst, | ||
| uint8_t | protocol, | ||
| const void * | payload, | ||
| uint32_t | length ) |
send a payload to dst (net_lock held).
| source | the source address, or 0 for the address of the interface the packet goes out on. |
the sum of the pseudo-header of UDP and TCP (the addresses, the protocol, the length), to start their checksum with.
the source address a packet to dst gets (net_lock held), 0 if there is no route.
the interface a packet to dst goes out on, and the host it goes to first (dst, or a gateway).
net_lock held.
|
extern |