00001 /*************************************************************************** 00002 * Copyright (C) 2004 by Francisco J. Ros * 00003 * fjrm@dif.um.es * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00025 00026 #ifndef __OLSR_repositories_h__ 00027 #define __OLSR_repositories_h__ 00028 00029 #include <set> 00030 #include <vector> 00031 #include <config.h> 00032 00034 typedef struct OLSR_rt_entry { 00035 nsaddr_t dest_addr_; 00036 nsaddr_t next_addr_; 00037 nsaddr_t iface_addr_; 00038 u_int32_t dist_; 00039 00040 inline nsaddr_t& dest_addr() { return dest_addr_; } 00041 inline nsaddr_t& next_addr() { return next_addr_; } 00042 inline nsaddr_t& iface_addr() { return iface_addr_; } 00043 inline u_int32_t& dist() { return dist_; } 00044 } OLSR_rt_entry; 00045 00047 typedef struct OLSR_iface_assoc_tuple { 00049 nsaddr_t iface_addr_; 00051 nsaddr_t main_addr_; 00053 double time_; 00054 00055 inline nsaddr_t& iface_addr() { return iface_addr_; } 00056 inline nsaddr_t& main_addr() { return main_addr_; } 00057 inline double& time() { return time_; } 00058 } OLSR_iface_assoc_tuple; 00059 00061 typedef struct OLSR_link_tuple { 00063 nsaddr_t local_iface_addr_; 00065 nsaddr_t nb_iface_addr_; 00067 double sym_time_; 00069 double asym_time_; 00071 double lost_time_; 00073 double time_; 00074 00075 inline nsaddr_t& local_iface_addr() { return local_iface_addr_; } 00076 inline nsaddr_t& nb_iface_addr() { return nb_iface_addr_; } 00077 inline double& sym_time() { return sym_time_; } 00078 inline double& asym_time() { return asym_time_; } 00079 inline double& lost_time() { return lost_time_; } 00080 inline double& time() { return time_; } 00081 } OLSR_link_tuple; 00082 00084 typedef struct OLSR_nb_tuple { 00086 nsaddr_t nb_main_addr_; 00088 u_int8_t status_; 00090 u_int8_t willingness_; 00091 00092 inline nsaddr_t& nb_main_addr() { return nb_main_addr_; } 00093 inline u_int8_t& status() { return status_; } 00094 inline u_int8_t& willingness() { return willingness_; } 00095 } OLSR_nb_tuple; 00096 00098 typedef struct OLSR_nb2hop_tuple { 00100 nsaddr_t nb_main_addr_; 00102 nsaddr_t nb2hop_addr_; 00104 double time_; 00105 00106 inline nsaddr_t& nb_main_addr() { return nb_main_addr_; } 00107 inline nsaddr_t& nb2hop_addr() { return nb2hop_addr_; } 00108 inline double& time() { return time_; } 00109 } OLSR_nb2hop_tuple; 00110 00112 typedef struct OLSR_mprsel_tuple { 00114 nsaddr_t main_addr_; 00116 double time_; 00117 00118 inline nsaddr_t& main_addr() { return main_addr_; } 00119 inline double& time() { return time_; } 00120 } OLSR_mprsel_tuple; 00121 00123 typedef std::vector<nsaddr_t> addr_list_t; 00124 00126 typedef struct OLSR_dup_tuple { 00128 nsaddr_t addr_; 00130 u_int16_t seq_num_; 00132 bool retransmitted_; 00134 addr_list_t iface_list_; 00136 double time_; 00137 00138 inline nsaddr_t& addr() { return addr_; } 00139 inline u_int16_t& seq_num() { return seq_num_; } 00140 inline bool& retransmitted() { return retransmitted_; } 00141 inline addr_list_t& iface_list() { return iface_list_; } 00142 inline double& time() { return time_; } 00143 } OLSR_dup_tuple; 00144 00146 typedef struct OLSR_topology_tuple { 00148 nsaddr_t dest_addr_; 00150 nsaddr_t last_addr_; 00152 u_int16_t seq_; 00154 double time_; 00155 00156 inline nsaddr_t& dest_addr() { return dest_addr_; } 00157 inline nsaddr_t& last_addr() { return last_addr_; } 00158 inline u_int16_t& seq() { return seq_; } 00159 inline double& time() { return time_; } 00160 } OLSR_topology_tuple; 00161 00162 00163 typedef std::set<nsaddr_t> mprset_t; 00164 typedef std::vector<OLSR_mprsel_tuple*> mprselset_t; 00165 typedef std::vector<OLSR_link_tuple*> linkset_t; 00166 typedef std::vector<OLSR_nb_tuple*> nbset_t; 00167 typedef std::vector<OLSR_nb2hop_tuple*> nb2hopset_t; 00168 typedef std::vector<OLSR_topology_tuple*> topologyset_t; 00169 typedef std::vector<OLSR_dup_tuple*> dupset_t; 00170 typedef std::vector<OLSR_iface_assoc_tuple*> ifaceassocset_t; 00171 00172 #endif