mikroSDK Reference Manual
ipv6_frag.h
Go to the documentation of this file.
1
31#ifndef _IPV6_FRAG_H
32#define _IPV6_FRAG_H
33
34//Dependencies
35#include "core/net.h"
36#include "ipv6/ipv6.h"
37
38//IPv6 fragmentation support
39#ifndef IPV6_FRAG_SUPPORT
40 #define IPV6_FRAG_SUPPORT ENABLED
41#elif (IPV6_FRAG_SUPPORT != ENABLED && IPV6_FRAG_SUPPORT != DISABLED)
42 #error IPV6_FRAG_SUPPORT parameter is not valid
43#endif
44
45//Support for overlapping fragments
46#ifndef IPV6_OVERLAPPING_FRAG_SUPPORT
47 #define IPV6_OVERLAPPING_FRAG_SUPPORT DISABLED
48#elif (IPV6_OVERLAPPING_FRAG_SUPPORT != ENABLED && IPV6_OVERLAPPING_FRAG_SUPPORT != DISABLED)
49 #error IPV6_OVERLAPPING_FRAG_SUPPORT parameter is not valid
50#endif
51
52//Reassembly algorithm tick interval
53#ifndef IPV6_FRAG_TICK_INTERVAL
54 #define IPV6_FRAG_TICK_INTERVAL 1000
55#elif (IPV6_FRAG_TICK_INTERVAL < 10)
56 #error IPV6_FRAG_TICK_INTERVAL parameter is not valid
57#endif
58
59//Maximum number of fragmented packets the host will accept
60//and hold in the reassembly queue simultaneously
61#ifndef IPV6_MAX_FRAG_DATAGRAMS
62 #define IPV6_MAX_FRAG_DATAGRAMS 4
63#elif (IPV6_MAX_FRAG_DATAGRAMS < 1)
64 #error IPV6_MAX_FRAG_DATAGRAMS parameter is not valid
65#endif
66
67//Maximum datagram size the host will accept when reassembling fragments
68#ifndef IPV6_MAX_FRAG_DATAGRAM_SIZE
69 #define IPV6_MAX_FRAG_DATAGRAM_SIZE 8192
70#elif (IPV6_MAX_FRAG_DATAGRAM_SIZE < 1280)
71 #error IPV6_MAX_FRAG_DATAGRAM_SIZE parameter is not valid
72#endif
73
74//Maximum time an IPv6 fragment can spend waiting to be reassembled
75#ifndef IPV6_FRAG_TIME_TO_LIVE
76 #define IPV6_FRAG_TIME_TO_LIVE 15000
77#elif (IPV6_FRAG_TIME_TO_LIVE < 1000)
78 #error IPV6_FRAG_TIME_TO_LIVE parameter is not valid
79#endif
80
81//Infinity is implemented by a very large integer
82#define IPV6_INFINITY 0xFFFF
83
84//C++ guard
85#ifdef __cplusplus
86extern "C" {
87#endif
88
89
90//CodeWarrior or Win32 compiler?
91#if defined(__CWCC__) || defined(_WIN32)
92 #pragma pack(push, 1)
93#endif
94
95
101{
102 uint16_t first;
103 uint16_t last;
104 uint16_t next;
105} Ipv6HoleDesc;
106
107
108//CodeWarrior or Win32 compiler?
109#if defined(__CWCC__) || defined(_WIN32)
110 #pragma pack(pop)
111#endif
112
113
118typedef struct
119{
120 uint_t chunkCount;
121 uint_t maxChunkCount;
122 ChunkDesc chunk[N(IPV6_MAX_FRAG_DATAGRAM_SIZE) + 1];
124
125
139
140
141//Tick counter to handle periodic operations
142extern systime_t ipv6FragTickCounter;
143
144//IPv6 datagram fragmentation and reassembly
145error_t ipv6FragmentDatagram(NetInterface *interface,
146 const Ipv6PseudoHeader *pseudoHeader, const NetBuffer *payload,
147 size_t payloadOffset, size_t pathMtu, NetTxAncillary *ancillary);
148
149void ipv6ParseFragmentHeader(NetInterface *interface, const NetBuffer *ipPacket,
150 size_t ipPacketOffset, size_t fragHeaderOffset, size_t nextHeaderOffset,
151 NetRxAncillary *ancillary);
152
153void ipv6FragTick(NetInterface *interface);
154
155Ipv6FragDesc *ipv6SearchFragQueue(NetInterface *interface,
156 const Ipv6Header *packet, const Ipv6FragmentHeader *header);
157
158void ipv6FlushFragQueue(NetInterface *interface);
159
160Ipv6HoleDesc *ipv6FindHole(Ipv6FragDesc *frag, uint16_t offset);
161void ipv6DumpHoleList(Ipv6FragDesc *frag);
162
163//C++ guard
164#ifdef __cplusplus
165}
166#endif
167
168#endif
error_t
Error codes.
Definition error.h:43
IPv6 (Internet Protocol Version 6)
typedef __packed_struct
Hole descriptor.
Definition ipv6_frag.h:101
TCP/IP stack core.
uint32_t systime_t
System time.
Definition os_port_none.h:90
Structure describing a chunk of data.
Definition net_mem.h:77
Fragmented packet descriptor.
Definition ipv6_frag.h:131
size_t fragPartLength
Length of the fragmentable part.
Definition ipv6_frag.h:135
uint32_t identification
Fragment identification field.
Definition ipv6_frag.h:133
size_t unfragPartLength
Length of the unfragmentable part.
Definition ipv6_frag.h:134
uint16_t firstHole
Index of the first hole.
Definition ipv6_frag.h:136
systime_t timestamp
Time at which the first fragment was received.
Definition ipv6_frag.h:132
Ipv6ReassemblyBuffer buffer
Buffer containing the reassembled datagram.
Definition ipv6_frag.h:137
Reassembly buffer.
Definition ipv6_frag.h:119
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89