Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mld.h
00001 /** 00002 * @file mld.h 00003 * @brief MLD (Multicast Listener Discovery 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 _MLD_H 00030 #define _MLD_H 00031 00032 //Dependencies 00033 #include "core/net.h" 00034 00035 //MLD support 00036 #ifndef MLD_SUPPORT 00037 #define MLD_SUPPORT DISABLED 00038 #elif (MLD_SUPPORT != ENABLED && MLD_SUPPORT != DISABLED) 00039 #error MLD_SUPPORT parameter is not valid 00040 #endif 00041 00042 //MLD tick interval 00043 #ifndef MLD_TICK_INTERVAL 00044 #define MLD_TICK_INTERVAL 1000 00045 #elif (MLD_TICK_INTERVAL < 10) 00046 #error MLD_TICK_INTERVAL parameter is not valid 00047 #endif 00048 00049 //Unsolicited report interval 00050 #ifndef MLD_UNSOLICITED_REPORT_INTERVAL 00051 #define MLD_UNSOLICITED_REPORT_INTERVAL 10000 00052 #elif (MLD_UNSOLICITED_REPORT_INTERVAL < 1000) 00053 #error MLD_UNSOLICITED_REPORT_INTERVAL parameter is not valid 00054 #endif 00055 00056 //Hop Limit used by MLD messages 00057 #define MLD_HOP_LIMIT 1 00058 00059 00060 /** 00061 * @brief MLD node states 00062 **/ 00063 00064 typedef enum 00065 { 00066 MLD_STATE_NON_LISTENER = 0, 00067 MLD_STATE_DELAYING_LISTENER = 1, 00068 MLD_STATE_IDLE_LISTENER = 2 00069 } MldState; 00070 00071 00072 //CodeWarrior or Win32 compiler? 00073 #if defined(__CWCC__) || defined(_WIN32) 00074 #pragma pack(push, 1) 00075 #endif 00076 00077 00078 /** 00079 * @brief MLD message 00080 **/ 00081 00082 typedef __start_packed struct 00083 { 00084 uint8_t type; //0 00085 uint8_t code; //1 00086 uint16_t checksum; //2-3 00087 uint16_t maxRespDelay; //4-5 00088 uint16_t reserved; //6-7 00089 Ipv6Addr multicastAddr; //8-23 00090 } __end_packed MldMessage; 00091 00092 00093 //CodeWarrior or Win32 compiler? 00094 #if defined(__CWCC__) || defined(_WIN32) 00095 #pragma pack(pop) 00096 #endif 00097 00098 00099 //Tick counter to handle periodic operations 00100 extern systime_t mldTickCounter; 00101 00102 //MLD related functions 00103 error_t mldInit(NetInterface *interface); 00104 error_t mldStartListening(NetInterface *interface, Ipv6FilterEntry *entry); 00105 error_t mldStopListening(NetInterface *interface, Ipv6FilterEntry *entry); 00106 00107 void mldTick(NetInterface *interface); 00108 void mldLinkChangeEvent(NetInterface *interface); 00109 00110 void mldProcessListenerQuery(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, 00111 const NetBuffer *buffer, size_t offset, uint8_t hopLimit); 00112 00113 void mldProcessListenerReport(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, 00114 const NetBuffer *buffer, size_t offset, uint8_t hopLimit); 00115 00116 error_t mldSendListenerReport(NetInterface *interface, Ipv6Addr *ipAddr); 00117 error_t mldSendListenerDone(NetInterface *interface, Ipv6Addr *ipAddr); 00118 00119 uint32_t mldRand(uint32_t max); 00120 00121 void mldDumpMessage(const MldMessage *message); 00122 00123 #endif 00124
Generated on Tue Jul 12 2022 17:10:15 by
1.7.2