00001 /* 00002 * Copyright (c) 2010, FIP AUTHORS 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * 1) Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 00011 * 2) Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 00015 * 3) Neither the name of the FIP AUTHORS nor the names of its contributors 00016 * may be used to endorse or promote products derived from this software 00017 * without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00023 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 * POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 /* 00032 * fip_route6.h 00033 * 00034 * Created on: 28-Jul-2010 00035 * Author: colin 00036 */ 00037 00038 #ifndef FIP_ROUTE6_H_ 00039 #define FIP_ROUTE6_H_ 00040 00041 #define METRIC_BEST (0) 00042 #define METRIC_DEFRT (128) 00043 #define METRIC_WORST (255) 00044 00045 /** IPv6 Routes with additional state */ 00046 typedef struct 00047 { 00048 fip_routestate_t state; /**< Route state (unused, used, etc) */ 00049 unsigned char length; /**< Route length in bits */ 00050 unsigned char metric; /**< Route metric (low is better) */ 00051 fip_ifnum_t interfaceNext; /**< Next-hop interface */ 00052 fip_bool_t advRoute; /**< For routers, flag that indicates if we advertise this prefix */ 00053 fip_vlifetime_t validLifetime; /**< When advertising the route, how long this is valid for */ 00054 fip_vlifetime_t expireTime32S; /**< When in seconds since system start the route expires, 0 = Never */ 00055 fip_ip6addr_t route; /**< Route itself */ 00056 fip_ip6addr_t nextHop; /**< Next hop IPv6 Address */ 00057 } fip_myip6route_t; 00058 00059 typedef fip_ds6_searchStatus_t fip_route6_searchStatus_t; 00060 00061 fip_return_t fip_route6_addRoute(const unsigned char route[], unsigned char routeLen, 00062 unsigned char metric, fip_ifnum_t interface, 00063 fip_vlifetime_t lifetime, const fip_ip6addr_t * const nextHop, 00064 fip_bool_t advRoute); 00065 fip_route6_searchStatus_t fip_route6_findRouteByDestination(const unsigned char * route, unsigned char routeLen); 00066 fip_route6_searchStatus_t fip_route6_findRouteByNextHop(const fip_ip6addr_t * const nextHop); 00067 fip_ds6_searchStatus_t fip_route6_findBestRoute(const fip_ip6addr_t * const destination); 00068 void fip_route6_process(void); 00069 const fip_ip6addr_t * fip_route6_getNextHop(void); 00070 00071 extern fip_myip6route_t fip_routingTable[FIP_CONF_MAX_ROUTES]; 00072 00073 #endif /* FIP_ROUTE6_H_ */