Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3712b42d authored by Karsten Keil's avatar Karsten Keil
Browse files

Add layer1 over IP support



Implement a ISDN over IP tunnel to use mISDN hardware on
remote locations.

Signed-off-by: default avatarKarsten Keil <kkeil@suse.de>
parent af69fb3a
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -23,5 +23,22 @@ config MISDN_DSP
	  and get more informations about this module and it's usage.
	  If unsure, say 'N'.

config MISDN_L1OIP
	tristate "ISDN over IP tunnel"
	depends on MISDN
	help
	  Enable support for ISDN over IP tunnel.

	  It features:
	    - dynamic IP exchange, if one or both peers have dynamic IPs
	    - BRI (S0) and PRI (S2M) interface
	    - layer 1 control via network keepalive frames
	    - direct tunneling of physical interface via IP

	  NOTE: This protocol is called 'Layer 1 over IP' and is not
	  compatible with ISDNoIP (Agfeo) or TDMoIP. Protocol description is
	  provided in the source code.

source "drivers/isdn/hardware/mISDN/Kconfig"

endif #MISDN
+2 −0
Original line number Diff line number Diff line
@@ -4,8 +4,10 @@

obj-$(CONFIG_MISDN) += mISDN_core.o
obj-$(CONFIG_MISDN_DSP) += mISDN_dsp.o
obj-$(CONFIG_MISDN_L1OIP) += l1oip.o

# multi objects

mISDN_core-objs := core.o fsm.o socket.o hwchannel.o stack.o layer1.o layer2.o tei.o timerdev.o
mISDN_dsp-objs := dsp_core.o dsp_cmx.o dsp_tones.o dsp_dtmf.o dsp_audio.o dsp_blowfish.o dsp_pipeline.o dsp_hwec.o
l1oip-objs := l1oip_core.o l1oip_codec.o
+91 −0
Original line number Diff line number Diff line
/*
 * see notice in l1oip.c
 */

/* debugging */
#define DEBUG_L1OIP_INIT	0x00010000
#define DEBUG_L1OIP_SOCKET	0x00020000
#define DEBUG_L1OIP_MGR		0x00040000
#define DEBUG_L1OIP_MSG		0x00080000

/* enable to disorder received bchannels by sequence 2143658798... */
/*
#define REORDER_DEBUG
*/

/* frames */
#define L1OIP_MAX_LEN		2048		/* max packet size form l2 */
#define L1OIP_MAX_PERFRAME	1400		/* max data size in one frame */


/* timers */
#define L1OIP_KEEPALIVE		15
#define L1OIP_TIMEOUT		65


/* socket */
#define L1OIP_DEFAULTPORT	931


/* channel structure */
struct l1oip_chan {
	struct dchannel       	*dch;
	struct bchannel       	*bch;
	u32			tx_counter;	/* counts xmit bytes/packets */
	u32			rx_counter;	/* counts recv bytes/packets */
	u32			codecstate;	/* used by codec to save data */
#ifdef REORDER_DEBUG
	int			disorder_flag;
	struct sk_buff		*disorder_skb;
	u32			disorder_cnt;
#endif
};


/* card structure */
struct l1oip {
	struct list_head        list;

	/* card */
	int			registered;	/* if registered with mISDN */
	char			name[MISDN_MAX_IDLEN];
	int			idx;		/* card index */
	int			pri;		/* 1=pri, 0=bri */
	int			d_idx;		/* current dchannel number */
	int			b_num;		/* number of bchannels */
	u32			id;		/* id of connection */
	int			ondemand;	/* if transmis. is on demand */
	int			bundle;		/* bundle channels in one frm */
	int			codec;		/* codec to use for transmis. */
	int			limit;		/* limit number of bchannels */

	/* timer */
	struct timer_list 	keep_tl;
	struct timer_list 	timeout_tl;
	int			timeout_on;
	struct work_struct	workq;

	/* socket */
	struct socket 		*socket;	/* if set, socket is created */
	struct completion 	socket_complete;/* completion of sock thread */
	struct task_struct	*socket_thread;
	spinlock_t 		socket_lock;	/* access sock outside thread */
	u32			remoteip;	/* if all set, ip is assigned */
	u16	 		localport;	/* must always be set */
	u16	 		remoteport;	/* must always be set */
	struct sockaddr_in	sin_local;	/* local socket name */
	struct sockaddr_in	sin_remote;	/* remote socket name */
	struct msghdr		sendmsg;	/* ip message to send */
	struct iovec		sendiov;	/* iov for message */

	/* frame */
	struct l1oip_chan	chan[128];	/* channel instances */
};

extern int l1oip_law_to_4bit(u8 *data, int len, u8 *result, u32 *state);
extern int l1oip_4bit_to_law(u8 *data, int len, u8 *result);
extern int l1oip_alaw_to_ulaw(u8 *data, int len, u8 *result);
extern int l1oip_ulaw_to_alaw(u8 *data, int len, u8 *result);
extern void l1oip_4bit_free(void);
extern int l1oip_4bit_alloc(int ulaw);
+374 −0
Original line number Diff line number Diff line
/*

 * l1oip_codec.c  generic codec using lookup table
 *  -> conversion from a-Law to u-Law
 *  -> conversion from u-Law to a-Law
 *  -> compression by reducing the number of sample resolution to 4
 *
 * NOTE: It is not compatible with any standard codec like ADPCM.
 *
 * Author	Andreas Eversberg (jolly@eversberg.eu)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

 */

/*

How the codec works:
--------------------

The volume is increased to increase the dynamic range of the audio signal.
Each sample is converted to a-LAW with only 16 steps of level resolution.
A pair of two samples are stored in one byte.

The first byte is stored in the upper bits, the second byte is stored in the
lower bits.

To speed up compression and decompression, two lookup tables are formed:

- 16 bits index for two samples (law encoded) with 8 bit compressed result.
- 8 bits index for one compressed data with 16 bits decompressed result.

NOTE: The bytes are handled as they are law-encoded.

*/

#include <linux/vmalloc.h>
#include <linux/mISDNif.h>
#include "core.h"

/* definitions of codec. don't use calculations, code may run slower. */

static u8 *table_com;
static u16 *table_dec;


/* alaw -> ulaw */
static u8 alaw_to_ulaw[256] =
{
	0xab, 0x2b, 0xe3, 0x63, 0x8b, 0x0b, 0xc9, 0x49,
	0xba, 0x3a, 0xf6, 0x76, 0x9b, 0x1b, 0xd7, 0x57,
	0xa3, 0x23, 0xdd, 0x5d, 0x83, 0x03, 0xc1, 0x41,
	0xb2, 0x32, 0xeb, 0x6b, 0x93, 0x13, 0xcf, 0x4f,
	0xaf, 0x2f, 0xe7, 0x67, 0x8f, 0x0f, 0xcd, 0x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x44, 0xc4, 0x04, 0x84, 0x64, 0xe4, 0x24,
	0xa4, 0x5c, 0xdc, 0x1c, 0x9c, 0x7c, 0xfc, 0x3c,
	0xbc, 0x4c, 0xcc, 0x0c, 0x8c, 0x6c, 0xec, 0x2c,
	0xac, 0x50, 0xd0, 0x10, 0x90, 0x70, 0xf0, 0x30,
	0xb0, 0x40, 0xc0, 0x00, 0x80, 0x60, 0xe0, 0x20,
	0x58, 0xd8, 0x18, 0x98, 0x78, 0xf8, 0x38, 0xb8,
	0x48, 0xc8, 0x08, 0x88, 0x68, 0xe8, 0x28, 0xa8,
	0xd6, 0x16, 0x96, 0x76, 0xf6, 0x36, 0xb6, 0x46,
	0xc6, 0x06, 0x86, 0x66, 0xe6, 0x26, 0xa6, 0xde,
	0x9e, 0x7e, 0xfe, 0x3e, 0xbe, 0x4e, 0xce, 0x0e,
	0x8e, 0x6e, 0xee, 0x2e, 0x52, 0x12, 0x72, 0x32,
	0xb2, 0x42, 0xc2, 0x02, 0x82, 0x62, 0xe2, 0x22,
	0xa2, 0x5a, 0xda, 0x1a, 0x9a, 0x7a, 0xfa, 0x3a,
	0xba, 0xba, 0x4a, 0x4a, 0xca, 0xca, 0x0a, 0x0a,
	0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a
};

/* alaw -> 4bit compression */
static u8 alaw_to_4bit[256] = {
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0d, 0x02,
	0x0e, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x01, 0x0a, 0x05,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x08, 0x07, 0x0f, 0x00, 0x0b, 0x04,
	0x0e, 0x01, 0x0a, 0x05, 0x0f, 0x00, 0x0c, 0x03,
	0x0d, 0x02, 0x09, 0x06, 0x0f, 0x00, 0x0b, 0x04,
};

/* 4bit -> alaw decompression */
static u8 _4bit_to_alaw[16] = {
	0x5d, 0x51, 0xd9, 0xd7, 0x5f, 0x53, 0xa3, 0x4b,
	0x2a, 0x3a, 0x22, 0x2e, 0x26, 0x56, 0x20, 0x2c,
};

/* ulaw -> 4bit compression */
static u8 ulaw_to_4bit[256] = {
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
	0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
	0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04,
	0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
	0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05,
	0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
	0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
	0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08,
	0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
	0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
	0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
	0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
	0x0f, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
	0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e,
	0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
	0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
	0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
	0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b,
	0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
	0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a,
	0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
	0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
	0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
	0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
};

/* 4bit -> ulaw decompression */
static u8 _4bit_to_ulaw[16] = {
	0x11, 0x21, 0x31, 0x40, 0x4e, 0x5c, 0x68, 0x71,
	0xfe, 0xef, 0xe7, 0xdb, 0xcd, 0xbf, 0xaf, 0x9f,
};


/*
 * Compresses data to the result buffer
 * The result size must be at least half of the input buffer.
 * The number of samples also must be even!
 */
int
l1oip_law_to_4bit(u8 *data, int len, u8 *result, u32 *state)
{
	int ii, i = 0, o = 0;

	if (!len)
		return 0;

	/* send saved byte and first input byte */
	if (*state) {
		*result++ = table_com[(((*state)<<8)&0xff00) | (*data++)];
		len--;
		o++;
	}

	ii = len >> 1;

	while (i < ii) {
		*result++ = table_com[(data[0]<<8) | (data[1])];
		data += 2;
		i++;
		o++;
	}

	/* if len has an odd number, we save byte for next call */
	if (len & 1)
		*state = 0x100 + *data;
	else
		*state = 0;

	return o;
}

/* Decompress data to the result buffer
 * The result size must be the number of sample in packet. (2 * input data)
 * The number of samples in the result are even!
 */
int
l1oip_4bit_to_law(u8 *data, int len, u8 *result)
{
	int i = 0;
	u16 r;

	while (i < len) {
		r = table_dec[*data++];
		*result++ = r>>8;
		*result++ = r;
		i++;
	}

	return len << 1;
}


/*
 * law conversion
 */
int
l1oip_alaw_to_ulaw(u8 *data, int len, u8 *result)
{
	int i = 0;

	while (i < len) {
		*result++ = alaw_to_ulaw[*data++];
		i++;
	}

	return len;
}

int
l1oip_ulaw_to_alaw(u8 *data, int len, u8 *result)
{
	int i = 0;

	while (i < len) {
		*result++ = ulaw_to_alaw[*data++];
		i++;
	}

	return len;
}


/*
 * generate/free compression and decompression table
 */
void
l1oip_4bit_free(void)
{
	if (table_dec)
		vfree(table_dec);
	if (table_com)
		vfree(table_com);
	table_com = NULL;
	table_dec = NULL;
}

int
l1oip_4bit_alloc(int ulaw)
{
	int i1, i2, c, sample;

	/* in case, it is called again */
	if (table_dec)
		return 0;

	/* alloc conversion tables */
	table_com = vmalloc(65536);
	table_dec = vmalloc(512);
	if (!table_com | !table_dec) {
		l1oip_4bit_free();
		return -ENOMEM;
	}
	memset(table_com, 0, 65536);
	memset(table_dec, 0, 512);
	/* generate compression table */
	i1 = 0;
	while (i1 < 256) {
		if (ulaw)
			c = ulaw_to_4bit[i1];
		else
			c = alaw_to_4bit[i1];
		i2 = 0;
		while (i2 < 256) {
			table_com[(i1<<8) | i2] |= (c<<4);
			table_com[(i2<<8) | i1] |= c;
			i2++;
		}
		i1++;
	}

	/* generate decompression table */
	i1 = 0;
	while (i1 < 16) {
		if (ulaw)
			sample = _4bit_to_ulaw[i1];
		else
			sample = _4bit_to_alaw[i1];
		i2 = 0;
		while (i2 < 16) {
			table_dec[(i1<<4) | i2] |= (sample<<8);
			table_dec[(i2<<4) | i1] |= sample;
			i2++;
		}
		i1++;
	}

	return 0;
}

+1518 −0

File added.

Preview size limit exceeded, changes collapsed.