1/* 2 * FSM pseudo code used in the design/implementation of the CC PTP monitor. 3 */ 4FSM CC_PTP_Monitor 5{ 6 State CC_STATE_IDLE { 7 Init { 8 } 9 Prolog { 10 Action Set_Selfdestruct; 11 } 12 Stimulus CC_EVENT_AVAILABLE { 13 /* Received CCBS-T-Aailable */ 14 Action Pass_Up_CC_Available; 15 Next_State CC_STATE_AVAILABLE; 16 } 17 Stimulus CC_EVENT_CANCEL { 18 Action Set_Selfdestruct; 19 } 20 } 21 State CC_STATE_AVAILABLE { 22 /* 23 * The upper layer is responsible for canceling the CC available 24 * offering. 25 */ 26 Stimulus CC_EVENT_CC_REQUEST { 27 /* 28 * Before event is posted: 29 * cc_record->is_ccnr is set. 30 * The signaling connection call record is created. 31 */ 32 Action Queue_CC_Request; 33 /* 34 * For PTP mode the T_ACTIVATE timer is not defined. However, 35 * we will use it to protect our resources from leaks caused 36 * by the network cable being disconnected. 37 * This timer should be set longer than normal so the 38 * CC records will normally be cleaned up by network activity. 39 */ 40 Action Start_T_ACTIVATE; 41 Next_State CC_STATE_REQUESTED; 42 } 43 Stimulus CC_EVENT_CANCEL { 44 Next_State CC_STATE_IDLE; 45 } 46 } 47 State CC_STATE_REQUESTED { 48 Epilog { 49 Action Stop_T_ACTIVATE; 50 } 51 Stimulus CC_EVENT_CC_REQUEST_ACCEPT { 52 /* 53 * Received CCBS-T-Request/CCNR-T-Request response 54 * Before event is posted: 55 * Negotiated CC retention setting saved 56 */ 57 Action Pass_Up_CC_Req_Rsp_Success; 58 Next_State CC_STATE_ACTIVATED; 59 } 60 Stimulus CC_EVENT_CC_REQUEST_FAIL { 61 Action Pass_Up_CC_Req_Rsp_Fail(error/reject, code); 62 Action Pass_Up_CC_Cancel; 63 /* 64 * If this request fail comes in with the RELEASE_COMPLETE 65 * message then the post action will never get a chance to 66 * run. It will be aborted because the CC_EVENT_SIGNALING_GONE 67 * will be processed first. 68 */ 69 Action Post_HANGUP_SIGNALING; 70 Next_State CC_STATE_WAIT_DESTRUCTION; 71 } 72 Stimulus CC_EVENT_TIMEOUT_T_ACTIVATE { 73 Action Pass_Up_CC_Req_Rsp_Timeout; 74 Action Pass_Up_CC_Cancel; 75 Action Hangup_Signaling_Link; 76 Next_State CC_STATE_IDLE; 77 } 78 Stimulus CC_EVENT_SIGNALING_GONE { 79 /* Claim it was a timeout */ 80 Action Pass_Up_CC_Req_Rsp_Timeout; 81 Action Pass_Up_CC_Cancel; 82 Next_State CC_STATE_IDLE; 83 } 84 Stimulus CC_EVENT_CANCEL { 85 Action Hangup_Signaling_Link; 86 Next_State CC_STATE_IDLE; 87 } 88 } 89 State CC_STATE_WAIT_DESTRUCTION { 90 /* 91 * Delayed disconnect of the signaling link to allow subcmd events 92 * from the signaling link to be passed up. 93 */ 94 Stimulus CC_EVENT_SIGNALING_GONE { 95 /* Signaling link cleared. */ 96 Next_State CC_STATE_IDLE; 97 } 98 Stimulus CC_EVENT_HANGUP_SIGNALING { 99 Action Hangup_Signaling_Link; 100 Next_State CC_STATE_IDLE; 101 } 102 Stimulus CC_EVENT_CANCEL { 103 Action Hangup_Signaling_Link; 104 Next_State CC_STATE_IDLE; 105 } 106 } 107 State CC_STATE_ACTIVATED { 108 Prolog { 109 Action Reset_A_Status; 110 } 111 Stimulus CC_EVENT_REMOTE_USER_FREE { 112 /* Received CCBS_T_RemoteUserFree */ 113 Action Pass_Up_Remote_User_Free; 114 Test = Get_A_Status; 115 Test == Busy { 116 Next_State CC_STATE_SUSPENDED; 117 } 118 Next_State CC_STATE_WAIT_CALLBACK; 119 } 120 Stimulus CC_EVENT_SUSPEND { 121 Action Set_A_Status_Busy; 122 } 123 Stimulus CC_EVENT_RESUME { 124 Action Reset_A_Status; 125 } 126 } 127 State CC_STATE_WAIT_CALLBACK { 128 Stimulus CC_EVENT_SUSPEND { 129 Next_State CC_STATE_SUSPENDED; 130 } 131 } 132 State CC_STATE_SUSPENDED { 133 Prolog { 134 Action Send_CC_Suspend; 135 } 136 Stimulus CC_EVENT_RESUME { 137 Action Send_CC_Resume; 138 Next_State CC_STATE_ACTIVATED; 139 } 140 } 141 Superstate CC_ACTIVE(CC_STATE_ACTIVATED, CC_STATE_WAIT_CALLBACK, CC_STATE_SUSPENDED) { 142 Prolog { 143 /* Start T_CCBS6/T_CCNR6 depending upon CC mode. */ 144 Action Start_T_SUPERVISION; 145 } 146 Epilog { 147 Action Stop_T_SUPERVISION; 148 } 149 Stimulus CC_EVENT_RECALL { 150 /* The original call parameters have already been set. */ 151 Action Queue_SETUP_Recall; 152 } 153 Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION { 154 Action Pass_Up_CC_Cancel; 155 Action Hangup_Signaling_Link; 156 Next_State CC_STATE_IDLE; 157 } 158 Stimulus CC_EVENT_SIGNALING_GONE { 159 /* Signaling link cleared. */ 160 Action Pass_Up_CC_Cancel; 161 Next_State CC_STATE_IDLE; 162 } 163 Stimulus CC_EVENT_CANCEL { 164 Action Hangup_Signaling_Link; 165 Next_State CC_STATE_IDLE; 166 } 167 } 168} 169