예제 #1
0
 def payload_is_accepted(self, packet):
     seq_lo, seq_hi = packet.get_seq_interval()
     first_byte, last_byte = seq_lo, seq_hi - 1
     first_ok = SequenceNumber.a_leq_b_leq_c(self.rcv_nxt, first_byte,
                                             self.rcv_nxt + self.rcv_wnd)
     last_ok = SequenceNumber.a_leq_b_leq_c(self.rcv_nxt, last_byte,
                                            self.rcv_nxt + self.rcv_wnd)
     return last_byte >= first_byte and (first_ok or last_ok)
예제 #2
0
 def payload_is_accepted(self, packet):
     seq_lo, seq_hi = packet.get_seq_interval()
     first_byte, last_byte = seq_lo, seq_hi-1
     first_ok = SequenceNumber.a_leq_b_leq_c(self.rcv_nxt,
                                             first_byte,
                                             self.rcv_nxt+self.rcv_wnd)
     last_ok = SequenceNumber.a_leq_b_leq_c(self.rcv_nxt, last_byte,
                                            self.rcv_nxt+self.rcv_wnd)
     return last_byte >= first_byte and (first_ok or last_ok)
예제 #3
0
 def usable_window_size(self):
     upper_limit = self.snd_una + self.snd_wnd
     # If the upper window limit is below SND_NXT, we must return 0.
     if SequenceNumber.a_leq_b_leq_c(self.snd_una, self.snd_nxt,
                                     upper_limit):
         return upper_limit - self.snd_nxt
     else:
         # TODO: add test!
         return 0
예제 #4
0
 def usable_window_size(self):
     upper_limit = self.snd_una + self.snd_wnd
     # Si el límite superior de la ventana está por debajo de SND_NXT,
     # tenemos que devolver 0.
     if SequenceNumber.a_leq_b_leq_c(self.snd_una, self.snd_nxt,
                                     upper_limit):
         return upper_limit - self.snd_nxt
     else:
         # TODO: agregar test!
         return 0
예제 #5
0
 def should_update_window(self, ack_number):
     # TODO: agregar tests para esto.
     # RFC 1122, p.94 (corrección al RFC 793).
     return SequenceNumber.a_leq_b_leq_c(self.snd_una, ack_number,
                                         self.snd_nxt)
예제 #6
0
파일: rto.py 프로젝트: ealmansi/tdc-tp3
 def ack_covers_tracked_packet(self, ack_number):
     iss = self.protocol.iss
     seq_number = self.tracked_packet.get_seq_number() 
     return SequenceNumber.a_leq_b_leq_c(iss, seq_number, ack_number)
예제 #7
0
 def should_update_window(self, ack_number):
     # TODO: agregar tests para esto.
     # RFC 1122, p.94 (corrección al RFC 793).
     return SequenceNumber.a_leq_b_leq_c(self.snd_una, ack_number,
                                         self.snd_nxt)
예제 #8
0
 def should_update_window(self, ack_number):
     # TODO: add tests for this.
     # RFC 1122, p.94 (correction to RFC 793).
     return SequenceNumber.a_leq_b_leq_c(self.snd_una, ack_number,
                                         self.snd_nxt)
예제 #9
0
 def ack_covers_tracked_packet(self, ack_number):
     iss = self.protocol.iss
     seq_number = self.tracked_packet.get_seq_number() 
     return SequenceNumber.a_leq_b_leq_c(iss, seq_number, ack_number)