- case CC_NOTIFY | INDICATION:
- notify_ind(prim, dinfo, data);
- break;
-
- case CC_HOLD | INDICATION:
- hold_ind(prim, dinfo, data);
- break;
-
- case CC_RETRIEVE | INDICATION:
- retrieve_ind(prim, dinfo, data);
- break;
-
- case CC_SUSPEND | INDICATION:
- suspend_ind(prim, dinfo, data);
- break;
-
- case CC_RESUME | INDICATION:
- resume_ind(prim, dinfo, data);
- break;
-
- case CC_FACILITY | INDICATION:
- facility_ind(prim, dinfo, data);
- break;
-
- case CC_RELEASE_CR | INDICATION:
- l1l2l3_trace_header(p_m_mISDNport, this, L3_RELEASE_CR_IND, DIRECTION_IN);
- add_trace("callref", NULL, "0x%x", p_m_d_l3id);
- end_trace();
- if (p_m_d_ntmode)
- {
- if ((p_m_d_l3id&0xff00) == 0xff00)
- p_m_mISDNport->procids[p_m_d_l3id&0xff] = 0;
- }
- p_m_d_l3id = 0;
- p_m_d_ces = -1;
- p_m_delete = 1;
-//#warning remove me
-//PDEBUG(DEBUG_LOG, "JOLLY release cr %d\n", p_serial);
- /* sending release to endpoint in case we still have an endpoint
- * this is because we don't get any response if a release_complete is received (or a release in release state)
- */
- while(p_epointlist)
- {
- struct lcr_msg *message;
- message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE);
- message->param.disconnectinfo.cause = (p_m_d_collect_cause!=CAUSE_NOUSER)?p_m_d_collect_cause:CAUSE_UNSPECIFIED;
- message->param.disconnectinfo.location = (p_m_d_collect_cause!=CAUSE_NOUSER)?p_m_d_collect_location:LOCATION_PRIVATE_LOCAL;
- message_put(message);
- /* remove epoint */
- free_epointlist(p_epointlist);
-
- new_state(PORT_STATE_RELEASE);
- }
- break;
-
- case CC_NEW_CR | INDICATION:
- l1l2l3_trace_header(p_m_mISDNport, this, L3_NEW_CR_IND, DIRECTION_IN);
- if (p_m_d_l3id)
- add_trace("callref", "old", "0x%x", p_m_d_l3id);
- if (p_m_d_ntmode)
- {
- new_l3id = *((int *)(((u_char *)data+mISDNUSER_HEAD_SIZE)));
- if (((new_l3id&0xff00)!=0xff00) && ((p_m_d_l3id&0xff00)==0xff00))
- p_m_mISDNport->procids[p_m_d_l3id&0xff] = 0;
- } else
- {
- new_l3id = dinfo;
- }
- p_m_d_l3id = new_l3id;
- add_trace("callref", "new", "0x%x", p_m_d_l3id);
- end_trace();
- break;
-
- default:
- l1l2l3_trace_header(p_m_mISDNport, this, L3_UNKNOWN, DIRECTION_IN);
- add_trace("unhandled", "prim", "0x%x", prim);
- end_trace();
- }
-}
-#endif
-
-void Pdss1::new_state(int state)
-{
-// class Endpoint *epoint;
-
- /* set timeout */
- if (state == PORT_STATE_IN_OVERLAP)
- {
- p_m_timeout = p_m_mISDNport->ifport->tout_dialing;
- time(&p_m_timer);
- }
- if (state != p_state)
- {
- if (state == PORT_STATE_IN_SETUP
- || state == PORT_STATE_OUT_SETUP
- || state == PORT_STATE_IN_OVERLAP
- || state == PORT_STATE_OUT_OVERLAP)
- {
- p_m_timeout = p_m_mISDNport->ifport->tout_setup;
- time(&p_m_timer);
- }
- if (state == PORT_STATE_IN_PROCEEDING
- || state == PORT_STATE_OUT_PROCEEDING)
- {
- p_m_timeout = p_m_mISDNport->ifport->tout_proceeding;
- time(&p_m_timer);
- }
- if (state == PORT_STATE_IN_ALERTING
- || state == PORT_STATE_OUT_ALERTING)
- {
- p_m_timeout = p_m_mISDNport->ifport->tout_alerting;
- time(&p_m_timer);
- }
- if (state == PORT_STATE_CONNECT
- || state == PORT_STATE_CONNECT_WAITING)
- {
- p_m_timeout = 0;
- }
- if (state == PORT_STATE_IN_DISCONNECT
- || state == PORT_STATE_OUT_DISCONNECT)
- {
- p_m_timeout = p_m_mISDNport->ifport->tout_disconnect;
- time(&p_m_timer);
- }
- }
-
- Port::new_state(state);
-}
-
-
-/*
- * handler
- */
-int Pdss1::handler(void)
-{
- int ret;
-
- if ((ret = PmISDN::handler()))
- return(ret);
-
- /* handle destruction */
- if (p_m_delete && p_m_d_l3id==0)
- {
- delete this;
- return(-1);
- }
-
- return(0);
-}
-
-
-/*
- * handles all messages from endpoint
- */
-/* MESSAGE_INFORMATION */
-void Pdss1::message_information(unsigned long epoint_id, int message_id, union parameter *param)
-{
-#ifdef SOCKET_MISDN
- l3_msg *l3m;
-#else
- int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- msg_t *dmsg;
- INFORMATION_t *information;
-#endif
-
- if (param->information.id[0]) /* only if we have something to dial */
- {
-#ifdef SOCKET_MISDN
- l3m = create_l3msg();
-#else
- dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
- information = (INFORMATION_t *)(dmsg->data + headerlen);
-#endif
- l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT);
-#ifdef SOCKET_MISDN
- enc_ie_called_pn(l3m, 0, 1, (unsigned char *)param->information.id);
-#else
- enc_ie_called_pn(&information->CALLED_PN, dmsg, 0, 1, (unsigned char *)param->information.id);
-#endif
- end_trace();
-#ifdef SOCKET_MISDN
- p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m);
-#else
- msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
-#endif
- }
- new_state(p_state);
-}
-
-
-int newteid = 0;
-
-/* MESSAGE_SETUP */
-void Pdss1::message_setup(unsigned long epoint_id, int message_id, union parameter *param)
-{
-#ifdef SOCKET_MISDN
- l3_msg *l3m;
- int ret;
-#else
- int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- msg_t *dmsg;
- INFORMATION_t *information;
- SETUP_t *setup;
- int i;
-#endif
- int plan, type, screen, present, reason;
- int capability, mode, rate, coding, user, presentation, interpretation, hlc, exthlc;
- int channel, exclusive;
- struct epoint_list *epointlist;