Skip to content

Commit 3712b42

Browse files
author
Karsten Keil
committed
Add layer1 over IP support
Implement a ISDN over IP tunnel to use mISDN hardware on remote locations. Signed-off-by: Karsten Keil <[email protected]>
1 parent af69fb3 commit 3712b42

File tree

5 files changed

+2003
-1
lines changed

5 files changed

+2003
-1
lines changed

drivers/isdn/mISDN/Kconfig

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,22 @@ config MISDN_DSP
2323
and get more informations about this module and it's usage.
2424
If unsure, say 'N'.
2525

26-
source "drivers/isdn/hardware/mISDN/Kconfig"
26+
config MISDN_L1OIP
27+
tristate "ISDN over IP tunnel"
28+
depends on MISDN
29+
help
30+
Enable support for ISDN over IP tunnel.
31+
32+
It features:
33+
- dynamic IP exchange, if one or both peers have dynamic IPs
34+
- BRI (S0) and PRI (S2M) interface
35+
- layer 1 control via network keepalive frames
36+
- direct tunneling of physical interface via IP
37+
38+
NOTE: This protocol is called 'Layer 1 over IP' and is not
39+
compatible with ISDNoIP (Agfeo) or TDMoIP. Protocol description is
40+
provided in the source code.
41+
42+
source "drivers/isdn/hardware/mISDN/Kconfig"
43+
2744
endif #MISDN

drivers/isdn/mISDN/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
obj-$(CONFIG_MISDN) += mISDN_core.o
66
obj-$(CONFIG_MISDN_DSP) += mISDN_dsp.o
7+
obj-$(CONFIG_MISDN_L1OIP) += l1oip.o
78

89
# multi objects
910

1011
mISDN_core-objs := core.o fsm.o socket.o hwchannel.o stack.o layer1.o layer2.o tei.o timerdev.o
1112
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
13+
l1oip-objs := l1oip_core.o l1oip_codec.o

drivers/isdn/mISDN/l1oip.h

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* see notice in l1oip.c
3+
*/
4+
5+
/* debugging */
6+
#define DEBUG_L1OIP_INIT 0x00010000
7+
#define DEBUG_L1OIP_SOCKET 0x00020000
8+
#define DEBUG_L1OIP_MGR 0x00040000
9+
#define DEBUG_L1OIP_MSG 0x00080000
10+
11+
/* enable to disorder received bchannels by sequence 2143658798... */
12+
/*
13+
#define REORDER_DEBUG
14+
*/
15+
16+
/* frames */
17+
#define L1OIP_MAX_LEN 2048 /* max packet size form l2 */
18+
#define L1OIP_MAX_PERFRAME 1400 /* max data size in one frame */
19+
20+
21+
/* timers */
22+
#define L1OIP_KEEPALIVE 15
23+
#define L1OIP_TIMEOUT 65
24+
25+
26+
/* socket */
27+
#define L1OIP_DEFAULTPORT 931
28+
29+
30+
/* channel structure */
31+
struct l1oip_chan {
32+
struct dchannel *dch;
33+
struct bchannel *bch;
34+
u32 tx_counter; /* counts xmit bytes/packets */
35+
u32 rx_counter; /* counts recv bytes/packets */
36+
u32 codecstate; /* used by codec to save data */
37+
#ifdef REORDER_DEBUG
38+
int disorder_flag;
39+
struct sk_buff *disorder_skb;
40+
u32 disorder_cnt;
41+
#endif
42+
};
43+
44+
45+
/* card structure */
46+
struct l1oip {
47+
struct list_head list;
48+
49+
/* card */
50+
int registered; /* if registered with mISDN */
51+
char name[MISDN_MAX_IDLEN];
52+
int idx; /* card index */
53+
int pri; /* 1=pri, 0=bri */
54+
int d_idx; /* current dchannel number */
55+
int b_num; /* number of bchannels */
56+
u32 id; /* id of connection */
57+
int ondemand; /* if transmis. is on demand */
58+
int bundle; /* bundle channels in one frm */
59+
int codec; /* codec to use for transmis. */
60+
int limit; /* limit number of bchannels */
61+
62+
/* timer */
63+
struct timer_list keep_tl;
64+
struct timer_list timeout_tl;
65+
int timeout_on;
66+
struct work_struct workq;
67+
68+
/* socket */
69+
struct socket *socket; /* if set, socket is created */
70+
struct completion socket_complete;/* completion of sock thread */
71+
struct task_struct *socket_thread;
72+
spinlock_t socket_lock; /* access sock outside thread */
73+
u32 remoteip; /* if all set, ip is assigned */
74+
u16 localport; /* must always be set */
75+
u16 remoteport; /* must always be set */
76+
struct sockaddr_in sin_local; /* local socket name */
77+
struct sockaddr_in sin_remote; /* remote socket name */
78+
struct msghdr sendmsg; /* ip message to send */
79+
struct iovec sendiov; /* iov for message */
80+
81+
/* frame */
82+
struct l1oip_chan chan[128]; /* channel instances */
83+
};
84+
85+
extern int l1oip_law_to_4bit(u8 *data, int len, u8 *result, u32 *state);
86+
extern int l1oip_4bit_to_law(u8 *data, int len, u8 *result);
87+
extern int l1oip_alaw_to_ulaw(u8 *data, int len, u8 *result);
88+
extern int l1oip_ulaw_to_alaw(u8 *data, int len, u8 *result);
89+
extern void l1oip_4bit_free(void);
90+
extern int l1oip_4bit_alloc(int ulaw);
91+

0 commit comments

Comments
 (0)