1
0

Extra state kunnen verwijderen door extra variabelen te gebruiken

This commit is contained in:
Ben Brücker 2014-01-04 16:51:14 +01:00
parent eb7bf0093c
commit 89c58716fd

View File

@ -37,10 +37,12 @@ void receive_packet(){
void send_packet(){
from_network := transfer;
}
</declaration><location id="id0" x="-864" y="-736"><committed/></location><location id="id1" x="-672" y="-736"><name x="-682" y="-766">PacketLost</name><committed/></location><location id="id2" x="-864" y="-864"><name x="-1008" y="-888">PacketInTransit</name></location><location id="id3" x="-864" y="-608"><name x="-912" y="-584">ReadyToReceive</name></location><init ref="id3"/><transition><source ref="id0"/><target ref="id2"/><label kind="assignment" x="-848" y="-760">initialize(from_network)</label><nail x="-832" y="-792"/></transition><transition><source ref="id0"/><target ref="id3"/><label kind="synchronisation" x="-976" y="-688">Packet[target]!</label></transition><transition><source ref="id2"/><target ref="id0"/><label kind="assignment" x="-968" y="-792">send_packet()</label></transition><transition><source ref="id2"/><target ref="id1"/></transition><transition><source ref="id1"/><target ref="id3"/></transition><transition><source ref="id3"/><target ref="id2"/><label kind="synchronisation" x="-1120" y="-784">Packet[network]?</label><label kind="assignment" x="-1120" y="-768">set_target(),
receive_packet()</label><nail x="-992" y="-608"/><nail x="-992" y="-864"/><nail x="-992" y="-864"/></transition></template><template><name>Host_Handshake</name><parameter>const int local, const int remote, const int network</parameter><declaration>clock c;
</declaration><location id="id0" x="-5312" y="-1536"><committed/></location><location id="id1" x="-5152" y="-1664"><name x="-5160" y="-1696">PacketLost</name><committed/></location><location id="id2" x="-5312" y="-1664"><name x="-5360" y="-1696">PacketInTransit</name></location><location id="id3" x="-5312" y="-1408"><name x="-5360" y="-1384">ReadyToReceive</name></location><init ref="id3"/><transition><source ref="id0"/><target ref="id2"/><label kind="assignment" x="-5296" y="-1560">initialize(from_network)</label><nail x="-5280" y="-1592"/></transition><transition><source ref="id0"/><target ref="id3"/><label kind="synchronisation" x="-5400" y="-1480">Packet[target]!</label></transition><transition><source ref="id2"/><target ref="id0"/><label kind="assignment" x="-5400" y="-1608">send_packet()</label></transition><transition><source ref="id2"/><target ref="id1"/></transition><transition><source ref="id1"/><target ref="id3"/><nail x="-5152" y="-1408"/></transition><transition><source ref="id3"/><target ref="id2"/><label kind="synchronisation" x="-5432" y="-1560">Packet[network]?</label><label kind="assignment" x="-5432" y="-1544">set_target(),
receive_packet()</label><nail x="-5440" y="-1408"/><nail x="-5440" y="-1664"/><nail x="-5440" y="-1664"/></transition></template><template><name>Host_Handshake</name><parameter>const int local, const int remote, const int network</parameter><declaration>clock c;
int last_syn = 0;
int last_ack = 0;
int retrans_syn;
int retrans_ack;
TCP_packet received;
void set_target(int syn, int ack) {
@ -68,20 +70,25 @@ void initialize()
{
last_syn := 0;
last_ack := 0;
}</declaration><location id="id4" x="-520" y="-672"><name x="-528" y="-656">SynRcvd1</name><label kind="invariant" x="-536" y="-640">c &lt;= UBOUND</label></location><location id="id5" x="-104" y="-448"><committed/></location><location id="id6" x="-392" y="-544"><committed/></location><location id="id7" x="-880" y="-872"><committed/></location><location id="id8" x="-392" y="-448"><name x="-424" y="-432">Established</name></location><location id="id9" x="-880" y="-544"><name x="-976" y="-576">SynRcvd2</name><label kind="invariant" x="-1000" y="-560">c &lt;= UBOUND</label></location><location id="id10" x="-104" y="-544"><name x="-64" y="-584">SynSent</name><label kind="invariant" x="-72" y="-568">c &lt;= UBOUND</label></location><location id="id11" x="-392" y="-872"><name x="-408" y="-912">Listen</name></location><location id="id12" x="-392" y="-1064"><name x="-464" y="-1064">Closed</name></location><init ref="id12"/><transition><source ref="id8"/><target ref="id8"/><nail x="-400" y="-480"/><nail x="-432" y="-480"/></transition><transition><source ref="id4"/><target ref="id8"/><label kind="guard" x="-632" y="-584">from_network.ack == last_syn &amp;&amp;
from_network.syn == 0</label><label kind="synchronisation" x="-632" y="-600">Packet[local]?</label><label kind="assignment" x="-632" y="-552">receive_packet()</label><nail x="-648" y="-672"/><nail x="-648" y="-512"/><nail x="-392" y="-512"/></transition><transition><source ref="id4"/><target ref="id4"/><label kind="guard" x="-552" y="-792">c &gt; LBOUND</label><label kind="synchronisation" x="-552" y="-808">Packet[network]!</label><label kind="assignment" x="-552" y="-776">set_target(0, last_ack),
c:=0</label><nail x="-484" y="-738"/><nail x="-556" y="-738"/></transition><transition><source ref="id6"/><target ref="id4"/><label kind="synchronisation" x="-384" y="-679">Packet[network]!</label><label kind="assignment" x="-384" y="-664">set_target(0, update_ack()),
c := 0</label><nail x="-392" y="-672"/></transition><transition><source ref="id9"/><target ref="id9"/><label kind="guard" x="-1216" y="-544">c &gt; LBOUND</label><label kind="synchronisation" x="-1216" y="-560">Packet[network]!</label><label kind="assignment" x="-1216" y="-528">set_target(last_syn, last_ack),
c:=0</label><nail x="-1008" y="-544"/><nail x="-1008" y="-512"/></transition><transition><source ref="id10"/><target ref="id10"/><label kind="guard" x="32" y="-552">c &gt; LBOUND</label><label kind="synchronisation" x="32" y="-536">Packet[network]!</label><label kind="assignment" x="32" y="-520">set_target(last_syn, 0),
c := 0</label><nail x="24" y="-512"/><nail x="24" y="-544"/></transition><transition><source ref="id12"/><target ref="id12"/><label kind="synchronisation" x="-528" y="-1192">Packet[local]?</label><label kind="assignment" x="-528" y="-1176">receive_packet()</label><nail x="-376" y="-1176"/><nail x="-408" y="-1176"/></transition><transition><source ref="id5"/><target ref="id8"/><label kind="synchronisation" x="-296" y="-488">Packet[network]!</label><label kind="assignment" x="-336" y="-472">set_target(0, update_ack())</label></transition><transition><source ref="id7"/><target ref="id9"/><label kind="synchronisation" x="-1160" y="-824">Packet[network]!</label><label kind="assignment" x="-1160" y="-808">set_target(update_syn(), update_ack()),
c := 0</label></transition><transition><source ref="id11"/><target ref="id7"/><label kind="guard" x="-592" y="-920">from_network.syn != 0 &amp;&amp;
from_network.ack == 0</label><label kind="synchronisation" x="-592" y="-936">Packet[local]?</label><label kind="assignment" x="-592" y="-896">receive_packet()</label></transition><transition><source ref="id10"/><target ref="id5"/><label kind="guard" x="-96" y="-488">from_network.ack == last_syn &amp;&amp;
from_network.syn != 0</label><label kind="synchronisation" x="-96" y="-504">Packet[local]?</label><label kind="assignment" x="-80" y="-456">receive_packet()</label></transition><transition><source ref="id10"/><target ref="id6"/><label kind="guard" x="-296" y="-592">from_network.syn != 0 &amp;&amp;
from_network.ack == 0</label><label kind="synchronisation" x="-296" y="-608">Packet[local]?</label><label kind="assignment" x="-296" y="-568">receive_packet()</label></transition><transition><source ref="id11"/><target ref="id10"/><label kind="synchronisation" x="-320" y="-920">Packet[network]!</label><label kind="assignment" x="-320" y="-904">set_target(update_syn(), 0),
c := 0</label><nail x="-136" y="-872"/><nail x="-136" y="-576"/></transition><transition><source ref="id9"/><target ref="id8"/><label kind="guard" x="-872" y="-432">from_network.ack == last_syn &amp;&amp;
from_network.syn == 0</label><label kind="synchronisation" x="-872" y="-448">Packet[local]?</label><label kind="assignment" x="-872" y="-400">receive_packet()</label><nail x="-880" y="-448"/></transition><transition><source ref="id10"/><target ref="id12"/><nail x="-72" y="-576"/><nail x="-72" y="-1096"/><nail x="-360" y="-1096"/></transition><transition><source ref="id12"/><target ref="id10"/><label kind="synchronisation" x="-248" y="-1064">Packet[network]!</label><label kind="assignment" x="-248" y="-1048">initialize(),
}
void set_retrans(int syn, int ack) {
retrans_syn = syn;
retrans_ack = ack;
}</declaration><location id="id4" x="-448" y="-672"><committed/></location><location id="id5" x="-736" y="-768"><committed/></location><location id="id6" x="-992" y="-928"><committed/></location><location id="id7" x="-736" y="-672"><name x="-768" y="-656">Established</name></location><location id="id8" x="-992" y="-768"><name x="-984" y="-768">SynRcvd</name><label kind="invariant" x="-984" y="-752">c &lt;= UBOUND</label></location><location id="id9" x="-448" y="-768"><name x="-512" y="-768">SynSent</name><label kind="invariant" x="-552" y="-752">c &lt;= UBOUND</label></location><location id="id10" x="-736" y="-928"><name x="-752" y="-912">Listen</name></location><location id="id11" x="-736" y="-1120"><name x="-800" y="-1128">Closed</name></location><init ref="id11"/><transition><source ref="id5"/><target ref="id8"/><label kind="synchronisation" x="-920" y="-832">Packet[network]!</label><label kind="assignment" x="-920" y="-817">set_target(0, update_ack()),
set_retrans(0, last_ack),
c := 0</label></transition><transition><source ref="id7"/><target ref="id7"/><nail x="-704" y="-704"/><nail x="-776" y="-704"/></transition><transition><source ref="id8"/><target ref="id8"/><label kind="guard" x="-1232" y="-720">c &gt; LBOUND</label><label kind="synchronisation" x="-1232" y="-736">Packet[network]!</label><label kind="assignment" x="-1232" y="-704">set_target(retrans_syn, retrans_ack),
c:=0</label><nail x="-1120" y="-768"/><nail x="-1120" y="-736"/></transition><transition><source ref="id9"/><target ref="id9"/><label kind="guard" x="-312" y="-776">c &gt; LBOUND</label><label kind="synchronisation" x="-312" y="-792">Packet[network]!</label><label kind="assignment" x="-312" y="-760">set_target(last_syn, 0),
c := 0</label><nail x="-320" y="-736"/><nail x="-320" y="-768"/></transition><transition><source ref="id11"/><target ref="id11"/><label kind="synchronisation" x="-856" y="-1192">Packet[local]?</label><label kind="assignment" x="-856" y="-1176">receive_packet()</label><nail x="-720" y="-1192"/><nail x="-752" y="-1192"/></transition><transition><source ref="id4"/><target ref="id7"/><label kind="synchronisation" x="-664" y="-672">Packet[network]!</label><label kind="assignment" x="-664" y="-656">set_target(0, update_ack())</label></transition><transition><source ref="id6"/><target ref="id8"/><label kind="synchronisation" x="-1240" y="-888">Packet[network]!</label><label kind="assignment" x="-1240" y="-872">set_target(update_syn(), update_ack()),
set_retrans(last_syn, last_ack),
c := 0</label></transition><transition><source ref="id10"/><target ref="id6"/><label kind="guard" x="-944" y="-976">from_network.syn != 0 &amp;&amp;
from_network.ack == 0</label><label kind="synchronisation" x="-944" y="-992">Packet[local]?</label><label kind="assignment" x="-944" y="-952">receive_packet()</label></transition><transition><source ref="id9"/><target ref="id4"/><label kind="guard" x="-432" y="-712">from_network.ack == last_syn &amp;&amp;
from_network.syn != 0</label><label kind="synchronisation" x="-432" y="-728">Packet[local]?</label><label kind="assignment" x="-432" y="-680">receive_packet()</label></transition><transition><source ref="id9"/><target ref="id5"/><label kind="guard" x="-672" y="-816">from_network.syn != 0 &amp;&amp;
from_network.ack == 0</label><label kind="synchronisation" x="-672" y="-832">Packet[local]?</label><label kind="assignment" x="-672" y="-792">receive_packet()</label></transition><transition><source ref="id10"/><target ref="id9"/><label kind="synchronisation" x="-664" y="-976">Packet[network]!</label><label kind="assignment" x="-664" y="-960">set_target(update_syn(), 0),
c := 0</label><nail x="-480" y="-928"/><nail x="-480" y="-800"/></transition><transition><source ref="id8"/><target ref="id7"/><label kind="guard" x="-984" y="-656">from_network.ack == last_syn &amp;&amp;
from_network.syn == 0</label><label kind="synchronisation" x="-984" y="-672">Packet[local]?</label><label kind="assignment" x="-984" y="-624">receive_packet()</label><nail x="-992" y="-672"/></transition><transition><source ref="id9"/><target ref="id11"/><nail x="-416" y="-800"/><nail x="-416" y="-1152"/><nail x="-704" y="-1152"/></transition><transition><source ref="id11"/><target ref="id9"/><label kind="synchronisation" x="-592" y="-1120">Packet[network]!</label><label kind="assignment" x="-592" y="-1104">initialize(),
set_target(update_syn(), 0),
c := 0</label><nail x="-104" y="-1064"/></transition><transition><source ref="id11"/><target ref="id12"/><nail x="-360" y="-904"/><nail x="-360" y="-1032"/></transition><transition><source ref="id12"/><target ref="id11"/><label kind="assignment" x="-496" y="-976">initialize()</label><nail x="-424" y="-1032"/><nail x="-424" y="-904"/></transition></template><system>Network1 = Network(0);
c := 0</label><nail x="-448" y="-1120"/></transition><transition><source ref="id10"/><target ref="id11"/><nail x="-704" y="-960"/><nail x="-704" y="-1088"/></transition><transition><source ref="id11"/><target ref="id10"/><label kind="assignment" x="-840" y="-1032">initialize()</label><nail x="-768" y="-1088"/><nail x="-768" y="-960"/></transition></template><system>Network1 = Network(0);
Network2 = Network(0);
Network3 = Network(0);
Network4 = Network(0);