Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ipv6_misc.h Source File

ipv6_misc.h

Go to the documentation of this file.
00001 /**
00002  * @file ipv6_misc.h
00003  * @brief Helper functions for IPv6
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_MISC_H
00030 #define _IPV6_MISC_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "ipv6/ipv6.h"
00035 
00036 //IPv6 related functions
00037 Ipv6AddrState ipv6GetAddrState(NetInterface *interface, const Ipv6Addr *addr);
00038 
00039 error_t ipv6SetAddr(NetInterface *interface, uint_t index, const Ipv6Addr *addr,
00040    Ipv6AddrState state, systime_t validLifetime, systime_t preferredLifetime, bool_t permanent);
00041 
00042 void ipv6AddAddr(NetInterface *interface, const Ipv6Addr *addr,
00043    uint32_t validLifetime, uint32_t preferredLifetime);
00044 
00045 void ipv6RemoveAddr(NetInterface *interface, const Ipv6Addr *addr);
00046 
00047 void ipv6AddPrefix(NetInterface *interface, const Ipv6Addr *prefix,
00048    uint_t length, uint32_t validLifetime, uint32_t preferredLifetime);
00049 
00050 void ipv6RemovePrefix(NetInterface *interface, const Ipv6Addr *prefix, uint_t length);
00051 
00052 void ipv6AddDefaultRouter(NetInterface *interface,
00053    const Ipv6Addr *addr, uint16_t lifetime);
00054 
00055 void ipv6RemoveDefaultRouter(NetInterface *interface, const Ipv6Addr *addr);
00056 
00057 void ipv6FlushAddrList(NetInterface *interface);
00058 void ipv6FlushPrefixList(NetInterface *interface);
00059 void ipv6FlushDefaultRouterList(NetInterface *interface);
00060 void ipv6FlushDnsServerList(NetInterface *interface);
00061 
00062 error_t ipv6CheckSourceAddr(NetInterface *interface, const Ipv6Addr *ipAddr);
00063 error_t ipv6CheckDestAddr(NetInterface *interface, const Ipv6Addr *ipAddr);
00064 
00065 error_t ipv6SelectSourceAddr(NetInterface **interface,
00066    const Ipv6Addr *destAddr, Ipv6Addr *srcAddr);
00067 
00068 bool_t ipv6IsOnLink(NetInterface *interface, const Ipv6Addr *ipAddr);
00069 bool_t ipv6IsTentativeAddr(NetInterface *interface, const Ipv6Addr *ipAddr);
00070 bool_t ipv6IsAnycastAddr(NetInterface *interface, const Ipv6Addr *ipAddr);
00071 
00072 bool_t ipv6CompPrefix(const Ipv6Addr *ipAddr1, const Ipv6Addr *ipAddr2, size_t length);
00073 
00074 uint_t ipv6GetAddrScope(const Ipv6Addr *ipAddr);
00075 uint_t ipv6GetMulticastAddrScope(const Ipv6Addr *ipAddr);
00076 uint_t ipv6GetCommonPrefixLength(const Ipv6Addr *ipAddr1, const Ipv6Addr *ipAddr2);
00077 
00078 error_t ipv6ComputeSolicitedNodeAddr(const Ipv6Addr *ipAddr,
00079    Ipv6Addr *solicitedNodeAddr);
00080 
00081 error_t ipv6MapMulticastAddrToMac(const Ipv6Addr *ipAddr, MacAddr *macAddr);
00082 
00083 void ipv6GenerateLinkLocalAddr(const Eui64* interfaceId, Ipv6Addr *ipAddr);
00084 
00085 #endif
00086