OpenSS7
SS7 for the
Common Man

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified:

Home Overview Status News Documentation Resources About
   
 Overview
 Status
 News
 Documentation
 Resources
 About

   
Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> strss7/drivers/slsi/sls_tcoc.h


File /code/strss7/drivers/slsi/sls_tcoc.h



#ident "@(#) $Id: sls_tcoc.h,v 0.8.2.1 2002/10/18 02:40:38 brian Exp $"

#ifndef __SLS_TCOC_H__
#define __SLS_TCOC_H__

static inline void lk_hmrt_changeover_ack(lk_t * lk);
static inline void lk_hmrt_changeover_order(lk_t * lk);
static inline void lk_hmrt_emergency_changeover_ack(lk_t * lk);
static inline void lk_hmrt_emergency_changeover_order(lk_t * lk);
static inline void lk_hmrt_update_routing_tables(lk_t * lk);

static inline void lk_lsac_STM_ready(lk_t * lk);

static inline void lk_tlac_changeover_executed(lk_t * lk);
static inline void lk_tlac_changeover_not_required(lk_t * lk);

static inline void lk_tsrc_alternative_routing_data_request(lk_t * lk);
static inline void lk_tsrc_changeover_executed(lk_t * lk);
static inline void lk_tsrc_changeover_not_required(lk_t * lk);

static inline void lk_t1_timeout(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT07:
		/* send buffered messages on alternative signalling link(s); messages for
		   inaccessible destinations are discarded. */
		lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent messages for
							   unavailable link are diverted to
							   alternative link(s) (if any) or
							   discarded */
		lk_tlac_changeover_executed(lk);
		lk_tsrc_changeover_executed(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	}
}

static inline void lk_t2_timeout(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT:
		lk->dcalls->sl_stop(lk);
		lk_lsac_STM_ready(lk);	/* This message is required only if signalling link
					   restoration may interfere with message retrieval. */
		/* Send buffered messages on alternative signalling link(s); messages for
		   inaccessible destinations are discarded. */
		lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent messages for
							   unavailable link are diverted to
							   alternative link(s) (if any) or
							   discarded. */
		lk_tlac_changeover_executed(lk);
		lk_tsrc_changeover_executed(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	}
}

static inline void lk_tcoc_signalling_link_unavailable(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_IDLE:
		/* buffer messages for affected signalling link */
		lk_tsrc_alternative_routing_data_request(lk);
		lk->statem.tcoc_state = LK_STATE_WAIT01;
		break;
	case LK_STATE_RETRIEVING:
		lk->statem.unavailable = 1;
		break;
	}
}

static inline void lk_tcoc_alternative_routine_data(lk_t * lk)
{
	/* 
	 *  Identifies alternative signalling links, if any and also identifies
	 *  whether unavailable link was loaded and accessibility of other SP.
	 */
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT01:
		if (lk->statem.retrieval_required) {	/* retrieval required? */
			if (lk->statem.changeover_possible) {	/* can changeover messages be
								   exchanged? */
				lk->dcalls.sl_bsnt(lk);
				lk->statem.tcoc_state = LK_STATE_WAIT02;
			} else {
				/* For inhibiting of link or other SP might be inaccessible.  NOTE
				   - In the processor outage and management inhibiting states,
				   changeover messages should not be exchanged. */
				lk_lsac_STM_ready(lk);	/* This message is required only if
							   signalling link restoration attempts may 
							   interfere with message retrieval. */
				lk_timer_start(t1);
				lk->statem.tcoc_state = LK_STATE_WAIT07;	/* To reduce risk
										   that diversion
										   will cause
										   mis-sequencing. */
			}
		} else {
			lk->dcalls.sl_fsnc(lk);	/* FIXME: where is the FSNC? */
			lk->statem.unavailable = 1;
			lk->statem.tcoc_state = LK_STATE_RETRIEVING;
		}
		break;
	case LK_STATE_WAIT06:
		if (lk->statem.retrieval_required && lk->statem.remote_bsnt_retrieved) {
			lk->dcalls->sl_fsnc(lk);	/* use remote bsnt */
			lk->statem.unavailable = 1;
			lk->statem.tcoc_state = RETRIEVING;
		} else {
			lk_lsac_STM_ready(lk);	/* This message is required only if signalling link
						   restoration may interfere with message retrieval. 
						 */
			/* Send buffered messages on alternative signalling link(s); messages for
			   inaccessible destinations are discarded. */
			lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent
								   messages for unavailable link
								   are diverted to alternative
								   link(s) (if any) or discarded. */
			lk_tlac_changeover_executed(lk);
			lk_tsrc_changeover_executed(lk);
			lk->statem.tcoc_state = IDLE;
		}
		break;
	}
}

static inline void lk_tcoc_emergency_changeover_order(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_IDLE:
		lk->statem.remote_bsnt_retrieved = 0;
		/* Buffer messages for the affected signalling link. */
		lk->dcalls->sl_retrieve_bsnt(lk);	/* Needed for updating retransmission
							   buffer at remote end. */
		lk->statem.tcoc_state = LK_STATE_WAIT05;
		break;
	case LK_STATE_WAIT01:
	case LK_STATE_WAIT02:
		break;
	}
}

static inline void lk_tcoc_changeover_order(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_IDLE:
		lk->statem.remote_bsnt_retrieved = 1;
		/* Buffer messags for the affected signalling link. */
		lk->dcalls->sl_retrieve_bsnt(lk);	/* Needed for updating retransmission
							   buffer at remote end. */
		lk->statem.tcoc_state = LK_STATE_WAIT05;
		break;
	case LK_STATE_WAIT01:
	case LK_STATE_WAIT02:
		break;
	case LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT:
		lk_timer_stop(t2);
		if (lk->statem.local_bsnt_retrieved)
			lk_hmrt_changeover_ack(lk);
		else
			lk_hmrt_emergency_changeover_ack(lk);
		lk->dcalls->sl_fsnc(lk);
		lk->statem.unavailable = 1;
		lk->statem.tcoc_state = LK_STATE_RETRIEVING;
		break;
	}
}

static inline void lk_tcoc_signalling_link_available(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT07:	/* To reduces the risk that diversion will cause mis-sequencing. */
		lk_timer_stop(t1);
		/* fall thru */
	case LK_STATE_WAIT01:
	case LK_STATE_WAIT02:
		/* send buffered messages on restored link */
		/* stop buffering messages for restored link */
		lk_tlac_changeover_not_required(lk);
		lk_tsrc_changeover_not_required(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	case LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT:
		lk_timer_stop(t2);
		if (lk->statem.local_bsnt_retrieved)
			lk_hmrt_changeover_ack(lk);
		else
			lk_hmrt_emergency_changeover_ack(lk);
		lk_lsac_STM_ready(lk);	/* This message is required only if signalling link
					   restoration may interfere with message retrieval. */
		/* Send buffered messages on alternative signalling link(s); messages for
		   inaccessible destinations are discarded. */
		lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent messages for
							   unavailable link are diverted to
							   alternative link(s) (if any) or
							   discarded. */
		lk_tlac_changeover_executed(lk);
		lk_tsrc_changeover_executed(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	case LK_STATE_RETRIEVING:
		lk->statem.unavailable = 0;
		break;
	case LK_STATE_WAIT06:
		/* Send buffered messages on restored link. */
		/* Stop buffering messages for restored link. */
		lk_tlac_changeover_not_required(lk);
		lk_tsrc_changeover_not_required(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	}
}

static inline void lk_tcoc_bsnt(lk_t * lk)
{				/* bsnt from L2 */
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT02:
		lk->statem.local_bsnt_retrieved = 1;
		lk_hmrt_changeover_order(lk);
		lk_timer_start(t2);
		lk->statem.tcoc_state = LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT;
		break;
	case LK_STATE_WAIT05:
		lk_hmrt_changeover_ack(lk);	/* use retrieved bnst */
		lk_tsrc_alternative_routing_data_request(lk);
		lk->statem.tcoc_state = LK_STATE_WAIT06;
		break;
	}
}

static inline void lk_tcoc_bsnt_not_retrievable(lk_t * lk)
{				/* unspec from L2 */
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT02:
		lk->statem.local_bsnt_retrieved = 0;
		lk->dcalls->sl_stop(lk);
		lk_hmrt_emergency_changeover_order(lk);
		lk_timer_start(t2);
		lk->statem.tcoc_state = LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT;
		break;
	case LK_STATE_WAIT05:
		lk->dcalls->sl_stop(lk);
		lk_hmrt_emergency_changeover_ack(lk);
		lk_tsrc_alternative_routing_data_request(lk);
		lk->statem.tcoc_state = LK_STATE_WAIT06;
		break;
	}
}

static inline void lk_tcoc_changeover_ack(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT:
		lk_timer_stop(t2);
		lk->dcalls->sl_fsnc(lk);	/* FSNC from message. */
		lk->statem.unavailable = 1;
		lk->statem.tcoc_state = LK_STATE_RETRIEVING;
		break;
	}
}

static inline void lk_tcoc_emergency_changeover_ack(lk_t * lk)
{
	switch (lk->statem.tcoc_state) {
	case LK_STATE_WAIT_FOR_ACKNOWLEDGEMENT:
		lk_timer_stop(t2);
		lk_lsac_STM_ready(lk);	/* This message is required only if signalling link
					   restoration may interfere with message retrieval. */
		/* Send buffered messages on alternative signalling link(s); messages for
		   inaccessible destinations are discarded. */
		lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent messages for
							   unavailable link are diverted to
							   alternative link(s) (if any) or
							   discarded. */
		lk_tlac_changeover_executed(lk);
		lk_tsrc_changeover_executed(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	}
}

static inline void lk_tcoc_retrieved_messages(lk_t * lk)
{				/* from L2 */
	switch (lk->statem.tcoc_state) {
	case LK_STATE_RETRIEVING:
		/* Save retrieved messages */
		break;
	}
}

static inline void lk_tcoc_retrieval_complete(lk_t * lk)
{				/* from L2 */
	switch (lk->statem.tcoc_state) {
	case LK_STATE_RETRIEVING:
		if (lk->statem.unavailable) {
			/* Send retrieved messages on alternative signalling link(s). */
			lk_lsac_STM_ready(lk);	/* This message is required only if signalling link
						   restoration may interfere with message retrieval. 
						 */
			/* Send buffered messages on alternative signalling link(s); messages for
			   inaccessible destinations are discarded. */
			lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent
								   messages for unavailable link
								   are diverted to alternative
								   link(s) (if any) or discarded. */
			lk_tlac_changeover_executed(lk);
			lk_tsrc_changeover_executed(lk);
			lk->statem.tcoc_state = IDLE;
			break;
		} else {
			/* Send retrieved messages on restored link. */
			/* Send buffered messages on restored link. */
			/* Stop buffering messages for restored link. */
			lk_tlac_changeover_not_required(lk);
			lk_tsrc_changeover_not_required(lk);
			lk->statem.tcoc_state = LK_STATE_IDLE;
		}
		break;
	}
}

static inline void lk_tcoc_retrieval_not_possible(lk_t * lk)
{				/* uspec from L2 */
	switch (lk->statem.tcoc_state) {
	case LK_STATE_RETRIEVING:
		lk_lsac_STM_ready(lk);	/* This message is required only if signalling link
					   restoration may interfere with message retrieval. */
		/* Send buffered messages on alternative signalling link(s); messages for
		   inaccessible destinations are discarded. */
		lk_hmrt_update_routing_tables(lk);	/* To ensure that subsequent messages for
							   unavailable link are diverted to
							   alternative link(s) (if any) or
							   discarded. */
		lk_tlac_changeover_executed(lk);
		lk_tsrc_changeover_executed(lk);
		lk->statem.tcoc_state = IDLE;
		break;
	}
}

#endif				/* __SLS_TCOC_H__ */


Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> strss7/drivers/slsi/sls_tcoc.h

OpenSS7
SS7 for the
Common Man
Home Overview Status News Documentation Resources About

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified: