projects
/
lcr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://schlaile@git.misdn.org/var/git/lcr
[lcr.git]
/
mISDN.cpp
diff --git
a/mISDN.cpp
b/mISDN.cpp
index
98e2c6c
..
3e1d0e4
100644
(file)
--- a/
mISDN.cpp
+++ b/
mISDN.cpp
@@
-64,13
+64,13
@@
int mISDN_initialize(void)
/* open debug, if enabled and not only stack debugging */
if (options.deb)
{
/* open debug, if enabled and not only stack debugging */
if (options.deb)
{
- SPRINT(filename, "%s/debug.log",
INSTALL_DATA
);
+ SPRINT(filename, "%s/debug.log",
LOG_DIR
);
debug_fp = fopen(filename, "a");
}
if (options.deb & DEBUG_STACK)
{
debug_fp = fopen(filename, "a");
}
if (options.deb & DEBUG_STACK)
{
- SPRINT(filename, "%s/debug_mISDN.log",
INSTALL_DATA
);
+ SPRINT(filename, "%s/debug_mISDN.log",
LOG_DIR
);
mISDN_debug_init(0xffffffff, filename, filename, filename);
} else
mISDN_debug_init(0, NULL, NULL, NULL);
mISDN_debug_init(0xffffffff, filename, filename, filename);
} else
mISDN_debug_init(0, NULL, NULL, NULL);
@@
-385,7
+385,7
@@
static int _bchannel_create(struct mISDNport *mISDNport, int i)
mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, (mISDNport->b_mode[i]==B_MODE_HDLC)?ISDN_P_B_L2DSPHDLC:ISDN_P_B_L2DSP);
if (mISDNport->b_socket[i] < 0)
{
mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, (mISDNport->b_mode[i]==B_MODE_HDLC)?ISDN_P_B_L2DSPHDLC:ISDN_P_B_L2DSP);
if (mISDNport->b_socket[i] < 0)
{
- PERROR("Error: Failed to open bchannel-socket for index %d with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", i);
+ PERROR("Error: Failed to open bchannel-socket for index %d with mISDN-DSP layer. Did you load mISDN
_
dsp.ko?\n", i);
return(0);
}
return(0);
}
@@
-406,7
+406,7
@@
static int _bchannel_create(struct mISDNport *mISDNport, int i)
ret = bind(mISDNport->b_socket[i], (struct sockaddr *)&addr, sizeof(addr));
if (ret < 0)
{
ret = bind(mISDNport->b_socket[i], (struct sockaddr *)&addr, sizeof(addr));
if (ret < 0)
{
- PERROR("Error: Failed to bind bchannel-socket for index %d with mISDN-DSP layer
. Did you load mISDNdsp.ko?\n", i
);
+ PERROR("Error: Failed to bind bchannel-socket for index %d with mISDN-DSP layer
(errno=%d). Did you load mISDN_dsp.ko?\n", i, errno
);
close(mISDNport->b_socket[i]);
mISDNport->b_socket[i] = -1;
return(0);
close(mISDNport->b_socket[i]);
mISDNport->b_socket[i] = -1;
return(0);
@@
-1954,15
+1954,21
@@
int mISDN_handler(void)
switch(l3m->type)
{
case MPH_ACTIVATE_IND:
switch(l3m->type)
{
case MPH_ACTIVATE_IND:
- l1l2l3_trace_header(mISDNport, NULL, L1_ACTIVATE_IND, DIRECTION_IN);
- end_trace();
- mISDNport->l1link = 1;
+ if (mISDNport->l1link != 1)
+ {
+ l1l2l3_trace_header(mISDNport, NULL, L1_ACTIVATE_IND, DIRECTION_IN);
+ end_trace();
+ mISDNport->l1link = 1;
+ }
break;
case MPH_DEACTIVATE_IND:
break;
case MPH_DEACTIVATE_IND:
- l1l2l3_trace_header(mISDNport, NULL, L1_DEACTIVATE_IND, DIRECTION_IN);
- end_trace();
- mISDNport->l1link = 0;
+ if (mISDNport->l1link != 0)
+ {
+ l1l2l3_trace_header(mISDNport, NULL, L1_DEACTIVATE_IND, DIRECTION_IN);
+ end_trace();
+ mISDNport->l1link = 0;
+ }
break;
case MPH_INFORMATION_IND:
break;
case MPH_INFORMATION_IND:
@@
-2000,6
+2006,7
@@
int mISDN_handler(void)
l1l2l3_trace_header(mISDNport, NULL, L2_ESTABLISH_IND, DIRECTION_IN);
add_trace("tei", NULL, "%d", l3m->pid);
end_trace();
l1l2l3_trace_header(mISDNport, NULL, L2_ESTABLISH_IND, DIRECTION_IN);
add_trace("tei", NULL, "%d", l3m->pid);
end_trace();
+ mISDNport->l2link = 1;
if ((!mISDNport->ntmode || mISDNport->ptp) && l3m->pid < 127)
{
if (mISDNport->l2establish)
if ((!mISDNport->ntmode || mISDNport->ptp) && l3m->pid < 127)
{
if (mISDNport->l2establish)
@@
-2007,7
+2014,6
@@
int mISDN_handler(void)
mISDNport->l2establish = 0;
PDEBUG(DEBUG_ISDN, "the link became active before l2establish timer expiry.\n");
}
mISDNport->l2establish = 0;
PDEBUG(DEBUG_ISDN, "the link became active before l2establish timer expiry.\n");
}
- mISDNport->l2link = 1;
}
break;
}
break;
@@
-2017,10
+2023,12
@@
int mISDN_handler(void)
l1l2l3_trace_header(mISDNport, NULL, L2_RELEASE_IND, DIRECTION_IN);
add_trace("tei", NULL, "%d", l3m->pid);
end_trace();
l1l2l3_trace_header(mISDNport, NULL, L2_RELEASE_IND, DIRECTION_IN);
add_trace("tei", NULL, "%d", l3m->pid);
end_trace();
+ /* down if not nt-ptmp */
+ if (!mISDNport->ntmode || mISDNport->ptp)
+ mISDNport->l2link = 0;
}
if ((!mISDNport->ntmode || mISDNport->ptp) && l3m->pid < 127)
{
}
if ((!mISDNport->ntmode || mISDNport->ptp) && l3m->pid < 127)
{
- mISDNport->l2link = 0;
if (!mISDNport->l2establish && mISDNport->l2hold)
{
PDEBUG(DEBUG_ISDN, "set timer and establish.\n");
if (!mISDNport->l2establish && mISDNport->l2hold)
{
PDEBUG(DEBUG_ISDN, "set timer and establish.\n");
@@
-2117,7
+2125,7
@@
int do_layer3(struct mlayer3 *ml3, unsigned int cmd, unsigned int pid, struct l3
/*
* global function to add a new card (port)
*/
/*
* global function to add a new card (port)
*/
-struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt, int l2hold, struct interface *interface)
+struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt, int
te_special, int
l2hold, struct interface *interface)
{
int ret;
struct mISDNport *mISDNport, **mISDNportp;
{
int ret;
struct mISDNport *mISDNport, **mISDNportp;
@@
-2160,7
+2168,7
@@
struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
}
if (port == cnt)
{
}
if (port == cnt)
{
- PERROR_RUNTIME("Port name '%s' no
found, use 'isdn
info' tool to list all existing ports.\n", portname);
+ PERROR_RUNTIME("Port name '%s' no
t found, use 'misdn_
info' tool to list all existing ports.\n", portname);
return(NULL);
}
// note: 'port' has still the port number
return(NULL);
}
// note: 'port' has still the port number
@@
-2270,6
+2278,7
@@
struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
mISDNportp = &((*mISDNportp)->next);
mISDNport = (struct mISDNport *)MALLOC(sizeof(struct mISDNport));
mISDNport->l1link = -1;
mISDNportp = &((*mISDNportp)->next);
mISDNport = (struct mISDNport *)MALLOC(sizeof(struct mISDNport));
mISDNport->l1link = -1;
+ mISDNport->l2link = -1;
pmemuse++;
*mISDNportp = mISDNport;
pmemuse++;
*mISDNportp = mISDNport;
@@
-2344,6
+2353,7
@@
struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
mISDNport->b_num = devinfo.nrbchan;
mISDNport->portnum = port;
mISDNport->ntmode = nt;
mISDNport->b_num = devinfo.nrbchan;
mISDNport->portnum = port;
mISDNport->ntmode = nt;
+ mISDNport->tespecial = te_special;
mISDNport->pri = pri;
mISDNport->ptp = ptp;
mISDNport->l2hold = l2hold;
mISDNport->pri = pri;
mISDNport->ptp = ptp;
mISDNport->l2hold = l2hold;
@@
-2366,8
+2376,9
@@
struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
time(&mISDNport->l2establish);
}
time(&mISDNport->l2establish);
}
- /* initially, we assume that the link is down, exept for nt-ptmp */
- mISDNport->l2link = (mISDNport->ntmode && !mISDNport->ptp)?1:0;
+ /* for nt-mode ptmp the link is always up */
+ if (mISDNport->ntmode && !mISDNport->ptp)
+ mISDNport->l2link = 1;
PDEBUG(DEBUG_BCHANNEL, "using 'mISDN_dsp.o' module\n");
PDEBUG(DEBUG_BCHANNEL, "using 'mISDN_dsp.o' module\n");