#include <scoreboard-rh.h>
Collaboration diagram for ScoreBoardRH:

Public Member Functions | |
| ScoreBoardRH (int *numdupacks) | |
| int | IsEmpty () |
| void | ClearScoreBoard () |
| int | GetNextRetran () |
| void | MarkRetran (int retran_seqno, int snd_nxt, int rh_id) |
| int | UpdateScoreBoard (int last_ack_, hdr_tcp *, int rh_id) |
| int | CheckSndNxt (int sack_max) |
| int | GetFack (int last_ack) |
| int | GetNewHoles () |
| void | TimeoutScoreBoard (int snd_nxt) |
| int | FakeSack (int last_ack, int num_dupacks) |
| int | RetranSacked (int rh_id) |
| int | RetranOccurred (int rh_id) |
Protected Attributes | |
| int | first_ |
| int | length_ |
| int | retran_occured_ |
| int | retran_sacked_ |
| int * | numdupacks_ |
| ScoreBoardRH::ScoreBoardNode | SBSIZE |
|
|
Definition at line 48 of file scoreboard-rh.h. References first_, length_, numdupacks_, and retran_occured_.
00048 : numdupacks_(numdupacks) {first_=0; length_=0; retran_occured_=0;} |
|
|
Definition at line 182 of file scoreboard-rh.cc. References first_, length_, SBNI, SBSIZE, and ScoreBoardRH::ScoreBoardNode::seq_no_. Referenced by UpdateScoreBoard().
00183 {
00184 int i;
00185 int num_lost = 0;
00186
00187 if (length_ != 0) {
00188 for (i=SBN[(first_)%SBSIZE].seq_no_; i<sack_max; i++) {
00189 // Check to see if this segment's snd_nxt_ is now covered by the sack block
00190 if (SBNI.retran_ && SBNI.snd_nxt_ < sack_max) {
00191 // the packet was lost again
00192 SBNI.retran_ = 0;
00193 SBNI.snd_nxt_ = 0;
00194 SBNI.sack_cnt_ = 1;
00195 num_lost++;
00196 }
00197 }
00198 }
00199 return (num_lost);
00200
00201
00202 }
|
|
|
Definition at line 204 of file scoreboard-rh.cc. References length_. Referenced by UpdateScoreBoard().
00205 {
00206 length_ = 0;
00207 }
|
|
||||||||||||
|
|
|
|
Definition at line 238 of file scoreboard-rh.cc. References first_, length_, SBSIZE, and ScoreBoardRH::ScoreBoardNode::seq_no_. Referenced by SackRHTcpAgent::computefack().
|
|
|
Definition at line 248 of file scoreboard-rh.cc. References first_, length_, numdupacks_, SBNI, SBSIZE, and ScoreBoardRH::ScoreBoardNode::seq_no_. Referenced by SackRHTcpAgent::recv().
00249 {
00250 int i, new_holes=0;
00251
00252 for (i=SBN[(first_)%SBSIZE].seq_no_;
00253 i<SBN[(first_)%SBSIZE].seq_no_+length_; i++) {
00254 // Check to see if this segment is a new hole
00255 #if 1
00256 if (!SBNI.ack_flag_ && !SBNI.sack_flag_ && SBNI.sack_cnt_ == 1) {
00257 new_holes++;
00258 }
00259 #else
00260 if (!SBNI.ack_flag_ && !SBNI.sack_flag_ && SBNI.sack_cnt_ == *numdupacks_) {
00261 new_holes++;
00262 }
00263 #endif
00264 }
00265 return (new_holes);
00266 }
|
|
|
Definition at line 213 of file scoreboard-rh.cc. References first_, length_, numdupacks_, SBNI, SBSIZE, and ScoreBoardRH::ScoreBoardNode::seq_no_. Referenced by SackRHTcpAgent::send_much().
00214 {
00215 int i;
00216
00217 if (length_) {
00218 for (i=SBN[(first_)%SBSIZE].seq_no_;
00219 i<SBN[(first_)%SBSIZE].seq_no_+length_; i++) {
00220 if (!SBNI.ack_flag_ && !SBNI.sack_flag_ && !SBNI.retran_
00221 && (SBNI.sack_cnt_ >= *numdupacks_)) {
00222 return (i);
00223 }
00224 }
00225 }
00226 return (-1);
00227 }
|
|
|
Definition at line 49 of file scoreboard-rh.h. References length_.
00049 {return (length_ == 0);}
|
|
||||||||||||||||
|
Definition at line 230 of file scoreboard-rh.cc. References ScoreBoardRH::ScoreBoardNode::retran_, retran_occured_, ScoreBoardRH::ScoreBoardNode::rh_id_, SBSIZE, and ScoreBoardRH::ScoreBoardNode::snd_nxt_. Referenced by SackRHTcpAgent::send_much().
|
|
|
Definition at line 60 of file scoreboard-rh.h. References retran_occured_.
00060 {return (retran_occured_ == rh_id);}
|
|
|
Definition at line 427 of file scoreboard-rh.cc. References retran_sacked_. Referenced by SackRHTcpAgent::recv().
00427 {
00428 return (retran_sacked_ == rh_id);
00429 }
|
|
|
Definition at line 268 of file scoreboard-rh.cc. References first_, length_, numdupacks_, SBNI, SBSIZE, and ScoreBoardRH::ScoreBoardNode::seq_no_. Referenced by SackRHTcpAgent::timeout().
00269 {
00270 int i, sack_right;
00271
00272 if (length_ == 0) {
00273 // No need to do anything!
00274 return;
00275 }
00276
00277 sack_right = snd_nxt; // Use this to know how far to extend.
00278
00279 // Create new entries off the right side.
00280 if (sack_right > SBN[(first_+length_+SBSIZE-1)%SBSIZE].seq_no_) {
00281 // Create new entries
00282 for (i = SBN[(first_+length_+SBSIZE-1)%SBSIZE].seq_no_+1; i<sack_right; i++) {
00283 SBNI.seq_no_ = i;
00284 SBNI.ack_flag_ = 0;
00285 SBNI.sack_flag_ = 0;
00286 SBNI.retran_ = 0;
00287 SBNI.snd_nxt_ = 0;
00288 SBNI.sack_cnt_ = 0;
00289 SBNI.rh_id_ = 0;
00290 length_++;
00291 if (length_ >= SBSIZE) {
00292 printf ("Error, scoreboard too large (increase SBSIZE for more space)\n");
00293 exit(1);
00294 }
00295 }
00296 }
00297
00298 /* Now go through the whole scoreboard and update sack_cnt on holes;
00299 clear retran flag on everything. */
00300 for (i=SBN[(first_)%SBSIZE].seq_no_;
00301 i<SBN[(first_)%SBSIZE].seq_no_+length_; i++) {
00302 // Check to see if this segment is a hole
00303 if (!SBNI.ack_flag_ && !SBNI.sack_flag_) {
00304 SBNI.retran_ = 0;
00305 SBNI.snd_nxt_ = 0;
00306 SBNI.sack_cnt_ = *numdupacks_; // This forces all holes to be retransmitted.
00307 }
00308 }
00309
00310 /* And, finally, check the first segment in case of a renege. */
00311 i=SBN[(first_)%SBSIZE].seq_no_;
00312 if (!SBNI.ack_flag_ && SBNI.sack_flag_) {
00313 printf ("Renege!!! seqno = %d\n", SBNI.seq_no_);
00314 SBNI.sack_flag_ = 0;
00315 SBNI.retran_ = 0;
00316 SBNI.snd_nxt_ = 0;
00317 SBNI.sack_cnt_ = *numdupacks_; // This forces it to be retransmitted.
00318 }
00319 }
|
|
||||||||||||||||
|
Definition at line 61 of file scoreboard-rh.cc. References ASSERT, ASSERT1, CheckSndNxt(), ClearScoreBoard(), first_, length_, retran_sacked_, hdr_tcp::sa_left(), hdr_tcp::sa_length(), hdr_tcp::sa_right(), SBNI, SBSIZE, and ScoreBoardRH::ScoreBoardNode::seq_no_. Referenced by SackRHTcpAgent::recv().
00062 {
00063 int i, sack_index, sack_left, sack_right;
00064 int sack_max = 0;
00065 int retran_decr = 0;
00066
00067 /* Can't do this, because we need to process out the retran_decr */
00068 #if 0
00069 if (tcph->sa_length() == 0) {
00070 // There are no SACK blocks, so clear the scoreboard.
00071 this->ClearScoreBoard();
00072 return(0);
00073 }
00074 #endif
00075
00076 /* What we do need to do is not create a scoreboard if we don't need one. */
00077 if ((tcph->sa_length() == 0) && (length_ == 0)) {
00078 return(0);
00079 }
00080
00081
00082 // If there is no scoreboard, create one.
00083 if (length_ == 0) {
00084 i = last_ack+1;
00085 SBNI.seq_no_ = i;
00086 SBNI.ack_flag_ = 0;
00087 SBNI.sack_flag_ = 0;
00088 SBNI.retran_ = 0;
00089 SBNI.snd_nxt_ = 0;
00090 SBNI.sack_cnt_ = 0;
00091 SBNI.rh_id_ = 0;
00092 first_ = i%SBSIZE;
00093 length_++;
00094 if (length_ >= SBSIZE) {
00095 printf ("Error, scoreboard too large (increase SBSIZE for more space)\n");
00096 exit(1);
00097 }
00098 }
00099
00100 // Advance the left edge of the block.
00101 if (SBN[first_].seq_no_ <= last_ack) {
00102 for (i=SBN[(first_)%SBSIZE].seq_no_; i<=last_ack; i++) {
00103 // Advance the ACK
00104 if (SBNI.seq_no_ <= last_ack) {
00105 ASSERT(first_ == i%SBSIZE);
00106 first_ = (first_+1)%SBSIZE;
00107 length_--;
00108 ASSERT1(length_ >= 0);
00109 SBNI.ack_flag_ = 1;
00110 SBNI.sack_flag_ = 1;
00111 if (SBNI.retran_) {
00112 SBNI.retran_ = 0;
00113 SBNI.snd_nxt_ = 0;
00114 retran_decr++;
00115 retran_sacked_ = rh_id;
00116 }
00117 if (length_==0)
00118 break;
00119 }
00120 }
00121 }
00122
00123 for (sack_index=0; sack_index < tcph->sa_length(); sack_index++) {
00124 sack_left = tcph->sa_left(sack_index);
00125 sack_right = tcph->sa_right(sack_index);
00126
00127 /* Remember the highest segment SACKed by this packet */
00128 if (sack_right > sack_max) {
00129 sack_max = sack_right;
00130 }
00131
00132 // Create new entries off the right side.
00133 if (sack_right > SBN[(first_+length_+SBSIZE-1)%SBSIZE].seq_no_) {
00134 // Create new entries
00135 for (i = SBN[(first_+length_+SBSIZE-1)%SBSIZE].seq_no_+1; i<sack_right; i++) {
00136 SBNI.seq_no_ = i;
00137 SBNI.ack_flag_ = 0;
00138 SBNI.sack_flag_ = 0;
00139 SBNI.retran_ = 0;
00140 SBNI.snd_nxt_ = 0;
00141 SBNI.sack_cnt_ = 0;
00142 SBNI.rh_id_ = 0;
00143 length_++;
00144 if (length_ >= SBSIZE) {
00145 printf ("Error, scoreboard too large (increase SBSIZE for more space)\n");
00146 exit(1);
00147 }
00148 }
00149 }
00150
00151 for (i=SBN[(first_)%SBSIZE].seq_no_; i<sack_right; i++) {
00152 // Check to see if this segment is now covered by the sack block
00153 if (SBNI.seq_no_ >= sack_left && SBNI.seq_no_ < sack_right) {
00154 if (! SBNI.sack_flag_) {
00155 SBNI.sack_flag_ = 1;
00156 }
00157 if (SBNI.retran_) {
00158 SBNI.retran_ = 0;
00159 SBNI.snd_nxt_ = 0;
00160 retran_decr++;
00161 retran_sacked_ = rh_id;
00162 }
00163 }
00164 }
00165 }
00166
00167 /* Now go through the whole scoreboard and update sack_cnt
00168 on holes which still exist. */
00169 if (length_ != 0) {
00170 for (i=SBN[(first_)%SBSIZE].seq_no_; i<sack_max; i++) {
00171 // Check to see if this segment is a hole
00172 if (!SBNI.ack_flag_ && !SBNI.sack_flag_) {
00173 SBNI.sack_cnt_++;
00174 }
00175 }
00176 }
00177
00178 retran_decr += CheckSndNxt(sack_max);
00179
00180 return (retran_decr);
00181 }
|
Here is the call graph for this function:

|
|
Definition at line 63 of file scoreboard-rh.h. Referenced by CheckSndNxt(), GetFack(), GetNewHoles(), GetNextRetran(), ScoreBoardRH(), TimeoutScoreBoard(), and UpdateScoreBoard(). |
|
|
Definition at line 63 of file scoreboard-rh.h. Referenced by CheckSndNxt(), ClearScoreBoard(), GetFack(), GetNewHoles(), GetNextRetran(), IsEmpty(), ScoreBoardRH(), TimeoutScoreBoard(), and UpdateScoreBoard(). |
|
|
Definition at line 68 of file scoreboard-rh.h. Referenced by GetNewHoles(), GetNextRetran(), ScoreBoardRH(), and TimeoutScoreBoard(). |
|
|
Definition at line 64 of file scoreboard-rh.h. Referenced by MarkRetran(), RetranOccurred(), and ScoreBoardRH(). |
|
|
Definition at line 66 of file scoreboard-rh.h. Referenced by RetranSacked(), and UpdateScoreBoard(). |
|
|
Referenced by CheckSndNxt(), GetFack(), GetNewHoles(), GetNextRetran(), MarkRetran(), TimeoutScoreBoard(), and UpdateScoreBoard(). |
1.3.3