*/
PmISDN::~PmISDN()
{
- struct message *message;
+ struct lcr_msg *message;
/* remove bchannel relation */
drop_bchannel();
/* init trace with given values */
start_trace(mISDNport?mISDNport->portnum:0,
(mISDNport)?((mISDNport->ifport)?mISDNport->ifport->interface:NULL):NULL,
- port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype):NULL,
+ port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype, options.national, options.international):NULL,
port?port->p_dialinginfo.id:NULL,
direction,
CATEGORY_CH,
/* init trace with given values */
start_trace(mISDNport?mISDNport->portnum:0,
mISDNport?mISDNport->ifport->interface:NULL,
- port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype):NULL,
+ port?numberrize_callerinfo(port->p_callerinfo.id, port->p_callerinfo.ntype, options.national, options.international):NULL,
port?port->p_dialinginfo.id:NULL,
direction,
CATEGORY_CH,
}
/* open socket */
- mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_L2DSP);
+#warning testing without bchannel
+return(0);
+#warning testing without DSP
+ mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_RAW/*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);
*/
int PmISDN::handler(void)
{
- struct message *message;
+ struct lcr_msg *message;
int elapsed = 0;
int ret;
#endif
unsigned char *data_temp;
unsigned long length_temp;
- struct message *message;
+ struct lcr_msg *message;
unsigned char *p;
int l;
/* MESSAGE_mISDNSIGNAL */
-//extern struct message *dddebug;
+//extern struct lcr_msg *dddebug;
void PmISDN::message_mISDNsignal(unsigned long epoint_id, int message_id, union parameter *param)
{
switch(param->mISDNsignal.message)
/* MESSAGE_CRYPT */
void PmISDN::message_crypt(unsigned long epoint_id, int message_id, union parameter *param)
{
- struct message *message;
+ struct lcr_msg *message;
switch(param->crypt.type)
{
l3m = &mb->l3;
switch(l3m->type)
{
-#warning SOCKET TBD: Layer 1 indication
-#if 0
- case MT_L1ACTIVATE:
+ case MPH_ACTIVATE_IND:
l1l2l3_trace_header(mISDNport, NULL, L1_ACTIVATE_IND, DIRECTION_IN);
end_trace();
mISDNport->l1link = 1;
break;
- case MT_L1DEACTIVATE:
+ case MPH_DEACTIVATE_IND:
l1l2l3_trace_header(mISDNport, NULL, L1_DEACTIVATE_IND, DIRECTION_IN);
end_trace();
mISDNport->l1link = 0;
break;
- case MT_L1CONTROL:
- PDEBUG(DEBUG_ISDN, "Received PH_CONTROL for port %d (%s).\n", mISDNport->portnum, mISDNport->ifport->interface->name);
- // special config commands for interface (ip-address/LOS/AIS/RDI/SLIP)
+ case MPH_INFORMATION_IND:
+ PDEBUG(DEBUG_ISDN, "Received MPH_INFORMATION_IND for port %d (%s).\n", mISDNport->portnum, mISDNport->ifport->interface->name);
+ switch (l3m->pid)
+ {
+ case L1_SIGNAL_LOS_ON:
+ mISDNport->los = 1;
+ break;
+ case L1_SIGNAL_LOS_OFF:
+ mISDNport->los = 0;
+ break;
+ case L1_SIGNAL_AIS_ON:
+ mISDNport->ais = 1;
+ break;
+ case L1_SIGNAL_AIS_OFF:
+ mISDNport->ais = 0;
+ break;
+ case L1_SIGNAL_RDI_ON:
+ mISDNport->rdi = 1;
+ break;
+ case L1_SIGNAL_RDI_OFF:
+ mISDNport->rdi = 0;
+ break;
+ case L1_SIGNAL_SLIP_TX:
+ mISDNport->slip_tx++;
+ break;
+ case L1_SIGNAL_SLIP_RX:
+ mISDNport->slip_rx++;
+ break;
+ }
break;
-#endif
case MT_L2ESTABLISH:
l1l2l3_trace_header(mISDNport, NULL, L2_ESTABLISH_IND, DIRECTION_IN);
#ifdef SOCKET_MISDN
devinfo.id = port - 1;
ret = ioctl(mISDNsocket, IMGETDEVINFO, &devinfo);
- if (ret <= 0)
+ if (ret < 0)
{
PERROR_RUNTIME("Cannot get device information for port %d. (ioctl IMGETDEVINFO failed ret=%d)\n", i, ret);
return(NULL);
/* allocate ressources of port */
#ifdef SOCKET_MISDN
- /* open layer 3 */
+ /* open layer 3 and init upqueue */
protocol = (nt)?L3_PROTOCOL_DSS1_USER:L3_PROTOCOL_DSS1_NET;
prop = 0;
if (ptp) // ptp forced
mISDNport->ml3 = open_layer3(port-1, protocol, prop , do_layer3, mISDNport);
if (!mISDNport->ml3)
{
- PERROR_RUNTIME("Cannot get layer(%d) id of port %d\n", nt?2:4, port);
+ PERROR_RUNTIME("oper_layer3() failed for port %d\n", port);
+ mISDNport_close(mISDNport);
return(NULL);
}
+ mqueue_init(&mISDNport->upqueue);
#if 0
/* if ntmode, establish L1 to send the tei removal during start */
}
#endif
-#ifdef SOCKET_MISDN
- /* init stack queue */
- mqueue_init(&mISDNport->upqueue);
-#endif
-
/* initially, we assume that the link is down, exept for nt-ptmp */
mISDNport->l2link = (mISDNport->ntmode && !mISDNport->ptp)?1:0;
}
#ifdef SOCKET_MISDN
- close_layer3(mISDNport->ml3);
- mqueue_purge(&mISDNport->upqueue);
+ /* close layer 3, if open and purge upqueue */
+ if (mISDNport->ml3)
+ {
+ close_layer3(mISDNport->ml3);
+ mqueue_purge(&mISDNport->upqueue);
+ }
#else
/* free ressources of port */
msg_queue_purge(&mISDNport->downqueue);
#ifdef SOCKET_MISDN
devinfo.id = i - 1;
ret = ioctl(sock, IMGETDEVINFO, &devinfo);
- if (ret <= 0)
+ if (ret < 0)
{
fprintf(stderr, "Cannot get device information for port %d. (ioctl IMGETDEVINFO failed ret=%d)\n", i, ret);
break;
if ((te || nt) && (bri || pri || pots))
useable = 1;
- if (te && bri)
- printf("TE-mode BRI S/T interface line (for phone lines)");
- if (nt && bri)
- printf("NT-mode BRI S/T interface port (for phones)");
- if (te && pri)
- printf("TE-mode PRI E1 interface line (for phone lines)");
- if (nt && pri)
- printf("NT-mode PRI E1 interface port (for E1 terminals)");
- if (te && pots)
- printf("FXS POTS interface port (for analog lines)");
- if (nt && pots)
- printf("FXO POTS interface port (for analog phones)");
+ if (te && nt && bri)
+ printf("TE/NT-mode BRI S/T (for phone lines & phones)");
+ if (te && !nt && bri)
+ printf("TE-mode BRI S/T (for phone lines)");
+ if (nt && !te && bri)
+ printf("NT-mode BRI S/T (for phones)");
+ if (te && nt && pri)
+ printf("TE/NT-mode PRI E1 (for phone lines & E1 devices)");
+ if (te && !nt && pri)
+ printf("TE-mode PRI E1 (for phone lines)");
+ if (nt && !te && pri)
+ printf("NT-mode PRI E1 (for E1 devices)");
+ if (te && nt && pots)
+ printf("FXS/FXO POTS (for analog lines & phones)");
+ if (te && !nt && pots)
+ printf("FXS POTS (for analog lines)");
+ if (nt && !te && pots)
+ printf("FXO POTS (for analog phones)");
if (pots)
{
useable = 0;
useable = 1;
nt = 1;
pri = 1;
- printf("NT-mode PRI E1 interface port (for E1 terminals)");
+ printf("NT-mode PRI E1 interface port (for E1 devices)");
break;
default:
useable = 0;
#ifdef SOCKET_MISDN
hh->prim = DL_DATA_REQ;
hh->id = 0;
- memcpy(buf+MISDN_HEADER_LEN, data, ISDN_LOAD);
+ memset(buf+MISDN_HEADER_LEN, (options.law=='a')?0x2a:0xff, ISDN_LOAD);
ret = sendto(p_m_mISDNport->b_socket[p_m_b_index], buf, MISDN_HEADER_LEN+ISDN_LOAD, 0, NULL, 0);
if (!ret)
PERROR("Failed to send to socket %d\n", p_m_mISDNport->b_socket[p_m_b_index]);
frm->addr = p_m_mISDNport->b_addr[p_m_b_index] | FLG_MSG_DOWN;
frm->dinfo = 0;
frm->len = ISDN_LOAD;
- memcpy(buf+mISDN_HEADER_LEN, data, ISDN_LOAD);
+ memset(buf+mISDN_HEADER_LEN, (options.law=='a')?0x2a:0xff, ISDN_LOAD);
mISDN_write(mISDNdevice, frm, mISDN_HEADER_LEN+ISDN_LOAD, TIMEOUT_1SEC);
#endif
p_m_load += ISDN_LOAD;