tangled
alpha
login
or
join now
dekker.one
/
TCP-setup-uppaal
0
fork
atom
An Uppaal analysis of the connection setup of the TCP protocol.
0
fork
atom
overview
issues
pulls
pipelines
Updated sequence number stuff
Ben Brücker
12 years ago
eeffc10d
cedf077c
+25
-22
1 changed file
expand all
collapse all
unified
split
Model
model.xml
+25
-22
Model/model.xml
···
50
50
c:=0</label><nail x="-5440" y="-1408"/><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;
51
51
meta int snd_una = 0;
52
52
meta int snd_nxt = 0;
53
53
-
meta int seg_ack = 0;
54
54
-
meta int seg_len = 0;
53
53
+
meta int snd_ack = 0;
55
54
meta int rcv_nxt = 0;
55
55
+
const int seg_len = 0;
56
56
+
const int window = 1;
56
57
meta TCP_segment retrans;
57
58
meta TCP_segment received;
58
59
59
60
bool receive_packet(){
60
60
-
received := from_network;
61
61
-
snd_nxt = received.ackNr;
62
62
-
seg_ack = (received.seqNr + 1 + len)%MAX_SEQ;
63
63
-
64
64
-
initialize(from_network);
65
65
-
}
66
66
-
67
67
-
int update_win(){
68
68
-
//TODO: do something usefull.
69
69
-
return 0;
70
70
-
}
71
71
-
72
72
-
void reset()
73
73
-
{
74
74
-
last_seq := 0;
75
75
-
last_ack := 0;
76
76
-
initialize(retrans);
77
77
-
initialize(received);
61
61
+
if (from_network.syn) {
62
62
+
rcv_nxt = from_network.seqNr;
63
63
+
}
64
64
+
if (rcv_nxt == from_network.seqNr) {
65
65
+
if (received.ack && snd_una < from_network.ackNr) {
66
66
+
snd_una = from_network.ackNr;
67
67
+
}
68
68
+
else if (received.ack) {
69
69
+
return false;
70
70
+
}
71
71
+
received := from_network;
72
72
+
snd_nxt = received.ackNr + 1;
73
73
+
snd_ack = (received.seqNr + 1 + seg_len)%MAX_SEQ;
74
74
+
initialize(from_network);
75
75
+
return true;
76
76
+
}
77
77
+
return false;
78
78
}
79
79
80
80
void send(bool syn, bool ack) {
81
81
+
if (syn) {
82
82
+
snd_una := snd_nxt;
83
83
+
}
81
84
target_address = remote;
82
85
retrans.syn := syn;
83
86
retrans.ack := ack;
84
87
retrans.seqNr := snd_nxt;
85
85
-
retrans.ackNr := seq_ack;
86
86
-
retrans.win := update_win();
88
88
+
retrans.ackNr := snd_ack;
89
89
+
retrans.win := window;
87
90
to_network := retrans;
88
91
}
89
92