summaryrefslogtreecommitdiffstats
path: root/library/NS_Provider_FR.ttcn
diff options
context:
space:
mode:
Diffstat (limited to 'library/NS_Provider_FR.ttcn')
-rw-r--r--library/NS_Provider_FR.ttcn25
1 files changed, 24 insertions, 1 deletions
diff --git a/library/NS_Provider_FR.ttcn b/library/NS_Provider_FR.ttcn
index 851e6c4f..afa27d9e 100644
--- a/library/NS_Provider_FR.ttcn
+++ b/library/NS_Provider_FR.ttcn
@@ -22,6 +22,9 @@ import from FrameRelay_Emulation all;
type component NS_Provider_FR_CT extends NS_Provider_CT, FR_Client_CT {
/* component reference to Frame Relay emulation */
var FR_Emulation_CT vc_FREMU;
+
+ var boolean link_available := false;
+ var boolean pvc_active := false;
};
function main(NSConfiguration config) runs on NS_Provider_FR_CT system af_packet {
@@ -50,8 +53,28 @@ function main(NSConfiguration config) runs on NS_Provider_FR_CT system af_packet
NSE.send(dec_PDU_NS(rx_fr.payload));
}
+ [] FR.receive(FRemu_Event:{link_status:=FR_LINK_STS_AVAILABLE}) -> value rx_frevt {
+ if (link_available == false and pvc_active == true) {
+ NSE.send(NS_Provider_Evt:{link_status := NS_PROV_LINK_STATUS_UP});
+ }
+ link_available := true;
+ }
+ [] FR.receive(FRemu_Event:{link_status:=FR_LINK_STS_UNAVAILABLE}) -> value rx_frevt {
+ link_available := false;
+ NSE.send(NS_Provider_Evt:{link_status := NS_PROV_LINK_STATUS_DOWN});
+ }
+ [] FR.receive(tr_FRemu_PvcStatusAct(config.provider.fr.dlci, true)) -> value rx_frevt {
+ if (pvc_active == false and link_available == true) {
+ NSE.send(NS_Provider_Evt:{link_status := NS_PROV_LINK_STATUS_UP});
+ }
+ pvc_active := true;
+ }
+ [] FR.receive(tr_FRemu_PvcStatusAct(config.provider.fr.dlci, false)) -> value rx_frevt {
+ pvc_active := false;
+ NSE.send(NS_Provider_Evt:{link_status := NS_PROV_LINK_STATUS_DOWN});
+ }
[] FR.receive(FRemu_Event:?) -> value rx_frevt {
- /* TODO: dispatch to user */
+ log("Unhandled FRemu_event: ", rx_frevt);
}
[] NSE.receive(PDU_NS:?) -> value rx_pdu {
FR.send(ts_FR(config.provider.fr.dlci, enc_PDU_NS(rx_pdu), true));