Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ipv6_routing.h Source File

ipv6_routing.h

Go to the documentation of this file.
00001 /**
00002  * @file ipv6_routing.h
00003  * @brief IPv6 routing
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This file is part of CycloneTCP Open.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software Foundation,
00023  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024  *
00025  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00026  * @version 1.7.6
00027  **/
00028 
00029 #ifndef _IPV6_ROUTING_H
00030 #define _IPV6_ROUTING_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "ipv6/ipv6.h"
00035 
00036 //IPv6 routing support
00037 #ifndef IPV6_ROUTING_SUPPORT
00038    #define IPV6_ROUTING_SUPPORT DISABLED
00039 #elif (IPV6_ROUTING_SUPPORT != ENABLED && IPV6_ROUTING_SUPPORT != DISABLED)
00040    #error IPV6_ROUTING_SUPPORT parameter is not valid
00041 #endif
00042 
00043 //Size of the IPv6 routing table
00044 #ifndef IPV6_ROUTING_TABLE_SIZE
00045    #define IPV6_ROUTING_TABLE_SIZE 8
00046 #elif (IPV6_ROUTING_TABLE_SIZE < 1)
00047    #error IPV6_ROUTING_TABLE_SIZE parameter is not valid
00048 #endif
00049 
00050 
00051 /**
00052  * @brief Routing table entry
00053  **/
00054 
00055 typedef struct
00056 {
00057    bool_t valid;            ///<Valid entry
00058    Ipv6Addr prefix;         ///<Destination
00059    uint_t prefixLength;     ///<IPv6 prefix length
00060    NetInterface *interface; ///<Outgoing network interface
00061    Ipv6Addr nextHop;        ///<Next hop
00062    uint_t metric;           ///<Metric value
00063 } Ipv6RoutingTableEntry;
00064 
00065 
00066 //IPv6 routing related functions
00067 error_t ipv6InitRouting(void);
00068 error_t ipv6EnableRouting(NetInterface *interface, bool_t enable);
00069 
00070 error_t ipv6AddRoute(const Ipv6Addr *prefix, uint_t prefixLength,
00071    NetInterface *interface, const Ipv6Addr *nextHop, uint_t metric);
00072 
00073 error_t ipv6DeleteRoute(const Ipv6Addr *prefix, uint_t prefixLength);
00074 error_t ipv6DeleteAllRoutes(void);
00075 
00076 error_t ipv6ForwardPacket(NetInterface *srcInterface,
00077    NetBuffer *ipPacket, size_t ipPacketOffset);
00078 
00079 #endif
00080