[Sumover-dev] [svn commit] r4581 - vic/branches/cc/rtp
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Mon Feb 1 19:00:30 GMT 2010
Author: soohyunc
Date: Mon Feb 1 19:00:30 2010
New Revision: 4581
Modified:
vic/branches/cc/rtp/transmitter.cpp
vic/branches/cc/rtp/transmitter.h
Log:
To add TFRC algorithm, we have added a control loop (switch-case).
Modified: vic/branches/cc/rtp/transmitter.cpp
==============================================================================
--- vic/branches/cc/rtp/transmitter.cpp (original)
+++ vic/branches/cc/rtp/transmitter.cpp Mon Feb 1 19:00:30 2010
@@ -92,7 +92,8 @@
loop_layer_(1000),
loopback_(0),
is_cc_active_(1),
- is_first_(1)
+ is_first_(1),
+ cc_type_(0)
{
memset((char*)&mh_, 0, sizeof(mh_));
mh_.msg_iovlen = 2;
@@ -213,9 +214,11 @@
void Transmitter::send(pktbuf* pb)
{
- // CC is active, so just follow CC routines
- // (i.e., not sending packets here)
- if (is_cc_on()) {
+ switch (cc_type_) {
+ //
+ // window-based congestion control (TFWC)
+ //
+ case WBCC:
// if it is the very first packet, just send it.
if(is_first_) {
if (head_ != 0) {
@@ -224,7 +227,7 @@
} else
tail_ = head_ = pb;
pb->next = 0;
- cc_output();
+ cc_tfwc_output();
is_first_ = false;
}
// if it is not, just queue up the packets.
@@ -236,9 +239,40 @@
tail_ = head_ = pb;
pb->next = 0;
}
- }
- // CC is not active, so just go for the normal operation
- else {
+ break;
+
+ //
+ // rate-based congestion control (TFRC)
+ //
+ case RBCC:
+ // if it is the very first packet, just send it.
+ if(is_first_) {
+ if (head_ != 0) {
+ tail_->next = pb;
+ tail_ = pb;
+ } else
+ tail_ = head_ = pb;
+ pb->next = 0;
+ cc_tfrc_output();
+ is_first_ = false;
+ }
+ // if it is not, just queue up the packets.
+ else {
+ if (head_ != 0) {
+ tail_->next = pb;
+ tail_ = pb;
+ } else
+ tail_ = head_ = pb;
+ pb->next = 0;
+ }
+ break;
+
+ //
+ // without congestion control
+ //
+ case NOCC:
+ default:
+ // CC is not active, so just go for the normal operation
if (!busy_) {
double delay = txtime(pb);
nextpkttime_ = gettimeofday_secs() + delay;
@@ -257,15 +291,15 @@
tail_ = head_ = pb;
pb->next = 0;
}
- } // if (is_cc_on())
+ } // switch (cc_type)
}
/*
- * main CC output routines
+ * main TFWC CC output routines
*/
-void Transmitter::cc_output()
+void Transmitter::cc_tfwc_output()
{
- printf("\t------------entering cc_output()------------\n");
+ printf("\t------------entering cc_tfwc_output()------------\n");
printf("\t| |\n");
printf("\tV V\n");
@@ -279,7 +313,7 @@
printf("\t=========== PACKET NOT AVAILABLE ===========\n\n");
return;
}
- printf("\tthere are packets available to send in cc_output()\n");
+ printf("\tthere are packets available to send in cc_tfwc_output()\n");
// pb is not null, hence parse it.
rtphdr* rh = (rtphdr *) pb->data;
@@ -318,6 +352,13 @@
printf("\t============================================\n");
}
+/*
+ * main TFRC CC output
+ */
+void Transmitter::cc_tfrc_output() {
+ // TBA
+}
+
void Transmitter::timeout()
{
double now = gettimeofday_secs();
Modified: vic/branches/cc/rtp/transmitter.h
==============================================================================
--- vic/branches/cc/rtp/transmitter.h (original)
+++ vic/branches/cc/rtp/transmitter.h Mon Feb 1 19:00:30 2010
@@ -52,6 +52,10 @@
#include "cc/tfwc_sndr.h"
#include "cc/tfwc_rcvr.h"
+#define NOCC 100
+#define WBCC 101
+#define RBCC 102
+
/*
* The base object for performing the outbound path of
* the application level protocol.
@@ -86,7 +90,8 @@
void flush();
void send(pktbuf*);
inline bool is_cc_on() { return is_cc_active_; }
- void cc_output();
+ void cc_tfwc_output();
+ void cc_tfrc_output();
/*
* Buffer allocation hooks.
@@ -125,8 +130,9 @@
static u_int16_t seqno_;
/* Cc related variables */
- bool is_cc_active_; /* is Cc module activated? */
+ bool is_cc_active_; /* is Cc module activated? */
bool is_first_; /* is this first CC'd data packet? */
+ int cc_type_;
private:
static pktbuf* freehdrs_;
More information about the Sumover-dev
mailing list