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_llsc.h


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



#ifndef __SLS_LLSC_H__
#define __SLS_LLSC_H__

static inline void lk_lsac_activate_link(lk_t * lk);
static inline void lk_lsac_deactivate_link(lk_t * lk);
static inline void lk_lsac_emergency_ceases(lk_t * lk);
static inline void lk_lsac_emergency(lk_t * lk);
static inline void lk_lsac_restart_ends(lk_t * lk);

/*
 *  Signalling Link Managment (SLM)
 *
 *  Link Set Control (LLSC) Figure 36/Q.704
 */

static inline void ls_llsc_activate_link_set(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_INACTIVE:
		ls->statem.llsc_state = LS_STATE_ACTIVE;
	case LS_STATE_ACTIVE:	/* Link set restart */
		ls->statem.links_active = 0;
		for (lk = ls->device; lk; lk = lk->next) {
			/* FIXME: Select links to activate */
			if (lk->statem.lsac_state == LK_STATE_INACTIVE)
				lk_lsac_activate_link(lk);
			else
				ls->statem.links_active++;
		}
		break;
	}
}

static inline void ls_llsc_deactivate_link_set(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		for (lk = ls->device; lk; lk = lk->next) {
			if (lk->statem.lsac_state == LK_STATE_INACTIVE)	/* why not send to all? */
				lk_lsac_deactivate_link(lk);
		}
		lk->statem.llsc_state = LS_STATE_INACTIVE;
		break;
	}
}

static inline void ls_llsc_link_active(lk_t * lk)
{
	ls_t *ls = lk->module;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		if (++(ls->statem.links_active) > ls->config.links_specified) {
			/* FIXME: Select a link to deactivate */
			for (lk = ls->device; lk; lk = lk->next) {
				if (lk->statem.lsac_state == LK_STATE_ACTIVE) {
					lk_lsac_deactivate_link(lk);
					break;
				}
			}
		}
		break;
	}
}

static inline void ls_llsc_link_failed(lk_t * lk)
{
	ls_t *ls = lk->module;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		if (!(--ls->statem.links_active)) {
			/* FIXME: Select links to activate */
			ls_llsc_activate_link_set(ls);
		}
		break;
	}
}

static inline void ls_llsc_activate_another_link(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		if (ls->statem.links_active < ls->config.links_specified) {
			/* FIXME: Select a link to activate */
			for (lk = ls->device; lk; lk = lk->next) {
				if (lk->statem.lsac_state == LK_STATE_INACTIVE) {
					lk_lsac_activate_link(lk);
					break;
				}
			}
		}
		break;
	}
}

static inline void ls_llsc_emergency(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		for (lk = ls->device; lk; lk = lk->next)
			lk_lsac_emergency(lk);
		break;
	}
}

static inline void ls_llsc_emergency_ceases(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		for (lk = ls->device; lk; lk = lk->next)
			lk_lsac_emergency_ceases(lk);
		break;
	}
}

static inline void ls_llsc_link_inactive(lk_t * lk)
{
	ls_t *ls = lk->module;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		ls->statem.links_active--;
		break;
	}
}

static inline void ls_llsc_restart_begins(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_INACTIVE:
		ls->statem.llsc_state = LS_STATE_ACTIVE;
	case LS_STATE_ACTIVE:
		for (lk = ls->device; lk; lk = lk->next)
			/* FIXME: Select links to activate */
			if (lk->statem.lsac_state == LK_STATE_INACTIVE)
				lk_lsac_activate_link(lk);
		break;
	}
}

static inline void ls_llsc_restart_ends(ls_t * ls)
{
	lk_t *lk;
	switch (ls->statem.llsc_state) {
	case LS_STATE_ACTIVE:
		for (lk = ls->device; lk; lk = lk->next)
			lk_lsac_restart_ends(lk);
		break;
	}
}

#endif				/* __SLS_LLSC_H__ */


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

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

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