Microchip® Advanced Software Framework

ip_frag.h File Reference
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/pbuf.h"
#include "lwip/netif.h"
#include "lwip/ip_addr.h"
#include "lwip/ip.h"

Data Structures

struct  ip_reassdata
 
struct  pbuf_custom_ref
 

Macros

#define IP_TMR_INTERVAL   1000
 
#define LWIP_PBUF_CUSTOM_REF_DEFINED
 A custom pbuf that holds a reference to another pbuf, which is freed when this custom pbuf is freed. More...
 

Functions

err_t ip_frag (struct pbuf *p, struct netif *netif, ip_addr_t *dest)
 Fragment an IP datagram if too large for the netif. More...
 
struct pbufip_reass (struct pbuf *p)
 Reassembles incoming IP fragments into an IP datagram. More...
 
void ip_reass_init (void)
 
void ip_reass_tmr (void)
 Reassembly timer base function for both NO_SYS == 0 and 1 (!). More...
 

#define IP_TMR_INTERVAL   1000
#define LWIP_PBUF_CUSTOM_REF_DEFINED

A custom pbuf that holds a reference to another pbuf, which is freed when this custom pbuf is freed.

This is used to create a custom PBUF_REF that points into the original pbuf.

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
pip packet to send
netifthe netif on which to send
destdestination ip address to which to send
Returns
ERR_OK if sent successfully, err_t otherwise

References pbuf_custom::custom_free_function, ERR_MEM, ERR_OK, htons, if(), inet_chksum(), ip_frag(), ip_frag_alloc_pbuf_custom_ref(), ip_frag_free_pbuf_custom_ref(), IP_HLEN, IP_MF, IP_OFFMASK, IP_REASS_DEBUG, ipfrag_free_pbuf_custom(), IPFRAG_STATS_INC, IPH_CHKSUM_SET, IPH_LEN_SET, IPH_OFFSET, IPH_OFFSET_SET, pbuf::len, LWIP_ASSERT, LWIP_DEBUGF, LWIP_MEM_ALIGN, netif::mtu, pbuf::next, ntohs, NULL, pbuf_custom_ref::original, netif::output, pbuf::payload, pbuf_alloc(), pbuf_alloced_custom(), pbuf_cat(), pbuf_chain(), pbuf_copy_partial(), pbuf_free(), pbuf_header(), PBUF_IP, PBUF_LINK, PBUF_RAM, PBUF_RAW, pbuf_realloc(), PBUF_REF, pbuf_ref(), pbuf_custom_ref::pc, snmp_inc_ipfragcreates, snmp_inc_ipfragoks, and pbuf::tot_len.

Referenced by ip_frag(), ip_reass(), and ip_reass_enqueue_new_datagram().

void ip_reass_init ( void  )
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).

References IP_REASS_DEBUG, ip_reass_free_complete_datagram(), LWIP_DEBUGF, ip_reassdata::next, NULL, reassdatagrams, ip_reassdata::timer, and U16_F.

Referenced by ip_reass_timer().