void saal_okay(SIG_ENTITY *sig) { SOCKET *curr; trace_msg("SAAL came up"); #ifdef THOMFLEX /* * Some versions of the Thomson Thomflex 5000 won't do any signaling before * they get a RESTART. Whenever SAAL comes up, this may indicate that the * switch got booted, so we send that RESTART. We also have to clear all * pending connections, which isn't that nice ... Note that the rest of the * RESTART state machine is not implemented, so the RESTART ACKNOWLEDGE * will yield a warning. */ { Q_DSC dsc; int size; clear_all_calls(sig); q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,QMSG_RESTART); q_assign(&dsc,QF_call_ref,0); q_assign(&dsc,QF_rst_class,ATM_RST_ALL_VC); if ((size = q_close(&dsc)) >= 0) to_signaling(sig,q_buffer,size); } #endif if (!t309) return; stop_timer(t309); t309 = NULL; for (curr = sockets; curr; curr = curr->next) if (curr->sig == sig && curr->call_state != cs_null) send_status_enq(curr); }
int send_call_proceeding(SOCKET *sock) { Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_CALL_PROC); q_assign(&dsc,QF_call_ref,sock->call_ref); if (sock->sig->mode == sm_net) { int vpci,vci; sock->pvc.sap_family = AF_ATMPVC; vpci = sock->sig->signaling_pvc.sap_addr.itf; sock->pvc.sap_addr.itf = get_itf(sock->sig,&vpci); sock->pvc.sap_addr.vpi = vpci; vci = get_vci(sock->pvc.sap_addr.itf); if (vci < 0) { (void) q_close(&dsc); return vci; } sock->pvc.sap_addr.vci = vci; } if (sock->sig->mode != sm_user) { q_assign(&dsc,QF_vpi,sock->pvc.sap_addr.vpi); q_assign(&dsc,QF_vci,sock->pvc.sap_addr.vci); } if (sock->ep_ref >= 0) q_assign(&dsc,QF_ep_ref,sock->ep_ref); if ((size = q_close(&dsc)) >= 0) to_signaling(sock->sig,q_buffer,size); return 0; }
static void send_conn_avail(SOCKET *sock) { Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_CONN_AVAIL); q_assign(&dsc,QF_call_ref,sock->call_ref); if ((size = q_close(&dsc)) >= 0) to_signaling(sock->sig,q_buffer,size); }
static void send_status_enq(SOCKET *sock) { Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_STATUS_ENQ); q_assign(&dsc,QF_call_ref,sock->call_ref); if (sock->ep_ref >= 0) q_assign(&dsc,QF_ep_ref,sock->ep_ref); if ((size = q_close(&dsc)) >= 0) to_signaling(sock->sig,q_buffer,size); /* @@@ should start T322 */ }
static void send_drop_party_ack(SIG_ENTITY *sig,unsigned long call_ref, unsigned short ep_ref,unsigned char cause) { Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_DROP_PARTY_ACK); q_assign(&dsc,QF_call_ref,call_ref); q_assign(&dsc,QF_ep_ref,ep_ref); q_assign(&dsc,QF_cause,cause); if ((size = q_close(&dsc)) >= 0) to_signaling(sig,q_buffer,size); }
static void send_restart_ack(SIG_ENTITY *sig,unsigned long call_ref,int vpi, int vci) { Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_REST_ACK); q_assign(&dsc,QF_call_ref,call_ref); if (!vpi && !vci) q_assign(&dsc,QF_rst_class,ATM_RST_ALL_VC); else { q_assign(&dsc,QF_rst_class,ATM_RST_IND_VC); q_assign(&dsc,QF_vpi,vpi); q_assign(&dsc,QF_vci,vci); } if ((size = q_close(&dsc)) >= 0) to_signaling(sig,q_buffer,size); }
static void send_status(SIG_ENTITY *sig,SOCKET *sock,unsigned long call_ref, unsigned char cause,...) { va_list ap; Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_STATUS); if (sock) { q_assign(&dsc,QF_call_ref,sock->call_ref); q_assign(&dsc,QF_call_state,(int) sock->call_state); if (sock->ep_ref >= 0) { q_assign(&dsc,QF_ep_ref,sock->ep_ref); q_assign(&dsc,QF_ep_state,eps_map[sock->call_state]); } } else { q_assign(&dsc,QF_call_ref,call_ref); q_assign(&dsc,QF_call_state,0); /* U0 - Null / REST 0 - Null */ } q_assign(&dsc,QF_cause,cause); va_start(ap,cause); switch (cause) { case ATM_CV_UNKNOWN_MSG_TYPE: case ATM_CV_INCOMP_MSG: q_assign(&dsc,QF_bad_msg_type,va_arg(ap,unsigned int)); break; case ATM_CV_MAND_IE_MISSING: case ATM_CV_INVALID_IE: { unsigned char ie; ie = va_arg(ap,unsigned int); q_write(&dsc,QF_ie_id6,&ie,1); break; } default: ; } va_end(ap); if ((size = q_close(&dsc)) >= 0) to_signaling(sig,q_buffer,size); }
void send_release(SOCKET *sock,unsigned char reason,...) { va_list ap; Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_RELEASE); q_assign(&dsc,QF_call_ref,sock->call_ref); q_assign(&dsc,QF_cause,reason); va_start(ap,reason); switch (reason) { case ATM_CV_TIMER_EXP: { char buf[4]; sprintf(buf,"%d",va_arg(ap,int)); q_write(&dsc,QF_timer,buf,3); break; } default: } va_end(ap); if ((size = q_close(&dsc)) >= 0) to_signaling(sock->sig,q_buffer,size); } void send_release_complete(SIG_ENTITY *sig,unsigned long call_ref, unsigned char cause,...) { va_list ap; Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_REL_COMP); q_assign(&dsc,QF_call_ref,call_ref); if (cause) { q_assign(&dsc,QF_cause,cause); va_start(ap,cause); switch (cause) { case ATM_CV_INVALID_IE: { unsigned char ie; ie = va_arg(ap,int); q_write(&dsc,QF_ie_id6,&ie,1); } break; default: } va_end(ap); } if ((size = q_close(&dsc)) >= 0) to_signaling(sig,q_buffer,size); } void send_modify_reject(SOCKET *sock,unsigned char reason) { Q_DSC dsc; int size; q_create(&dsc,q_buffer,MAX_Q_MSG); q_assign(&dsc,QF_msg_type,ATM_MSG_MODIFY_REJ); q_assign(&dsc,QF_call_ref,sock->call_ref); q_assign(&dsc,QF_cause,reason); if ((size = q_close(&dsc)) >= 0) to_signaling(sock->sig,q_buffer,size); }