Beispiel #1
0
static void
release_l1(struct layer1 *l1) {
	mISDN_FsmDelTimer(&l1->timerX, 0);
	mISDN_FsmDelTimer(&l1->timer3, 0);
	if (l1->dch)
		l1->dch->l1 = NULL;
	module_put(THIS_MODULE);
	kfree(l1);
}
Beispiel #2
0
static void
l1_info4_ind(struct FsmInst *fi, int event, void *arg)
{
	struct layer1 *l1 = fi->userdata;

	mISDN_FsmChangeState(fi, ST_L1_F7);
	l1->dcb(l1->dch, INFO3_P8);
	if (test_and_clear_bit(FLG_L1_DEACTTIMER, &l1->Flags))
		mISDN_FsmDelTimer(&l1->timer, 4);
	if (!test_bit(FLG_L1_ACTIVATED, &l1->Flags)) {
		if (test_and_clear_bit(FLG_L1_T3RUN, &l1->Flags))
			mISDN_FsmDelTimer(&l1->timer, 3);
		mISDN_FsmRestartTimer(&l1->timer, 110, EV_TIMER_ACT, NULL, 2);
		test_and_set_bit(FLG_L1_ACTTIMER, &l1->Flags);
	}
}
Beispiel #3
0
static void
lc_release_ind(struct FsmInst *fi, int event, void *arg)
{
	layer3_t *l3 = fi->userdata;

	mISDN_FsmDelTimer(&l3->l3m_timer, 52);
	mISDN_FsmChangeState(fi, ST_L3_LC_REL);
	discard_queue(&l3->squeue);
	l3ml3p(l3, DL_RELEASE | INDICATION);
}
Beispiel #4
0
static void
l2_disconnect(struct FsmInst *fi, int event, void *arg)
{
	struct layer2 *l2 = fi->userdata;
	struct sk_buff *skb = arg;

	skb_queue_purge(&l2->i_queue);
	freewin(l2);
	mISDN_FsmChangeState(fi, ST_L2_6);
	l2->rc = 0;
	send_uframe(l2, NULL, DISC | 0x10, CMD);
	mISDN_FsmDelTimer(&l2->t203, 1);
	restart_t200(l2, 2);
	if (skb)
		dev_kfree_skb(skb);
}
Beispiel #5
0
static void
establishlink(struct FsmInst *fi)
{
	struct layer2 *l2 = fi->userdata;
	u_char cmd;

	clear_exception(l2);
	l2->rc = 0;
	cmd = (test_bit(FLG_MOD128, &l2->flag) ? SABME : SABM) | 0x10;
	send_uframe(l2, NULL, cmd, CMD);
	mISDN_FsmDelTimer(&l2->t203, 1);
	restart_t200(l2, 1);
	test_and_clear_bit(FLG_PEND_REL, &l2->flag);
	freewin(l2);
	mISDN_FsmChangeState(fi, ST_L2_5);
}
Beispiel #6
0
static void
tei_id_chk_req(struct FsmInst *fi, int event, void *arg)
{
	teimgr_t *tm = fi->userdata;
	u_char *dp = arg;
	int tei;

	tei = *(dp+3) >> 1;
	if (tm->debug)
		tm->tei_m.printdebug(fi, "identity check req tei %d", tei);
	if ((tm->l2->tei != -1) && ((tei == GROUP_TEI) || (tei == tm->l2->tei))) {
		mISDN_FsmDelTimer(&tm->t202, 4);
		mISDN_FsmChangeState(&tm->tei_m, ST_TEI_NOP);
		put_tei_msg(tm, ID_CHK_RES, random_ri(), tm->l2->tei);
	}
}
Beispiel #7
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);
}
Beispiel #8
0
static void
lc_connected(struct FsmInst *fi, int event, void *arg)
{
	layer3_t *l3 = fi->userdata;
	struct sk_buff *skb;
	int dequeued = 0;

	mISDN_FsmDelTimer(&l3->l3m_timer, 51);
	mISDN_FsmChangeState(fi, ST_L3_LC_ESTAB);
	while ((skb = skb_dequeue(&l3->squeue))) {
		if (l3down(l3, DL_DATA | REQUEST, l3_newid(l3), skb))
			dev_kfree_skb(skb);
		dequeued++;
	}
	if (list_empty(&l3->plist) &&  dequeued) {
		if (l3->debug)
			l3m_debug(fi, "lc_connected: release link");
		mISDN_FsmEvent(&l3->l3m, EV_RELEASE_REQ, NULL);
	} else
		l3ml3p(l3, DL_ESTABLISH | CONFIRM);
}
Beispiel #9
0
static void
tei_id_remove(struct FsmInst *fi, int event, void *arg)
{
	teimgr_t *tm = fi->userdata;
	u_char *dp = arg;
	struct sk_buff *skb;
	int tei;

	tei = *(dp+3) >> 1;
	if (tm->debug)
		tm->tei_m.printdebug(fi, "identity remove tei %d", tei);
	if ((tm->l2->tei != -1) && ((tei == GROUP_TEI) || (tei == tm->l2->tei))) {
		mISDN_FsmDelTimer(&tm->t202, 5);
		mISDN_FsmChangeState(&tm->tei_m, ST_TEI_NOP);
		skb = create_link_skb(MDL_REMOVE | REQUEST, 0, 0, NULL, 0);
		if (!skb)
			return;
		if (tei_l2(tm->l2, skb))
			dev_kfree_skb(skb);
//		cs->cardmsg(cs, MDL_REMOVE | REQUEST, NULL);
	}
}
Beispiel #10
0
void
release_l3(layer3_t *l3)
{
	l3_process_t *p, *np;

	if (l3->l3m.debug)
		printk(KERN_DEBUG "release_l3(%p) plist(%s) global(%p) dummy(%p)\n",
			l3, list_empty(&l3->plist) ? "no" : "yes", l3->global, l3->dummy);
	list_for_each_entry_safe(p, np, &l3->plist, list)
		release_l3_process(p);
	if (l3->global) {
		StopAllL3Timer(l3->global);
		kfree(l3->global);
		l3->global = NULL;
	}
	if (l3->dummy) {
		StopAllL3Timer(l3->dummy);
		kfree(l3->dummy);
		l3->dummy = NULL;
	}
	mISDN_FsmDelTimer(&l3->l3m_timer, 54);
	discard_queue(&l3->squeue);
}
Beispiel #11
0
static void
tei_id_assign(struct FsmInst *fi, int event, void *arg)
{
	teimgr_t *otm, *tm = fi->userdata;
	struct sk_buff *skb;
	u_char *dp = arg;
	int ri, tei;

	ri = ((unsigned int) *dp++ << 8);
	ri += *dp++;
	dp++;
	tei = *dp >> 1;
	if (tm->debug)
		tm->tei_m.printdebug(fi, "identity assign ri %d tei %d",
			ri, tei);
	if ((otm = findtei(tm, tei))) {	/* same tei is in use */
		if (ri != otm->ri) {
			tm->tei_m.printdebug(fi,
				"possible duplicate assignment tei %d", tei);
			skb = create_link_skb(MDL_ERROR | RESPONSE, 0, 0,
				NULL, 0);
			if (!skb)
				return;
			if (tei_l2(otm->l2, skb))
				dev_kfree_skb(skb);
		}
	} else if (ri == tm->ri) {
		mISDN_FsmDelTimer(&tm->t202, 1);
		mISDN_FsmChangeState(fi, ST_TEI_NOP);
		skb = create_link_skb(MDL_ASSIGN | REQUEST, tei, 0, NULL, 0);
		if (!skb)
			return;
		if (tei_l2(tm->l2, skb))
			dev_kfree_skb(skb);
//		cs->cardmsg(cs, MDL_ASSIGN | REQUEST, NULL);
	}
}
Beispiel #12
0
inline void
stop_t200(struct layer2 *l2, int i)
{
	if (test_and_clear_bit(FLG_T200_RUN, &l2->flag))
		mISDN_FsmDelTimer(&l2->t200, i);
}
Beispiel #13
0
void
release_tei(teimgr_t *tm)
{
	mISDN_FsmDelTimer(&tm->t202, 1);
	kfree(tm);
}