static void
no_l3_proto(struct PStack *st, int pr, void *arg)
{
	struct sk_buff *skb = arg;

	HiSax_putstatus(st->l1.hardware, "L3", "no D protocol");
	if (skb) {
		dev_kfree_skb(skb);
	}
}
Example #2
0
void
LogFrame(struct IsdnCardState *cs, u_char * buf, int size)
{
	char *dp;

	if (size < 1)
		return;
	dp = cs->dlog;
	if (size < MAX_DLOG_SPACE / 3 - 10) {
		*dp++ = 'H';
		*dp++ = 'E';
		*dp++ = 'X';
		*dp++ = ':';
		dp += QuickHex(dp, buf, size);
		dp--;
		*dp++ = '\n';
		*dp = 0;
		HiSax_putstatus(cs, NULL, cs->dlog);
	} else
		HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);
}
static void
hisax_manager(struct PStack *st, int pr, void *arg)
{
	long Code;

	switch (pr) {
		case (MDL_ERROR | INDICATION):
			Code = (long) arg;
			HiSax_putstatus(st->l1.hardware, "manager: MDL_ERROR",
				" %c %s", (char)Code, 
				test_bit(FLG_LAPD, &st->l2.flag) ?
				"D-channel" : "B-channel");
			if (test_bit(FLG_LAPD, &st->l2.flag))
				error_handling_dchan(st, Code);
			break;
	}
}
Example #4
0
void
dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir)
{
	u_char *bend, *buf;
	char *dp;
	unsigned char pd, cr_l, cr, mt;
	unsigned char sapi, tei, ftyp;
	int i, cset = 0, cs_old = 0, cs_fest = 0;
	int size, finish = 0;

	if (skb->len < 3)
		return;
	/* display header */
	dp = cs->dlog;
	dp += jiftime(dp, jiffies);
	*dp++ = ' ';
	sapi = skb->data[0] >> 2;
	tei  = skb->data[1] >> 1;
	ftyp = skb->data[2];
	buf = skb->data;
	dp += sprintf(dp, "frame %s ", dir ? "network->user" : "user->network");
	size = skb->len;
	
	if (tei == GROUP_TEI) {
		if (sapi == CTRL_SAPI) { /* sapi 0 */
			if (ftyp == 3) {
				dp += sprintf(dp, "broadcast\n");
				buf += 3;
				size -= 3;
			} else {
				dp += sprintf(dp, "no UI broadcast\n");
				finish = 1;
			}
		} else if (sapi == TEI_SAPI) {
			dp += sprintf(dp, "tei management\n");
			finish = 1;
		} else {
			dp += sprintf(dp, "unknown sapi %d broadcast\n", sapi);
			finish = 1;
		}
	} else {
		if (sapi == CTRL_SAPI) {
			if (!(ftyp & 1)) { /* IFrame */
				dp += sprintf(dp, "with tei %d\n", tei);
				buf += 4;
				size -= 4;
			} else {
				dp += sprintf(dp, "SFrame with tei %d\n", tei);
				finish = 1;
			}
		} else {
			dp += sprintf(dp, "unknown sapi %d tei %d\n", sapi, tei);
			finish = 1;
		}
	}
	bend = skb->data + skb->len;
	if (buf >= bend) {
		dp += sprintf(dp, "frame too short\n");
		finish = 1;
	}
	if (finish) {
		*dp = 0;
		HiSax_putstatus(cs, NULL, cs->dlog);
		return;
	}
	if ((0xfe & buf[0]) == PROTO_DIS_N0) {	/* 1TR6 */
		/* locate message type */
		pd = *buf++;
		cr_l = *buf++;
		if (cr_l)
			cr = *buf++;
		else
			cr = 0;
		mt = *buf++;
		if (pd == PROTO_DIS_N0) {	/* N0 */
			for (i = 0; i < MT_N0_LEN; i++)
				if (mt_n0[i].nr == mt)
					break;
			/* display message type if it exists */
			if (i == MT_N0_LEN)
				dp += sprintf(dp, "callref %d %s size %d unknown message type N0 %x!\n",
					      cr & 0x7f, (cr & 0x80) ? "called" : "caller",
					      size, mt);
			else
				dp += sprintf(dp, "callref %d %s size %d message type %s\n",
					      cr & 0x7f, (cr & 0x80) ? "called" : "caller",
					      size, mt_n0[i].descr);
		} else {	/* N1 */
			for (i = 0; i < MT_N1_LEN; i++)
				if (mt_n1[i].nr == mt)
					break;
			/* display message type if it exists */
			if (i == MT_N1_LEN)
				dp += sprintf(dp, "callref %d %s size %d unknown message type N1 %x!\n",
					      cr & 0x7f, (cr & 0x80) ? "called" : "caller",
					      size, mt);
			else
				dp += sprintf(dp, "callref %d %s size %d message type %s\n",
					      cr & 0x7f, (cr & 0x80) ? "called" : "caller",
					      size, mt_n1[i].descr);
		}

		/* display each information element */
		while (buf < bend) {
			/* Is it a single octet information element? */
			if (*buf & 0x80) {
				switch ((*buf >> 4) & 7) {
					case 1:
						dp += sprintf(dp, "  Shift %x\n", *buf & 0xf);
						cs_old = cset;
						cset = *buf & 7;
						cs_fest = *buf & 8;
						break;
					case 3:
						dp += sprintf(dp, "  Congestion level %x\n", *buf & 0xf);
						break;
					case 2:
						if (*buf == 0xa0) {
							dp += sprintf(dp, "  More data\n");
							break;
						}
						if (*buf == 0xa1) {
							dp += sprintf(dp, "  Sending complete\n");
						}
						break;
						/* fall through */
					default:
						dp += sprintf(dp, "  Reserved %x\n", *buf);
						break;
				}
				buf++;
				continue;
			}
			/* No, locate it in the table */
			if (cset == 0) {
				for (i = 0; i < WE_0_LEN; i++)
					if (*buf == we_0[i].nr)
						break;

				/* When found, give appropriate msg */
				if (i != WE_0_LEN) {
					dp += sprintf(dp, "  %s\n", we_0[i].descr);
					dp += we_0[i].f(dp, buf);
				} else
					dp += sprintf(dp, "  Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
			} else if (cset == 6) {
				for (i = 0; i < WE_6_LEN; i++)
					if (*buf == we_6[i].nr)
						break;

				/* When found, give appropriate msg */
				if (i != WE_6_LEN) {
					dp += sprintf(dp, "  %s\n", we_6[i].descr);
					dp += we_6[i].f(dp, buf);
				} else
					dp += sprintf(dp, "  Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
			} else
				dp += sprintf(dp, "  Unknown Codeset %d attribute %x attribute size %d\n", cset, *buf, buf[1]);
			/* Skip to next element */
			if (cs_fest == 8) {
				cset = cs_old;
				cs_old = 0;
				cs_fest = 0;
			}
			buf += buf[1] + 2;
		}
	} else if ((buf[0] == 8) && (cs->protocol == ISDN_PTYPE_NI1)) {	/* NI-1 */