我要制定一项协议,而不是应用以下协议:
用户A向N1网络协议发送REQ请求。 N1通过请求将请求传播到N2网络进程。然后,它向用户进程B发送IND指示,并接收RSP响应消息。使用rsp和CNF消息,此响应通过N1传播到A。
为此,我尝试使用以下代码:
mtype = {m}
chan REQ = [5] of {mtype,bit}
chan req = [5] of {mtype,bit}
chan IND = [5] of {mtype,bit}
chan RSP = [5] of {mtype,bit}
chan rsp = [5] of {mtype,bit}
chan CNF = [5] of {mtype,bit}
active proctype A(){
bit b =0;
bit v=0;
bit x;
do
:: true;
env: if
:: REQ!m,b;
:: skip;
fi;
espera: if
:: CNF?x
if
::x==b->b=!b; goto env;
fi;
fi;
od;
}
active proctype N1(){
bit b =0;
bit x;
bit y=0;
do
::true;
recibomensaje:
:: REQ?m,b;
espera_confirmacion:
if
::x==b->req!b;b!=b;goto espera2;
fi;
espera2:
::rsp?x
if
::x == y->RSP?y;y!=y;goto recibomensaje;
fi;
od;
}
active proctype N2(){
bit b =0;
bit x;
bit y=1;
do
::true;
recibomensaje:
:: req?m,b;
espera_confirmacion:
if
::x==b->IND!b;b!=b;goto espera2;
fi;
espera2:
::RSP?x
if
::x == y->rsp?y;y!=y;goto recibomensaje;
fi;
od;
}
给我的错误是:
proc 0 (A:1) Ejercicio2.1:15 (state 1) [(1)]
proc 2 (N2:1) Ejercicio2.1:55 (state 1) [(1)]
proc 1 (N1:1) Ejercicio2.1:35 (state 1) [(1)]
proc 2 (N2:1) Ejercicio2.1:57 (state 2) [(1)]
proc 0 (A:1) Ejercicio2.1:17 (state 2) [REQ!m,b]
proc 1 (N1:1) Ejercicio2.1:37 (state 2) [(1)]
proc 2 (N2:1) Ejercicio2.1:55 (state 1) [(1)]
proc 1 (N1:1) Ejercicio2.1:37 (state 3) [REQ?m,b]
proc 2 (N2:1) Ejercicio2.1:57 (state 2) [(1)]
proc 1 (N1:1) Ejercicio2.1:40 (state 4) [((x==b))]
proc 2 (N2:1) Ejercicio2.1:55 (state 1) [(1)]
warning: missing params in send