예제 #1
0
파일: l3_1tr6.c 프로젝트: rohsaini/mkunity
static void
l3_1tr6_setup_req(struct PStack *st, u_char pr, void *arg)
{
	struct sk_buff *skb;
	u_char tmp[128];
	u_char *p = tmp;
	u_char *teln;
	u_char *eaz;
	u_char channel = 0;
	int l;


	st->l3.callref = st->pa->callref;
	MsgHead(p, st->l3.callref, MT_N1_SETUP, PROTO_DIS_N1);

	teln = st->pa->setup.phone;
	st->pa->spv = 0;
	if (!isdigit(*teln)) {
		switch (0x5f & *teln) {
			case 'S':
				st->pa->spv = 1;
				break;
			case 'C':
				channel = 0x08;
			case 'P':
				channel |= 0x80;
				teln++;
				if (*teln == '1')
					channel |= 0x01;
				else
					channel |= 0x02;
				break;
			default:
				if (st->l3.debug & L3_DEB_WARN)
					l3_debug(st, "Wrong MSN Code");
				break;
		}
		teln++;
	}
	if (channel) {
		*p++ = 0x18;	/* channel indicator */
		*p++ = 1;
		*p++ = channel;
	}
	if (st->pa->spv) {	/* SPV ? */
		/* NSF SPV */
		*p++ = WE0_netSpecFac;
		*p++ = 4;	/* Laenge */
		*p++ = 0;
		*p++ = FAC_SPV;	/* SPV */
		*p++ = st->pa->setup.si1;	/* 0 for all Services */
		*p++ = st->pa->setup.si2;	/* 0 for all Services */
		*p++ = WE0_netSpecFac;
		*p++ = 4;	/* Laenge */
		*p++ = 0;
		*p++ = FAC_Activate;	/* aktiviere SPV (default) */
		*p++ = st->pa->setup.si1;	/* 0 for all Services */
		*p++ = st->pa->setup.si2;	/* 0 for all Services */
	}
	eaz = st->pa->setup.eazmsn;
	if (*eaz) {
		*p++ = WE0_origAddr;
		*p++ = strlen(eaz) + 1;
		/* Classify as AnyPref. */
		*p++ = 0x81;	/* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
		while (*eaz)
			*p++ = *eaz++ & 0x7f;
	}
	*p++ = WE0_destAddr;
	*p++ = strlen(teln) + 1;
	/* Classify as AnyPref. */
	*p++ = 0x81;		/* Ext = '1'B, Type = '000'B, Plan = '0001'B. */
	while (*teln)
		*p++ = *teln++ & 0x7f;

	*p++ = WE_Shift_F6;
	/* Codesatz 6 fuer Service */
	*p++ = WE6_serviceInd;
	*p++ = 2;		/* len=2 info,info2 */
	*p++ = st->pa->setup.si1;
	*p++ = st->pa->setup.si2;

	l = p - tmp;
	if (!(skb = l3_alloc_skb(l)))
		return;
	memcpy(skb_put(skb, l), tmp, l);
	L3DelTimer(&st->l3.timer);
	L3AddTimer(&st->l3.timer, st->l3.t303, CC_T303);
	newl3state(st, 1);
	st->l3.l3l2(st, DL_DATA, skb);

}
예제 #2
0
static void
l3_1tr6_setup_req(struct l3_process *pc, u_char pr, void *arg)
{
	struct sk_buff *skb;
	u_char tmp[128];
	u_char *p = tmp;
	u_char *teln;
	u_char *eaz;
	u_char channel = 0;
	int l;

	MsgHead(p, pc->callref, MT_N1_SETUP, PROTO_DIS_N1);
	teln = pc->para.setup.phone;
	pc->para.spv = 0;
	if (!isdigit(*teln)) {
		switch (0x5f & *teln) {
		case 'S':
			pc->para.spv = 1;
			break;
		case 'C':
			channel = 0x08;
		case 'P':
			channel |= 0x80;
			teln++;
			if (*teln == '1')
				channel |= 0x01;
			else
				channel |= 0x02;
			break;
		default:
			if (pc->st->l3.debug & L3_DEB_WARN)
				l3_debug(pc->st, "Wrong MSN Code");
			break;
		}
		teln++;
	}
	if (channel) {
		*p++ = 0x18;	
		*p++ = 1;
		*p++ = channel;
	}
	if (pc->para.spv) {	
		
		*p++ = WE0_netSpecFac;
		*p++ = 4;	
		*p++ = 0;
		*p++ = FAC_SPV;	
		*p++ = pc->para.setup.si1;	
		*p++ = pc->para.setup.si2;	
		*p++ = WE0_netSpecFac;
		*p++ = 4;	
		*p++ = 0;
		*p++ = FAC_Activate;	
		*p++ = pc->para.setup.si1;	
		*p++ = pc->para.setup.si2;	
	}
	eaz = pc->para.setup.eazmsn;
	if (*eaz) {
		*p++ = WE0_origAddr;
		*p++ = strlen(eaz) + 1;
		
		*p++ = 0x81;	
		while (*eaz)
			*p++ = *eaz++ & 0x7f;
	}
	*p++ = WE0_destAddr;
	*p++ = strlen(teln) + 1;
	
	*p++ = 0x81;		
	while (*teln)
		*p++ = *teln++ & 0x7f;

	*p++ = WE_Shift_F6;
	
	*p++ = WE6_serviceInd;
	*p++ = 2;		
	*p++ = pc->para.setup.si1;
	*p++ = pc->para.setup.si2;

	l = p - tmp;
	if (!(skb = l3_alloc_skb(l)))
		return;
	memcpy(skb_put(skb, l), tmp, l);
	L3DelTimer(&pc->timer);
	L3AddTimer(&pc->timer, T303, CC_T303);
	newl3state(pc, 1);
	l3_msg(pc->st, DL_DATA | REQUEST, skb);
}