Esempio n. 1
0
static void
l2_connected(struct FsmInst *fi, int event, void *arg)
{
	layer2_t *l2 = fi->userdata;
	msg_t *msg = arg;
	int pr=-1;

	if (!get_PollFlag(l2, msg)) {
		l2_mdl_error_ua(fi, event, arg);
		return;
	}
	free_msg(msg);
	if (test_and_clear_bit(FLG_PEND_REL, &l2->flag))
		l2_disconnect(fi, event, NULL);
	if (test_and_clear_bit(FLG_L3_INIT, &l2->flag)) {
		pr = DL_ESTABLISH | CONFIRM;
	} else if (l2->vs != l2->va) {
		msg_queue_purge(&l2->i_queue);
		pr = DL_ESTABLISH | INDICATION;
	}
	stop_t200(l2, 5);

	l2->vr = 0;
	l2->vs = 0;
	l2->va = 0;
	l2->sow = 0;
	FsmChangeState(fi, ST_L2_7);
	FsmAddTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 4);
	if (pr != -1)
		l2up_create(l2, pr, CES(l2), 0, NULL);

	if (msg_queue_len(&l2->i_queue) && cansend(l2))
		FsmEvent(fi, EV_L2_ACK_PULL, NULL);
}
Esempio n. 2
0
static void
l2_restart_multi(struct FsmInst *fi, int event, void *arg)
{
	struct layer2	*l2 = fi->userdata;
	struct sk_buff	*skb = arg;
	int		est = 0;

	send_uframe(l2, skb, UA | get_PollFlag(l2, skb), RSP);

	l2mgr(l2, MDL_ERROR_IND, (void *) 'F');

	if (l2->vs != l2->va) {
		skb_queue_purge(&l2->i_queue);
		est = 1;
	}

	clear_exception(l2);
	l2->vs = 0;
	l2->va = 0;
	l2->vr = 0;
	l2->sow = 0;
	mISDN_FsmChangeState(fi, ST_L2_7);
	stop_t200(l2, 3);
	mISDN_FsmRestartTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 3);

	if (est)
		l2up_create(l2, DL_ESTABLISH_IND, 0, NULL);
/*		mISDN_queue_data(&l2->inst, l2->inst.id | MSG_BROADCAST,
 *		    MGR_SHORTSTATUS | INDICATION, SSTATUS_L2_ESTABLISHED,
 *		    0, NULL, 0);
 */
	if (skb_queue_len(&l2->i_queue) && cansend(l2))
		mISDN_FsmEvent(fi, EV_L2_ACK_PULL, NULL);
}
Esempio n. 3
0
static void
l2_restart_multi(struct FsmInst *fi, int event, void *arg)
{
	struct PStack *st = fi->userdata;
	struct sk_buff *skb = arg;
	int est = 0, state;

	state = fi->state;

	send_uframe(st, UA | get_PollFlagFree(st, skb), RSP);

	st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'F');

	if (st->l2.vs != st->l2.va) {
		skb_queue_purge(&st->l2.i_queue);
		est = 1;
	}

	clear_exception(&st->l2);
	st->l2.vs = 0;
	st->l2.va = 0;
	st->l2.vr = 0;
	st->l2.sow = 0;
	FsmChangeState(fi, ST_L2_7);
	stop_t200(st, 3);
	FsmRestartTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 3);

	if (est)
		st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL);

	if ((ST_L2_7==state) || (ST_L2_8 == state))
		if (!skb_queue_empty(&st->l2.i_queue) && cansend(st))
			st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
}
Esempio n. 4
0
static void
l2_restart_multi(struct FsmInst *fi, int event, void *arg)
{
	layer2_t *l2 = fi->userdata;
	msg_t *msg = arg;
	int est = 0;

	send_uframe(l2, msg, UA | get_PollFlag(l2, msg), RSP);

	l2mgr(l2, MDL_ERROR | INDICATION, (void *) 'F');

	if (l2->vs != l2->va) {
		msg_queue_purge(&l2->i_queue);
		est = 1;
	}

	clear_exception(l2);
	l2->vs = 0;
	l2->va = 0;
	l2->vr = 0;
	l2->sow = 0;
	FsmChangeState(fi, ST_L2_7);
	stop_t200(l2, 3);
	FsmRestartTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 3);

	if (est)
		l2up_create(l2, DL_ESTABLISH | INDICATION, CES(l2), 0, NULL);

	if (msg_queue_len(&l2->i_queue) && cansend(l2))
		FsmEvent(fi, EV_L2_ACK_PULL, NULL);
}
Esempio n. 5
0
static void
l2_st6_dm_release(struct FsmInst *fi, int event, void *arg)
{
	struct PStack *st = fi->userdata;
	struct sk_buff *skb = arg;

	if (get_PollFlagFree(st, skb)) {
		stop_t200(st, 8);
		lapb_dl_release_l2l3(st, CONFIRM);
		FsmChangeState(fi, ST_L2_4);
	}
}
Esempio n. 6
0
static void
l2_st6_dm_release(struct FsmInst *fi, int event, void *arg)
{
	layer2_t *l2 = fi->userdata;
	msg_t *msg = arg;

	if (get_PollFlagFree(l2, msg)) {
		stop_t200(l2, 8);
		lapb_dl_release_l2l3(l2, CONFIRM);
		FsmChangeState(fi, ST_L2_4);
	}
}
Esempio n. 7
0
static void
l2_st6_dm_release(struct FsmInst *fi, int event, void *arg)
{
	struct layer2 *l2 = fi->userdata;
	struct sk_buff *skb = arg;

	if (get_PollFlagFree(l2, skb)) {
		stop_t200(l2, 8);
		lapb_dl_release_l2l3(l2, DL_RELEASE_CNF);
		mISDN_FsmChangeState(fi, ST_L2_4);
		if (l2->tm)
			l2_tei(l2, MDL_STATUS_DOWN_IND, 0);
	}
}
Esempio n. 8
0
static void
l2_stop_multi(struct FsmInst *fi, int event, void *arg)
{
	layer2_t *l2 = fi->userdata;
	msg_t *msg = arg;

	FsmChangeState(fi, ST_L2_4);
	FsmDelTimer(&l2->t203, 3);
	stop_t200(l2, 4);

	send_uframe(l2, msg, UA | get_PollFlag(l2, msg), RSP);
	msg_queue_purge(&l2->i_queue);
	freewin(l2);
	lapb_dl_release_l2l3(l2, INDICATION);
}
Esempio n. 9
0
static void
l2_released(struct FsmInst *fi, int event, void *arg)
{
	layer2_t *l2 = fi->userdata;
	msg_t *msg = arg;

	if (!get_PollFlag(l2, msg)) {
		l2_mdl_error_ua(fi, event, arg);
		return;
	}
	free_msg(msg);
	stop_t200(l2, 6);
	lapb_dl_release_l2l3(l2, CONFIRM);
	FsmChangeState(fi, ST_L2_4);
}
Esempio n. 10
0
static void
l2_st5_dm_release(struct FsmInst *fi, int event, void *arg)
{
	struct PStack *st = fi->userdata;
	struct sk_buff *skb = arg;

	if (get_PollFlagFree(st, skb)) {
		stop_t200(st, 7);
	 	if (!test_bit(FLG_L3_INIT, &st->l2.flag))
			skb_queue_purge(&st->l2.i_queue);
		if (test_bit(FLG_LAPB, &st->l2.flag))
			st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
		st5_dl_release_l2l3(st);
		FsmChangeState(fi, ST_L2_4);
	}
}
Esempio n. 11
0
static void
l2_stop_multi(struct FsmInst *fi, int event, void *arg)
{
	struct PStack *st = fi->userdata;
	struct sk_buff *skb = arg;

	FsmChangeState(fi, ST_L2_4);
	FsmDelTimer(&st->l2.t203, 3);
	stop_t200(st, 4);

	send_uframe(st, UA | get_PollFlagFree(st, skb), RSP);

	skb_queue_purge(&st->l2.i_queue);
	freewin(st);
	lapb_dl_release_l2l3(st, INDICATION);
}
Esempio n. 12
0
static void
l2_st5_dm_release(struct FsmInst *fi, int event, void *arg)
{
	layer2_t *l2 = fi->userdata;
	msg_t *msg = arg;

	if (get_PollFlagFree(l2, msg)) {
		stop_t200(l2, 7);
	 	if (!test_bit(FLG_L3_INIT, &l2->flag))
			msg_queue_purge(&l2->i_queue);
		if (test_bit(FLG_LAPB, &l2->flag))
			l2down_create(l2, PH_DEACTIVATE | REQUEST, 0, 0, NULL);
		st5_dl_release_l2l3(l2);
		FsmChangeState(fi, ST_L2_4);
	}
}
Esempio n. 13
0
static void
l2_released(struct FsmInst *fi, int event, void *arg)
{
	struct PStack *st = fi->userdata;
	struct sk_buff *skb = arg;

	if (!get_PollFlag(st, skb)) {
		l2_mdl_error_ua(fi, event, arg);
		return;
	}
	dev_kfree_skb(skb);

	stop_t200(st, 6);
	lapb_dl_release_l2l3(st, CONFIRM);
	FsmChangeState(fi, ST_L2_4);
}
Esempio n. 14
0
static void
l2_stop_multi(struct FsmInst *fi, int event, void *arg)
{
	struct layer2	*l2 = fi->userdata;
	struct sk_buff	*skb = arg;

	mISDN_FsmChangeState(fi, ST_L2_4);
	mISDN_FsmDelTimer(&l2->t203, 3);
	stop_t200(l2, 4);

	send_uframe(l2, skb, UA | get_PollFlag(l2, skb), RSP);
	skb_queue_purge(&l2->i_queue);
	freewin(l2);
	lapb_dl_release_l2l3(l2, DL_RELEASE_IND);
	if (l2->tm)
		l2_tei(l2, MDL_STATUS_DOWN_IND, 0);
}
Esempio n. 15
0
static void
l2_released(struct FsmInst *fi, int event, void *arg)
{
	struct layer2 *l2 = fi->userdata;
	struct sk_buff *skb = arg;

	if (!get_PollFlag(l2, skb)) {
		l2_mdl_error_ua(fi, event, arg);
		return;
	}
	dev_kfree_skb(skb);
	stop_t200(l2, 6);
	lapb_dl_release_l2l3(l2, DL_RELEASE_CNF);
	mISDN_FsmChangeState(fi, ST_L2_4);
	if (l2->tm)
		l2_tei(l2, MDL_STATUS_DOWN_IND, 0);
}
Esempio n. 16
0
static void
l2_st5_dm_release(struct FsmInst *fi, int event, void *arg)
{
	struct layer2 *l2 = fi->userdata;
	struct sk_buff *skb = arg;

	if (get_PollFlagFree(l2, skb)) {
		stop_t200(l2, 7);
		if (!test_bit(FLG_L3_INIT, &l2->flag))
			skb_queue_purge(&l2->i_queue);
		if (test_bit(FLG_LAPB, &l2->flag))
			l2down_create(l2, PH_DEACTIVATE_REQ,
				l2_newid(l2), 0, NULL);
		st5_dl_release_l2l3(l2);
		mISDN_FsmChangeState(fi, ST_L2_4);
		if (l2->tm)
			l2_tei(l2, MDL_STATUS_DOWN_IND, 0);
	}
}
Esempio n. 17
0
static void
l2_connected(struct FsmInst *fi, int event, void *arg)
{
	struct PStack *st = fi->userdata;
	struct sk_buff *skb = arg;
	int pr=-1;

	if (!get_PollFlag(st, skb)) {
		l2_mdl_error_ua(fi, event, arg);
		return;
	}
	dev_kfree_skb(skb);

	if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag))
		l2_disconnect(fi, event, arg);

	if (test_and_clear_bit(FLG_L3_INIT, &st->l2.flag)) {
		pr = DL_ESTABLISH | CONFIRM;
	} else if (st->l2.vs != st->l2.va) {
		skb_queue_purge(&st->l2.i_queue);
		pr = DL_ESTABLISH | INDICATION;
	}

	stop_t200(st, 5);

	st->l2.vr = 0;
	st->l2.vs = 0;
	st->l2.va = 0;
	st->l2.sow = 0;
	FsmChangeState(fi, ST_L2_7);
	FsmAddTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 4);

	if (pr != -1)
		st->l2.l2l3(st, pr, NULL);

	if (!skb_queue_empty(&st->l2.i_queue) && cansend(st))
		st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
}
Esempio n. 18
0
static void
l2_connected(struct FsmInst *fi, int event, void *arg)
{
	struct layer2	*l2 = fi->userdata;
	struct sk_buff	*skb = arg;
	int pr = -1;

	if (!get_PollFlag(l2, skb)) {
		l2_mdl_error_ua(fi, event, arg);
		return;
	}
	dev_kfree_skb(skb);
	if (test_and_clear_bit(FLG_PEND_REL, &l2->flag))
		l2_disconnect(fi, event, NULL);
	if (test_and_clear_bit(FLG_L3_INIT, &l2->flag)) {
		pr = DL_ESTABLISH_CNF;
	} else if (l2->vs != l2->va) {
		skb_queue_purge(&l2->i_queue);
		pr = DL_ESTABLISH_IND;
	}
	stop_t200(l2, 5);
	l2->vr = 0;
	l2->vs = 0;
	l2->va = 0;
	l2->sow = 0;
	mISDN_FsmChangeState(fi, ST_L2_7);
	mISDN_FsmAddTimer(&l2->t203, l2->T203, EV_L2_T203, NULL, 4);
	if (pr != -1)
		l2up_create(l2, pr, 0, NULL);

	if (skb_queue_len(&l2->i_queue) && cansend(l2))
		mISDN_FsmEvent(fi, EV_L2_ACK_PULL, NULL);

	if (l2->tm)
		l2_tei(l2, MDL_STATUS_UP_IND, 0);
}