l2tpd_fsm: add control connection states L2CC_S_WAIT_FOR_TCRP, L2CC_S_ESTABLISHED_CONFIGURED
L2CC_S_WAIT_FOR_TCRP = after sending a TCRQ L2CC_S_ESTABLISHED_CONFIGURED = when the connection is fully initialized
This commit is contained in:
parent
f53b8c2d89
commit
218d6bfb2b
|
@ -39,11 +39,41 @@ static void l2tp_ctrl_s_established(struct osmo_fsm_inst *fi, uint32_t event, vo
|
|||
{
|
||||
struct l2tpd_connection *l2c = fi->priv;
|
||||
|
||||
if (!l2tp_tx_scc_rp(l2c)) {
|
||||
osmo_fsm_inst_state_chg(fi, L2CC_S_WAIT_FOR_TCRP, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void l2tp_ctrl_s_wait_for_tcrp(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||
{
|
||||
struct l2tpd_connection *l2c = fi->priv;
|
||||
|
||||
switch (event) {
|
||||
case L2CC_E_LOCAL_CLOSE_REQ:
|
||||
l2tp_tx_stop_ccn(l2c);
|
||||
osmo_fsm_inst_state_chg(fi, L2CC_S_INIT, 0, 0);
|
||||
/* FIXME: teardown */
|
||||
/* FIXME: teardown instead of INIT */
|
||||
break;
|
||||
case L2CC_E_RX_STOP_CCN:
|
||||
l2tp_tx_ack(l2c);
|
||||
/* FIXME: tear down whole l2c */
|
||||
break;
|
||||
case L2CC_E_RX_TCRP:
|
||||
l2tp_tx_ack(l2c);
|
||||
osmo_fsm_inst_state_chg(fi, L2CC_S_ESTABLISHED_CONFIGURED, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void l2tp_ctrl_s_established_configured(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||
{
|
||||
struct l2tpd_connection *l2c = fi->priv;
|
||||
|
||||
switch (event) {
|
||||
case L2CC_E_LOCAL_CLOSE_REQ:
|
||||
l2tp_tx_stop_ccn(l2c);
|
||||
osmo_fsm_inst_state_chg(fi, L2CC_S_INIT, 0, 0);
|
||||
/* FIXME: teardown instead of INIT */
|
||||
break;
|
||||
case L2CC_E_RX_STOP_CCN:
|
||||
l2tp_tx_ack(l2c);
|
||||
|
@ -58,6 +88,7 @@ static const struct value_string l2tp_cc_events[] = {
|
|||
{ L2CC_E_RX_SCCRP, "RX-SCCRP" },
|
||||
{ L2CC_E_RX_SCCCN, "RX-SCCCN" },
|
||||
{ L2CC_E_RX_STOP_CCN, "RX-STOPCCN" },
|
||||
{ L2CC_E_RX_TCRP, "RX-TCRP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
@ -79,11 +110,27 @@ static const struct osmo_fsm_state l2tp_ctrl_states[] = {
|
|||
[L2CC_S_ESTABLISHED] = {
|
||||
.in_event_mask = S(L2CC_E_LOCAL_CLOSE_REQ) |
|
||||
S(L2CC_E_RX_STOP_CCN),
|
||||
.out_state_mask = S(L2CC_S_ESTABLISHED) |
|
||||
.out_state_mask = S(L2CC_S_WAIT_FOR_TCRP) |
|
||||
S(L2CC_S_INIT),
|
||||
.name = "ESTABLISHED",
|
||||
.action = l2tp_ctrl_s_established,
|
||||
},
|
||||
[L2CC_S_WAIT_FOR_TCRP] = {
|
||||
.in_event_mask = S(L2CC_E_LOCAL_CLOSE_REQ) |
|
||||
S(L2CC_E_RX_STOP_CCN) |
|
||||
S(L2CC_E_RX_TCRP),
|
||||
.out_state_mask = S(L2CC_S_ESTABLISHED_CONFIGURED) |
|
||||
S(L2CC_S_INIT),
|
||||
.name = "WAIT_FOR_TCRP",
|
||||
.action = l2tp_ctrl_s_wait_for_tcrp,
|
||||
},
|
||||
[L2CC_S_ESTABLISHED_CONFIGURED] = {
|
||||
.in_event_mask = S(L2CC_E_LOCAL_CLOSE_REQ) |
|
||||
S(L2CC_E_RX_STOP_CCN),
|
||||
.out_state_mask = S(L2CC_S_INIT),
|
||||
.name = "ESTABLISHED_CONFIGURED",
|
||||
.action = l2tp_ctrl_s_established_configured,
|
||||
},
|
||||
};
|
||||
|
||||
struct osmo_fsm l2tp_cc_fsm = {
|
||||
|
@ -165,4 +212,3 @@ struct osmo_fsm l2tp_ic_fsm = {
|
|||
.allstate_event_mask = S(L2IC_E_RX_CDN) | S(L2IC_E_LOCAL_CLOSE_REQ),
|
||||
.allstate_action = l2tp_ic_allstate,
|
||||
};
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ enum l2tpd_ctrl_con_event {
|
|||
L2CC_E_RX_SCCCN,
|
||||
/* Received Stop CCN */
|
||||
L2CC_E_RX_STOP_CCN,
|
||||
/* Received Transport configuration Reply */
|
||||
L2CC_E_RX_TCRP,
|
||||
};
|
||||
|
||||
enum l2tpd_in_call_event {
|
||||
|
@ -42,6 +44,10 @@ enum l2tpd_ctrl_con_state {
|
|||
L2CC_S_WAIT_CTL_CONN,
|
||||
/* Control Conncetion is established */
|
||||
L2CC_S_ESTABLISHED,
|
||||
/* After we sent a TCRQ, waiting for TCRP */
|
||||
L2CC_S_WAIT_FOR_TCRP,
|
||||
/* We configured the SIU to start sessions */
|
||||
L2CC_S_ESTABLISHED_CONFIGURED
|
||||
};
|
||||
|
||||
/* ICRQ recipient */
|
||||
|
|
Loading…
Reference in New Issue