2 * The olsr.org Optimized Link-State Routing daemon(olsrd)
3 * Copyright (c) 2004, Thomas Lopatic (thomas@lopatic.de)
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of olsr.org, olsrd nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
33 * Visit http://www.olsr.org for more information.
35 * If you find this software useful feel free to make a donation
36 * to the project. For more information see the website or contact
37 * the copyright holders.
47 #include "lq_packet.h"
50 #define LINK_COST_BROKEN 65535
51 #define ROUTE_COST_BROKEN (0xffffffff)
52 #define ZERO_ROUTE_COST 0
55 olsr_linkcost (*calc_hello_cost)(const void *lq);
56 olsr_linkcost (*calc_tc_cost)(const void *lq);
58 olsr_bool (*is_relevant_costchange)(olsr_linkcost c1, olsr_linkcost c2);
60 olsr_linkcost (*packet_loss_handler)(void *lq, olsr_bool lost);
62 void (*memorize_foreign_hello)(void *local, void *foreign);
63 void (*copy_link_lq_into_tc)(void *target, void *source);
64 void (*clear_hello)(void *target);
65 void (*clear_tc)(void *target);
67 int (*serialize_hello_lq)(unsigned char *buff, void *lq);
68 int (*serialize_tc_lq)(unsigned char *buff, void *lq);
69 void (*deserialize_hello_lq)(const olsr_u8_t **curr, void *lq);
70 void (*deserialize_tc_lq)(const olsr_u8_t **curr, void *lq);
72 char *(*print_hello_lq)(void *ptr);
73 char *(*print_tc_lq)(void *ptr);
74 char *(*print_cost)(olsr_linkcost cost);
80 void set_lq_handler(struct lq_handler *handler, char *name);
82 olsr_linkcost olsr_calc_tc_cost(const struct tc_edge_entry *);
83 olsr_bool olsr_is_relevant_costchange(olsr_linkcost c1, olsr_linkcost c2);
85 int olsr_serialize_hello_lq_pair(unsigned char *buff, struct lq_hello_neighbor *neigh);
86 void olsr_deserialize_hello_lq_pair(const olsr_u8_t **curr, struct hello_neighbor *neigh);
87 int olsr_serialize_tc_lq_pair(unsigned char *buff, struct tc_mpr_addr *neigh);
88 void olsr_deserialize_tc_lq_pair(const olsr_u8_t **curr, struct tc_edge_entry *edge);
90 void olsr_update_packet_loss_worker(struct link_entry *entry, olsr_bool lost);
91 void olsr_memorize_foreign_hello_lq(struct link_entry *local, struct hello_neighbor *foreign);
93 char *get_link_entry_text(struct link_entry *entry);
94 char *get_tc_edge_entry_text(struct tc_edge_entry *entry);
95 const char *get_linkcost_text(olsr_linkcost cost, olsr_bool route);
97 void olsr_copy_hello_lq(struct lq_hello_neighbor *target, struct link_entry *source);
98 void olsr_copylq_link_entry_2_tc_mpr_addr(struct tc_mpr_addr *target, struct link_entry *source);
99 void olsr_copylq_link_entry_2_tc_edge_entry(struct tc_edge_entry *target, struct link_entry *source);
100 void olsr_clear_tc_lq(struct tc_mpr_addr *target);
102 struct hello_neighbor *olsr_malloc_hello_neighbor(const char *id);
103 struct tc_mpr_addr *olsr_malloc_tc_mpr_addr(const char *id);
104 struct lq_hello_neighbor *olsr_malloc_lq_hello_neighbor(const char *id);
105 struct link_entry *olsr_malloc_link_entry(const char *id);
106 struct tc_edge_entry *olsr_malloc_tc_edge_entry(const char *id);
108 #endif /*LQPLUGIN_H_*/