RTPSession Class Reference

#include <rtp.h>

Inheritance diagram for RTPSession:

NsObject TclObject Handler Collaboration diagram for RTPSession:

Collaboration graph
[legend]

Detailed Description

Definition at line 86 of file rtp.h.

Public Member Functions

int build_report (int bye)
int command (int argc, const char *const *argv)
virtual void debug (const char *fmt,...)
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
virtual void delay_bind_init_all ()
int isdebug () const
void localsrc_update (int)
virtual void recv (Packet *p, const char *s)
virtual void recv (Packet *p, Handler *)
virtual void recv_ctrl (Packet *p)
virtual void recvOnly (Packet *)
 RTPSession ()
u_int32_t srcid ()
 ~RTPSession ()

Protected Member Functions

int build_bye ()
int build_sdes ()
void enter (RTPSource *)
void handle (Event *)
RTPSourcelookup (u_int32_t)
virtual void reset ()

Protected Attributes

RTPSourceallsrcs_
int debug_
int last_np_
RTPSourcelocalsrc_


Constructor & Destructor Documentation

RTPSession::RTPSession  ) 
 

Definition at line 64 of file session-rtp.cc.

00065     : allsrcs_(0), localsrc_(0), last_np_(0)
00066 {
00067 }

RTPSession::~RTPSession  ) 
 

Definition at line 69 of file session-rtp.cc.

References allsrcs_, localsrc_, and RTPSource::next.

00070 {
00071     while (allsrcs_ != 0) {
00072         RTPSource* p = allsrcs_;
00073         allsrcs_ = allsrcs_->next;
00074         delete p;
00075     }
00076     delete localsrc_;
00077 }


Member Function Documentation

int RTPSession::build_bye  )  [protected]
 

Definition at line 123 of file session-rtp.cc.

00124 {
00125     return (8);
00126 }

int RTPSession::build_report int  bye  ) 
 

Definition at line 88 of file session-rtp.cc.

References last_np_, localsrc_, RTPSource::np(), RTCP_HDRSIZE, and RTCP_SR_SIZE.

Referenced by RTCPAgent::command(), and RTCPAgent::timeout().

00089 {
00090     int nsrc = 0;
00091     int nrr = 0;
00092     int len = RTCP_HDRSIZE;
00093     int we_sent = 0;
00094     if (localsrc_->np() != last_np_) {
00095         last_np_ = localsrc_->np();
00096         we_sent = 1;
00097         len += RTCP_SR_SIZE;
00098     }
00099     for (RTPSource* sp = allsrcs_; sp != 0; sp = sp->next) {
00100         ++nsrc;
00101             int received = sp->np() - sp->snp();
00102         if (received == 0) {
00103             continue;
00104         }
00105         sp->snp(sp->np());
00106         len += RTCP_RR_SIZE;
00107         if (++nrr >= 31)
00108             break;
00109     }
00110 
00111     if (bye) 
00112         len += build_bye();
00113     else 
00114         len += build_sdes();
00115 
00116     Tcl::instance().evalf("%s adapt-timer %d %d %d", name(), 
00117                   nsrc, nrr, we_sent);
00118     Tcl::instance().evalf("%s sample-size %d", name(), len);
00119 
00120     return (len);
00121 }

Here is the call graph for this function:

int RTPSession::build_sdes  )  [protected]
 

Definition at line 128 of file session-rtp.cc.

00129 {
00130     /* XXX We'll get to this later... */
00131     return (20);
00132 }

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

Reimplemented from NsObject.

Definition at line 173 of file session-rtp.cc.

References enter(), and localsrc_.

00174 {
00175     if (argc == 3) {
00176         if (strcmp(argv[1], "enter") == 0) {
00177             RTPSource* s = (RTPSource*)TclObject::lookup(argv[2]);
00178             enter(s);
00179             return (TCL_OK);
00180         }
00181         if (strcmp(argv[1], "localsrc") == 0) {
00182             localsrc_ = (RTPSource*)TclObject::lookup(argv[2]);
00183             enter(localsrc_);
00184             return (TCL_OK);
00185         }
00186     }
00187     return (TclObject::command(argc, argv));
00188 }

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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

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 RTPSession::enter RTPSource  )  [protected]
 

Definition at line 167 of file session-rtp.cc.

References allsrcs_, and RTPSource::next.

Referenced by command().

00168 {
00169     s->next = allsrcs_;
00170     allsrcs_ = s;
00171 }

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 RTPSession::localsrc_update int   ) 
 

Definition at line 79 of file session-rtp.cc.

References localsrc_, and RTPSource::np().

Referenced by RTPAgent::timeout().

00080 {
00081     localsrc_->np(1);
00082 }

Here is the call graph for this function:

RTPSource * RTPSession::lookup u_int32_t   )  [protected]
 

Definition at line 157 of file session-rtp.cc.

References allsrcs_, RTPSource::next, and RTPSource::srcid().

Referenced by recv().

00158 {
00159     RTPSource *p;
00160     for (p = allsrcs_; p != 0; p = p->next)
00161         if (p->srcid() == srcid)
00162             return (p);
00163 
00164     return (0);
00165 }

Here is the call graph for this function:

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 RTPSession::recv Packet p,
Handler
[virtual]
 

Implements NsObject.

Definition at line 134 of file session-rtp.cc.

References hdr_rtp::access(), RTPSource::ehsr(), Packet::free(), lookup(), RTPSource::np(), hdr_rtp::seqno(), hdr_rtp::srcid(), and srcid().

Referenced by RTPAgent::recv().

00135 {
00136     hdr_rtp *rh = hdr_rtp::access(p);
00137     u_int32_t srcid = rh->srcid();
00138     RTPSource* s = lookup(srcid);
00139     if (s == 0) {
00140         Tcl& tcl = Tcl::instance();
00141         tcl.evalf("%s new-source %d", name(), srcid);
00142         s = (RTPSource*)TclObject::lookup(tcl.result());
00143     }
00144     s->np(1);
00145     s->ehsr(rh->seqno());
00146     Packet::free(p);
00147 }

Here is the call graph for this function:

void RTPSession::recv_ctrl Packet p  )  [virtual]
 

Definition at line 149 of file session-rtp.cc.

References hdr_cmn::access(), Packet::free(), and hdr_cmn::size().

Referenced by RTCPAgent::recv().

00150 {
00151     hdr_cmn* ch = hdr_cmn::access(p);
00152     Tcl::instance().evalf("%s sample-size %d", name(), ch->size());
00153     Packet::free(p);
00154 }

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, Queue< T >, and XcpSink.

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

u_int32_t RTPSession::srcid  )  [inline]
 

Definition at line 93 of file rtp.h.

References localsrc_, and RTPSource::srcid().

Referenced by RTPAgent::makepkt(), recv(), and RTCPAgent::sendpkt().

00093 { return (localsrc_->srcid()); }

Here is the call graph for this function:


Field Documentation

RTPSource* RTPSession::allsrcs_ [protected]
 

Definition at line 97 of file rtp.h.

Referenced by enter(), lookup(), and ~RTPSession().

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(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), SctpAgent::Reset(), REDQueue::reset(), DropTail::shrink_queue(), and Delayer::try_send().

int RTPSession::last_np_ [protected]
 

Definition at line 103 of file rtp.h.

Referenced by build_report().

RTPSource* RTPSession::localsrc_ [protected]
 

Definition at line 98 of file rtp.h.

Referenced by build_report(), command(), localsrc_update(), srcid(), and ~RTPSession().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:28:36 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6