~ubuntu-branches/ubuntu/trusty/libpri/trusty

« back to all changes in this revision

Viewing changes to doc/cc_ptp_monitor_flattened.fsm

  • Committer: Package Import Robot
  • Author(s): Faidon Liambotis
  • Date: 2011-11-26 17:25:59 UTC
  • mfrom: (1.3.11)
  • Revision ID: package-import@ubuntu.com-20111126172559-f6c5r81fgkn0krlb
Tags: 1.4.12-1
* New upstream release. 
  - Drop patch gcc-4.6-werror, not needed anymore.
  - Adapt patch enable-gcc-optimizations.
  - Updated symbols file with (a lot of) new symbols.

Show diffs side-by-side

added added

removed removed

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