#include <sathandoff.h>
Inheritance diagram for TermLinkHandoffMgr:


Public Member Functions | |
| TermLinkHandoffMgr () | |
| int | handoff () |
| void | start () |
| Node * | node () |
| int | command (int argc, const char *const *argv) |
| SatNode * | get_peer (SatLinkHead *) |
Protected Member Functions | |
| SatLinkHead * | get_peer_next_linkhead (SatNode *) |
| SatLinkHead * | get_peer_linkhead (SatLinkHead *) |
Protected Attributes | |
| TermHandoffTimer | timer_ |
| Node * | node_ |
Static Protected Attributes | |
| double | elevation_mask_ = 0 |
| int | term_handoff_int_ = 10 |
| RNG | handoff_rng_ |
| int | handoff_randomization_ = 0 |
|
|
Definition at line 194 of file sathandoff.cc. References elevation_mask_, and term_handoff_int_.
00194 : timer_(this) 00195 { 00196 bind("elevation_mask_", &elevation_mask_); 00197 bind("term_handoff_int_", &term_handoff_int_); 00198 } |
|
||||||||||||
|
Definition at line 98 of file sathandoff.cc. References LinkHandoffMgr::node_.
|
|
|
Definition at line 161 of file sathandoff.cc. References Phy::channel(), Phy::head(), Channel::ifhead_, Phy::nextchnl(), LinkHead::node(), and SatLinkHead::phy_tx(). Referenced by SatNode::dumpSats(), SatLinkHandoffMgr::handoff(), and handoff().
00162 {
00163 SatChannel *schan_;
00164 Phy *remote_phy_;
00165
00166 schan_ = (SatChannel*) slhp->phy_tx()->channel();
00167 if (schan_ == 0)
00168 return 0; // Link is not currently connected
00169 remote_phy_ = schan_->ifhead_.lh_first;
00170 if (remote_phy_ == 0) {
00171 // this is not an error as far as satellite GSL endpoints
00172 // appear to be concerned.
00173 // Commented out for drawing GSL links in dumpSats()
00174 // in satnode.cc
00175 // printf("Error: node %d's tx phy ", slhp->node()->address());
00176 // printf("connected to channel with no receivers\n");
00177 return 0;
00178 }
00179 if (remote_phy_->nextchnl()) {
00180 printf("Error: This ISL channel has more than one target\n");
00181 return 0;
00182 }
00183
00184 return ( (SatNode*) remote_phy_->head()->node());
00185 }
|
Here is the call graph for this function:

|
|
Definition at line 133 of file sathandoff.cc. References Node::address(), Phy::channel(), Phy::head(), Channel::ifhead_, Phy::nextchnl(), LinkHead::node(), SatLinkHead::node(), and SatLinkHead::phy_tx(). Referenced by SatLinkHandoffMgr::handoff().
00134 {
00135 SatChannel *schan_;
00136 Phy *remote_phy_;
00137 Node *remote_node_;
00138
00139 schan_ = (SatChannel*) slhp->phy_tx()->channel();
00140 if (schan_ == 0) {
00141 printf("Error: get_peer_linkhead called for a non-");
00142 printf("connected link on node %d\n", slhp->node()->address());
00143 return 0; // Link is not currently connected
00144 }
00145 remote_phy_ = schan_->ifhead_.lh_first;
00146 if (remote_phy_ == 0) {
00147 printf("Error: node %d's tx phy ", slhp->node()->address());
00148 printf("connected to channel with no receivers\n");
00149 return 0;
00150 }
00151 remote_node_ = remote_phy_->head()->node();
00152 if (remote_phy_->nextchnl()) {
00153 printf("Error: This ISL channel has more than one target\n");
00154 return 0;
00155 }
00156 return ( (SatLinkHead*) remote_phy_->head());
00157 }
|
Here is the call graph for this function:

|
|
Definition at line 114 of file sathandoff.cc. References Phy::channel(), LINK_ISL_CROSSSEAM, Node::linklisthead(), LinkHead::nextlinkhead(), SatLinkHead::phy_rx(), SatLinkHead::phy_tx(), and LinkHead::type(). Referenced by SatLinkHandoffMgr::handoff().
00115 {
00116 LinkHead* lhp;
00117 SatLinkHead* slhp;
00118 for (lhp = np->linklisthead().lh_first; lhp;
00119 lhp = lhp->nextlinkhead() ) {
00120 slhp = (SatLinkHead*) lhp;
00121 if (slhp->type() == LINK_ISL_CROSSSEAM) {
00122 if (!slhp->phy_tx()->channel() &&
00123 !slhp->phy_rx()->channel() )
00124 return slhp;
00125 }
00126 }
00127 printf("Error, couldn't find an empty crossseam stack for handoff\n");
00128 return 0;
00129 }
|
Here is the call graph for this function:

|
|
Reimplemented from LinkHandoffMgr. Definition at line 208 of file sathandoff.cc. References Node::address(), SatGeometry::check_elevation(), PolarSatPosition::coord(), SatPosition::coord(), DEG_TO_RAD, SatNode::downlink(), elevation_mask_, FALSE, LinkHandoffMgr::get_peer(), LinkHandoffMgr::handoff_randomization_, LinkHandoffMgr::handoff_rng_, Channel::ifhead_, Phy::insertchnl(), SatRouteObject::instance(), SatNode::IsASatNode(), LINK_GENERIC, LINK_GSL_GEO, LINK_GSL_POLAR, Node::linklisthead(), SatLinkHead::linkup_, PolarSatPosition::next(), LinkHead::nextlinkhead(), Node::nextnode(), SatPosition::node(), Phy::node(), LinkHandoffMgr::node_, Node::nodehead_, NOW, SatLinkHead::phy_rx(), SatLinkHead::phy_tx(), SatNode::position(), POSITION_SAT_POLAR, SatRouteObject::recompute(), Phy::removechnl(), TimerHandler::resched(), Phy::setchnl(), term_handoff_int_, timer_, TRUE, SatPosition::type(), LinkHead::type(), RNG::uniform(), SatNode::uplink(), and SatRouteObject::wiredRouting(). Referenced by TermHandoffTimer::expire().
00209 {
00210 coordinate sat_coord, earth_coord;
00211 SatLinkHead* slhp;
00212 SatNode *peer_; // Polar satellite at opposite end of the GSL
00213 SatNode *best_peer_; // Best found peer for handoff
00214 Node *nodep; // Pointer used in searching the list of nodes
00215 PolarSatPosition *nextpos_;
00216 int link_changes_flag_ = FALSE; // Flag indicating change took place
00217 int restart_timer_flag_ = FALSE; // Restart timer only if polar links
00218 double found_elev_ = 0; //``Flag'' indicates whether handoff can occur
00219 double best_found_elev_ = 0;
00220 double mask_ = DEG_TO_RAD(TermLinkHandoffMgr::elevation_mask_);
00221
00222 earth_coord = ((SatNode *)node_)->position()->coord();
00223 // Traverse the linked list of link interfaces
00224 for (slhp = (SatLinkHead*) node_->linklisthead().lh_first; slhp;
00225 slhp = (SatLinkHead*) slhp->nextlinkhead() ) {
00226 if (slhp->type() == LINK_GSL_GEO ||
00227 slhp->type() == LINK_GENERIC)
00228 continue;
00229 if (slhp->type() != LINK_GSL_POLAR) {
00230 printf("Error: Terminal link type ");
00231 printf("not valid %d NOW %f\n", slhp->type(), NOW);
00232 exit(1);
00233 }
00234 // The link is a GSL_POLAR link-- should be one receive
00235 // interface on it
00236 restart_timer_flag_ = TRUE;
00237 peer_ = get_peer(slhp);
00238 if (peer_) {
00239 sat_coord = peer_->position()->coord();
00240 if (!SatGeometry::check_elevation(sat_coord,
00241 earth_coord, mask_) && slhp->linkup_) {
00242 slhp->linkup_ = FALSE;
00243 link_changes_flag_ = TRUE;
00244 // Detach receive link interface from channel
00245 // Next line removes phy from linked list
00246 // of interfaces attached to channel
00247 slhp->phy_rx()->removechnl();
00248 // Set our channel pointers to NULL
00249 slhp->phy_tx()->setchnl(0);
00250 slhp->phy_rx()->setchnl(0);
00251 // wired-satellite integration
00252 if (SatRouteObject::instance().wiredRouting()) {
00253 Tcl::instance().evalf("[Simulator instance] sat_link_destroy %d %d", slhp->phy_tx()->node()->address(), peer_->address());
00254 // Must do this bidirectionally
00255 Tcl::instance().evalf("[Simulator instance] sat_link_destroy %d %d", peer_->address(), slhp->phy_tx()->node()->address());
00256 }
00257 }
00258 }
00259 if (!slhp->linkup_) {
00260 // If link is down, see if we can use another satellite
00261 //
00262 // As an optimization, first check the next satellite
00263 // coming over the horizon. Next, consider all
00264 // remaining satellites.
00265 //
00266 if (peer_) {
00267 // Next satellite
00268 nextpos_ = ((PolarSatPosition*)
00269 peer_->position())->next();
00270 if (nextpos_) {
00271 sat_coord = nextpos_->coord();
00272 found_elev_ = SatGeometry::check_elevation(sat_coord, earth_coord, mask_);
00273 if (found_elev_)
00274 peer_ = (SatNode*) nextpos_->node();
00275 }
00276 }
00277 // Next, check all remaining satellites if not found
00278 if (!found_elev_) {
00279 for (nodep=Node::nodehead_.lh_first; nodep;
00280 nodep = nodep->nextnode()) {
00281 if (!SatNode::IsASatNode(nodep->address()))
00282 continue;
00283 peer_ = (SatNode*) nodep;
00284 if (peer_->position() &&
00285 (peer_->position()->type() !=
00286 POSITION_SAT_POLAR))
00287 continue;
00288 sat_coord =
00289 peer_->position()->coord();
00290 found_elev_ = SatGeometry::check_elevation(sat_coord, earth_coord, mask_);
00291 if (found_elev_ > best_found_elev_) {
00292 best_peer_ = peer_;
00293 best_found_elev_ = found_elev_;
00294 }
00295 }
00296 if (best_found_elev_) {
00297 peer_ = best_peer_;
00298 found_elev_ = best_found_elev_;
00299 }
00300 }
00301 if (found_elev_) {
00302 slhp->linkup_ = TRUE;
00303 link_changes_flag_ = TRUE;
00304 // Point slhp->phy_tx to peer_'s inlink
00305 slhp->phy_tx()->setchnl(peer_->uplink());
00306 // Point slhp->phy_rx to peer_'s outlink and
00307 // add phy_rx to the channels list of phy's
00308 slhp->phy_rx()->setchnl(peer_->downlink());
00309 // Add phy to channel's linked list of i/fces
00310 slhp->phy_rx()->insertchnl(&(peer_->downlink()->ifhead_));
00311 }
00312 }
00313 }
00314 if (link_changes_flag_) {
00315 SatRouteObject::instance().recompute();
00316 }
00317 if (restart_timer_flag_) {
00318 // If we don't have polar GSLs, don't reset the timer
00319 if (handoff_randomization_) {
00320 timer_.resched(term_handoff_int_ +
00321 handoff_rng_.uniform(-1 * term_handoff_int_/2,
00322 term_handoff_int_/2));
00323 } else
00324 timer_.resched(term_handoff_int_);
00325 }
00326 return link_changes_flag_;
00327 }
|
Here is the call graph for this function:

|
|
Definition at line 78 of file sathandoff.h. References LinkHandoffMgr::node_.
00078 { return node_; } // backpointer to node
|
|
|
Definition at line 77 of file sathandoff.h. References LinkHandoffMgr::handoff(). Referenced by SatNode::command().
00077 { handoff(); }
|
Here is the call graph for this function:

|
|
Definition at line 191 of file sathandoff.cc. Referenced by handoff(), and TermLinkHandoffMgr(). |
|
|
Definition at line 91 of file sathandoff.cc. Referenced by SatLinkHandoffMgr::handoff(), handoff(), and LinkHandoffMgr::LinkHandoffMgr(). |
|
|
Definition at line 90 of file sathandoff.cc. Referenced by SatLinkHandoffMgr::handoff(), and handoff(). |
|
|
Definition at line 83 of file sathandoff.h. Referenced by LinkHandoffMgr::command(), SatLinkHandoffMgr::handoff(), handoff(), and LinkHandoffMgr::node(). |
|
|
Definition at line 192 of file sathandoff.cc. Referenced by handoff(), and TermLinkHandoffMgr(). |
|
|
Definition at line 109 of file sathandoff.h. Referenced by handoff(). |
1.3.3