l2tpd_fsm: make fsm itself and states public

This commit is contained in:
Alexander Couzens 2016-10-23 22:43:35 +02:00 committed by Harald Welte
parent ea516e972d
commit 9586b78d02
3 changed files with 22 additions and 24 deletions

View File

@ -73,7 +73,7 @@ l2tpd_cc_alloc(struct l2tpd_instance *inst)
l2c->local.ccid = inst->next_l_cc_id++;
llist_add(&l2c->list, &inst->connections);
l2c->fsm = osmo_fsm_inst_alloc(l2tp_cc_fsm, l2c, NULL, LOGL_DEBUG, NULL);
l2c->fsm = osmo_fsm_inst_alloc(&l2tp_cc_fsm, l2c, NULL, LOGL_DEBUG, NULL);
return l2c;
}

View File

@ -4,24 +4,6 @@
#define S(x) (1 << (x))
enum l2tpd_ctrl_con_state {
/* Before we receive SCCRQ*/
L2CC_S_INIT,
/* After we sent SCCRP, waiting for SCCCN */
L2CC_S_WAIT_CTL_CONN,
/* Control Conncetion is established */
L2CC_S_ESTABLISHED,
};
/* ICRQ recipient */
enum l2tpd_in_call_state {
/* Waiting for ICRQ */
L2IC_S_INIT,
/* Waiting for ICCN */
L2IC_S_WAIT_CONN,
L2IC_S_ESTABLISHED,
};
static void l2tp_ctrl_s_init(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
/* FIXME: Send SCCRP */
@ -83,7 +65,7 @@ static const struct osmo_fsm_state l2tp_ctrl_states[] = {
},
};
static struct osmo_fsm l2tp_cc_fsm = {
struct osmo_fsm l2tp_cc_fsm = {
.name = "L2TP-CC",
.states = l2tp_ctrl_states,
.num_states = ARRAY_SIZE(l2tp_ctrl_states),
@ -91,9 +73,6 @@ static struct osmo_fsm l2tp_cc_fsm = {
.event_names = l2tp_cc_events,
};
static void l2tp_ic_s_init(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
/* ICRQ was received */
@ -156,7 +135,7 @@ static const struct osmo_fsm_state l2tp_ic_states[] = {
},
};
static struct osmo_fsm l2tp_ic_fsm = {
struct osmo_fsm l2tp_ic_fsm = {
.name = "L2TP-IC",
.states = l2tp_ic_states,
.num_states = ARRAY_SIZE(l2tp_ic_states),

View File

@ -35,4 +35,23 @@ enum l2tpd_in_call_event {
L2IC_E_LOCAL_CLOSE_REQ,
};
enum l2tpd_ctrl_con_state {
/* Before we receive SCCRQ*/
L2CC_S_INIT,
/* After we sent SCCRP, waiting for SCCCN */
L2CC_S_WAIT_CTL_CONN,
/* Control Conncetion is established */
L2CC_S_ESTABLISHED,
};
/* ICRQ recipient */
enum l2tpd_in_call_state {
/* Waiting for ICRQ */
L2IC_S_INIT,
/* Waiting for ICCN */
L2IC_S_WAIT_CONN,
L2IC_S_ESTABLISHED,
};
extern struct osmo_fsm l2tp_ic_fsm;
extern struct osmo_fsm l2tp_cc_fsm;