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

MIPEncapsulator Class Reference

#include <mip.h>

Inheritance diagram for MIPEncapsulator:

Inheritance graph
[legend]
Collaboration diagram for MIPEncapsulator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MIPEncapsulator ()
void recv (Packet *p, Handler *h)
NsObjecttarget ()
virtual void drop (Packet *p)
virtual void recv (Packet *p, const char *s)
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

virtual void drop (Packet *p, const char *s)
int command (int argc, const char *const *argv)
void send (Packet *p, Handler *h)
virtual void reset ()
void handle (Event *)

Protected Attributes

ns_addr_t here_
int mask_
int shift_
int defttl_
NsObjecttarget_
NsObjectdrop_
int debug_

Constructor & Destructor Documentation

MIPEncapsulator::MIPEncapsulator  ) 
 

Definition at line 56 of file mip.cc.

References ns_addr_t::addr_, defttl_, here_, mask_, ns_addr_t::port_, and shift_.

00056                                  : Connector(), mask_(0xffffffff), 
00057         shift_(8), defttl_(32)
00058 {
00059         bind("addr_", (int*)&(here_.addr_));
00060         bind("port_", (int*)&(here_.port_));
00061         bind("shift_", &shift_);
00062         bind("mask_", &mask_);
00063         bind("ttl_", &defttl_);
00064 }


Member Function Documentation

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

Reimplemented from NsObject.

Reimplemented in SA_Agent, SALink, AODV, aodv_rqueue, MFTPRcvAgent, MFTPSndAgent, PingAgent, RTPAgent, UdpAgent, FtpClientAgent, FtpSrvrAgent, BayFullTcpAgent, Filter, MultiFieldFilter, Agent, Encapsulator, IvsReceiver, MessageAgent, NetworkInterface, LinkHead, PktCounter, SessionHelper, TTLChecker, SessionTTLChecker, coreQueue, edgeQueue, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, DSDV_Agent, DSRProto, DSRAgent, IcmpAgent, NatAgent, TCPDestNat, TCPSrcNat, TCPSrcDestNat, TapAgent, TCPTapAgent, GAFAgent, GAFPartner, imepAgent, LinkDelay, DynamicLink, HackLossyLink, rtProtoLS, ARPTable, LL, CtrMcastEncap, CtrMcastDecap, LmsAgent, LmsReceiver, LmsSender, mcastControlAgent, RLM_Sender, RLM_Receiver, SSMSRMAgent, SRMAgent, DumbAgent, MIPBSAgent, MIPMHAgent, LDPAgent, PingAgent, PushbackQueue, PushbackAgent, QSAgent, CBQClass, CBQueue, WRR_CBQueue, DelayModel, Demarker, DropTail, DRR, CMUPriQueue, SRMErrorModel, ErrorModel, TwoStateErrorModel, MultiStateErrorModel, ListErrorModel, SelectErrorModel, MrouteErrorModel, ErrorModule, LMSErrorModel, FQ, GK, JoBS, Marker, PIQueue, PriQueue, RedPDQueue, REDQueue, REMQueue, rtqueue, SFQ, SRR, Vq, RapAgent, rtProtoDV, SatLL, SatLinkHead, SatRouteAgent, FloodAgent, LandmarkAgent, SensorQueryAgent, SRAgent, AckRecons, RTCPAgent, SAack_Agent, AbsTcpAgent, FullTcpAgent, IntTcpAgent, TcpSessionAgent, TcpSink, TcpAgent, TfrcSinkAgent, TfrcAgent, LossMonitor, SnoopQueue, toraAgent, CMUTrace, Trace, and SimpleTcpAgent.

Definition at line 56 of file connector.cc.

References NsObject::command(), Connector::drop_, and Connector::target_.

Referenced by Vq::command(), SessionTTLChecker::command(), TTLChecker::command(), Trace::command(), SRR::command(), SFQ::command(), SessionHelper::command(), SALink::command(), rtqueue::command(), REMQueue::command(), REDQueue::command(), SnoopQueue::command(), PktCounter::command(), PIQueue::command(), LinkHead::command(), NetworkInterface::command(), Marker::command(), JoBS::command(), HackLossyLink::command(), GK::command(), GAFPartner::command(), FQ::command(), MultiFieldFilter::command(), Filter::command(), ErrorModule::command(), ErrorModel::command(), DynamicLink::command(), dsREDQueue::command(), CMUPriQueue::command(), DRR::command(), DropTail::command(), Demarker::command(), DelayModel::command(), LinkDelay::command(), CBQClass::command(), CBQueue::command(), aodv_rqueue::command(), and Agent::command().

00057 {
00058         Tcl& tcl = Tcl::instance();
00059         /*XXX*/
00060         if (argc == 2) {
00061                 if (strcmp(argv[1], "target") == 0) {
00062                         if (target_ != 0)
00063                                 tcl.result(target_->name());
00064                         return (TCL_OK);
00065                 }
00066                 if (strcmp(argv[1], "drop-target") == 0) {
00067                         if (drop_ != 0)
00068                                 tcl.resultf("%s", drop_->name());
00069                         return (TCL_OK);
00070                 }
00071                 if (strcmp(argv[1], "isDynamic") == 0) {
00072                         return TCL_OK;
00073                 }
00074         }
00075 
00076         else if (argc == 3) {
00077                 if (strcmp(argv[1], "target") == 0) {
00078                         if (*argv[2] == '0') {
00079                                 target_ = 0;
00080                                 return (TCL_OK);
00081                         }
00082                         target_ = (NsObject*)TclObject::lookup(argv[2]);
00083                         if (target_ == 0) {
00084                                 tcl.resultf("no such object %s", argv[2]);
00085                                 return (TCL_ERROR);
00086                         }
00087                         return (TCL_OK);
00088                 }
00089                 if (strcmp(argv[1], "drop-target") == 0) {
00090                         drop_ = (NsObject*)TclObject::lookup(argv[2]);
00091                         if (drop_ == 0) {
00092                                 tcl.resultf("no object %s", argv[2]);
00093                                 return (TCL_ERROR);
00094                         }
00095                         return (TCL_OK);
00096                 }
00097         }
00098         return (NsObject::command(argc, argv));
00099 }

Here is the call graph for this function:

void NsObject::debug const char *  fmt,
... 
[virtual, inherited]
 

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 }

int NsObject::delay_bind_dispatch const char *  varName,
const char *  localName,
TclObject tracer
[virtual, inherited]
 

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 }

void NsObject::delay_bind_init_all  )  [virtual, inherited]
 

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 }

void Connector::drop Packet p,
const char *  s
[protected, virtual, inherited]
 

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:

void Connector::drop Packet p  )  [virtual, inherited]
 

Definition at line 106 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

Referenced by DSRAgent::acceptRouteReply(), ARPTable::arpresolve(), JoBS::dropFront(), Vq::dropPacketForECN(), DSRAgent::dropSendBuff(), JoBS::dropTail(), dsREDQueue::edrop(), Vq::enque(), SRR::enque(), SimpleIntServ::enque(), SFQ::enque(), rtqueue::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), PIQueue::enque(), Marker::enque(), GK::enque(), dsREDQueue::enque(), DRR::enque(), DropTail::enque(), Demarker::enque(), aodv_rqueue::enque(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), DSRAgent::getRouteForPacket(), Snoop::handle(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), imepAgent::purgeReXmitQ(), SessionTTLChecker::recv(), TTLChecker::recv(), toraAgent::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TBF::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), FloodAgent::recv(), Filter::recv(), DynamicLink::recv(), DSDV_Agent::recv(), AODV::recv(), AODV::recvError(), PriQueue::recvHighPriority(), AODV::recvReply(), toraAgent::reset(), Queue< T >::reset(), LinkDelay::reset(), AODV::rt_ll_failed(), AODV::rt_purge(), AODV::rt_resolve(), toraAgent::rtRoutePacket(), TCPTapAgent::sendpkt(), TapAgent::sendpkt(), IPTapAgent::sendpkt(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), PriQueue::Terminate(), DSRAgent::Terminate(), CMUPriQueue::Terminate(), ARPTable::Terminate(), and DSRAgent::undeliverablePkt().

00107 {
00108         if (drop_ != 0)
00109                 drop_->recv(p);
00110         else
00111                 Packet::free(p);
00112 }

Here is the call graph for this function:

void NsObject::handle Event  )  [protected, virtual, inherited]
 

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

00092 {
00093         recv((Packet*)e);
00094 }

Here is the call graph for this function:

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

void NsObject::recv Packet p,
const char *  s
[virtual, inherited]
 

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:

void MIPEncapsulator::recv Packet p,
Handler h
[virtual]
 

Reimplemented from Connector.

Definition at line 66 of file mip.cc.

References hdr_cmn::access(), hdr_ipinip::access(), hdr_ip::access(), ns_addr_t::addr_, hdr_ip::daddr(), defttl_, hdr_ip::dport(), Packet::free(), Address::get_nodeaddr(), hdr_ipinip::hdr_, here_, Address::instance(), IP_HEADER_SIZE, hdr_ipinip::next_, ns_addr_t::port_, NsObject::recv(), hdr_ip::saddr(), hdr_cmn::size(), hdr_ip::sport(), Connector::target_, hdr_ip::ttl(), and hdr_ip::ttl_.

00067 {
00068         Tcl& tcl = Tcl::instance();
00069 
00070         hdr_ip* hdr = hdr_ip::access(p);
00071         hdr_ipinip **ppinhdr = (hdr_ipinip**)hdr_ipinip::access(p);
00072         if (--hdr->ttl_ <= 0) {
00073                 /*
00074                  * XXX this should be "dropped" somehow.  Right now,
00075                  * these events aren't traced.
00076                  */
00077                 hdr_ipinip *ptr = *ppinhdr, *temp;
00078                 while (ptr != NULL) {
00079                         temp = ptr;
00080                         ptr = ptr->next_;
00081                         delete temp;
00082                 }
00083                 *ppinhdr = NULL;
00084                 Packet::free(p);
00085                 return;
00086         }
00087         hdr_ipinip *inhdr = new hdr_ipinip;
00088         //int dst = ((hdr->dst() >> shift_) & mask_);
00089         int dst = Address::instance().get_nodeaddr(hdr->daddr());
00090         tcl.evalf("%s tunnel-exit %d", name_, dst);
00091         int te = atoi(tcl.result());
00092 
00093         inhdr->next_ = *ppinhdr;
00094         *ppinhdr = inhdr;
00095         inhdr->hdr_ = *hdr;
00096 
00097         hdr->saddr() = here_.addr_;
00098         hdr->sport() = here_.port_;
00099         //hdr->dst() = addr_ & ~(~(nsaddr_t)0 << shift_) | (te & mask_) << shift_;;
00100         hdr->daddr() = te;
00101         hdr->dport() = 1;
00102         hdr->ttl() = defttl_;
00103         hdr_cmn::access(p)->size() += IP_HEADER_SIZE;
00104 
00105         target_->recv(p,h);
00106 }

Here is the call graph for this function:

virtual void NsObject::recvOnly Packet  )  [inline, virtual, inherited]
 

Reimplemented in Agent, and Trace.

Definition at line 56 of file object.h.

Referenced by Trace::recvOnly().

00056 {};

void NsObject::reset  )  [protected, virtual, inherited]
 

Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, and Queue< T >.

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

void Connector::send Packet p,
Handler h
[inline, protected, inherited]
 

Reimplemented in Agent, and LinkDelay.

Definition at line 54 of file connector.h.

References NsObject::recv(), and Connector::target_.

Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), SALink::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), CBQClass::recv(), and AddSR::recv().

00054 { target_->recv(p, h); }

Here is the call graph for this function:

NsObject* Connector::target  )  [inline, inherited]
 

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_; }


Member Data Documentation

int NsObject::debug_ [protected, inherited]
 

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().

int MIPEncapsulator::defttl_ [protected]
 

Definition at line 109 of file mip.h.

Referenced by MIPEncapsulator(), and recv().

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv().

ns_addr_t MIPEncapsulator::here_ [protected]
 

Definition at line 106 of file mip.h.

Referenced by MIPEncapsulator(), and recv().

int MIPEncapsulator::mask_ [protected]
 

Definition at line 107 of file mip.h.

Referenced by MIPEncapsulator().

int MIPEncapsulator::shift_ [protected]
 

Definition at line 108 of file mip.h.

Referenced by MIPEncapsulator().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 56 of file connector.h.

Referenced by SRAgent::command(), SA_Agent::command(), IvsReceiver::command(), MultiFieldFilter::command(), Filter::command(), Connector::command(), DiffusionAgent::DiffusionAgent(), DSRAgent::DSRAgent(), PromotionTimer::expire(), FloodingAgent::FloodingAgent(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), DSDVTriggerHandler::handle(), AckRecons::handle(), DSRAgent::handlePacketReceipt(), DSDV_Agent::helper_callback(), AODV::initialized(), DSDV_Agent::lost_link(), OmniMcastAgent::OmniMcastAgent(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), TCPTapAgent::processpkt(), IPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), CMUPriQueue::prq_resume(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), TBF::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SatDequeTrace::recv(), SAack_Agent::recv(), Queue< T >::recv(), PingResponder::recv(), recv(), LmsAgent::recv(), HackLossyLink::recv(), GAFPartner::recv(), FQ::recv(), FloodAgent::recv(), ErrorModel::recv(), DynamicLink::recv(), DumbAgent::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), CtrMcastDecap::recv(), CtrMcastEncap::recv(), CMUTrace::recv(), PriQueue::recvHighPriority(), Trace::recvOnly(), TapAgent::recvpkt(), Queue< T >::resume(), LinkDelay::send(), Connector::send(), Agent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), MFTPSndAgent::send_data(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), MFTPRcvAgent::send_nak(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), MFTPSndAgent::send_status_request(), LmsAgent::send_upstream(), LandmarkAgent::SendChangedTagListUpdate(), AODV::sendError(), AODV::sendHello(), UdpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), LmsSender::sendmsg(), DSDV_Agent::sendOutBCastPkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), IvsSource::sendpkt(), AODV::sendReply(), AODV::sendRequest(), LmsSender::solicit_naks(), Connector::target(), TBF::timeout(), and toraAgent::tora_output().


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