Deprecated fork of old network stack source from github. Please use official library instead: https://mbed.org/users/mbed_official/code/EthernetInterface/
ip_frag.c File Reference
This is the IPv4 packet segmentation and reassembly implementation. More...
Go to the source code of this file.
Functions | |
static void | ip_reass_dequeue_datagram (struct ip_reassdata *ipr, struct ip_reassdata *prev) |
Dequeues a datagram from the datagram queue. | |
static int | ip_reass_free_complete_datagram (struct ip_reassdata *ipr, struct ip_reassdata *prev) |
Free a datagram (struct ip_reassdata) and all its pbufs. | |
void | ip_reass_tmr (void) |
Reassembly timer base function for both NO_SYS == 0 and 1 (!). | |
static int | ip_reass_remove_oldest_datagram (struct ip_hdr *fraghdr, int pbufs_needed) |
Free the oldest datagram to make room for enqueueing new fragments. | |
static struct ip_reassdata * | ip_reass_enqueue_new_datagram (struct ip_hdr *fraghdr, int clen) |
Enqueues a new fragment into the fragment queue. | |
static int | ip_reass_chain_frag_into_datagram_and_validate (struct ip_reassdata *ipr, struct pbuf *new_p) |
Chain a new pbuf into the pbuf list that composes the datagram. | |
struct pbuf * | ip_reass (struct pbuf *p) |
Reassembles incoming IP fragments into an IP datagram. | |
static struct pbuf_custom_ref * | ip_frag_alloc_pbuf_custom_ref (void) |
Allocate a new struct pbuf_custom_ref. | |
static void | ip_frag_free_pbuf_custom_ref (struct pbuf_custom_ref *p) |
Free a struct pbuf_custom_ref. | |
static void | ipfrag_free_pbuf_custom (struct pbuf *p) |
Free-callback function to free a 'struct pbuf_custom_ref', called by pbuf_free. | |
err_t | ip_frag (struct pbuf *p, struct netif *netif, ip_addr_t *dest) |
Fragment an IP datagram if too large for the netif. |
Detailed Description
This is the IPv4 packet segmentation and reassembly implementation.
Definition in file ip_frag.c.
Function Documentation
err_t ip_frag | ( | struct pbuf * | p, |
struct netif * | netif, | ||
ip_addr_t * | dest | ||
) |
Fragment an IP datagram if too large for the netif.
Chop the datagram in MTU sized chunks and send them in order by using a fixed size static memory buffer (PBUF_REF) or point PBUF_REFs into p (depending on IP_FRAG_USES_STATIC_BUF).
- Parameters:
-
p ip packet to send netif the netif on which to send dest destination ip address to which to send
- Returns:
- ERR_OK if sent successfully, err_t otherwise
static struct pbuf_custom_ref* ip_frag_alloc_pbuf_custom_ref | ( | void | ) | [static, read] |
Allocate a new struct pbuf_custom_ref.
static void ip_frag_free_pbuf_custom_ref | ( | struct pbuf_custom_ref * | p ) | [static] |
Free a struct pbuf_custom_ref.
struct pbuf* ip_reass | ( | struct pbuf * | p ) | [read] |
static int ip_reass_chain_frag_into_datagram_and_validate | ( | struct ip_reassdata * | ipr, |
struct pbuf * | new_p | ||
) | [static] |
Chain a new pbuf into the pbuf list that composes the datagram.
The pbuf list will grow over time as new pbufs are rx. Also checks that the datagram passes basic continuity checks (if the last fragment was received at least once).
- Parameters:
-
root_p points to the 'root' pbuf for the current datagram being assembled. new_p points to the pbuf for the current fragment
- Returns:
- 0 if invalid, >0 otherwise
static void ip_reass_dequeue_datagram | ( | struct ip_reassdata * | ipr, |
struct ip_reassdata * | prev | ||
) | [static] |
static struct ip_reassdata* ip_reass_enqueue_new_datagram | ( | struct ip_hdr * | fraghdr, |
int | clen | ||
) | [static, read] |
Enqueues a new fragment into the fragment queue.
- Parameters:
-
fraghdr points to the new fragments IP hdr clen number of pbufs needed to enqueue (used for freeing other datagrams if not enough space)
- Returns:
- A pointer to the queue location into which the fragment was enqueued
static int ip_reass_free_complete_datagram | ( | struct ip_reassdata * | ipr, |
struct ip_reassdata * | prev | ||
) | [static] |
Free a datagram (struct ip_reassdata) and all its pbufs.
Updates the total count of enqueued pbufs (ip_reass_pbufcount), SNMP counters and sends an ICMP time exceeded packet.
- Parameters:
-
ipr datagram to free prev the previous datagram in the linked list
- Returns:
- the number of pbufs freed
static int ip_reass_remove_oldest_datagram | ( | struct ip_hdr * | fraghdr, |
int | pbufs_needed | ||
) | [static] |
Free the oldest datagram to make room for enqueueing new fragments.
The datagram 'fraghdr' belongs to is not freed!
- Parameters:
-
fraghdr IP header of the current fragment pbufs_needed number of pbufs needed to enqueue (used for freeing other datagrams if not enough space)
- Returns:
- the number of pbufs freed
void ip_reass_tmr | ( | void | ) |
Generated on Tue Jul 12 2022 23:10:20 by 1.7.2