BA
/
BaBoRo1
Embed:
(wiki syntax)
Show/hide line numbers
ipv6.h
00001 /* 00002 * Copyright (c) 2013-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 00018 #ifndef _IPV6_H 00019 #define _IPV6_H 00020 00021 #include "Core/include/ns_buffer.h" 00022 #include "Common_Protocols/ipv6_constants.h" 00023 00024 extern uint16_t ipv6_header_size_required(buffer_t *buf); 00025 extern uint16_t ipv6_max_unfragmented_payload(buffer_t *buf, uint16_t mtu_limit); 00026 extern uint16_t ipv6_mtu(buffer_t *buf); 00027 00028 extern buffer_routing_info_t *ipv6_buffer_route_to(buffer_t *buf, const uint8_t *next_hop, struct protocol_interface_info_entry *next_if); 00029 extern buffer_routing_info_t *ipv6_buffer_route(buffer_t *buf); 00030 00031 typedef enum ipv6_exthdr_stage { 00032 IPV6_EXTHDR_SIZE, 00033 IPV6_EXTHDR_INSERT, 00034 IPV6_EXTHDR_MODIFY 00035 } ipv6_exthdr_stage_t; 00036 00037 #define IPV6_EXTHDR_MODIFY_TUNNEL 1 00038 00039 /* Hooks for routing code to insert/modify IPv6 extension headers. 00040 * 00041 * IPV6_EXTHDR_SIZE: buffer not yet fully formed, but we know the final 00042 * destination. Can perform routing decision. Call should set result to total size 00043 * of extension header that would be inserted by IPV6_EXTHDR_INSERT. 00044 * 00045 * IPV6_EXTHDR_INSERT: we are about to add IP header - provider can 00046 * prepend extension headers, and modify options.type to new outer NH. 00047 * (We do not support extension headers from more than one source per packet). 00048 * These headers can be placeholders, with filling deferred until 00049 * IPV6_EXTHDR_MODIFY. If a source routing header is inserted, buffer dst_sa 00050 * should be changed from final destination to next IP destination. 00051 * XXX no - won't work. Separate mechanism for varying IP dest? 00052 * 00053 * IPV6_EXTHDR_MODIFY: the buffer contains an existing complete IP packet, 00054 * possibly generated internally, and possibly received externally. Provider 00055 * can update fields in extension headers it knows. 00056 * 00057 * If it needs to insert headers that are not present, it can force insertion 00058 * into a tunnel, by: 00059 * setting dst_sa and src_sa appropriate for the tunnel endpoints 00060 * XXX does this work out okay with dest cache and PMTU? 00061 * updating route info like next hop if necessary (probably not) 00062 * returning IPV6_EXTHDR_MODIFY_TUNNEL 00063 * During new header formation for the tunnel, IPV6_EXTHDR_INSERT will be 00064 * called again, and obviously it must ensure headers are inserted so that 00065 * IPV6_EXTHDR_MODIFY doesn't request to tunnel a second time. 00066 * 00067 * In all cases, a negative value in result indicates error. 00068 */ 00069 typedef buffer_t *ipv6_exthdr_provider_fn_t(buffer_t *buf, ipv6_exthdr_stage_t stage, int16_t *result); 00070 void ipv6_set_exthdr_provider(ipv6_route_src_t src, ipv6_exthdr_provider_fn_t *fn); 00071 00072 extern buffer_t *ipv6_down(buffer_t *buf); 00073 extern buffer_t *ipv6_forwarding_down(buffer_t *buf); 00074 extern buffer_t *ipv6_forwarding_up(buffer_t *buf); 00075 00076 void ipv6_transmit_multicast_on_interface(buffer_t *buf, struct protocol_interface_info_entry *cur); 00077 00078 #endif /* _IPV6_H */
Generated on Tue Jul 12 2022 12:21:57 by
