1 /* 2 * The olsr.org Optimized Link-State Routing daemon (olsrd) 3 * 4 * (c) by the OLSR project 5 * 6 * See our Git repository to find out who worked on this file 7 * and thus is a copyright holder on it. 8 * 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 15 * * Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * * Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in 19 * the documentation and/or other materials provided with the 20 * distribution. 21 * * Neither the name of olsr.org, olsrd nor the names of its 22 * contributors may be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 28 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 * 38 * Visit http://www.olsr.org for more information. 39 * 40 * If you find this software useful feel free to make a donation 41 * to the project. For more information see the website or contact 42 * the copyright holders. 43 * 44 */ 45 46 #ifndef _OLSR_MID 47 #define _OLSR_MID 48 49 #include "olsr_types.h" 50 #include "hashing.h" 51 #include "mantissa.h" 52 #include "packet.h" 53 54 struct mid_address { 55 union olsr_ip_addr alias; 56 struct mid_entry *main_entry; 57 struct mid_address *next_alias; 58 uint32_t vtime; 59 60 /* These are for the reverse list */ 61 struct mid_address *prev; 62 struct mid_address *next; 63 }; 64 65 /* 66 * Contains the main addr of a node and a list of aliases 67 */ 68 struct mid_entry { 69 union olsr_ip_addr main_addr; 70 struct mid_address *aliases; 71 struct mid_entry *prev; 72 struct mid_entry *next; 73 struct timer_entry *mid_timer; 74 }; 75 76 #define OLSR_MID_JITTER 5 /* percent */ 77 78 extern struct mid_entry mid_set[HASHSIZE]; 79 extern struct mid_address reverse_mid_set[HASHSIZE]; 80 81 int olsr_init_mid_set(void); 82 void olsr_delete_all_mid_entries(void); 83 void olsr_cleanup_mid(union olsr_ip_addr *); 84 void insert_mid_alias(union olsr_ip_addr *, const union olsr_ip_addr *, olsr_reltime); 85 union olsr_ip_addr *mid_lookup_main_addr(const union olsr_ip_addr *); 86 struct mid_address *mid_lookup_aliases(const union olsr_ip_addr *); 87 struct mid_entry *mid_lookup_entry_bymain(const union olsr_ip_addr *); 88 void olsr_print_mid_set(void); 89 int olsr_update_mid_table(const union olsr_ip_addr *, olsr_reltime); 90 void olsr_delete_mid_entry(struct mid_entry *); 91 bool olsr_input_mid(union olsr_message *, struct interface_olsr *, union olsr_ip_addr *); 92 93 #endif /* _OLSR_MID */ 94 95 /* 96 * Local Variables: 97 * c-basic-offset: 2 98 * indent-tabs-mode: nil 99 * End: 100 */ 101