ReactOS 0.4.16-dev-297-gc569aee
ip6_frag.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2010 Inico Technologies Ltd.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31 * OF SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Ivan Delamer <delamer@inicotech.com>
36 *
37 *
38 * Please coordinate changes and requests with Ivan Delamer
39 * <delamer@inicotech.com>
40 */
41#ifndef LWIP_HDR_IP6_FRAG_H
42#define LWIP_HDR_IP6_FRAG_H
43
44#include "lwip/opt.h"
45#include "lwip/pbuf.h"
46#include "lwip/ip6_addr.h"
47#include "lwip/ip6.h"
48#include "lwip/netif.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54
55#if LWIP_IPV6 && LWIP_IPV6_REASS /* don't build if not configured for use in lwipopts.h */
56
58#define IP6_REASS_TMR_INTERVAL 1000
59
70#ifndef IPV6_FRAG_COPYHEADER
71#define IPV6_FRAG_COPYHEADER 0
72#endif
73
74/* With IPV6_FRAG_COPYHEADER==1, a helper structure may (or, depending on the
75 * presence of extensions, may not) overwrite part of the IP header. Therefore,
76 * we copy the fields that we need from the IP header for as long as the helper
77 * structure may still be in place. This is easier than temporarily restoring
78 * those fields in the IP header each time we need to perform checks on them. */
79#if IPV6_FRAG_COPYHEADER
80#define IPV6_FRAG_SRC(ipr) ((ipr)->src)
81#define IPV6_FRAG_DEST(ipr) ((ipr)->dest)
82#else /* IPV6_FRAG_COPYHEADER */
83#define IPV6_FRAG_SRC(ipr) ((ipr)->iphdr->src)
84#define IPV6_FRAG_DEST(ipr) ((ipr)->iphdr->dest)
85#endif /* IPV6_FRAG_COPYHEADER */
86
90struct ip6_reassdata {
91 struct ip6_reassdata *next;
92 struct pbuf *p;
93 struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
94#if IPV6_FRAG_COPYHEADER
95 ip6_addr_p_t src; /* copy of the source address in the IP header */
96 ip6_addr_p_t dest; /* copy of the destination address in the IP header */
97 /* This buffer (for the part of the original header that we overwrite) will
98 * be slightly oversized, but we cannot compute the exact size from here. */
99 u8_t orig_hdr[sizeof(struct ip6_frag_hdr) + sizeof(void*)];
100#else /* IPV6_FRAG_COPYHEADER */
101 /* In this case we still need the buffer, for sending ICMPv6 replies. */
102 u8_t orig_hdr[sizeof(struct ip6_frag_hdr)];
103#endif /* IPV6_FRAG_COPYHEADER */
104 u32_t identification;
105 u16_t datagram_len;
106 u8_t nexth;
107 u8_t timer;
108#if LWIP_IPV6_SCOPES
109 u8_t src_zone; /* zone of original packet's source address */
110 u8_t dest_zone; /* zone of original packet's destination address */
111#endif /* LWIP_IPV6_SCOPES */
112};
113
114#define ip6_reass_init() /* Compatibility define */
115void ip6_reass_tmr(void);
116struct pbuf *ip6_reass(struct pbuf *p);
117
118#endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
119
120#if LWIP_IPV6 && LWIP_IPV6_FRAG /* don't build if not configured for use in lwipopts.h */
121
122#ifndef LWIP_PBUF_CUSTOM_REF_DEFINED
123#define LWIP_PBUF_CUSTOM_REF_DEFINED
127struct pbuf_custom_ref {
129 struct pbuf_custom pc;
131 struct pbuf *original;
132};
133#endif /* LWIP_PBUF_CUSTOM_REF_DEFINED */
134
135err_t ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest);
136
137#endif /* LWIP_IPV6 && LWIP_IPV6_FRAG */
138
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* LWIP_HDR_IP6_FRAG_H */
GLenum src
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
s8_t err_t
Definition: err.h:96
static char * dest
Definition: rtl.c:135
#define ip6_frag
Definition: netiodef.h:210
typedefPACK_STRUCT_END struct ip6_addr_packed ip6_addr_p_t
Definition: ip6.h:62
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: ip6.h:82
Definition: netif.h:269
Definition: pbuf.h:186
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList