Date: Wed, 16 Jul 2008 21:06:54 GMT From: Victor Hugo Bilouro <bilouro@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 145343 for review Message-ID: <200807162106.m6GL6swd023203@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145343 Change 145343 by bilouro@bilouro_tcptest on 2008/07/16 21:06:09 Added three new methods to act as fasteners (1)threewayhandshakenoopt -> this make 3way (2)closeconnection -> this make active close (3)passivecloseconnection -> this make passive close Affected files ... .. //depot/projects/soc2008/bilouro_tcptest/src/scripts/tests/tcptest.py#2 edit Differences ... ==== //depot/projects/soc2008/bilouro_tcptest/src/scripts/tests/tcptest.py#2 (text+ko) ==== @@ -248,6 +248,84 @@ return ~total & 0xffff + +def threewayhandshakenoopt(self, tcb, from_, to): + + # + #--->Sending SYN + (ipsyn, tcpsyn) = createsyn(self, tcb, from_, to) + createwritepacket(self, tcb, ipsyn, tcpsyn, from_, to) + + # + #--->Receivinig SYN + ACK + (ipsynack, tcpsynack) = receive(self, tcb, from_, to) + + #Some blackmagic to use assertSequenceAcknowledgmentOK at SYN + tcb.tcpsequence[ to ] = tcpsynack.sequence + assertSequenceAcknowledgmentOK(self, tcb, tcpsynack, from_, to) + assertSynPresent(self, tcpsynack) + tcb.tcpsequence[ to ] = tcpsynack.sequence + 1 + + # + #-->Sending ACK + (ipack, tcpack) = createip(self, tcb, from_, to) + createwritepacket(self, tcb, ipack, tcpack, from_, to) + + +def closeconnection(self, tcb, from_, to): + + # + #--->Sending FIN + (ipfin, tcpfin) = createfin(self, tcb, from_, to) + createwritepacket(self, tcb, ipfin, tcpfin, from_, to) + + # + #--->Receiving ACK from FIN sent + (ipfinack, tcpfinack) = receive(self, tcb, from_, to) + assertSequenceAcknowledgmentOK(self, tcb, tcpfinack, from_, to) + + # + #--->Receiving FIN + #test if FIN was sent in the same segment + if (tcpfinack.fin == None or tcpfinack.fin == 0): + (ipfinack, tcpfinack) = receive(self, tcb, from_, to) + assertSequenceAcknowledgmentOK(self, tcb, tcpfinack, from_, to) + + assertFin(self, tcpfinack) + tcb.tcpsequence[ to ] += 1 + + # + #--->Sending ACK + (ipackfin, tcpackfin) = createip(self, tcb, from_, to) + createwritepacket(self, tcb, ipackfin, tcpackfin, from_, to) + + + +def passivecloseconnection(self, tcb, from_, to): + + # + #--->Receiving FIN + (ipfinack, tcpfinack) = receive(self, tcb, from_, to) + assertSequenceAcknowledgmentOK(self, tcb, tcpfinack, from_, to) + assertFin(self, tcpfinack) + tcb.tcpsequence[ to ] += 1 + + # + #--->Sending ACK + (ipackfin, tcpackfin) = createip(self, tcb, from_, to) + createwritepacket(self, tcb, ipackfin, tcpackfin, from_, to) + + # + #--->Sending FIN + (ipfin, tcpfin) = createfin(self, tcb, from_, to) + createwritepacket(self, tcb, ipfin, tcpfin, from_, to) + + # + #--->Receiving ACK from FIN sent + (ipfinack, tcpfinack) = receive(self, tcb, from_, to) + assertSequenceAcknowledgmentOK(self, tcb, tcpfinack, from_, to) + + class tcb: def __init__(self): self.ip = { }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807162106.m6GL6swd023203>