00001 /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */ 00002 /* 00003 * Copyright (c) 1997 Regents of the University of California. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 3. All advertising materials mentioning features or use of this software 00015 * must display the following acknowledgement: 00016 * This product includes software developed by the Computer Systems 00017 * Engineering Group at Lawrence Berkeley Laboratory. 00018 * 4. Neither the name of the University nor of the Laboratory may be used 00019 * to endorse or promote products derived from this software without 00020 * specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00023 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00028 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00029 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00031 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00032 * SUCH DAMAGE. 00033 */ 00034 /* Ported from CMU/Monarch's code*/ 00035 00036 #ifndef __tora_dest_h__ 00037 #define __tora_dest_h__ 00038 00039 class TORANeighbor; 00040 class toraAgent; 00041 00042 LIST_HEAD(tn_head, TORANeighbor); 00043 00044 class TORADest { 00045 friend class toraAgent; 00046 public: 00047 TORADest(nsaddr_t id, Agent *a); 00048 00049 TORANeighbor* nb_add(nsaddr_t id); 00050 int nb_del(nsaddr_t id); 00051 TORANeighbor* nb_find(nsaddr_t id); 00052 00053 void update_height_nb(TORANeighbor* tn, 00054 struct hdr_tora_upd *uh); 00055 void update_height(double TAU, nsaddr_t OID, 00056 int R, int DELTA, nsaddr_t ID); 00057 00058 int nb_check_same_ref(void); 00059 00060 /* 00061 * Finds the minimum height neighbor whose lnk_stat is DN. 00062 */ 00063 TORANeighbor* nb_find_next_hop(); 00064 00065 TORANeighbor* nb_find_height(int R); 00066 TORANeighbor* nb_find_max_height(void); 00067 TORANeighbor* nb_find_min_height(int R); 00068 TORANeighbor* nb_find_min_nonnull_height(Height *h); 00069 00070 void dump(void); 00071 00072 private: 00073 LIST_ENTRY(TORADest) link; 00074 00075 nsaddr_t index; // IP address of destination 00076 Height height; // 5-tuple height of this node 00077 int rt_req; // route required flag 00078 double time_upd; // time last UPD packet was sent 00079 00080 double time_tx_qry; // time sent last QUERY 00081 double time_rt_req; // time rt_req last set - JGB 00082 00083 tn_head nblist; // List of neighbors. 00084 int num_active; // # active links 00085 int num_down; // # down stream links 00086 int num_up; // # up stream links 00087 00088 toraAgent *agent; 00089 }; 00090 00091 #endif // __tora_dest_h__ 00092