Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

SatNode Class Reference

#include <satnode.h>

Inheritance diagram for SatNode:

Inheritance graph
[legend]
Collaboration diagram for SatNode:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SatNode ()
SatRouteAgentragent ()
SatPositionposition ()
SatTracetrace ()
Channeluplink ()
Channeldownlink ()
int address ()
int nodeid ()
bool exist_namchan () const
virtual void namlog (const char *fmt,...)
NsObjectintf_to_target (int32_t)
void insert (struct node_head *head)
Nodenextnode ()
const struct if_head & ifhead () const
const struct linklist_head & linklisthead () const
void addNeighbor (Node *node)
void route_notify (RoutingModule *rtm)
void unreg_route_notify (RoutingModule *rtm)
void add_route (char *dst, NsObject *target)
void delete_route (char *dst, NsObject *nullagent)
void set_table_size (int nn)
void set_table_size (int level, int csize)
EnergyModelenergy_model ()
Locationlocation ()
void Update (void)
void UpdateNeighbors (void)
void Dump (void)
virtual const NodeWeight_t NextAdj (const NodeWeight_t &)
virtual void AddAdj (nodeid_t a, int w=1)
virtual NixPair_t GetNix (nodeid_t)
virtual Nixl_t GetNixl ()
virtual nodeid_t GetNeighbor (Nix_t)

Static Public Member Functions

int addNode (int)
int IsASatNode (int)
Nodeget_node_by_address (nsaddr_t)

Public Attributes

neighbor_list_nodeneighbor_list_
double time_arrival
double time_transition
int route_changes
int link_changes
Neighborneighbor
EdgeVec_t m_Adj
nodeid_t m_id

Static Public Attributes

int dist_routing_ = 0
node_head nodehead_

Protected Member Functions

int command (int argc, const char *const *argv)
void dumpSats ()
 LIST_ENTRY (Node) entry
void namdump ()

Protected Attributes

SatRouteAgentragent_
SatChanneluplink_
SatChanneldownlink_
SatPositionpos_
SatTracetrace_
LinkHandoffMgrhm_
int address_
int nodeid_
Tcl_Channel namChan_
if_head ifhead_
linklist_head linklisthead_
RoutingModulertnotif_
EnergyModelenergy_model_
Locationlocation_

Static Protected Attributes

int * satnodelist_ = NULL
int maxsatnodelist_ = 0
char nwrk_ [NODE_NAMLOG_BUFSZ]

Constructor & Destructor Documentation

SatNode::SatNode  ) 
 

Definition at line 61 of file satnode.cc.

References dist_routing_.

00061                  : ragent_(0), trace_(0), hm_(0)  
00062 {
00063         bind_bool("dist_routing_", &dist_routing_);
00064 }


Member Function Documentation

void Node::add_route char *  dst,
NsObject target
[virtual, inherited]
 

Reimplemented from ParentNode.

Definition at line 241 of file node.cc.

References RoutingModule::add_route(), and Node::rtnotif_.

00241                                                 {
00242         if (rtnotif_)
00243                 rtnotif_->add_route(dst, target);
00244 }

Here is the call graph for this function:

virtual void Node::AddAdj nodeid_t  a,
int  w = 1
[virtual, inherited]
 

Reimplemented from RNode.

void Node::addNeighbor Node node  )  [inherited]
 

Definition at line 262 of file node.cc.

References Node::neighbor_list_, neighbor_list_node::next, Node::nodeid(), and neighbor_list_node::nodeid.

Referenced by Node::command().

00262                                       {
00263 
00264         neighbor_list_node* nlistItem = (neighbor_list_node *)malloc(sizeof(neighbor_list_node));
00265         nlistItem->nodeid = neighbor->nodeid();
00266         nlistItem->next = neighbor_list_;
00267         neighbor_list_=nlistItem; 
00268 }

Here is the call graph for this function:

int SatNode::addNode int   )  [static]
 

Definition at line 151 of file satnode.cc.

References MAXSATNODELIST, maxsatnodelist_, and satnodelist_.

Referenced by command().

00152 {
00153         if (maxsatnodelist_ == 0) {
00154                 satnodelist_ = new int[MAXSATNODELIST];
00155                 memset(satnodelist_, 0, MAXSATNODELIST * sizeof(satnodelist_));
00156                 maxsatnodelist_ = MAXSATNODELIST;
00157         }
00158         assert(nodenum < 2*maxsatnodelist_);
00159         if (nodenum >= maxsatnodelist_) {
00160                 // Double size of array
00161                 int i;
00162                 int* temp = new int[2 * maxsatnodelist_];
00163                 memset(temp, 0, 2 * maxsatnodelist_ * sizeof(temp));
00164                 for (i = 0; i < maxsatnodelist_; i++) {
00165                         temp[i] = satnodelist_[i];
00166                 }
00167                 delete [] satnodelist_;
00168                 satnodelist_ = temp;
00169                 maxsatnodelist_ *= 2;
00170         }
00171         satnodelist_[nodenum] = 1;
00172         return 0;
00173 }

int Node::address  )  [inline, virtual, inherited]
 

Reimplemented from ParentNode.

Definition at line 131 of file node.h.

References Node::address_.

Referenced by ARPTable::arpinput(), ARPTable::arpresolve(), PushbackAgent::command(), God::command(), SatRouteObject::compute_topology(), GridKeeper::dump(), dumpSats(), SatChannel::find_peer_mac_addr(), SatTrace::format(), GridKeeper::get_neighbors(), LinkHandoffMgr::get_peer_linkhead(), PositionHandler::handle(), GridHandler::handle(), SatLinkHandoffMgr::handoff(), TermLinkHandoffMgr::handoff(), WebTrafPool::launchReq(), EmpWebTrafSession::launchReq(), SatRouteObject::populate_routing_tables(), and EmpFtpTrafSession::sendFile().

00131 { return address_;}

int SatNode::command int  argc,
const char *const *  argv
[protected, virtual]
 

Reimplemented from Node.

Definition at line 66 of file satnode.cc.

References addNode(), Node::command(), downlink_, dumpSats(), hm_, Node::ifhead_, Phy::insertnode(), pos_, ragent_, Phy::setnode(), LinkHandoffMgr::start(), trace_, and uplink_.

00066                                                      {     
00067         Tcl& tcl = Tcl::instance();
00068         if (argc == 2) {
00069                 if (strcmp(argv[1], "set_downlink") == 0) {
00070                         if (downlink_ != NULL) {
00071                                 tcl.result(downlink_->name());
00072                                 return (TCL_OK);
00073                         }
00074                 } else if (strcmp(argv[1], "set_uplink") == 0) {
00075                         if (downlink_ != NULL) {
00076                                 tcl.result(uplink_->name());
00077                                 return (TCL_OK);
00078                         }
00079                 } else if (strcmp(argv[1], "start_handoff") == 0) {
00080                         if (hm_)
00081                                 hm_->start();
00082                         else {
00083                                 printf("Error: starting non-existent ");
00084                                 printf("handoff mgr\n");
00085                                 exit(1);
00086                         }
00087                         return (TCL_OK);
00088                 } else if (strcmp(argv[1], "dump_sats") == 0) {
00089                         dumpSats();
00090                         return (TCL_OK);
00091                 }
00092         }
00093         if (argc == 3) {
00094                 if (strcmp(argv[1], "set_uplink") == 0) {
00095                         uplink_ = (SatChannel *) TclObject::lookup(argv[2]);
00096                         if (uplink_ == 0) {
00097                                 tcl.resultf("no such object %s", argv[2]);
00098                                 return (TCL_ERROR);
00099                         }
00100                         return (TCL_OK);
00101                 } else if (strcmp(argv[1], "set_downlink") == 0) {
00102                         downlink_ = (SatChannel *) TclObject::lookup(argv[2]);
00103                         if (downlink_ == 0) {
00104                                 tcl.resultf("no such object %s", argv[2]);
00105                                 return (TCL_ERROR);
00106                         }
00107                         return (TCL_OK);
00108                 } else if (strcmp(argv[1], "set_trace") == 0) {
00109                         trace_ = (SatTrace *) TclObject::lookup(argv[2]);
00110                         if (trace_ == 0) {
00111                                 tcl.resultf("no such object %s", argv[2]);
00112                                 return (TCL_ERROR);
00113                         }
00114                         return (TCL_OK);
00115                 } else if (strcmp(argv[1], "set_ragent") == 0) {
00116                         ragent_ = (SatRouteAgent *) TclObject::lookup(argv[2]);
00117                         if (ragent_ == 0) {
00118                                 tcl.resultf("no such object %s", argv[2]);
00119                                 return (TCL_ERROR);
00120                         }
00121                         return (TCL_OK);
00122                 } else if(strcmp(argv[1], "addif") == 0) {
00123                         SatPhy* n = (SatPhy*) TclObject::lookup(argv[2]);
00124                         if(n == 0)
00125                                 return TCL_ERROR; 
00126                         n->insertnode(&ifhead_);
00127                         n->setnode(this);
00128                         return TCL_OK;
00129                 } else if (strcmp(argv[1], "set_position") == 0) {
00130                         pos_ = (SatPosition*) TclObject::lookup(argv[2]);
00131                         if (pos_ == 0) {
00132                                 tcl.resultf("no such object %s", argv[2]);
00133                                 return (TCL_ERROR);
00134                         }
00135                         return (TCL_OK);
00136                 } else if (strcmp(argv[1], "set_handoff_mgr") == 0) {
00137                         hm_ = (LinkHandoffMgr*) TclObject::lookup(argv[2]);
00138                         if (hm_ == 0) {
00139                                 tcl.resultf("no such object %s", argv[2]);
00140                                 return (TCL_ERROR);
00141                         }
00142                         return (TCL_OK);
00143                 } else if (strcmp(argv[1], "set_address") == 0) {
00144                         addNode(atoi(argv[2]));
00145                         return (TCL_OK);
00146                 }
00147         }
00148         return (Node::command(argc, argv));
00149 }

Here is the call graph for this function:

void Node::delete_route char *  dst,
NsObject nullagent
[virtual, inherited]
 

Reimplemented from ParentNode.

Definition at line 247 of file node.cc.

References RoutingModule::delete_route(), and Node::rtnotif_.

00247                                                       {
00248         if (rtnotif_)
00249                 rtnotif_->delete_route(dst, nullagent);
00250 }

Here is the call graph for this function:

Channel* SatNode::downlink  )  [inline]
 

Definition at line 65 of file satnode.h.

References downlink_.

Referenced by TermLinkHandoffMgr::handoff().

00065 { return ((Channel*) downlink_);} 

void Node::Dump void   )  [inherited]
 

Definition at line 624 of file calcdest.cc.

References Node::destination, Node::direction, Neighbor::index, Node::index, Node::neighbor, NODES, Node::position, Neighbor::reachable, Node::speed, Node::time_arrival, Node::time_transition, Node::time_update, u_int32_t, vector::X, vector::Y, and vector::Z.

Referenced by dumpall().

00625 {
00626         Neighbor *m;
00627         u_int32_t i;
00628 
00629         fprintf(stdout,
00630                 "Node: %d\tpos: (%.2f, %.2f, %.2f) dst: (%.2f, %.2f, %.2f)\n",
00631                 index, position.X, position.Y, position.Z,
00632                 destination.X, destination.Y, destination.Z);
00633         fprintf(stdout, "\tdir: (%.2f, %.2f, %.2f) speed: %.2f\n",
00634                 direction.X, direction.Y, direction.Z, speed);
00635         fprintf(stdout, "\tArrival: %.2f, Update: %.2f, Transition: %.2f\n",
00636                 time_arrival, time_update, time_transition);
00637 
00638         for(i = 1; i < NODES; i++) {
00639                 m = &neighbor[i];
00640                 fprintf(stdout, "\tNeighbor: %d (%x), Reachable: %d, Transition Time: %.2f\n",
00641                         m->index, (int) m, m->reachable, m->time_transition);
00642         }
00643 }

void SatNode::dumpSats  )  [protected]
 

Definition at line 186 of file satnode.cc.

References Node::address(), SatPosition::coord(), SatGeometry::get_latitude(), SatGeometry::get_longitude(), LinkHandoffMgr::get_peer(), hm_, IsASatNode(), LINK_GENERIC, Node::linklisthead_, SatLinkHead::linkup_, LinkHead::nextlinkhead(), Node::nextnode(), Node::nodehead_, NOW, PolarSatPosition::plane(), position(), POSITION_SAT_GEO, POSITION_SAT_POLAR, POSITION_SAT_TERM, RAD_TO_DEG, LinkHead::type(), and SatPosition::type().

Referenced by command().

00187 {
00188         SatNode *snodep, *peer_snodep;
00189         SatPosition *sposp, *peer_sposp;
00190         PolarSatPosition *polar_sposp;
00191         SatLinkHead *slhp;
00192         int linktype;
00193 
00194         printf("\nDumping satellites at time %.2f\n\n", NOW);
00195         for (snodep= (SatNode*) Node::nodehead_.lh_first; snodep; 
00196                 snodep = (SatNode*) snodep->nextnode()) {
00197                 if (!SatNode::IsASatNode(snodep->address()))
00198                         continue;
00199                 sposp = snodep->position();
00200                 printf("%d\t%.2f\t%.2f", snodep->address(), 
00201                     RAD_TO_DEG(SatGeometry::get_latitude(sposp->coord())), 
00202                     RAD_TO_DEG(SatGeometry::get_longitude(sposp->coord())));
00203                 // If SatNode is polar, append plane information
00204                 if (sposp->type()==POSITION_SAT_POLAR) {
00205                         polar_sposp = (PolarSatPosition*) snodep->position();
00206                         printf ("\t%d", polar_sposp->plane());
00207                 } else if (sposp->type()==POSITION_SAT_GEO) {
00208                         printf ("\tGEO");
00209                 } else if (sposp->type()==POSITION_SAT_TERM) {
00210                         printf ("\tTERM");
00211                 }
00212                 printf("\n");
00213         }
00214         printf("\n");
00215         // Dump satellite links
00216         // There is a static list of address classifiers //QQQ
00217         printf("Links:\n");
00218         for (snodep = (SatNode*) Node::nodehead_.lh_first; snodep; 
00219                 snodep = (SatNode*) snodep->nextnode()) {
00220                 if (!SatNode::IsASatNode(snodep->address()))
00221                         continue;
00222                 // XXX Not all links necessarily satlinks
00223                 for (slhp = (SatLinkHead*) snodep->linklisthead_.lh_first; 
00224                     slhp; slhp = (SatLinkHead*) slhp->nextlinkhead() ) {
00225                         linktype = slhp->type();
00226                         if (linktype == LINK_GENERIC)
00227                                 continue;
00228                         if (!slhp->linkup_)
00229                                 continue;
00230                         // Link is up.
00231                         // Print out source and dest coordinates.
00232                         sposp = snodep->position();
00233                         peer_snodep = hm_->get_peer(slhp);
00234                         if (peer_snodep == 0)
00235                                 continue; // this link interface is not attached
00236                         // need something in here for txs.
00237                         peer_sposp = peer_snodep->position();
00238                         printf("%.2f\t%.2f\t%.2f\t%.2f\t%d\n", 
00239                          RAD_TO_DEG(SatGeometry::get_latitude(sposp->coord())),
00240                          RAD_TO_DEG(SatGeometry::get_longitude(sposp->coord())),
00241                          RAD_TO_DEG(SatGeometry::get_latitude(peer_sposp->coord())), 
00242                          RAD_TO_DEG(SatGeometry::get_longitude(peer_sposp->coord())),
00243                          linktype);
00244                 }
00245         }
00246         printf("\nDumped satellites at time %.2f\n\n", NOW);
00247 }

Here is the call graph for this function:

EnergyModel* Node::energy_model  )  [inline, inherited]
 

Definition at line 192 of file node.h.

References Node::energy_model_.

Referenced by MobileNode::command(), God::CountAliveNode(), WirelessPhy::em(), EnergyTimer::EnergyTimer(), EnergyTimer::expire(), CMUTrace::format_mac(), CMUTrace::format_rtp(), God::IsNeighbor(), GAFAgent::myttl(), CMUTrace::nam_format(), CMUTrace::node_energy(), GAFAgent::node_off(), GAFAgent::node_on(), MacTdma::radioSwitch(), Mac802_11::recv_timer(), Mac802_11::send(), OmniMcastAgent::Terminate(), FloodingAgent::Terminate(), and DiffusionAgent::Terminate().

00192 { return energy_model_; }

bool Node::exist_namchan  )  const [inline, inherited]
 

Definition at line 133 of file node.h.

References Node::namChan_.

Referenced by EnergyModel::set_node_sleep().

00133 { return (namChan_ != 0); }

Node * Node::get_node_by_address nsaddr_t   )  [static, inherited]
 

Definition at line 315 of file node.cc.

References Node::address_, and Node::nextnode().

Referenced by CMUTrace::format_mac(), CMUTrace::format_rtp(), GAFAgent::GAFAgent(), CMUTrace::nam_format(), and CMUTrace::node_energy().

00316 {
00317         Node * tnode = nodehead_.lh_first;
00318         for (; tnode; tnode = tnode->nextnode()) {
00319                 if (tnode->address_ == id ) {
00320                         return (tnode);
00321                 }
00322         }
00323         return NULL;
00324 }

Here is the call graph for this function:

virtual nodeid_t RNode::GetNeighbor Nix_t   )  [virtual, inherited]
 

virtual NixPair_t Node::GetNix nodeid_t   )  [virtual, inherited]
 

Reimplemented from RNode.

virtual Nixl_t RNode::GetNixl  )  [virtual, inherited]
 

Reimplemented in NixNode.

const struct if_head& Node::ifhead  )  const [inline, inherited]
 

Definition at line 148 of file node.h.

References Node::ifhead_.

Referenced by GAFAgent::myttl(), GAFAgent::node_off(), GAFAgent::node_on(), and Channel::sendUp().

00148 { return ifhead_; }

void Node::insert struct node_head *  head  )  [inline, inherited]
 

Definition at line 141 of file node.h.

References LIST_INSERT_HEAD.

Referenced by Node::Node().

00141                                                    {
00142                 LIST_INSERT_HEAD(head, this, entry);
00143         }

NsObject * Node::intf_to_target int32_t   )  [inherited]
 

Definition at line 305 of file node.cc.

References LinkHead::label(), Node::linklisthead_, and LinkHead::nextlinkhead().

00306 {
00307         LinkHead *lhp = linklisthead_.lh_first;
00308         for (; lhp; lhp = lhp->nextlinkhead()) 
00309                 if (label == lhp->label())
00310                         return ((NsObject*) lhp);
00311         return NULL;
00312 }

Here is the call graph for this function:

int SatNode::IsASatNode int   )  [static]
 

Definition at line 175 of file satnode.cc.

References maxsatnodelist_, and satnodelist_.

Referenced by SatRouteObject::compute_topology(), dumpSats(), TermLinkHandoffMgr::handoff(), and SatRouteObject::populate_routing_tables().

00176 {
00177         if (nodenum > maxsatnodelist_) {
00178                 printf("Error: IsASatNode() nodenum %d greater than maxsatnodelist_ %d\n", nodenum, maxsatnodelist_);
00179                 exit(1);
00180         }
00181         return satnodelist_[nodenum];
00182 }

const struct linklist_head& Node::linklisthead  )  const [inline, inherited]
 

Definition at line 149 of file node.h.

References Node::linklisthead_.

Referenced by SatRouteObject::compute_topology(), LinkHandoffMgr::get_peer_next_linkhead(), SatLinkHandoffMgr::handoff(), and TermLinkHandoffMgr::handoff().

00149                                                                 { 
00150                 return linklisthead_; 
00151         }

Node::LIST_ENTRY Node   )  [protected, inherited]
 

Location* Node::location  )  [inline, inherited]
 

Definition at line 193 of file node.h.

References Node::location_.

00193 { return location_; }

void Node::namdump  )  [protected, inherited]
 

Definition at line 281 of file node.cc.

References abort(), Node::namChan_, NODE_NAMLOG_BUFSZ, and Node::nwrk_.

Referenced by Node::namlog(), and MobileNode::set_destination().

00282 {
00283         int n = 0;
00284         /* Otherwise nwrk_ isn't initialized */
00285         n = strlen(nwrk_);
00286         if (n >= NODE_NAMLOG_BUFSZ-1) {
00287                 fprintf(stderr, 
00288                         "Node::namdump() exceeds buffer size. Bail out.\n");
00289                 abort();
00290         }
00291         if (n > 0) {
00292                 /*
00293                  * tack on a newline (temporarily) instead
00294                  * of doing two writes
00295                  */
00296                 nwrk_[n] = '\n';
00297                 nwrk_[n + 1] = 0;
00298                 (void)Tcl_Write(namChan_, nwrk_, n + 1);
00299                 nwrk_[n] = 0;
00300         }
00301 }

Here is the call graph for this function:

void Node::namlog const char *  fmt,
... 
[virtual, inherited]
 

Definition at line 270 of file node.cc.

References Node::namChan_, Node::namdump(), and Node::nwrk_.

00271 {
00272         // Don't do anything if we don't have a log file.
00273         if (namChan_ == 0) 
00274                 return;
00275         va_list ap;
00276         va_start(ap, fmt);
00277         vsprintf(nwrk_, fmt, ap);
00278         namdump();
00279 }

Here is the call graph for this function:

virtual const NodeWeight_t Node::NextAdj const NodeWeight_t  )  [virtual, inherited]
 

Reimplemented from RNode.

Node* Node::nextnode  )  [inline, inherited]
 

Reimplemented in MobileNode.

Definition at line 144 of file node.h.

Referenced by SatRouteObject::compute_topology(), dumpSats(), SatTrace::format(), Node::get_node_by_address(), TermLinkHandoffMgr::handoff(), and SatRouteObject::populate_routing_tables().

00144 { return entry.le_next; }

int Node::nodeid  )  [inline, virtual, inherited]
 

Reimplemented from ParentNode.

Definition at line 132 of file node.h.

References Node::nodeid_.

Referenced by Node::addNeighbor(), PushbackAgent::calculateLowerBound(), WebTrafPool::command(), PushbackAgent::command(), CMUTrace::format_mac(), WebServer::get_nid(), PushbackAgent::getQID(), PushbackAgent::identifyAggregate(), LoggingDataStruct::LoggingDataStruct(), CMUTrace::nam_format(), PushbackAgent::printMsg(), PushbackAgent::processPushbackStatus(), PushbackAgent::pushbackCancel(), PushbackAgent::pushbackCheck(), PushbackAgent::pushbackRefresh(), PushbackAgent::pushbackStatus(), PushbackAgent::refreshUpstreamLimits(), and PushbackQueue::timeout().

00132 { return nodeid_;}

SatPosition* SatNode::position  )  [inline]
 

Definition at line 60 of file satnode.h.

References pos_.

Referenced by dumpSats(), SatTrace::format(), SatLinkHandoffMgr::handoff(), and TermLinkHandoffMgr::handoff().

00060 { return pos_; }

SatRouteAgent* SatNode::ragent  )  [inline]
 

Definition at line 59 of file satnode.h.

References ragent_.

Referenced by SatRouteObject::populate_routing_tables(), and SatLL::sendDown().

00059 { return ragent_; }

void Node::route_notify RoutingModule rtm  )  [inherited]
 

Definition at line 222 of file node.cc.

References RoutingModule::route_notify(), and Node::rtnotif_.

Referenced by VcRoutingModule::command(), ManualRoutingModule::command(), HierRoutingModule::command(), McastRoutingModule::command(), QSRoutingModule::command(), SourceRoutingModule::command(), BaseRoutingModule::command(), and MPLSModule::command().

00222                                           {
00223         if (rtnotif_ == NULL)
00224                 rtnotif_ = rtm;
00225         else
00226                 rtnotif_->route_notify(rtm);
00227 }

Here is the call graph for this function:

void Node::set_table_size int  level,
int  csize
[virtual, inherited]
 

Reimplemented from ParentNode.

Definition at line 257 of file node.cc.

References Node::rtnotif_, and RoutingModule::set_table_size().

00257                                               {
00258         if (rtnotif_)
00259                 rtnotif_->set_table_size(level, csize);
00260 }

Here is the call graph for this function:

void Node::set_table_size int  nn  )  [virtual, inherited]
 

Reimplemented from ParentNode.

Definition at line 252 of file node.cc.

References Node::rtnotif_, and RoutingModule::set_table_size().

00252                                 {
00253         if (rtnotif_)
00254                 rtnotif_->set_table_size(nn);
00255 }

Here is the call graph for this function:

SatTrace* SatNode::trace  )  [inline]
 

Definition at line 61 of file satnode.h.

References trace_.

Referenced by SatRouteAgent::forwardPacket().

00061 { return trace_; }

void Node::unreg_route_notify RoutingModule rtm  )  [inherited]
 

Definition at line 229 of file node.cc.

References RoutingModule::next_rtm_, Node::rtnotif_, and RoutingModule::unreg_route_notify().

Referenced by VcRoutingModule::command(), ManualRoutingModule::command(), HierRoutingModule::command(), McastRoutingModule::command(), QSRoutingModule::command(), SourceRoutingModule::command(), BaseRoutingModule::command(), and MPLSModule::command().

00229                                                 {
00230         if (rtnotif_) {
00231                 if (rtnotif_ == rtm) {
00232                         //RoutingModule *tmp = rtnotif_;
00233                         rtnotif_= rtnotif_->next_rtm_;
00234                         //free (tmp);
00235                 }
00236                 else
00237                         rtnotif_->unreg_route_notify(rtm);
00238         }
00239 }

Here is the call graph for this function:

void Node::Update void   )  [inherited]
 

Definition at line 427 of file calcdest.cc.

References Node::destination, Node::direction, vector::length(), LIST_NEXT, LIST_REMOVE, MAXTIME, Node::position, Node::speed, TIME, Node::time_arrival, Node::time_transition, Node::time_update, vector::X, vector::Y, and vector::Z.

Referenced by main().

00428 {
00429         struct setdest *setdest = traj.lh_first;
00430 
00431         position += (speed * (TIME - time_update)) * direction;
00432 
00433         if(TIME == time_arrival) {
00434 
00435           if (NULL == setdest) 
00436             {
00437               destination = position;
00438               direction.X = direction.Y = direction.Z = 0.0;
00439               speed = 0.0;
00440               time_arrival = MAXTIME + 1;
00441             } 
00442           else 
00443             {
00444               vector v;
00445               destination.X = setdest->X;
00446               destination.Y = setdest->Y;
00447               speed = setdest->speed;
00448               if (0.0 == speed)
00449                 { // it's a pause at the current location
00450                   if (LIST_NEXT(setdest,traj))
00451                     time_arrival = LIST_NEXT(setdest,traj)->time;
00452                   else
00453                     time_arrival = MAXTIME + 1;
00454                 }
00455               else 
00456                 { // we're moving somewhere, when do we get there?
00457                   v = destination - position;
00458                   direction = v / v.length();
00459                   time_arrival = TIME + v.length() / speed;
00460                 }
00461               LIST_REMOVE(setdest,traj);
00462               free(setdest);
00463             }
00464         }
00465 
00466         time_update = TIME;
00467         time_transition = 0.0;
00468 }

Here is the call graph for this function:

void Node::UpdateNeighbors void   )  [inherited]
 

Definition at line 472 of file calcdest.cc.

References Node::direction, Neighbor::index, Node::index, vector::length(), Node::link_changes, LinkChangeCount, max, min, Node::neighbor, NodeList, NODES, Node::position, RANGE, Neighbor::reachable, ROUND_ERROR, Node::speed, t1, TIME, Node::time_transition, Neighbor::time_transition, u_int32_t, vector::X, vector::Y, and vector::Z.

Referenced by main().

00473 {
00474         static Node *n2;
00475         static Neighbor *m1, *m2;
00476         static vector D, B, v1, v2;
00477         static double a, b, c, t1, t2, Q;
00478         static u_int32_t i, reachable;
00479 
00480         v1 = speed * direction;
00481 
00482         /*
00483          *  Only need to go from INDEX --> N for each one since links
00484          *  are symmetric.
00485          */
00486         for(i = index+1; i < NODES; i++) {
00487 
00488                 m1 = &neighbor[i];
00489                 n2 = &NodeList[i];
00490                 m2 = &n2->neighbor[index];
00491 
00492                 assert(i == m1->index);
00493                 assert(m1->index == n2->index);
00494                 assert(index == m2->index);
00495                 assert(m1->reachable == m2->reachable);
00496 
00497                 reachable = m1->reachable;
00498 
00499                 /* ==================================================
00500                    Determine Reachability
00501                    ================================================== */
00502                 {       vector d = position - n2->position;
00503 
00504                         if(d.length() < RANGE) {
00505 #ifdef SANITY_CHECKS
00506                                 if(TIME > 0.0 && m1->reachable == 0)
00507                                         assert(RANGE - d.length() < ROUND_ERROR);
00508 #endif
00509                                 m1->reachable = m2->reachable = 1;
00510                         }
00511                         // Boundary condition handled below.
00512                         else {
00513 #ifdef SANITY_CHECKS
00514                                 if(TIME > 0.0 && m1->reachable == 1)
00515                                         assert(d.length() - RANGE < ROUND_ERROR);
00516 #endif
00517                                 m1->reachable = m2->reachable = 0;
00518                         }
00519 #ifdef DEBUG
00520                         fprintf(stdout, "# %.6f (%d, %d) %.2fm\n",
00521                                 TIME, index, m1->index, d.length());
00522 #endif
00523                 }
00524 
00525                 /* ==================================================
00526                    Determine Next Event Time
00527                    ================================================== */
00528                 v2 = n2->speed * n2->direction;
00529 
00530                 D = v2 - v1;
00531                 B = n2->position - position;
00532 
00533                 a = (D.X * D.X) + (D.Y * D.Y) + (D.Z * D.Z);
00534                 b = 2 * ((D.X * B.X) + (D.Y * B.Y) + (D.Z * B.Z));
00535                 c = (B.X * B.X) + (B.Y * B.Y) + (B.Z * B.Z) - (RANGE * RANGE);
00536 
00537                 if(a == 0.0) {
00538                         /*
00539                          *  No Finite Solution
00540                          */
00541                         m1->time_transition= 0.0;
00542                         m2->time_transition= 0.0;
00543                         goto  next;
00544                 }
00545 
00546                 Q = b * b - 4 * a * c;
00547                 if(Q < 0.0) {
00548                         /*
00549                          *  No real roots.
00550                          */
00551                         m1->time_transition = 0.0;
00552                         m2->time_transition = 0.0;
00553                         goto next;
00554                 }
00555                 Q = sqrt(Q);
00556 
00557                 t1 = (-b + Q) / (2 * a);
00558                 t2 = (-b - Q) / (2 * a);
00559 
00560                 // Stupid Rounding/Boundary Cases
00561                 if(t1 > 0.0 && t1 < ROUND_ERROR) t1 = 0.0;
00562                 if(t1 < 0.0 && -t1 < ROUND_ERROR) t1 = 0.0;
00563                 if(t2 > 0.0 && t2 < ROUND_ERROR) t2 = 0.0;
00564                 if(t2 < 0.0 && -t2 < ROUND_ERROR) t2 = 0.0;
00565 
00566                 if(t1 < 0.0 && t2 < 0.0) {
00567                         /*
00568                          *  No "future" time solution.
00569                          */
00570                         m1->time_transition = 0.0;
00571                         m2->time_transition = 0.0;
00572                         goto next;
00573                 }
00574 
00575                 /*
00576                  * Boundary conditions.
00577                  */
00578                 if((t1 == 0.0 && t2 > 0.0) || (t2 == 0.0 && t1 > 0.0)) {
00579                         m1->reachable = m2->reachable = 1;
00580                         m1->time_transition = m2->time_transition = TIME + max(t1, t2);
00581                 }
00582                 else if((t1 == 0.0 && t2 < 0.0) || (t2 == 0.0 && t1 < 0.0)) {
00583                         m1->reachable = m2->reachable = 0;
00584                         m1->time_transition = m2->time_transition = 0.0;
00585                 }
00586 
00587                 /*
00588                  * Non-boundary conditions.
00589                  */
00590                 else if(t1 > 0.0 && t2 > 0.0) {
00591                         m1->time_transition = TIME + min(t1, t2);
00592                         m2->time_transition = TIME + min(t1, t2);
00593                 }
00594                 else if(t1 > 0.0) {
00595                         m1->time_transition = TIME + t1;
00596                         m2->time_transition = TIME + t1;
00597                 }
00598                 else {
00599                         m1->time_transition = TIME + t2;
00600                         m2->time_transition = TIME + t2;
00601                 }
00602 
00603                 /* ==================================================
00604                    Update the transition times for both NODEs.
00605                    ================================================== */
00606                 if(time_transition == 0.0 || (m1->time_transition &&
00607                    time_transition > m1->time_transition)) {
00608                         time_transition = m1->time_transition;
00609                 }
00610                 if(n2->time_transition == 0.0 || (m2->time_transition &&
00611                    n2->time_transition > m2->time_transition)) {
00612                         n2->time_transition = m2->time_transition;
00613                 }
00614         next:
00615                 if(reachable != m1->reachable && TIME > 0.0) {
00616                         LinkChangeCount++;
00617                         link_changes++;
00618                         n2->link_changes++;
00619                 }
00620         }
00621 }

Here is the call graph for this function:

Channel* SatNode::uplink  )  [inline]
 

Definition at line 64 of file satnode.h.

References uplink_.

Referenced by TermLinkHandoffMgr::handoff().

00064 { return ((Channel*) uplink_);} 


Member Data Documentation

int Node::address_ [protected, inherited]
 

Reimplemented from ParentNode.

Definition at line 169 of file node.h.

Referenced by Node::address(), MobileNode::bound_position(), Node::command(), MobileNode::command(), MobileNode::dump(), Node::get_node_by_address(), PositionHandler::handle(), MobileNode::log_energy(), MobileNode::log_movement(), MobileNode::random_destination(), MobileNode::set_destination(), MobileNode::start(), and MobileNode::update_position().

int SatNode::dist_routing_ = 0 [static]
 

Definition at line 59 of file satnode.cc.

Referenced by SatRouteAgent::forwardPacket(), and SatNode().

SatChannel* SatNode::downlink_ [protected]
 

Definition at line 75 of file satnode.h.

Referenced by command(), and downlink().

EnergyModel* Node::energy_model_ [protected, inherited]
 

Definition at line 195 of file node.h.

Referenced by Node::command(), Node::energy_model(), and MobileNode::log_energy().

LinkHandoffMgr* SatNode::hm_ [protected]
 

Definition at line 78 of file satnode.h.

Referenced by command(), and dumpSats().

struct if_head Node::ifhead_ [protected, inherited]
 

Definition at line 179 of file node.h.

Referenced by command(), MobileNode::command(), MobileNode::dump(), Node::ifhead(), MobileNode::MobileNode(), and Node::Node().

int Node::link_changes [inherited]
 

Definition at line 86 of file setdest.h.

Referenced by Node::UpdateNeighbors().

struct linklist_head Node::linklisthead_ [protected, inherited]
 

Definition at line 180 of file node.h.

Referenced by Node::command(), dumpSats(), Node::intf_to_target(), Node::linklisthead(), and Node::Node().

Location* Node::location_ [protected, inherited]
 

Definition at line 199 of file node.h.

Referenced by Node::location().

EdgeVec_t Node::m_Adj [inherited]
 

Definition at line 53 of file tnode.h.

nodeid_t RNode::m_id [inherited]
 

Definition at line 42 of file rnode.h.

Referenced by NixNode::Id(), and Node::Node().

int SatNode::maxsatnodelist_ = 0 [static, protected]
 

Definition at line 58 of file satnode.cc.

Referenced by addNode(), and IsASatNode().

Tcl_Channel Node::namChan_ [protected, inherited]
 

Definition at line 173 of file node.h.

Referenced by Node::command(), Node::exist_namchan(), Node::namdump(), Node::namlog(), and MobileNode::set_destination().

Neighbor* Node::neighbor [inherited]
 

Definition at line 108 of file setdest.h.

Referenced by ComputeW(), Node::Dump(), and Node::UpdateNeighbors().

neighbor_list_node* Node::neighbor_list_ [inherited]
 

Definition at line 154 of file node.h.

Referenced by Node::addNeighbor(), LoggingDataStruct::LoggingDataStruct(), and Node::Node().

struct node_head Node::nodehead_ [static, inherited]
 

Definition at line 140 of file node.h.

Referenced by SatRouteObject::compute_topology(), dumpSats(), SatTrace::format(), TermLinkHandoffMgr::handoff(), Node::Node(), and SatRouteObject::populate_routing_tables().

int Node::nodeid_ [protected, inherited]
 

Reimplemented from ParentNode.

Definition at line 170 of file node.h.

Referenced by Node::command(), Node::nodeid(), and MobileNode::set_destination().

char Node::nwrk_ [static, protected, inherited]
 

Definition at line 100 of file node.cc.

Referenced by Node::namdump(), Node::namlog(), and MobileNode::set_destination().

SatPosition* SatNode::pos_ [protected]
 

Definition at line 76 of file satnode.h.

Referenced by command(), and position().

SatRouteAgent* SatNode::ragent_ [protected]
 

Definition at line 73 of file satnode.h.

Referenced by command(), and ragent().

int Node::route_changes [inherited]
 

Definition at line 85 of file setdest.h.

Referenced by show_diffs().

RoutingModule* Node::rtnotif_ [protected, inherited]
 

Definition at line 183 of file node.h.

Referenced by Node::add_route(), Node::delete_route(), Node::route_notify(), Node::set_table_size(), and Node::unreg_route_notify().

int * SatNode::satnodelist_ = NULL [static, protected]
 

Definition at line 57 of file satnode.cc.

Referenced by addNode(), and IsASatNode().

double Node::time_arrival [inherited]
 

Definition at line 81 of file setdest.h.

Referenced by Node::Dump(), main(), and Node::Update().

double Node::time_transition [inherited]
 

Definition at line 82 of file setdest.h.

Referenced by Node::Dump(), main(), Node::Update(), and Node::UpdateNeighbors().

SatTrace* SatNode::trace_ [protected]
 

Definition at line 77 of file satnode.h.

Referenced by command(), and trace().

SatChannel* SatNode::uplink_ [protected]
 

Definition at line 74 of file satnode.h.

Referenced by command(), and uplink().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:20:47 2004 for NS2.26SourcesOriginal by doxygen 1.3.3