Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ip4_frag.h Source File

ip4_frag.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * IP fragmentation/reassembly
00004  */
00005 
00006 /*
00007  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification,
00011  * are permitted provided that the following conditions are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright notice,
00014  *    this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  *    this list of conditions and the following disclaimer in the documentation
00017  *    and/or other materials provided with the distribution.
00018  * 3. The name of the author may not be used to endorse or promote products
00019  *    derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00023  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00024  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00029  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00030  * OF SUCH DAMAGE.
00031  *
00032  * This file is part of the lwIP TCP/IP stack.
00033  *
00034  * Author: Jani Monoses <jani@iv.ro>
00035  *
00036  */
00037 
00038 #ifndef LWIP_HDR_IP4_FRAG_H
00039 #define LWIP_HDR_IP4_FRAG_H
00040 
00041 #include "lwip/opt.h"
00042 #include "lwip/err.h"
00043 #include "lwip/pbuf.h"
00044 #include "lwip/netif.h"
00045 #include "lwip/ip_addr.h"
00046 #include "lwip/ip.h"
00047 
00048 #if LWIP_IPV4
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053 
00054 #if IP_REASSEMBLY
00055 /* The IP reassembly timer interval in milliseconds. */
00056 #define IP_TMR_INTERVAL 1000
00057 
00058 /** IP reassembly helper struct.
00059  * This is exported because memp needs to know the size.
00060  */
00061 struct ip_reassdata {
00062   struct ip_reassdata *next;
00063   struct pbuf *p;
00064   struct ip_hdr iphdr;
00065   u16_t datagram_len;
00066   u8_t flags;
00067   u8_t timer;
00068 };
00069 
00070 void ip_reass_init(void);
00071 void ip_reass_tmr(void);
00072 struct pbuf * ip4_reass(struct pbuf *p);
00073 #endif /* IP_REASSEMBLY */
00074 
00075 #if IP_FRAG
00076 #if !LWIP_NETIF_TX_SINGLE_PBUF
00077 #ifndef LWIP_PBUF_CUSTOM_REF_DEFINED
00078 #define LWIP_PBUF_CUSTOM_REF_DEFINED
00079 /** A custom pbuf that holds a reference to another pbuf, which is freed
00080  * when this custom pbuf is freed. This is used to create a custom PBUF_REF
00081  * that points into the original pbuf. */
00082 struct pbuf_custom_ref {
00083   /** 'base class' */
00084   struct pbuf_custom pc;
00085   /** pointer to the original pbuf that is referenced */
00086   struct pbuf *original;
00087 };
00088 #endif /* LWIP_PBUF_CUSTOM_REF_DEFINED */
00089 #endif /* !LWIP_NETIF_TX_SINGLE_PBUF */
00090 
00091 err_t ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest);
00092 #endif /* IP_FRAG */
00093 
00094 #ifdef __cplusplus
00095 }
00096 #endif
00097 
00098 #endif /* LWIP_IPV4 */
00099 
00100 #endif /* LWIP_HDR_IP4_FRAG_H */