Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ipv6_fragmentation.h Source File

ipv6_fragmentation.h

00001 /*
00002  * Copyright (c) 2015-2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef IPV6_FRAGMENTATION_H_
00018 #define IPV6_FRAGMENTATION_H_
00019 
00020 #ifndef NO_IP_FRAGMENT_RX
00021 
00022 #include "Common_Protocols/ipv6_constants.h"
00023 #include "Core/include/ns_buffer.h"
00024 
00025 /* How large a fragmented packet are we prepared to handle? */
00026 /* Must be a multiple of 8. This default can be overridden. */
00027 #ifndef IPV6_FRAG_MRU
00028 #define IPV6_FRAG_MRU 1504
00029 #endif
00030 
00031 #if IPV6_FRAG_MRU & 7
00032 #error IPV6_FRAG_MRU must be a multiple of 8
00033 #endif
00034 
00035 /* Note that the MRU above applies only to fragmented packets. RFC 2460 says:
00036  *
00037  *  From each link to which a node is directly attached, the node must be
00038  *  able to accept packets as large as that link's MTU.
00039  *
00040  * The IP spec doesn't seem to be explicit, but it is generally assumed that the
00041  * MRU should be greater than or equal to the MTU of every link - we shouldn't
00042  * refuse a packet just because it was fragmented.
00043  */
00044 
00045 #if IPV6_FRAG_MRU < IPV6_MIN_FRAG_MRU
00046 #error "IPV6_MRU too small"
00047 #endif
00048 
00049 uint16_t ipv6_frag_set_mru(uint16_t frag_mru);
00050 
00051 void ipv6_frag_timer(uint8_t secs);
00052 buffer_t *ipv6_frag_up(buffer_t *buf, const uint8_t *ptr, uint8_t *nh_ptr, uint16_t payload_length);
00053 #else
00054 #define ipv6_set_frag_mru(frag_mru) 0
00055 #define ipv6_frag_timer(secs) ((void) 0)
00056 #endif /* NO_IP_FRAGMENT_RX */
00057 
00058 #ifndef NO_IP_FRAGMENT_TX
00059 buffer_t *ipv6_frag_down(buffer_t *dgram_buf);
00060 #else
00061 #define ipv6_frag_down(buf) buffer_free(buf)
00062 #endif /* NO_IP_FRAGMENT_TX */
00063 
00064 #endif /* IPV6_FRAGMENTATION_H_ */