#include <satlink.h>
Inheritance diagram for SatLL:


Public Member Functions | |
| SatLL () | |
| virtual void | sendDown (Packet *p) |
| virtual void | sendUp (Packet *p) |
| virtual void | recv (Packet *p, Handler *h) |
| Channel * | channel () |
| SatNode * | satnode () |
| virtual void | recv (Packet *p, const char *s) |
| void | handle (Event *e) |
| int | initialized () |
| int | seqno () |
| int | ackno () |
| int | macDA () |
| Queue * | ifq () |
| NsObject * | downtarget () |
| NsObject * | uptarget () |
| ARPTable * | arp_table () |
| void | send (Packet *p, Handler *) |
| double | delay () |
| double | txtime (Packet *p) |
| double | bandwidth () const |
| void | pktintran (int src, int group) |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| virtual void | recvOnly (Packet *) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Protected Member Functions | |
| int | command (int argc, const char *const *argv) |
| void | reset () |
| virtual void | drop (Packet *p, const char *s) |
Protected Attributes | |
| SatNode * | satnode_ |
| int | arpcache_ |
| int | arpcachedst_ |
| int | seqno_ |
| int | ackno_ |
| int | macDA_ |
| Queue * | ifq_ |
| Mac * | mac_ |
| LanRouter * | lanrouter_ |
| ARPTable * | arptable_ |
| VARPTable * | varp_ |
| NsObject * | downtarget_ |
| NsObject * | uptarget_ |
| double | bandwidth_ |
| double | delay_ |
| Event | intr_ |
| int | dynamic_ |
| PacketQueue * | itq_ |
| int | total_ [4] |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Friends | |
| void | ARPTable::arpinput (Packet *p, LL *ll) |
| void | ARPTable::arprequest (nsaddr_t src, nsaddr_t dst, LL *ll) |
|
|
Definition at line 67 of file satlink.h. References arpcache_, and arpcachedst_.
00067 : LL(), arpcache_(-1), arpcachedst_(-1) {} |
|
|
Definition at line 94 of file ll.h. References LL::ackno_.
00094 { return ackno_; }
|
|
|
Definition at line 99 of file ll.h. References LL::arptable_.
00099 { return arptable_; }
|
|
|
Definition at line 57 of file delay.h. References LinkDelay::bandwidth_. Referenced by REMQueue::command(), REDQueue::command(), JoBS::deque(), JoBS::enforceWC(), PushbackQueue::getBW(), CBQueue::insert_class(), CBQClass::newallot(), QSAgent::recv(), REMQueue::reset(), REDQueue::reset(), dsREDQueue::reset(), PushbackQueue::timeout(), and JoBS::updateStats().
00057 { return bandwidth_; }
|
|
|
Definition at line 294 of file satlink.cc. References Phy::channel(), BiConnector::downtarget(), and LL::mac_. Referenced by sendDown().
00295 {
00296 Phy* phy_ = (Phy*) mac_->downtarget();
00297 return phy_->channel();
00298 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from LL. Definition at line 175 of file satlink.cc. References LL::command(), and satnode_.
00176 {
00177 if (argc == 3) {
00178 if (strcmp(argv[1], "setnode") == 0) {
00179 satnode_ = (SatNode*) TclObject::lookup(argv[2]);
00180 return (TCL_OK);
00181 }
00182 }
00183 return LL::command(argc, argv);
00184 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 102 of file object.cc. References NsObject::debug_.
00103 {
00104 if (!debug_)
00105 return;
00106 va_list ap;
00107 va_start(ap, fmt);
00108 vprintf(fmt, ap);
00109 }
|
|
|
Definition at line 53 of file delay.h. References LinkDelay::delay_. Referenced by REDQueue::command(), and Snoop::handle().
00053 { return delay_; }
|
|
||||||||||||||||
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 63 of file object.cc. References NsObject::debug_. Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().
00064 {
00065 if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer))
00066 return TCL_OK;
00067 return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }
|
|
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 57 of file object.cc. Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().
00058 {
00059 delay_bind_init_one("debug_");
00060 }
|
|
|
Definition at line 97 of file ll.h. References LL::downtarget_.
00097 { return downtarget_; }
|
|
||||||||||||
|
Definition at line 114 of file connector.cc. References Connector::drop_, Packet::free(), and NsObject::recv().
00115 {
00116 if (drop_ != 0)
00117 drop_->recv(p, s);
00118 else
00119 Packet::free(p);
00120 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Reimplemented from LinkDelay. Definition at line 85 of file ll.h. References LL::recv().
|
Here is the call graph for this function:

|
|
Definition at line 96 of file ll.h. References LL::ifq_. Referenced by Snoop::snoop_data().
00096 { return ifq_; }
|
|
|
Definition at line 86 of file ll.h. References LL::downtarget_, LL::mac_, and LL::uptarget_. Referenced by recv(), and LL::recv().
00086 {
00087 return (mac_ && uptarget_ && downtarget_);
00088 }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Definition at line 95 of file ll.h. References LL::macDA_.
00095 { return macDA_; }
|
|
||||||||||||
|
Definition at line 122 of file delay.cc. References hdr_CtrMcast::access(), hdr_ip::access(), hdr_ip::daddr(), LinkDelay::dynamic_, hdr_ip::flowid(), hdr_CtrMcast::group(), LinkDelay::itq_, len, PacketQueue::length(), PacketQueue::lookup(), hdr_ip::saddr(), hdr_CtrMcast::src(), and LinkDelay::total_. Referenced by LinkDelay::command().
00123 {
00124 int reg = 1;
00125 int prune = 30;
00126 int graft = 31;
00127 int data = 0;
00128 for (int i=0; i<4; i++) {
00129 total_[i] = 0;
00130 }
00131
00132 if (! dynamic_)
00133 return;
00134
00135 int len = itq_->length();
00136 while (len) {
00137 len--;
00138 Packet* p = itq_->lookup(len);
00139 hdr_ip* iph = hdr_ip::access(p);
00140 if (iph->flowid() == prune) {
00141 if (iph->saddr() == src && iph->daddr() == group) {
00142 total_[0]++;
00143 }
00144 } else if (iph->flowid() == graft) {
00145 if (iph->saddr() == src && iph->daddr() == group) {
00146 total_[1]++;
00147 }
00148 } else if (iph->flowid() == reg) {
00149 hdr_CtrMcast* ch = hdr_CtrMcast::access(p);
00150 if (ch->src() == src+1 && ch->group() == group) {
00151 total_[2]++;
00152 }
00153 } else if (iph->flowid() == data) {
00154 if (iph->saddr() == src+1 && iph->daddr() == group) {
00155 total_[3]++;
00156 }
00157 }
00158 }
00159 //printf ("%f %d %d %d %d\n", Scheduler::instance().clock(), total_[0], total_[1], total_[2],total_[3]);
00160 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in CMUTrace. Definition at line 96 of file object.cc. References Packet::free().
00097 {
00098 Packet::free(p);
00099 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from LL. Definition at line 156 of file satlink.cc. References hdr_cmn::direction(), hdr_cmn::DOWN, Connector::drop(), HDR_CMN, LL::initialized(), sendDown(), sendUp(), hdr_cmn::UP, and LL::uptarget_.
00157 {
00158 hdr_cmn *ch = HDR_CMN(p);
00159
00160 /*
00161 * Sanity Check
00162 */
00163 assert(initialized());
00164
00165 // If direction = UP, then pass it up the stack
00166 // Otherwise, set direction to DOWN and pass it down the stack
00167 if(ch->direction() == hdr_cmn::UP) {
00168 uptarget_ ? sendUp(p) : drop(p);
00169 return;
00170 }
00171
00172 ch->direction() = hdr_cmn::DOWN;
00173 sendDown(p);
00174 }
|
Here is the call graph for this function:

|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
00056 {};
|
|
|
Reimplemented from NsObject. Definition at line 101 of file delay.cc. References Scheduler::cancel(), PacketQueue::deque(), Connector::drop(), Scheduler::instance(), LinkDelay::itq_, and PacketQueue::length().
|
Here is the call graph for this function:

|
|
Definition at line 72 of file satlink.h. References satnode_. Referenced by sendDown().
00072 {return satnode_; }
|
|
||||||||||||
|
Reimplemented from Connector. Definition at line 96 of file delay.cc. References NsObject::recv(), and Connector::target_. Referenced by LinkDelay::handle().
|
Here is the call graph for this function:

|
|
Reimplemented from LL. Definition at line 187 of file satlink.cc. References hdr_ip::access(), Packet::access(), Mac::addr(), hdr_cmn::addr_type(), arpcache_, arpcachedst_, channel(), hdr_ip::daddr(), LinkDelay::delay_, LL::downtarget_, ETHERTYPE_IP, SatChannel::find_peer_mac_addr(), HDR_CMN, Mac::hdr_dst(), HDR_LL, HDR_MAC, Mac::hdr_src(), Mac::hdr_type(), Scheduler::instance(), Address::instance(), SatRouteObject::instance(), IP_BROADCAST, hdr_cmn::last_hop_, LL_DATA, hdr_ll::lltype(), RouteLogic::lookup_flat(), LL::mac_, MAC_BROADCAST, SatRouteAgent::myaddr(), hdr_cmn::next_hop(), hdr_cmn::next_hop_, NOW, NS_AF_INET, NS_AF_NONE, nsaddr_t, hdr_mac::offset_, Address::print_nodeaddr(), SatNode::ragent(), satnode(), Scheduler::schedule(), LL::seqno_, hdr_ll::seqno_, u_int32_t, and SatRouteObject::wiredRouting(). Referenced by recv().
00188 {
00189 hdr_cmn *ch = HDR_CMN(p);
00190 hdr_ll *llh = HDR_LL(p);
00191 char *mh = (char*)p->access(hdr_mac::offset_);
00192 int peer_mac_;
00193 SatChannel* satchannel_;
00194
00195 llh->seqno_ = ++seqno_;
00196 llh->lltype() = LL_DATA;
00197
00198 // wired-satellite integration
00199 if (SatRouteObject::instance().wiredRouting()) {
00200 // Wired/satellite integration
00201 // We need to make sure packet headers are set correctly
00202 // This code adapted from virtual-classifier.cc
00203 RouteLogic *routelogic_;
00204 hdr_ip* h = hdr_ip::access(p);
00205 int next_hopIP = -1; // Initialize in case route not found
00206 int myaddr_;
00207 Tcl &tcl = Tcl::instance();
00208 tcl.evalc("[Simulator instance] get-routelogic");
00209 routelogic_ = (RouteLogic*) TclObject::lookup(tcl.result());
00210 char* adst = Address::instance().print_nodeaddr(h->daddr());
00211 myaddr_ = satnode()->ragent()->myaddr();
00212 //char* asrc = Address::instance().print_nodeaddr(h->saddr());
00213 char* asrc = Address::instance().print_nodeaddr(myaddr_);
00214 routelogic_->lookup_flat(asrc, adst, next_hopIP);
00215 delete [] adst;
00216 delete [] asrc;
00217 // The following fields are usually set by routeagent
00218 // forwardPacket() in satroute.cc (when wiredRouting_ == 0)
00219 ch->next_hop_ = next_hopIP;
00220 if (satnode()) {
00221 ch->last_hop_ = satnode()->ragent()->myaddr();
00222 } else {
00223 printf("Error: LL has no satnode_ pointer set\n");
00224 exit(1);
00225 }
00226 }
00227 // Set mac src, type, and dst
00228 mac_->hdr_src(mh, mac_->addr());
00229 mac_->hdr_type(mh, ETHERTYPE_IP); // We'll just use ETHERTYPE_IP
00230
00231 nsaddr_t dst = ch->next_hop();
00232 // a value of -1 is IP_BROADCAST
00233 if (dst < -1) {
00234 printf("Error: next_hop_ field not set by routing agent\n");
00235 exit(1);
00236 }
00237
00238 switch(ch->addr_type()) {
00239
00240 case NS_AF_INET:
00241 case NS_AF_NONE:
00242 if (IP_BROADCAST == (u_int32_t) dst)
00243 {
00244 mac_->hdr_dst((char*) HDR_MAC(p), MAC_BROADCAST);
00245 break;
00246 }
00247 /*
00248 * Here is where arp would normally occur. In the satellite
00249 * case, we don't arp (for now). Instead, use destination
00250 * address to find the mac address corresponding to the
00251 * peer connected to this channel. If someone wants to
00252 * add arp, look at how the wireless code does it.
00253 */
00254 // Cache latest value used
00255 if (dst == arpcachedst_) {
00256 mac_->hdr_dst((char*) HDR_MAC(p), arpcache_);
00257 break;
00258 }
00259 // Search for peer's mac address (this is the pseudo-ARP)
00260 satchannel_ = (SatChannel*) channel();
00261 peer_mac_ = satchannel_->find_peer_mac_addr(dst);
00262 if (peer_mac_ < 0 ) {
00263 printf("Error: couldn't find dest mac on channel ");
00264 printf("for src/dst %d %d at NOW %f\n",
00265 ch->last_hop_, dst, NOW);
00266 exit(1);
00267 } else {
00268 mac_->hdr_dst((char*) HDR_MAC(p), peer_mac_);
00269 arpcachedst_ = dst;
00270 arpcache_ = peer_mac_;
00271 break;
00272 }
00273
00274 default:
00275 printf("Error: addr_type not set to NS_AF_INET or NS_AF_NONE\n");
00276 exit(1);
00277 }
00278
00279 // let mac decide when to take a new packet from the queue.
00280 Scheduler& s = Scheduler::instance();
00281 s.schedule(downtarget_, p, delay_);
00282 }
|
Here is the call graph for this function:

|
|
Reimplemented from LL. Definition at line 284 of file satlink.cc. References hdr_cmn::access(), LinkDelay::delay_, Connector::drop(), hdr_cmn::error(), Scheduler::instance(), Scheduler::schedule(), and LL::uptarget_. Referenced by recv().
00285 {
00286 Scheduler& s = Scheduler::instance();
00287 if (hdr_cmn::access(p)->error() > 0)
00288 drop(p);
00289 else
00290 s.schedule(uptarget_, p, delay_);
00291 }
|
Here is the call graph for this function:

|
|
Definition at line 93 of file ll.h. References LL::seqno_.
00093 { return seqno_; }
|
|
|
Definition at line 48 of file connector.h. References Connector::target_. Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().
00048 { return target_; }
|
|
|
Definition at line 54 of file delay.h. References hdr_cmn::access(), LinkDelay::bandwidth_, and hdr_cmn::size(). Referenced by LinkDelay::recv(), and CBQClass::update().
00054 {
00055 return (8. * hdr_cmn::access(p)->size() / bandwidth_);
00056 }
|
Here is the call graph for this function:

|
|
Definition at line 98 of file ll.h. References LL::uptarget_. Referenced by Snoop::command().
00098 { return uptarget_; }
|
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Definition at line 105 of file ll.h. Referenced by LL::ackno(). |
|
|
Definition at line 77 of file satlink.h. Referenced by SatLL(), and sendDown(). |
|
|
Definition at line 78 of file satlink.h. Referenced by SatLL(), and sendDown(). |
|
|
Definition at line 111 of file ll.h. Referenced by LL::arp_table(), LL::command(), LL::recv(), and LL::sendDown(). |
|
|
Definition at line 62 of file delay.h. Referenced by LinkDelay::bandwidth(), LinkDelay::LinkDelay(), and LinkDelay::txtime(). |
|
|
Reimplemented in FECModel, FloodAgent, and LandmarkAgent. Definition at line 66 of file object.h. Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset(). |
|
|
Definition at line 63 of file delay.h. Referenced by ARPTable::arpinput(), ARPTable::arprequest(), LinkDelay::delay(), LinkDelay::LinkDelay(), LinkDelay::recv(), sendDown(), LL::sendDown(), sendUp(), and LL::sendUp(). |
|
|
Definition at line 114 of file ll.h. Referenced by LL::command(), LL::downtarget(), LL::initialized(), sendDown(), and LL::sendDown(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Definition at line 65 of file delay.h. Referenced by LinkDelay::command(), LinkDelay::pktintran(), and LinkDelay::recv(). |
|
|
Definition at line 108 of file ll.h. Referenced by LL::command(), and LL::ifq(). |
|
|
Definition at line 64 of file delay.h. Referenced by LLSnoop::recv(), and LinkDelay::recv(). |
|
|
Definition at line 67 of file delay.h. Referenced by LinkDelay::command(), LinkDelay::handle(), LinkDelay::pktintran(), LinkDelay::recv(), and LinkDelay::reset(). |
|
|
Definition at line 110 of file ll.h. Referenced by LL::command(), and LL::sendDown(). |
|
|
Definition at line 109 of file ll.h. Referenced by channel(), LL::command(), LL::initialized(), sendDown(), and LL::sendDown(). |
|
|
Definition at line 106 of file ll.h. Referenced by LL::LL(), LL::macDA(), and LL::sendDown(). |
|
|
|
|
|
Definition at line 104 of file ll.h. Referenced by sendDown(), LL::sendDown(), and LL::seqno(). |
|
|
|
Definition at line 68 of file delay.h. Referenced by LinkDelay::command(), and LinkDelay::pktintran(). |
|
|
Definition at line 115 of file ll.h. Referenced by LL::command(), LL::initialized(), recv(), LL::recv(), sendUp(), LL::sendUp(), and LL::uptarget(). |
|
|
Definition at line 112 of file ll.h. Referenced by LL::command(), and LL::sendDown(). |
1.3.3