2 * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 *---------------------------------------------------------------------------
27 * i4b_l3fsm.c - layer 3 FSM
28 * -------------------------
30 * $Id: i4b_l3fsm.c,v 1.14 2006/11/16 01:33:49 christos Exp $
34 * last edit-date: [Fri Jan 5 11:33:47 2001]
36 *---------------------------------------------------------------------------*/
38 #include <sys/cdefs.h>
39 __KERNEL_RCSID(0, "$NetBSD: i4b_l3fsm.c,v 1.13 2006/10/16 12:23:00 pooka Exp $");
48 #include <sys/param.h>
49 #include <sys/kernel.h>
50 #include <sys/systm.h>
52 #include <sys/socket.h>
55 #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
56 #include <sys/callout.h>
60 #include <machine/i4b_debug.h>
61 #include <machine/i4b_ioctl.h>
62 #include <machine/i4b_cause.h>
64 #include <netisdn/i4b_debug.h>
65 #include <netisdn/i4b_ioctl.h>
66 #include <netisdn/i4b_cause.h>
69 #include <netisdn/i4b_isdnq931.h>
70 #include <netisdn/i4b_l2.h>
71 #include <netisdn/i4b_l1l2.h>
72 #include <netisdn/i4b_l3l4.h>
73 #include <netisdn/i4b_mbuf.h>
74 #include <netisdn/i4b_global.h>
75 #include <netisdn/i4b_l3.h>
76 #include <netisdn/i4b_l3fsm.h>
77 #include <netisdn/i4b_q931.h>
78 #include <netisdn/i4b_l4.h>
81 static void F_00A(call_desc_t
*cd
), F_00H(call_desc_t
*cd
), F_00I(call_desc_t
*cd
);
82 static void F_00J(call_desc_t
*cd
);
84 static void F_01B(call_desc_t
*cd
), F_01K(call_desc_t
*cd
), F_01L(call_desc_t
*cd
);
85 static void F_01M(call_desc_t
*cd
), F_01N(call_desc_t
*cd
), F_01U(call_desc_t
*cd
);
86 static void F_01O(call_desc_t
*cd
);
88 static void F_03C(call_desc_t
*cd
), F_03N(call_desc_t
*cd
), F_03O(call_desc_t
*cd
);
89 static void F_03P(call_desc_t
*cd
), F_03Y(call_desc_t
*cd
);
91 static void F_04O(call_desc_t
*cd
);
93 static void F_06D(call_desc_t
*cd
), F_06E(call_desc_t
*cd
), F_06F(call_desc_t
*cd
);
94 static void F_06G(call_desc_t
*cd
), F_06J(call_desc_t
*cd
), F_06Q(call_desc_t
*cd
);
96 static void F_07E(call_desc_t
*cd
), F_07F(call_desc_t
*cd
), F_07G(call_desc_t
*cd
);
98 static void F_08R(call_desc_t
*cd
), F_08Z(call_desc_t
*cd
);
100 static void F_09D(call_desc_t
*cd
), F_09E(call_desc_t
*cd
), F_09F(call_desc_t
*cd
);
101 static void F_09G(call_desc_t
*cd
);
103 static void F_11J(call_desc_t
*cd
), F_11Q(call_desc_t
*cd
), F_11V(call_desc_t
*cd
);
105 static void F_12C(call_desc_t
*cd
), F_12J(call_desc_t
*cd
);
107 static void F_19I(call_desc_t
*cd
), F_19J(call_desc_t
*cd
), F_19K(call_desc_t
*cd
);
108 static void F_19W(call_desc_t
*cd
);
110 static void F_NCNA(call_desc_t
*cd
), F_STENQ(call_desc_t
*cd
), F_STAT(call_desc_t
*cd
);
111 static void F_INFO(call_desc_t
*cd
), F_RELCP(call_desc_t
*cd
), F_REL(call_desc_t
*cd
);
112 static void F_DISC(call_desc_t
*cd
), F_DCRQ(call_desc_t
*cd
), F_UEM(call_desc_t
*cd
);
113 static void F_SIGN(call_desc_t
*cd
), F_DLEI(call_desc_t
*cd
), F_ILL(call_desc_t
*cd
);
114 static void F_309TO(call_desc_t
*cd
), F_DECF(call_desc_t
*cd
), F_FCTY(call_desc_t
*cd
);
115 static void F_DECF1(call_desc_t
*cd
), F_DECF2(call_desc_t
*cd
), F_DECF3(call_desc_t
*cd
);
116 static void F_DLRI(call_desc_t
*cd
), F_DLRIA(call_desc_t
*cd
), F_DECF4(call_desc_t
*cd
);
119 static const char *l3state_text
[N_STATES
] = {
133 "ST_IWA - In Wait EST-Accept",
134 "ST_IWR - In Wait EST-Reject",
135 "ST_OW - Out Wait EST",
136 "ST_IWL - In Wait EST-Alert",
138 "ST_SUSE - Subroutine sets state",
143 static const char *l3event_text
[N_EVENTS
] = {
144 "EV_SETUPRQ - L4 SETUP REQ", /* setup request from L4 */
145 "EV_DISCRQ - L4 DISC REQ", /* disconnect request from L4 */
146 "EV_RELRQ - L4 REL REQ", /* release request from L4 */
147 "EV_ALERTRQ - L4 ALERT REQ", /* alerting request from L4 */
148 "EV_SETACRS - L4 accept RSP", /* setup response accept from l4 */
149 "EV_SETRJRS - L4 reject RSP", /* setup response reject from l4 */
150 "EV_SETDCRS - L4 ignore RSP", /* setup response dontcare from l4 */
152 "EV_SETUP - rxd SETUP", /* incoming SETUP message from L2 */
153 "EV_STATUS - rxd STATUS", /* incoming STATUS message from L2 */
154 "EV_RELEASE - rxd REL", /* incoming RELEASE message from L2 */
155 "EV_RELCOMP - rxd REL COMPL", /* incoming RELEASE COMPLETE from L2 */
156 "EV_SETUPAK - rxd SETUP ACK", /* incoming SETUP ACK message from L2 */
157 "EV_CALLPRC - rxd CALL PROC", /* incoming CALL PROCEEDING from L2 */
158 "EV_ALERT - rxd ALERT", /* incoming ALERT message from L2 */
159 "EV_CONNECT - rxd CONNECT", /* incoming CONNECT message from L2 */
160 "EV_PROGIND - rxd PROG IND", /* incoming Progress IND from L2 */
161 "EV_DISCONN - rxd DISC", /* incoming DISCONNECT message from L2 */
162 "EV_CONACK - rxd CONN ACK", /* incoming CONNECT ACK message from L2 */
163 "EV_STATENQ - rxd STAT ENQ", /* incoming STATUS ENQ message from L2 */
164 "EV_INFO - rxd INFO", /* incoming INFO message from L2 */
165 "EV_FACILITY - rxd FACILITY", /* incoming FACILITY message */
167 "EV_T303EXP - T303 timeout", /* Timer T303 expired */
168 "EV_T305EXP - T305 timeout", /* Timer T305 expired */
169 "EV_T308EXP - T308 timeout", /* Timer T308 expired */
170 "EV_T309EXP - T309 timeout", /* Timer T309 expired */
171 "EV_T310EXP - T310 timeout", /* Timer T310 expired */
172 "EV_T313EXP - T313 timeout", /* Timer T313 expired */
174 "EV_DLESTIN - L2 DL_Est_Ind", /* dl establish indication from l2 */
175 "EV_DLRELIN - L2 DL_Rel_Ind", /* dl release indication from l2 */
176 "EV_DLESTCF - L2 DL_Est_Cnf", /* dl establish confirm from l2 */
177 "EV_DLRELCF - L2 DL_Rel_Cnf", /* dl release confirm from l2 */
179 "EV_ILL - Illegal event!!" /* Illegal */
183 /*---------------------------------------------------------------------------*
184 * layer 3 state transition table
185 *---------------------------------------------------------------------------*/
187 void (*func
) (call_desc_t
*); /* function to execute */
188 int newstate
; /* next state */
189 } l3state_tab
[N_EVENTS
][N_STATES
] = {
191 /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */
192 /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
193 /*EV_SETUPRQ*/ {{F_00A
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
194 /*EV_DISCRQ */ {{F_ILL
, ST_ILL
}, {F_01B
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_ILL
, ST_ILL
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_ILL
, ST_ILL
}, {F_NCNA
, ST_U12
}, {F_ILL
, ST_ILL
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_DCRQ
, ST_U11
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
195 /*EV_RELRQ */ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_03C
, ST_U19
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_12C
, ST_U19
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
196 /*EV_ALERTRQ*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_06D
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_09D
, ST_U7
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
197 /*EV_SETACRS*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_06E
, ST_SUSE
}, {F_07E
, ST_U8
}, {F_ILL
, ST_ILL
}, {F_09E
, ST_U8
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
198 /*EV_SETRJRS*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_06F
, ST_SUSE
}, {F_07F
, ST_U0
}, {F_ILL
, ST_ILL
}, {F_09F
, ST_U0
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
199 /*EV_SETDCRS*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_06G
, ST_U0
}, {F_07G
, ST_U0
}, {F_ILL
, ST_ILL
}, {F_09G
, ST_U0
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
200 /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */
201 /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
202 /*EV_SETUP */ {{F_00H
, ST_U6
}, {F_SIGN
, ST_U1
}, {F_SIGN
, ST_U3
}, {F_SIGN
, ST_U4
}, {F_SIGN
, ST_U6
}, {F_SIGN
, ST_U7
}, {F_SIGN
, ST_U8
}, {F_SIGN
, ST_U9
}, {F_SIGN
, ST_U10
}, {F_SIGN
, ST_U11
}, {F_SIGN
, ST_U12
}, {F_SIGN
, ST_U19
}, {F_SIGN
, ST_IWA
}, {F_SIGN
, ST_IWR
}, {F_SIGN
, ST_OW
}, {F_SIGN
, ST_IWL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
203 /*EV_STATUS */ {{F_00I
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_19I
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_STAT
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
204 /*EV_RELEASE*/ {{F_00J
, ST_U0
}, {F_UEM
, ST_SUSE
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_06J
, ST_U0
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_11J
, ST_U0
}, {F_12J
, ST_U0
}, {F_19J
, ST_U0
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_REL
, ST_U0
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
205 /*EV_RELCOMP*/ {{F_NCNA
, ST_U0
}, {F_01K
, ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_19K
, ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_RELCP
,ST_U0
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
206 /*EV_SETUPAK*/ {{F_UEM
, ST_SUSE
}, {F_01L
, ST_U3
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
207 /*EV_CALLPRC*/ {{F_UEM
, ST_SUSE
}, {F_01M
, ST_U3
}, {F_NCNA
, ST_U3
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
208 /*EV_ALERT */ {{F_UEM
, ST_SUSE
}, {F_01N
, ST_U4
}, {F_03N
, ST_U4
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
209 /*EV_CONNECT*/ {{F_UEM
, ST_SUSE
}, {F_01O
, ST_U10
}, {F_03O
, ST_U10
}, {F_04O
, ST_U10
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
210 /*EV_PROGIND*/ {{F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_03P
, ST_U3
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
211 /*EV_DISCONN*/ {{F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_06Q
, ST_U12
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_11Q
, ST_U19
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_DISC
, ST_U12
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
212 /*EV_CONACK */ {{F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_08R
, ST_U10
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
213 /*EV_STATENQ*/ {{F_STENQ
,ST_U0
}, {F_STENQ
,ST_U1
}, {F_STENQ
,ST_U3
}, {F_STENQ
,ST_U4
}, {F_STENQ
,ST_U6
}, {F_STENQ
,ST_U7
}, {F_STENQ
,ST_U8
}, {F_STENQ
,ST_U9
}, {F_STENQ
,ST_U10
}, {F_STENQ
,ST_U11
}, {F_STENQ
,ST_U12
}, {F_STENQ
,ST_U19
}, {F_STENQ
,ST_IWA
}, {F_STENQ
,ST_IWR
}, {F_STENQ
,ST_OW
}, {F_STENQ
,ST_OW
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
214 /*EV_INFO */ {{F_UEM
, ST_SUSE
}, {F_UEM
, ST_SUSE
}, {F_INFO
, ST_U3
}, {F_INFO
, ST_U4
}, {F_UEM
, ST_SUSE
}, {F_INFO
, ST_U7
}, {F_INFO
, ST_U8
}, {F_INFO
, ST_U9
}, {F_INFO
, ST_U10
}, {F_INFO
, ST_U11
}, {F_INFO
, ST_U12
}, {F_UEM
, ST_SUSE
}, {F_INFO
, ST_IWA
}, {F_INFO
, ST_IWR
}, {F_INFO
, ST_OW
}, {F_INFO
, ST_OW
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
215 /*EV_FACILITY*/ {{F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_FCTY
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
216 /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */
217 /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
218 /*EV_T303EXP*/ {{F_ILL
, ST_ILL
}, {F_01U
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
219 /*EV_T305EXP*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_11V
, ST_U19
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
220 /*EV_T308EXP*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_19W
, ST_SUSE
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
221 /*EV_T309EXP*/ {{F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_309TO
,ST_U0
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
222 /*EV_T310EXP*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_03Y
, ST_U11
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
223 /*EV_T313EXP*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_08Z
, ST_U11
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
224 /* STATE: ST_U0 ST_U1 ST_U3 ST_U4 ST_U6 ST_U7 ST_U8 ST_U9 ST_U10 ST_U11 ST_U12 ST_U19 ST_IWA ST_IWR ST_OW ST_IWL ST_SUBSET ST_ILL */
225 /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
226 /*EV_DLESTIN*/ {{F_ILL
, ST_ILL
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U3
}, {F_DLEI
, ST_U4
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_DLEI
, ST_U1
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
227 /*EV_DLRELIN*/ {{F_NCNA
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRIA
,ST_U10
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_DLRI
, ST_U0
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
228 /*EV_DLESTCF*/ {{F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF
, ST_SUSE
}, {F_DECF2
,ST_U8
}, {F_DECF3
,ST_U0
}, {F_DECF1
,ST_U1
}, {F_DECF4
,ST_U7
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
229 /*EV_DLRELCF*/ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}},
230 /*EV_ILL */ {{F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}, {F_ILL
, ST_ILL
}}
233 /*---------------------------------------------------------------------------*
235 *---------------------------------------------------------------------------*/
236 void next_l3state(call_desc_t
*cd
, int event
)
238 int currstate
, newstate
;
241 panic("i4b_l3fsm.c: event > N_EVENTS");
243 currstate
= cd
->Q931state
;
245 if(currstate
> N_STATES
)
246 panic("i4b_l3fsm.c: currstate > N_STATES");
248 newstate
= l3state_tab
[event
][currstate
].newstate
;
250 if(newstate
> N_STATES
)
251 panic("i4b_l3fsm.c: newstate > N_STATES");
253 NDBGL3(L3_F_MSG
, "L3 FSM event [%s]: [%s => %s]",
255 l3state_text
[currstate
],
256 l3state_text
[newstate
]);
258 /* execute function */
260 (*l3state_tab
[event
][currstate
].func
)(cd
);
262 if(newstate
== ST_ILL
)
264 newstate
= currstate
;
265 NDBGL3(L3_F_ERR
, "FSM illegal state, state = %s, event = %s!",
266 l3state_text
[newstate
],
267 l3event_text
[event
]);
270 if(newstate
!= ST_SUSE
)
271 cd
->Q931state
= newstate
;
275 /*---------------------------------------------------------------------------*
276 * return pointer to current state description
277 *---------------------------------------------------------------------------*/
278 const char *print_l3state(call_desc_t
*cd
)
280 return(l3state_text
[cd
->Q931state
]);
284 /*---------------------------------------------------------------------------*
285 * L3 FSM state U0 event L4 setup req
286 *---------------------------------------------------------------------------*/
287 static void F_00A(call_desc_t
*cd
)
289 NDBGL3(L3_F_MSG
, "FSM function F_00A executing");
291 if(i4b_get_dl_stat(cd
) == DL_DOWN
)
293 struct l2_softc
* l2sc
= (l2_softc_t
*)cd
->l3drv
->l1_token
;
294 i4b_dl_establish_req(l2sc
, l2sc
->drv
);
295 cd
->Q931state
= ST_OW
;
300 cd
->Q931state
= ST_U1
;
303 cd
->T303_first_to
= 1;
307 /*---------------------------------------------------------------------------*
308 * L3 FSM state U0 event SETUP from L2
309 *---------------------------------------------------------------------------*/
310 static void F_00H(call_desc_t
*cd
)
312 NDBGL3(L3_F_MSG
, "FSM function F_00H executing");
313 i4b_l4_connect_ind(cd
); /* tell l4 we have an incoming setup */
316 /*---------------------------------------------------------------------------*
317 * L3 FSM state U0 event STATUS from L2
318 *---------------------------------------------------------------------------*/
319 static void F_00I(call_desc_t
*cd
)
321 NDBGL3(L3_F_MSG
, "FSM function F_00I executing");
323 if(cd
->call_state
!= 0)
326 i4b_l3_tx_release_complete(cd
, 1); /* 1 = send cause */
328 cd
->Q931state
= ST_U0
;
331 /*---------------------------------------------------------------------------*
332 * L3 FSM state U0 event RELEASE from L2
333 *---------------------------------------------------------------------------*/
334 static void F_00J(call_desc_t
*cd
)
336 NDBGL3(L3_F_MSG
, "FSM function F_00J executing");
337 i4b_l3_tx_release_complete(cd
, 0); /* 0 = don't send cause */
340 /*---------------------------------------------------------------------------*
341 * L3 FSM state U1 event disconnect req from L4
342 *---------------------------------------------------------------------------*/
343 static void F_01B(call_desc_t
*cd
)
345 NDBGL3(L3_F_MSG
, "FSM function F_01B executing");
347 i4b_l3_tx_disconnect(cd
);
352 /*---------------------------------------------------------------------------*
353 * L3 FSM state U1 event RELEASE COMPLETE from L2
354 *---------------------------------------------------------------------------*/
355 static void F_01K(call_desc_t
*cd
)
357 NDBGL3(L3_F_MSG
, "FSM function F_01K executing");
359 i4b_l4_disconnect_ind(cd
); /* tell l4 we were rejected */
363 /*---------------------------------------------------------------------------*
364 * L3 FSM state U1 event SETUP ACK from L2
365 *---------------------------------------------------------------------------*/
366 static void F_01L(call_desc_t
*cd
)
368 NDBGL3(L3_F_MSG
, "FSM function F_01L executing");
372 * since this implementation does NOT support overlap sending,
373 * we react here as if we received a CALL PROCEEDING because
374 * several PBX's react with a SETUP ACK even if the called
375 * number is complete AND we sent a SENDING COMPLETE in the
376 * preceding SETUP message. (-hm)
380 i4b_l4_proceeding_ind(cd
);
383 /*---------------------------------------------------------------------------*
384 * L3 FSM state U1 event CALL PROCEEDING from L2
385 *---------------------------------------------------------------------------*/
386 static void F_01M(call_desc_t
*cd
)
388 NDBGL3(L3_F_MSG
, "FSM function F_01M executing");
391 i4b_l4_proceeding_ind(cd
);
394 /*---------------------------------------------------------------------------*
395 * L3 FSM state U1 event ALERT from L2 (XXX !)
396 *---------------------------------------------------------------------------*/
397 static void F_01N(call_desc_t
*cd
)
399 NDBGL3(L3_F_MSG
, "FSM function F_01N executing");
401 i4b_l4_alert_ind(cd
);
404 /*---------------------------------------------------------------------------*
405 * L3 FSM state U1 event CONNECT from L2 (XXX !)
406 *---------------------------------------------------------------------------*/
407 static void F_01O(call_desc_t
*cd
)
409 NDBGL3(L3_F_MSG
, "FSM function F_01O executing");
411 i4b_l3_tx_connect_ack(cd
);
412 i4b_l4_connect_active_ind(cd
);
415 /*---------------------------------------------------------------------------*
416 * L3 FSM state U1 event T303 timeout
417 *---------------------------------------------------------------------------*/
418 static void F_01U(call_desc_t
*cd
)
420 NDBGL3(L3_F_MSG
, "FSM function F_01U executing");
421 if(cd
->T303_first_to
== 1)
423 cd
->T303_first_to
= 0;
426 cd
->Q931state
= ST_U1
;
430 i4b_l4_disconnect_ind(cd
);
432 cd
->Q931state
= ST_U0
;
436 /*---------------------------------------------------------------------------*
437 * L3 FSM state U3 event release req from L4
438 *---------------------------------------------------------------------------*/
439 static void F_03C(call_desc_t
*cd
)
441 NDBGL3(L3_F_MSG
, "FSM function F_03C executing");
444 i4b_l3_tx_release(cd
, 1); /* 0 = don't send cause */
445 cd
->T308_first_to
= 1;
449 /*---------------------------------------------------------------------------*
450 * L3 FSM state U3 event ALERT from L2
451 *---------------------------------------------------------------------------*/
452 static void F_03N(call_desc_t
*cd
)
454 NDBGL3(L3_F_MSG
, "FSM function F_03N executing");
456 i4b_l4_alert_ind(cd
);
459 /*---------------------------------------------------------------------------*
460 * L3 FSM state U3 event CONNECT from L2
461 *---------------------------------------------------------------------------*/
462 static void F_03O(call_desc_t
*cd
)
464 NDBGL3(L3_F_MSG
, "FSM function F_03O executing");
466 i4b_l3_tx_connect_ack(cd
); /* CONNECT ACK to network */
467 i4b_l4_connect_active_ind(cd
);
470 /*---------------------------------------------------------------------------*
471 * L3 FSM state U3 event PROGESS IND from L2
472 *---------------------------------------------------------------------------*/
473 static void F_03P(call_desc_t
*cd
)
475 NDBGL3(L3_F_MSG
, "FSM function F_03P executing");
478 i4b_l4_progress_ind(cd
);
482 /*---------------------------------------------------------------------------*
483 * L3 FSM state U3 event T310 timeout
484 *---------------------------------------------------------------------------*/
485 static void F_03Y(call_desc_t
*cd
)
487 NDBGL3(L3_F_MSG
, "FSM function F_03Y executing");
488 cd
->cause_out
= 102; /* recovery on timer expiry */
489 i4b_l3_tx_disconnect(cd
);
491 i4b_l4_disconnect_ind(cd
);
494 /*---------------------------------------------------------------------------*
495 * L3 FSM state U4 event CONNECT from L2
496 *---------------------------------------------------------------------------*/
497 static void F_04O(call_desc_t
*cd
)
499 NDBGL3(L3_F_MSG
, "FSM function F_04O executing");
500 i4b_l3_tx_connect_ack(cd
); /* CONNECT ACK to network */
501 i4b_l4_connect_active_ind(cd
);
504 /*---------------------------------------------------------------------------*
505 * L3 FSM state U6 event alert req from L4
506 *---------------------------------------------------------------------------*/
507 static void F_06D(call_desc_t
*cd
)
509 NDBGL3(L3_F_MSG
, "FSM function F_06D executing");
511 if(i4b_get_dl_stat(cd
) == DL_DOWN
)
513 struct l2_softc
* l2sc
= (l2_softc_t
*)cd
->l3drv
->l1_token
;
514 i4b_dl_establish_req(l2sc
, l2sc
->drv
);
515 cd
->Q931state
= ST_IWL
;
520 cd
->Q931state
= ST_U7
;
524 /*---------------------------------------------------------------------------*
525 * L3 FSM state U6 event incoming setup accept from L4
526 *---------------------------------------------------------------------------*/
527 static void F_06E(call_desc_t
*cd
)
529 NDBGL3(L3_F_MSG
, "FSM function F_06E executing");
531 if(i4b_get_dl_stat(cd
) == DL_DOWN
)
533 struct l2_softc
* l2sc
= (l2_softc_t
*)cd
->l3drv
->l1_token
;
534 i4b_dl_establish_req(l2sc
, l2sc
->drv
);
535 cd
->Q931state
= ST_IWA
;
539 i4b_l3_tx_connect(cd
);
540 cd
->Q931state
= ST_U8
;
545 /*---------------------------------------------------------------------------*
546 * L3 FSM state U6 event incoming setup reject from L4
547 *---------------------------------------------------------------------------*/
548 static void F_06F(call_desc_t
*cd
)
550 NDBGL3(L3_F_MSG
, "FSM function F_06F executing");
552 if(i4b_get_dl_stat(cd
) == DL_DOWN
)
554 struct l2_softc
* l2sc
= (l2_softc_t
*)cd
->l3drv
->l1_token
;
555 i4b_dl_establish_req(l2sc
, l2sc
->drv
);
556 cd
->Q931state
= ST_IWR
;
561 i4b_l3_tx_release_complete(cd
, 1);
562 cd
->Q931state
= ST_U0
;
568 /*---------------------------------------------------------------------------*
569 * L3 FSM state U6 event incoming setup ignore from L4
570 *---------------------------------------------------------------------------*/
571 static void F_06G(call_desc_t
*cd
)
573 NDBGL3(L3_F_MSG
, "FSM function F_06G executing");
577 /*---------------------------------------------------------------------------*
578 * L3 FSM state U6 event RELEASE from L2
579 *---------------------------------------------------------------------------*/
580 static void F_06J(call_desc_t
*cd
)
582 NDBGL3(L3_F_MSG
, "FSM function F_06J executing");
583 i4b_l3_tx_release_complete(cd
, 0);
584 i4b_l4_disconnect_ind(cd
);
588 /*---------------------------------------------------------------------------*
589 * L3 FSM state U6 event DISCONNECT from L2
590 *---------------------------------------------------------------------------*/
591 static void F_06Q(call_desc_t
*cd
)
593 NDBGL3(L3_F_MSG
, "FSM function F_06Q executing");
594 i4b_l4_disconnect_ind(cd
);
597 /*---------------------------------------------------------------------------*
598 * L3 FSM state U7 event setup response accept from L4
599 *---------------------------------------------------------------------------*/
600 static void F_07E(call_desc_t
*cd
)
602 NDBGL3(L3_F_MSG
, "FSM function F_07E executing");
603 i4b_l3_tx_connect(cd
);
607 /*---------------------------------------------------------------------------*
608 * L3 FSM state U7 event setup response reject from L4
609 *---------------------------------------------------------------------------*/
610 static void F_07F(call_desc_t
*cd
)
612 NDBGL3(L3_F_MSG
, "FSM function F_07F executing");
613 i4b_l3_tx_release_complete(cd
, 1);
617 /*---------------------------------------------------------------------------*
618 * L3 FSM state U7 event setup response ignore from L4
619 *---------------------------------------------------------------------------*/
620 static void F_07G(call_desc_t
*cd
)
622 NDBGL3(L3_F_MSG
, "FSM function F_07G executing");
626 /*---------------------------------------------------------------------------*
627 * L3 FSM state U8 event CONNECT ACK from L2
628 *---------------------------------------------------------------------------*/
629 static void F_08R(call_desc_t
*cd
)
631 NDBGL3(L3_F_MSG
, "FSM function F_08R executing");
633 i4b_l4_connect_active_ind(cd
);
636 /*---------------------------------------------------------------------------*
637 * L3 FSM state U8 event T313 timeout
638 *---------------------------------------------------------------------------*/
639 static void F_08Z(call_desc_t
*cd
)
641 NDBGL3(L3_F_MSG
, "FSM function F_08Z executing");
642 cd
->cause_out
= 102; /* recovery on timer expiry */
643 i4b_l3_tx_disconnect(cd
);
645 i4b_l4_disconnect_ind(cd
);
648 /*---------------------------------------------------------------------------*
649 * L3 FSM state U9 event alert req from L4
650 *---------------------------------------------------------------------------*/
651 static void F_09D(call_desc_t
*cd
)
653 NDBGL3(L3_F_MSG
, "FSM function F_09D executing");
657 /*---------------------------------------------------------------------------*
658 * L3 FSM state U9 event setup response accept from L4
659 *---------------------------------------------------------------------------*/
660 static void F_09E(call_desc_t
*cd
)
662 NDBGL3(L3_F_MSG
, "FSM function F_09E executing");
663 i4b_l3_tx_connect(cd
);
667 /*---------------------------------------------------------------------------*
668 * L3 FSM state U9 event setup response reject from L4
669 *---------------------------------------------------------------------------*/
670 static void F_09F(call_desc_t
*cd
)
672 NDBGL3(L3_F_MSG
, "FSM function F_09F executing");
673 i4b_l3_tx_release_complete(cd
, 1);
676 /*---------------------------------------------------------------------------*
677 * L3 FSM state U9 event setup response ignore from L4
678 *---------------------------------------------------------------------------*/
679 static void F_09G(call_desc_t
*cd
)
681 NDBGL3(L3_F_MSG
, "FSM function F_09G executing");
685 /*---------------------------------------------------------------------------*
686 * L3 FSM state U11 event RELEASE from L2
687 *---------------------------------------------------------------------------*/
688 static void F_11J(call_desc_t
*cd
)
690 NDBGL3(L3_F_MSG
, "FSM function F_11J executing");
692 i4b_l3_tx_release_complete(cd
, 0);
693 i4b_l4_disconnect_ind(cd
);
697 /*---------------------------------------------------------------------------*
698 * L3 FSM state U11 event DISCONNECT from L2
699 *---------------------------------------------------------------------------*/
700 static void F_11Q(call_desc_t
*cd
)
702 NDBGL3(L3_F_MSG
, "FSM function F_11Q executing");
704 i4b_l3_tx_release(cd
, 0);
705 cd
->T308_first_to
= 1;
709 /*---------------------------------------------------------------------------*
710 * L3 FSM state U11 event T305 timeout
711 *---------------------------------------------------------------------------*/
712 static void F_11V(call_desc_t
*cd
)
714 NDBGL3(L3_F_MSG
, "FSM function F_11V executing");
716 i4b_l3_tx_release(cd
, 1);
717 cd
->T308_first_to
= 1;
721 /*---------------------------------------------------------------------------*
722 * L3 FSM state U12 event release req from L4
723 *---------------------------------------------------------------------------*/
724 static void F_12C(call_desc_t
*cd
)
726 NDBGL3(L3_F_MSG
, "FSM function F_12C executing");
727 i4b_l3_tx_release(cd
, 1);
728 cd
->T308_first_to
= 1;
732 /*---------------------------------------------------------------------------*
733 * L3 FSM state U12 event RELEASE from L2
734 *---------------------------------------------------------------------------*/
735 static void F_12J(call_desc_t
*cd
)
737 NDBGL3(L3_F_MSG
, "FSM function F_12J executing");
738 i4b_l3_tx_release_complete(cd
, 0);
739 i4b_l4_disconnect_ind(cd
);
743 /*---------------------------------------------------------------------------*
744 * L3 FSM state U19 event STATUS from L2
745 *---------------------------------------------------------------------------*/
746 static void F_19I(call_desc_t
*cd
)
748 NDBGL3(L3_F_MSG
, "FSM function F_19I executing");
750 if(cd
->call_state
== 0)
752 i4b_l4_status_ind(cd
);
754 cd
->Q931state
= ST_U0
;
758 cd
->Q931state
= ST_U19
;
762 /*---------------------------------------------------------------------------*
763 * L3 FSM state U19 event RELEASE from L2
764 *---------------------------------------------------------------------------*/
765 static void F_19J(call_desc_t
*cd
)
767 NDBGL3(L3_F_MSG
, "FSM function F_19J executing");
769 i4b_l4_disconnect_ind(cd
);
773 /*---------------------------------------------------------------------------*
774 * L3 FSM state U19 event RELEASE COMPLETE from L2
775 *---------------------------------------------------------------------------*/
776 static void F_19K(call_desc_t
*cd
)
778 NDBGL3(L3_F_MSG
, "FSM function F_19K executing");
780 i4b_l4_disconnect_ind(cd
);
784 /*---------------------------------------------------------------------------*
785 * L3 FSM state U19 event T308 timeout
786 *---------------------------------------------------------------------------*/
787 static void F_19W(call_desc_t
*cd
)
789 NDBGL3(L3_F_MSG
, "FSM function F_19W executing");
790 if(cd
->T308_first_to
== 0)
792 cd
->T308_first_to
= 1;
793 i4b_l3_tx_release(cd
, 0);
795 cd
->Q931state
= ST_U19
;
799 cd
->T308_first_to
= 0;
800 i4b_l4_disconnect_ind(cd
);
802 cd
->Q931state
= ST_U0
;
806 /*---------------------------------------------------------------------------*
807 * L3 FSM routine no change no action
808 *---------------------------------------------------------------------------*/
809 static void F_NCNA(call_desc_t
*cd
)
813 /*---------------------------------------------------------------------------*
814 * L3 FSM any state event STATUS ENQ from L2
815 *---------------------------------------------------------------------------*/
816 static void F_STENQ(call_desc_t
*cd
)
818 NDBGL3(L3_F_MSG
, "FSM function F_STENQ executing");
819 i4b_l3_tx_status(cd
, CAUSE_Q850_STENQRSP
); /* 30, resonse to stat enq */
822 /*---------------------------------------------------------------------------*
823 * L3 FSM any state except 0 & 19 event STATUS from L2
824 *---------------------------------------------------------------------------*/
825 static void F_STAT(call_desc_t
*cd
)
827 NDBGL3(L3_F_MSG
, "FSM function F_STAT executing");
828 if(cd
->call_state
== 0)
830 i4b_l4_status_ind(cd
);
831 cd
->Q931state
= ST_U0
;
836 /* XXX !!!!!!!!!!!!!!!!!! */
838 i4b_l4_status_ind(cd
);
839 cd
->cause_out
= 101; /* message not compatible with call state */
840 i4b_l3_tx_disconnect(cd
);
842 cd
->Q931state
= ST_U11
;
846 /*---------------------------------------------------------------------------*
847 * L3 FSM some states event INFORMATION from L2
848 *---------------------------------------------------------------------------*/
849 static void F_INFO(call_desc_t
*cd
)
851 NDBGL3(L3_F_MSG
, "FSM function F_INFO executing");
853 /* remain in current state */
856 /*---------------------------------------------------------------------------*
857 * L3 FSM some states event RELEASE COMPLETE from L2
858 *---------------------------------------------------------------------------*/
859 static void F_RELCP(call_desc_t
*cd
)
861 NDBGL3(L3_F_MSG
, "FSM function F_RELCP executing");
862 i4b_l3_stop_all_timers(cd
);
863 i4b_l4_disconnect_ind(cd
);
867 /*---------------------------------------------------------------------------*
868 * L3 FSM some states event RELEASE from L2
869 *---------------------------------------------------------------------------*/
870 static void F_REL(call_desc_t
*cd
)
872 NDBGL3(L3_F_MSG
, "FSM function F_REL executing");
873 i4b_l3_stop_all_timers(cd
);
874 i4b_l3_tx_release_complete(cd
, 0);
875 i4b_l4_disconnect_ind(cd
);
879 /*---------------------------------------------------------------------------*
880 * L3 FSM some states event DISCONNECT from L2
881 *---------------------------------------------------------------------------*/
882 static void F_DISC(call_desc_t
*cd
)
884 NDBGL3(L3_F_MSG
, "FSM function F_DISC executing");
885 i4b_l3_stop_all_timers(cd
);
888 * no disconnect ind to L4, no jump to state U12
889 * instead we issue a RELEASE and jump to U19
892 i4b_l3_tx_release(cd
, 0);
893 cd
->T308_first_to
= 1;
895 cd
->Q931state
= ST_U19
;
898 /*---------------------------------------------------------------------------*
899 * L3 FSM some states event disconnect request from L4
900 *---------------------------------------------------------------------------*/
901 static void F_DCRQ(call_desc_t
*cd
)
903 NDBGL3(L3_F_MSG
, "FSM function F_DCRQ executing");
905 /* stop T310 in case this is the result of an incoming call for a */
906 /* calledback connection */
908 if(cd
->T310
== TIMER_ACTIVE
)
912 i4b_l3_tx_disconnect(cd
);
914 cd
->Q931state
= ST_U11
;
917 /*---------------------------------------------------------------------------*
918 * L3 FSM any state except 0 event unexpected message from L2
919 *---------------------------------------------------------------------------*/
920 static void F_UEM(call_desc_t
*cd
)
922 NDBGL3(L3_F_ERR
, "FSM function F_UEM executing, state = %s", print_l3state(cd
));
923 i4b_l3_tx_status(cd
, CAUSE_Q850_MSGNCWCS
); /* 101, message not compatible with call state */
926 /*---------------------------------------------------------------------------*
927 * L3 FSM any state except 0 event SETUP from L2
928 *---------------------------------------------------------------------------*/
929 static void F_SIGN(call_desc_t
*cd
)
931 NDBGL3(L3_F_ERR
, "FSM function F_SIGN executing");
934 /* XXX */ /* freecd_by_cd(cd); ?????????? XXX */
937 /*---------------------------------------------------------------------------*
938 * L3 FSM relevant states event DL ESTABLISH IND from L2
939 *---------------------------------------------------------------------------*/
940 static void F_DLEI(call_desc_t
*cd
)
942 NDBGL3(L3_F_MSG
, "FSM function F_DLEI executing");
946 /* remain in current state */
949 /*---------------------------------------------------------------------------*
950 * L3 FSM any state event illegal event occurred
951 *---------------------------------------------------------------------------*/
952 static void F_ILL(call_desc_t
*cd
)
954 NDBGL3(L3_F_MSG
, "FSM function F_ILL executing");
957 /*---------------------------------------------------------------------------*
958 * L3 FSM any state event T309 timeout
959 *---------------------------------------------------------------------------*/
960 static void F_309TO(call_desc_t
*cd
)
962 NDBGL3(L3_F_ERR
, "FSM function F_309TO executing");
967 i4b_l4_dl_fail_ind(cd
);
973 /*---------------------------------------------------------------------------*
974 * L3 FSM any state event FACILITY message received
975 *---------------------------------------------------------------------------*/
976 static void F_FCTY(call_desc_t
*cd
)
978 NDBGL3(L3_F_MSG
, "FSM function F_FCTY executing");
979 /* ST_SUSE, no change in state ! */
982 /*---------------------------------------------------------------------------*
983 * L3 FSM state ST_OW event DL ESTABLISH CONF from L2
984 *---------------------------------------------------------------------------*/
985 static void F_DECF1(call_desc_t
*cd
)
987 NDBGL3(L3_F_MSG
, "FSM function F_DECF1 executing");
991 /*---------------------------------------------------------------------------*
992 * L3 FSM state ST_IWA event DL ESTABLISH CONF from L2
993 *---------------------------------------------------------------------------*/
994 static void F_DECF2(call_desc_t
*cd
)
996 NDBGL3(L3_F_MSG
, "FSM function F_DECF2 executing");
997 i4b_l3_tx_connect(cd
);
1000 /*---------------------------------------------------------------------------*
1001 * L3 FSM state ST_IWR event DL ESTABLISH CONF from L2
1002 *---------------------------------------------------------------------------*/
1003 static void F_DECF3(call_desc_t
*cd
)
1005 NDBGL3(L3_F_MSG
, "FSM function F_DECF3 executing");
1006 i4b_l3_tx_release_complete(cd
, 1);
1010 /*---------------------------------------------------------------------------*
1011 * L3 FSM state ST_IWL event DL ESTABLISH CONF from L2
1012 *---------------------------------------------------------------------------*/
1013 static void F_DECF4(call_desc_t
*cd
)
1015 NDBGL3(L3_F_MSG
, "FSM function F_DECF4 executing");
1016 i4b_l3_tx_alert(cd
);
1020 /*---------------------------------------------------------------------------*
1021 * L3 FSM any state event DL ESTABLISH CONF from L2
1022 *---------------------------------------------------------------------------*/
1023 static void F_DECF(call_desc_t
*cd
)
1025 NDBGL3(L3_F_MSG
, "FSM function F_DECF executing");
1027 i4b_l3_tx_status(cd
, CAUSE_Q850_NORMUNSP
); /* 31, normal unspecified */
1030 /*---------------------------------------------------------------------------*
1031 * L3 FSM any state except U10 event DL RELEASE IND from L2
1032 *---------------------------------------------------------------------------*/
1033 static void F_DLRI(call_desc_t
*cd
)
1035 NDBGL3(L3_F_MSG
, "FSM function F_DLRI executing");
1036 i4b_l3_stop_all_timers(cd
);
1037 i4b_l4_disconnect_ind(cd
);
1041 /*---------------------------------------------------------------------------*
1042 * L3 FSM state U10 event DL RELEASE IND from L2
1043 *---------------------------------------------------------------------------*/
1044 static void F_DLRIA(call_desc_t
*cd
)
1046 struct l2_softc
* l2sc
= (l2_softc_t
*)cd
->l3drv
->l1_token
;
1047 NDBGL3(L3_F_MSG
, "FSM function F_DLRIA executing");
1049 if(cd
->T309
== TIMER_IDLE
)
1052 i4b_dl_establish_req(l2sc
, l2sc
->drv
);
1055 #endif /* NI4BQ931 > 0 */