SAMV71 Xplained Ultra Software Package 1.5

ip_frag.c File Reference

#include "lwip/opt.h"
#include "lwip/ip_frag.h"
#include "lwip/ip.h"
#include "lwip/inet.h"
#include "lwip/inet_chksum.h"
#include "lwip/netif.h"
#include "lwip/snmp.h"
#include "lwip/stats.h"
#include "lwip/icmp.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  ip_reass_helper

Defines

#define IP_REASS_FLAG_LASTFRAG   0x01
#define IP_ADDRESSES_AND_ID_MATCH(iphdrA, iphdrB)

Functions

void ip_reass_tmr (void)
struct pbufip_reass (struct pbuf *p)
err_t ip_frag (struct pbuf *p, struct netif *netif, struct ip_addr *dest)

Variables

PACK_STRUCT_BEGIN struct
ip_reass_helper 
PACK_STRUCT_STRUCT

Detailed Description

This is the IPv4 packet segmentation and reassembly implementation.

Definition in file ip_frag.c.


Define Documentation

#define IP_ADDRESSES_AND_ID_MATCH (   iphdrA,
  iphdrB 
)
Value:
(ip_addr_cmp(&(iphdrA)->src, &(iphdrB)->src) && \
   ip_addr_cmp(&(iphdrA)->dest, &(iphdrB)->dest) && \
   IPH_ID(iphdrA) == IPH_ID(iphdrB)) ? 1 : 0

Definition at line 100 of file ip_frag.c.

#define IP_REASS_FLAG_LASTFRAG   0x01

The IP reassembly code currently has the following limitations:

  • IP header options are not supported
  • fragments must not overlap (e.g. due to different routes), currently, overlapping or duplicate fragments are thrown away if IP_REASS_CHECK_OVERLAP=1 (the default)!

Setting this to 0, you can turn off checking the fragments for overlapping regions. The code gets a little smaller. Only use this if you know that overlapping won't occur on your network! Set to 0 to prevent freeing the oldest datagram when the reassembly buffer is full (IP_REASS_MAX_PBUFS pbufs are enqueued). The code gets a little smaller. Datagrams will be freed by timeout only. Especially useful when MEMP_NUM_REASSDATA is set to 1, so one datagram can be reassembled at a time, only.

Definition at line 79 of file ip_frag.c.


Function Documentation

err_t ip_frag ( struct pbuf p,
struct netif netif,
struct ip_addr 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

Definition at line 628 of file ip_frag.c.

Here is the call graph for this function:

struct pbuf* ip_reass ( struct pbuf p  )  [read]

Reassembles incoming IP fragments into an IP datagram.

Parameters:
p points to a pbuf chain of the fragment
Returns:
NULL if reassembly is incomplete, ? otherwise

Definition at line 469 of file ip_frag.c.

Here is the call graph for this function:

void ip_reass_tmr ( void   ) 

Reassembly timer base function for both NO_SYS == 0 and 1 (!).

Should be called every 1000 msec (defined by IP_TMR_INTERVAL).

Definition at line 120 of file ip_frag.c.


Variable Documentation

PACK_STRUCT_BEGIN struct etharp_hdr PACK_STRUCT_STRUCT

This is a helper struct which holds the starting offset and the ending offset of this fragment to easily chain the fragments. It has to be packed since it has to fit inside the IP header.

the ARP message

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines