Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ip6_frag.h Source File

ip6_frag.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  *
00004  * IPv6 fragmentation and reassembly.
00005  */
00006 
00007 /*
00008  * Copyright (c) 2010 Inico Technologies Ltd.
00009  * All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without modification,
00012  * are permitted provided that the following conditions are met:
00013  *
00014  * 1. Redistributions of source code must retain the above copyright notice,
00015  *    this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright notice,
00017  *    this list of conditions and the following disclaimer in the documentation
00018  *    and/or other materials provided with the distribution.
00019  * 3. The name of the author may not be used to endorse or promote products
00020  *    derived from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00023  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00024  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00025  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00026  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00027  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00030  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00031  * OF SUCH DAMAGE.
00032  *
00033  * This file is part of the lwIP TCP/IP stack.
00034  *
00035  * Author: Ivan Delamer <delamer@inicotech.com>
00036  *
00037  *
00038  * Please coordinate changes and requests with Ivan Delamer
00039  * <delamer@inicotech.com>
00040  */
00041 #ifndef LWIP_HDR_IP6_FRAG_H
00042 #define LWIP_HDR_IP6_FRAG_H
00043 
00044 #include "lwip/opt.h"
00045 #include "lwip/pbuf.h"
00046 #include "lwip/ip6_addr.h"
00047 #include "lwip/ip6.h"
00048 #include "lwip/netif.h"
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053 
00054 
00055 #if LWIP_IPV6 && LWIP_IPV6_REASS  /* don't build if not configured for use in lwipopts.h */
00056 
00057 /** IP6_FRAG_COPYHEADER==1: for platforms where sizeof(void*) > 4, this needs to
00058  * be enabled (to not overwrite part of the data). When enabled, the IPv6 header
00059  * is copied instead of referencing it, which gives more room for struct ip6_reass_helper */
00060 #ifndef IPV6_FRAG_COPYHEADER
00061 #define IPV6_FRAG_COPYHEADER   0
00062 #endif
00063 
00064 /** The IPv6 reassembly timer interval in milliseconds. */
00065 #define IP6_REASS_TMR_INTERVAL 1000
00066 
00067 /* Copy the complete header of the first fragment to struct ip6_reassdata
00068    or just point to its original location in the first pbuf? */
00069 #if IPV6_FRAG_COPYHEADER
00070 #define IPV6_FRAG_HDRPTR
00071 #define IPV6_FRAG_HDRREF(hdr) (&(hdr))
00072 #else /* IPV6_FRAG_COPYHEADER */
00073 #define IPV6_FRAG_HDRPTR *
00074 #define IPV6_FRAG_HDRREF(hdr) (hdr)
00075 #endif /* IPV6_FRAG_COPYHEADER */
00076 
00077 /** IPv6 reassembly helper struct.
00078  * This is exported because memp needs to know the size.
00079  */
00080 struct ip6_reassdata {
00081   struct ip6_reassdata *next;
00082   struct pbuf *p;
00083   struct ip6_hdr IPV6_FRAG_HDRPTR iphdr;
00084   u32_t identification;
00085   u16_t datagram_len;
00086   u8_t nexth;
00087   u8_t timer;
00088 };
00089 
00090 #define ip6_reass_init() /* Compatibility define */
00091 void ip6_reass_tmr(void);
00092 struct pbuf *ip6_reass(struct pbuf *p);
00093 
00094 #endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
00095 
00096 #if LWIP_IPV6 && LWIP_IPV6_FRAG  /* don't build if not configured for use in lwipopts.h */
00097 
00098 #ifndef LWIP_PBUF_CUSTOM_REF_DEFINED
00099 #define LWIP_PBUF_CUSTOM_REF_DEFINED
00100 /** A custom pbuf that holds a reference to another pbuf, which is freed
00101  * when this custom pbuf is freed. This is used to create a custom PBUF_REF
00102  * that points into the original pbuf. */
00103 struct pbuf_custom_ref {
00104   /** 'base class' */
00105   struct pbuf_custom pc;
00106   /** pointer to the original pbuf that is referenced */
00107   struct pbuf *original;
00108 };
00109 #endif /* LWIP_PBUF_CUSTOM_REF_DEFINED */
00110 
00111 err_t ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest);
00112 
00113 #endif /* LWIP_IPV6 && LWIP_IPV6_FRAG */
00114 
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119 
00120 #endif /* LWIP_HDR_IP6_FRAG_H */