📄 sl_sm.h
字号:
return; case SS7_PVAR_ANSI_92: sl->statem.remote_processor_outage = 1; sl_l3_remote_processor_outage(sl); return; default: /* * A deviation from the SDLs has been * placed here to limit the number of * remote processor outage * indications which are delivered to * L3. One indication is sufficient. */ if ( !sl->statem.remote_processor_outage ) { sl->statem.remote_processor_outage = 1; sl_l3_remote_processor_outage(sl); } return; } }}static void sl_t2_timeout(sl_t *sl) { if ( sl->statem.iac_state == SL_STATE_NOT_ALIGNED ) { sl_lsc_alignment_not_possible(sl); sl->statem.emergency = 0; sl->statem.iac_state = SL_STATE_IDLE; }}static void sl_t1_timeout(sl_t *sl) { sl->statem.failure_reason = SL_FAIL_T1_TIMEOUT; sl_l3_out_of_service(sl, sl->statem.failure_reason); sl_rc_stop(sl); sl->dcalls->suerm_stop(sl); sl_txc_send_sios(sl); sl->statem.emergency = 0; if ( sl->statem.lsc_state == SL_STATE_ALIGNED_NOT_READY ) { sl_poc_stop(sl); /* ok if ANSI */ sl->statem.local_processor_outage = 0; } sl->statem.lsc_state = SL_STATE_OUT_OF_SERVICE;}static inline void sl_poc_local_processor_outage(sl_t* sl){ switch ( sl->statem.poc_state ) { case SL_STATE_IDLE: sl->statem.poc_state = SL_STATE_LOCAL_PROCESSOR_OUTAGE; return; case SL_STATE_REMOTE_PROCESSOR_OUTAGE: sl->statem.poc_state = SL_STATE_BOTH_PROCESSORS_OUT; return; }}static inline void sl_lsc_alignment_complete(sl_t *sl) { if ( sl->statem.lsc_state == SL_STATE_INITIAL_ALIGNMENT ) { sl->dcalls->suerm_start(sl); sl_timer_start(t1); if ( sl->statem.local_processor_outage ) { if ( sl->option.pvar != SS7_PVAR_ANSI_92 ) sl_poc_local_processor_outage(sl); sl_txc_send_sipo(sl); if ( sl->option.pvar != SS7_PVAR_ITUT_93 ) /* possible error */ sl_rc_reject_msu_fisu(sl); sl->statem.lsc_state = SL_STATE_ALIGNED_NOT_READY; } else { sl_txc_send_msu(sl); /* changed from send_fisu for Q.781 */ sl_rc_accept_msu_fisu(sl); /* error in ANSI spec? */ sl->statem.lsc_state = SL_STATE_ALIGNED_READY; } }}static void sl_t4_timeout(sl_t *sl) { if ( sl->statem.iac_state == SL_STATE_PROVING ) { if ( sl->statem.further_proving ) { sl->dcalls->aerm_start(sl); sl->statem.further_proving = 0; sl_timer_start_t4(t4v); } else { sl_lsc_alignment_complete(sl); sl->dcalls->aerm_stop(sl); sl->statem.emergency = 0; sl->statem.iac_state = SL_STATE_IDLE; } }}static inline void sl_lsc_sin(sl_t *sl) { switch ( sl->statem.lsc_state ) { case SL_STATE_IN_SERVICE: sl->statem.failure_reason = SL_FAIL_RECEIVED_SIN; sl_l3_out_of_service(sl, sl->statem.failure_reason); sl->dcalls->suerm_stop(sl); sl_rc_stop(sl); sl_txc_send_sios(sl); sl->statem.emergency = 0; sl->statem.lsc_state = SL_STATE_OUT_OF_SERVICE; return; case SL_STATE_PROCESSOR_OUTAGE: sl->statem.failure_reason = SL_FAIL_RECEIVED_SIN; sl_l3_out_of_service(sl, sl->statem.failure_reason); sl->dcalls->suerm_stop(sl); sl_rc_stop(sl); sl_poc_stop(sl); /* ok if not ITUT */ sl_txc_send_sios(sl); sl->statem.emergency = 0; sl->statem.local_processor_outage = 0; sl->statem.remote_processor_outage = 0; /* ok if not ANSI */ sl->statem.lsc_state = SL_STATE_OUT_OF_SERVICE; return; }}static inline void sl_iac_sin(sl_t *sl) { switch ( sl->statem.iac_state ) { case SL_STATE_NOT_ALIGNED: sl_timer_stop(t2); if ( sl->statem.emergency ) { sl->statem.t4v = sl->config.t4e; sl_txc_send_sie(sl); } else { sl->statem.t4v = sl->config.t4n; sl_txc_send_sin(sl); } sl_timer_start(t3); sl->statem.iac_state = SL_STATE_ALIGNED; return; case SL_STATE_ALIGNED: sl_timer_stop(t3); if ( sl->statem.t4v == sl->config.t4e ) sl->dcalls->aerm_set_tie(sl); sl->dcalls->aerm_start(sl); sl_timer_start_t4(t4v); sl->statem.Cp = 0; sl->statem.further_proving = 0; sl->statem.iac_state = SL_STATE_PROVING; return; }}static inline void sl_lsc_sie(sl_t *sl) { switch ( sl->statem.lsc_state ) { case SL_STATE_IN_SERVICE : sl->statem.failure_reason = SL_FAIL_RECEIVED_SIE; sl_l3_out_of_service(sl, sl->statem.failure_reason); sl->dcalls->suerm_stop(sl); sl_rc_stop(sl); sl_txc_send_sios(sl); sl->statem.emergency = 0; sl->statem.lsc_state = SL_STATE_OUT_OF_SERVICE; return; case SL_STATE_PROCESSOR_OUTAGE : sl->statem.failure_reason = SL_FAIL_RECEIVED_SIE; sl_l3_out_of_service(sl, sl->statem.failure_reason); sl->dcalls->suerm_stop(sl); sl_rc_stop(sl); sl_poc_stop(sl); /* ok if not ITUT */ sl_txc_send_sios(sl); sl->statem.emergency = 0; sl->statem.local_processor_outage = 0; sl->statem.remote_processor_outage = 0; /* ok if not ANSI */ sl->statem.lsc_state = SL_STATE_OUT_OF_SERVICE; return; }}static inline void sl_iac_sie(sl_t *sl) { switch ( sl->statem.iac_state ) { case SL_STATE_NOT_ALIGNED: sl_timer_stop(t2); if ( sl->statem.emergency ) { sl->statem.t4v = sl->config.t4e; sl_txc_send_sie(sl); } else { sl->statem.t4v = sl->config.t4e; /* yes e */ sl_txc_send_sin(sl); } sl_timer_start(t3); sl->statem.iac_state = SL_STATE_ALIGNED; return; case SL_STATE_ALIGNED: sl->statem.t4v = sl->config.t4e; sl_timer_stop(t3); sl->dcalls->aerm_set_tie(sl); sl->dcalls->aerm_start(sl); sl_timer_start_t4(t4v); sl->statem.Cp = 0; sl->statem.further_proving = 0; sl->statem.iac_state = SL_STATE_PROVING; return; case SL_STATE_PROVING: if ( sl->statem.t4v == sl->config.t4e ) return; sl_timer_stop(t4); sl->statem.t4v = sl->config.t4e; sl->dcalls->aerm_stop(sl); sl->dcalls->aerm_set_tie(sl); sl->dcalls->aerm_start(sl); sl->statem.further_proving = 0; sl_timer_start_t4(t4v); return; }}static inline void sl_rc_signal_unit(sl_t *sl, mblk_t *mp) { int pcr = sl->option.popt & SS7_POPT_PCR; if ( sl->statem.rc_state != SL_STATE_IN_SERVICE ) { freemsg(mp); return; } /* * Note: the driver must check that the length of the frame is within * appropriate bounds as specified by the DAEDR in Q.703. If the * length of the frame is incorrect, it should indicate daedr_error- * _frame rather than daedr_received_frame. */ if ( sl->option.popt & SS7_POPT_XSN ) { sl->statem.rx.R.bsn = ntohs(*((sl_ushort *)mp->b_rptr) ) & 0x0fff; sl->statem.rx.R.bib = ntohs(*((sl_ushort *)mp->b_rptr)++) & 0x8000; sl->statem.rx.R.fsn = ntohs(*((sl_ushort *)mp->b_rptr) ) & 0x0fff; sl->statem.rx.R.fib = ntohs(*((sl_ushort *)mp->b_rptr)++) & 0x8000; sl->statem.rx.len = ntohs(*((sl_ushort *)mp->b_rptr)++) & 0x01ff; } else { sl->statem.rx.R.bsn = *mp->b_rptr & 0x7f; sl->statem.rx.R.bib = *mp->b_rptr++ & 0x80; sl->statem.rx.R.fsn = *mp->b_rptr & 0x7f; sl->statem.rx.R.fib = *mp->b_rptr++ & 0x80; sl->statem.rx.len = *mp->b_rptr++ & 0x3f; } if ( sl->statem.rx.len == 1 ) { sl->statem.rx.sio = *mp->b_rptr++ & 0x07; } if ( sl->statem.rx.len == 2 ) { sl->statem.rx.sio = *mp->b_rptr++ & 0x07; sl->statem.rx.sio = *mp->b_rptr++ & 0x07; }#if 0 ptrace(("rx: bsn=%x, bib=%x, fsn=%x, fib=%x, len=%d, sio=%d\n", sl->statem.rx.R.bsn, sl->statem.rx.R.bib, sl->statem.rx.R.fsn, sl->statem.rx.R.fib, sl->statem.rx.len, sl->statem.rx.sio ));#endif if ( ((sl->statem.rx.len )==1)||((sl->statem.rx.len )==2) ) { switch ( sl->statem.rx.sio ) { case LSSU_SIO : { sl_lsc_sio (sl); sl_iac_sio (sl); break; } case LSSU_SIN : { sl_lsc_sin (sl); sl_iac_sin (sl); break; } case LSSU_SIE : { sl_lsc_sie (sl); sl_iac_sie (sl); break; } case LSSU_SIOS: { sl_lsc_sios(sl); sl_iac_sios(sl); break; } case LSSU_SIPO: { sl_lsc_sipo(sl); break; } case LSSU_SIB : { sl_lsc_sib (sl); break; } } freemsg(mp); return; } if ( SN_OUTSIDE(((sl->statem.rx.F.fsn-1)&sl->statem.sn_mask), sl->statem.rx.R.bsn, sl->statem.rx.T.fsn) ) { if ( sl->statem.abnormal_bsnr ) { sl->statem.failure_reason = SL_FAIL_ABNORMAL_BSNR; sl_lsc_link_failure(sl); sl->statem.rc_state = SL_STATE_IDLE; freemsg(mp);// sl_daedt_transmitter_wakeup(sl); return; } else { sl->statem.abnormal_bsnr = 1; sl->statem.unb = 0; freemsg(mp);// sl_daedt_transmitter_wakeup(sl); return; } } if ( sl->statem.abnormal_bsnr ) { if ( sl->statem.unb == 1 ) { sl->statem.abnormal_bsnr = 0; } else { sl->statem.unb = 1; freemsg(mp);// sl_daedt_transmitter_wakeup(sl); return; } } if ( pcr ) { sl_lsc_fisu_msu_received(sl); sl_txc_bsnr_and_bibr(sl); sl->statem.rx.F.fsn = (sl->statem.rx.R.bsn +1)&sl->statem.sn_mask; if ( ! sl->statem.msu_fisu_accepted ) { freemsg(mp); return; } sl_rb_congestion_function(sl); if ( sl->statem.congestion_discard ) { sl_cc_busy(sl); freemsg(mp); return; } if ( (sl->statem.rx.R.fsn == sl->statem.rx.X.fsn ) && (sl->statem.rx.len > 2) ) { sl_l3_pdu(sl, mp); sl->statem.rx.X.fsn = (sl->statem.rx.X.fsn +1)&sl->statem.sn_mask; if ( sl->statem.congestion_accept ) sl_cc_busy(sl); else sl_txc_fsnx_value(sl); return; } else { freemsg(mp); return; } return; } if ( sl->statem.rx.R.fib == sl->statem.rx.X.fib ) { if ( sl->statem.abnormal_fibr ) { if ( sl->statem.unf == 1 ) { sl->statem.abnormal_fibr = 0; } else { sl->statem.unf = 1; freemsg(mp);// sl_daedt_transmitter_wakeup(sl); return; } } sl_lsc_fisu_msu_received(sl); sl_txc_bsnr_and_bibr(sl); sl->statem.rx.F.fsn = (sl->statem.rx.R.bsn +1)&sl->statem.sn_mask; if ( ! sl->statem.msu_fisu_accepted ) { freemsg(mp); return; } sl_rb_congestion_function(sl); if ( sl->statem.congestion_discard ) { sl->statem.rtr = 1; freemsg(mp); sl_cc_busy(sl); return; } if ( (sl->statem.rx.R.fsn == sl->statem.rx.X.fsn ) && (sl->statem.rx.len > 2) ) { sl->statem.rx.X.fsn = (sl->statem.rx.X.fsn +1)&sl->statem.sn_mask; sl->statem.rtr = 0; sl_l3_pdu(sl, mp); if ( sl->statem.congestion_accept ) sl_cc_busy(sl); else sl_txc_fsnx_value(sl); return; } if ( (sl->statem.rx.R.fsn == ((sl->statem.rx.X.fsn -1)&sl->statem.sn_mask)) ) { freemsg(mp); return; } else { if ( sl->statem.congestion_accept ) { sl->statem.rtr = 1; sl_cc_busy(sl); /* not required? */ freemsg(mp); return; } else { sl_txc_nack_to_be_sent(sl); sl->statem.rtr = 1; sl->statem.rx.X.fib = sl->statem.rx.X.fib ?0:sl->statem.ib_mask; freemsg(mp); return; } } } else { if ( sl->statem.abnormal_fibr ) { sl->statem.failure_reason = SL_FAIL_ABNORMAL_FIBR; sl_lsc_link_failure(sl); freemsg(mp); return; } if ( sl->statem.rtr == 1 ) { sl_txc_bsnr_and_bibr(sl); sl->statem.rx.F.fsn = (sl->statem.rx.R.bsn +1)&sl->statem.sn_mask; freemsg(mp); return; } sl->statem.abnormal_fibr = 1; sl->statem.unf = 0; freemsg(mp);// sl_daedt_transmitter_wakeup(sl); return; }}static inline void sl_lsc_stop(sl_t *sl){ if ( sl->statem.lsc_state != SL_STATE_OUT_OF_SERVICE ) { sl_iac_stop(sl); /* ok if not running */ sl_timer_stop(t1); /* ok if not running */ sl_rc_stop(sl); sl->dcalls->suerm_stop(sl); /* ok if not running */ sl_poc_stop(sl); /* ok if not running or not ITUT */ sl_txc_send_sios(sl); sl->statem.emergency = 0; sl->statem.local_processor_outage = 0; sl->statem.remote_processor_outage = 0; /* ok of not ANSI */ sl->statem.lsc_state = SL_STATE_OUT_OF_SERVICE; }}static inline void sl_lsc_clear_rtb(sl_t *sl) { if ( sl->statem.lsc_state == SL_STATE_PROCESSOR_OUTAGE ) { sl->statem.local_processor_outage = 0; sl_txc_send_fisu(sl); sl_txc_clear_rtb(sl); }}static inline void sl_iac_correct_su(sl_t *sl) { if ( sl->statem.iac_state == SL_STATE_PROVING ) { if ( sl->statem.further_proving ) { sl_timer_stop(t4); sl->dcalls->aerm_start(sl); sl->statem.further_proving = 0; sl_timer_start_t4(t4v); } }}static inline void sl_iac_abort_proving(sl_t *sl) { if ( sl->statem.iac_state == SL_STATE_PROVING ) { sl->statem.Cp++; if ( sl->statem.Cp == sl->config.M ) { sl_lsc_alignment_not_possible(sl); sl_timer_stop(t4); sl->dcalls->aerm_stop(sl); sl->statem.emergency = 0; sl->statem.iac_state = SL_STATE_IDLE; return; } sl->statem.further_proving = 1; }}#define sl_lsc_flush_buffers sl_lsc_clear_buffersstatic inline void sl_lsc_clear_buffers(sl_t *sl) { switch ( sl->statem.lsc_state ) { case SL_STATE_OUT_OF_SERVICE: switch ( sl->option.pvar ) { case SS7_PVAR_ITUT_93: case SS7_PVAR_ITUT_96: return; case SS7_PVAR_ANSI_92: sl_l3_rtb_cleared(sl); sl->statem.local_processor_outage = 0; /* ??? */ return; } case SL_STATE_INITIAL_ALIGNMENT: switch ( sl->option.pvar ) { case SS7_PVAR_ITUT_93: case SS7_PVAR_ITUT_96: return; case SS7_PVAR_ANSI_92: sl_l3_rtb_cleared(sl); sl->statem.local_processor_outage = 0; return; } case SL_STATE_ALIGNED_NOT_READY:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -