The Pedigree Project  0.1
ip6_frag.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
26 /*
27  * Copyright (c) 2010 Inico Technologies Ltd.
28  * All rights reserved.
29  *
30  * Redistribution and use in source and binary forms, with or without modification,
31  * are permitted provided that the following conditions are met:
32  *
33  * 1. Redistributions of source code must retain the above copyright notice,
34  * this list of conditions and the following disclaimer.
35  * 2. Redistributions in binary form must reproduce the above copyright notice,
36  * this list of conditions and the following disclaimer in the documentation
37  * and/or other materials provided with the distribution.
38  * 3. The name of the author may not be used to endorse or promote products
39  * derived from this software without specific prior written permission.
40  *
41  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
42  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
43  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
44  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
46  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
47  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
48  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
49  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
50  * OF SUCH DAMAGE.
51  *
52  * This file is part of the lwIP TCP/IP stack.
53  *
54  * Author: Ivan Delamer <delamer@inicotech.com>
55  *
56  *
57  * Please coordinate changes and requests with Ivan Delamer
58  * <delamer@inicotech.com>
59  */
60 #ifndef LWIP_HDR_IP6_FRAG_H
61 #define LWIP_HDR_IP6_FRAG_H
62 
63 #include "lwip/opt.h"
64 #include "lwip/pbuf.h"
65 #include "lwip/ip6_addr.h"
66 #include "lwip/ip6.h"
67 #include "lwip/netif.h"
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 
74 #if LWIP_IPV6 && LWIP_IPV6_REASS /* don't build if not configured for use in lwipopts.h */
75 
79 #ifndef IPV6_FRAG_COPYHEADER
80 #define IPV6_FRAG_COPYHEADER 0
81 #endif
82 
84 #define IP6_REASS_TMR_INTERVAL 1000
85 
86 /* Copy the complete header of the first fragment to struct ip6_reassdata
87  or just point to its original location in the first pbuf? */
88 #if IPV6_FRAG_COPYHEADER
89 #define IPV6_FRAG_HDRPTR
90 #define IPV6_FRAG_HDRREF(hdr) (&(hdr))
91 #else /* IPV6_FRAG_COPYHEADER */
92 #define IPV6_FRAG_HDRPTR *
93 #define IPV6_FRAG_HDRREF(hdr) (hdr)
94 #endif /* IPV6_FRAG_COPYHEADER */
95 
99 struct ip6_reassdata {
100  struct ip6_reassdata *next;
101  struct pbuf *p;
102  struct ip6_hdr IPV6_FRAG_HDRPTR iphdr;
103  u32_t identification;
104  u16_t datagram_len;
105  u8_t nexth;
106  u8_t timer;
107 };
108 
109 #define ip6_reass_init() /* Compatibility define */
110 void ip6_reass_tmr(void);
111 struct pbuf *ip6_reass(struct pbuf *p);
112 
113 #endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
114 
115 #if LWIP_IPV6 && LWIP_IPV6_FRAG /* don't build if not configured for use in lwipopts.h */
116 
117 #ifndef LWIP_PBUF_CUSTOM_REF_DEFINED
118 #define LWIP_PBUF_CUSTOM_REF_DEFINED
119 
122 struct pbuf_custom_ref {
124  struct pbuf_custom pc;
126  struct pbuf *original;
127 };
128 #endif /* LWIP_PBUF_CUSTOM_REF_DEFINED */
129 
130 err_t ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest);
131 
132 #endif /* LWIP_IPV6 && LWIP_IPV6_FRAG */
133 
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* LWIP_HDR_IP6_FRAG_H */
Definition: pbuf.h:161
Definition: netif.h:244
s8_t err_t
Definition: err.h:76