-
Notifications
You must be signed in to change notification settings - Fork 0
/
QoS2_multiPub_singleSub.spdl
100 lines (66 loc) · 1.92 KB
/
QoS2_multiPub_singleSub.spdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
usertype Message;
usertype operations;
usertype Acknowledgment;
//http://www.steves-internet-guide.com/understanding-mqtt-qos-2/
//https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
protocol MQTT-Multi-Publishers(X, Y, S, Sub) {
role X {
const mx: Nonce;
fresh PUBREC : operations;
fresh PUBREL : operations;
fresh ack : Acknowledgment;
var PUBCOMP : operations;
send_1(X, S, { mx, X}k(S) );
recv_4 (S, X, {PUBREC, S}k(S));
send_6(X, S, {PUBREL}k(S));
recv_10(S,X, {PUBCOMP,ack}k(S));
claim_a1(X, Secret,mx);
claim_a2(X,Weakagree);
claim_r3(X,Niagree);
claim_r4(X,Nisynch);
}
role Y {
const my: Nonce;
fresh PUBREC : operations;
fresh PUBREL : operations;
fresh ack : Acknowledgment;
var PUBCOMP : operations;
send_2(Y, S, { my, Y}k(S) );
recv_5 (S, Y, {PUBREC, S}k(S));
send_7(Y, S, {PUBREL}k(S));
recv_11(S,Y, {PUBCOMP,ack}k(S));
claim_a1(Y, Secret,my);
claim_a2(Y,Weakagree);
claim_r3(Y,Niagree);
claim_r4(Y,Nisynch);
}
role S {
var mx , my : Nonce;
fresh ack : Acknowledgment;
fresh PUBREC : operations;
fresh PUBREL : operations;
fresh PUBCOMP : operations;
fresh PUBCOMP : operations;
read_1(X, S, { mx, X}k(S) );
read_2(Y, S, { my, Y}k(S) );
send_3(S, Sub, X, Y, my, mx);
send_4 (S, X, {PUBREC, S}k(S));
send_5(S, Y, {PUBREC, S}k(S));
recv_6(X, S, {PUBREL}k(S));
recv_7(Y, S, {PUBREL}k(S));
send_8(S, Sub, {X, S, mx}k(Sub));
send_9(S, Sub, {Y, S, my}k(Sub));
send_10(S,X, {PUBCOMP,ack}k(S));
send_11(S,Y, {PUBCOMP,ack}k(S));
}
role Sub {
var mx , my : Nonce;
var ack : Acknowledgment;
var PUBREC : operations;
var PUBREL : operations;
var PUBCOMP : operations;
recv_3(S, Sub, X, Y, my, mx);
recv_8(S, Sub, {X, S, mx}k(Sub));
recv_9(S, Sub, {Y, S, my}k(Sub));
}
}