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/sigtran/ua_data.h


File /code/strss7/drivers/sigtran/ua_data.h



#ifndef __UA_DATA_H__
#define __UA_DATA_H__

#ident "@(#) $RCSfile: ua_data.h,v $ $Name:  $($Revision: 0.8.2.2 $) $Date: 2002/10/18 03:09:22 $"

/*
 *  Options cookie.
 */
typedef struct ss7_opts {
	uint flags;
	uint result;
	ulong pvar;			/* T_SS7_PVAR */
	ulong mplev;			/* T_SS7_MPLEV */
	ulong debug;			/* T_SS7_DEBUG */
	ulong pcr;			/* T_SS7_PCR */
	ulong hsl;			/* T_SS7_HSL */
	ulong xsn;			/* T_SS7_XSN */
	ulong clust;			/* T_SS7_CLUSTER */
	ulong seq;			/* T_SS7_SEQ_CTRL */
	ulong prior;			/* T_SS7_PRIORITY */
	ulong pclass;			/* T_SS7_PCLASS */
	ulong imp;			/* T_SS7_IMPORTANCE */
	ulong reterr;			/* T_SS7_RET_ERROR */
} ss7_opts_t;

typedef struct ss7_vars {
	uint level;
	ulong pvar;			/* T_SS7_PVAR */
	ulong seq;			/* T_SS7_SEQ_CTRL */
	ulong prior;			/* T_SS7_PRIORITY */
	ulong pclass;			/* T_SS7_PCLASS */
	ulong imp;			/* T_SS7_IMPORTANCE */
	ulong reterr;			/* T_SS7_RET_ERROR */
} ss7_vars_t;

typedef struct ops {
	int (*r_prim) (queue_t *, mblk_t *);	/* read primitives */
	int (*w_prim) (queue_t *, mblk_t *);	/* write primitives */
} ops_t;

typedef struct pcb {
	void (*rd_cleanup) (queue_t *);
	void (*wr_wakeup) (queue_t *);
	int (*conn_req) (queue_t *, struct sockaddr *, ss7_opts_t *, mblk_t *);
	int (*conn_res) (queue_t *, mblk_t *, queue_t *, mblk_t *);
	int (*discon_req) (queue_t *, mblk_t *);
	int (*data_req) (queue_t *, uint, ss7_opts_t *, mblk_t *);
	int (*ordrel_req) (queue_t *);
	int (*exdata_req) (queue_t *, uint, ss7_opts_t *, mblk_t *);
} pcb_t;

struct pp;
struct xp;
struct gp;
struct as;
struct ap;
struct sp;
struct np;

#define UA_STRU_PP	0x00000001
#define UA_STRU_XP	0x00000002
#define UA_STRU_AS_U	0x00000003
#define UA_STRU_AS_P	0x00000004
#define UA_STRU_SP	0x00000005
#define UA_STRU_SG	0x00000006
#define UA_STRU_MASK	0x000000ff

#define UA_TYPE_NONE	0x00000000
#define UA_TYPE_UAP	0x00000100	/* remote SIGTRAN ASP/SGP/SPP */
#define UA_TYPE_IPC	0x00000200	/* peer internal ASP/SGP/SPP */
#define UA_TYPE_SS7	0x00000400	/* internal ASP(User) or SGP(Provider) */
#define UA_TYPE_MASK	0x0000ff00

#define UA_MODE_NONE	0x00000000
#define UA_MODE_SGP	0x00000001	/* structure is proxy for remote SGP */
#define UA_MODE_ASP	0x00000002	/* structure is proxy for remote ASP */
#define UA_MODE_SPP	0x00000004	/* structure is proxy for remote IPSP */
#define UA_MODE_MASK	0x000000ff

#define UA_PROT_NONE	0x00000000
#define UA_PROT_SL	0x00010000	/* SL/M2UA protocol */
#define UA_PROT_MTP	0x00020000	/* MTP/M3UA protocol */
#define UA_PROT_ISUP	0x00040000	/* ISUP/M3UA protocol */
#define UA_PROT_SCCP	0x00080000	/* SCCP/ SUA protocol */
#define UA_PROT_TCAP	0x00100000	/* TCAP/ TUA protocol */
#define UA_PROT_MASK	0x00ff0000

#define UA_STRM_NONE	0x00000000
#define UA_STRM_LM	0x01000000	/* stream has LM semantics only */
#define UA_STRM_SS7	0x02000000	/* stream has SS7 semantics */
#define UA_STRM_NSP	0x04000000	/* stream has NSP transport semantics */
#define UA_STRM_TSP	0x08000000	/* stream has TSP transport semantics */
#define UA_STRM_SCTP	0x10000000	/* stream has SCTP transport semantics */
#define UA_STRM_SSCOP	0x20000000	/* stream has SSCOP transport semanitcs */
#define UA_STRM_MASK	0xff000000

/*
 *  DP, LP Structures
 *  -------------------------------------------------------------------------
 *  This structure is used to link all stream queues into the data structures
 *  of the UA multiplexor regardless of whether they are upper or lower
 *  interfaces.  The signalling process structure is used to represent ASP,
 *  SGP and SPP proxies.  This structure is created whenever a stream or
 *  queue-pair is created at OPEN or LINK time.  We keep track of opens and
 *  links separately to distinguish the dev id versus the mux id.
 */
typedef struct pp {
	struct pp *next;		/* next PP in list */
	struct pp **prev;		/* prev PP in list */
//      struct pp       *links;         /* structures we have I_LINKed          */
	queue_t *rq;			/* associated read queue */
	queue_t *wq;			/* associated write queue */
//      union {
//      queue_t         *mq;            /* associated mgmt  queue               */
//      struct pp       *links;         /* structures we have I_LINKed          */
//      }               lk;
	struct xp *xp;			/* XP for this stream (UAT SGP or ASP) */
	struct as *as;			/* AS for this stream (SS7 SGP or ASP) */
	struct sp *sp;			/* SP for this stream */
	union {
		uint mux;		/* multiplexor id */
		uint sid;		/* structure id */
		uint32_t iid;		/* interface id */
		uint32_t rc;		/* routing context */
		dev_t dev;		/* device number */
	} id;				/* structure identifier */
	uint type;			/* structure type */
	uint state;			/* structure state */
	uint flags;			/* structure flags */
	uint rbid;			/* RD(q) buffer call id */
	uint wbid;			/* WR(q) buffer call id */
	struct drv *drv;		/* driver */
	struct ops ops;			/* primitive operations */
	struct pcb pcb;			/* protocol control block operations */
	ss7_vars_t prot;		/* protocol options */
} pp_t;

typedef pp_t dp_t;
typedef pp_t lp_t;
typedef pp_t ua_t;

extern dp_t *ua_opens_list;		/* list of all opened streams */
extern lp_t *ua_links_list;		/* list of all linked streams */

/*
 *  SPP --> ASP, SGP Structures
 *  -------------------------------------------------------------------------
 *  This struct represents an ASP, SGP or SPP proxy.  There are three types of
 *  each proxy: SS7 (User/ASP or Provider/SGP), IPC (Peer/ASP, Peer/SGP) and
 *  UAP (remote/ASP, remote/SGP, remote/SPP).  Only the UAPs provide strict
 *  SIGTRAN syntax and semantics.  SS7 proxies are used to attach internal SS7
 *  Users or Providers to the model.  IPC proxies are used to interface
 *  inter-SGP and inter-ASP communication to the model.  UAP proxies are used
 *  to interface external ASP or SGP equipment to the model.
 */

typedef struct xp {
	struct {
		struct sp *sp;		/* this XP associated with that SP */
		struct xp *next;	/* next XP associated with that SP */
		struct xp **prev;	/* prev XP associated with that SP */
	} sp;
	struct {
		struct pp *pp;		/* this XP associated with that DP/LP */
		struct xp *next;	/* next XP associated with that DP/LP */
		struct xp **prev;	/* prev XP associated with that DP/LP */
	} pp;
	struct gp *gp;			/* graph of AS for this XP */
	size_t asat_count;		/* ASs for which this XP is attached */
	size_t asdn_count;		/* ASs for which this XP is down */
	size_t asur_count;		/* ASs for which this XP is unreg'd */
	size_t asac_count;		/* ASs for which this XP is active */
	size_t asia_count;		/* ASs for which this XP is inactive */
	uint type;			/* type of XP */
	uint state;			/* state of this XP */
	uint aspid;			/* ASP Id */
	uint prio;			/* priority of this XP in this SP */
	uint cost;			/* cost of using this XP */
	uint t_ack;			/* timer for ack of messages */
	uint t_hbt;			/* timer for ack of heartbeats */
} xp_t;

typedef xp_t asp_t;
typedef xp_t sgp_t;
typedef xp_t spp_t;
typedef xp_t ss7_t;

extern asp_t *ua_asp_list;		/* list of ASP structures */
extern sgp_t *ua_sgp_list;		/* list of SGP structures */

#define ASP_DOWN	 0
#define ASP_WACK_ASPUP	 1	/* T(ack) timer running */
#define ASP_WACK_ASPDN	 2	/* T(ack) timer running */
#define ASP_UNREG	 3
#define ASP_WRSP_REG	 4	/* T(ack) timer running */
#define ASP_WRSP_DEREG	 5	/* T(ack) timer running */
#define ASP_UP		 6

#define ASPF_DOWN	(1<< ASP_DOWN		)
#define ASPF_WACK_ASPUP	(1<< ASP_WACK_ASPUP	)
#define ASPF_WACK_ASPDN	(1<< ASP_WACK_ASPDN	)
#define ASPF_UNREG	(1<< ASP_UNREG		)
#define ASPF_WRSP_REG	(1<< ASP_WRSP_REG	)
#define ASPF_WRSP_DEREG	(1<< ASP_WRSP_DEREG	)
#define ASPF_UP		(1<< ASP_UP		)

/*
 *  GP --> AS/XP Map
 *  -------------------------------------------------------------------------
 *  This structure describes the role of an XP (ASP/SGP) within an AS.  For
 *  ASP/AS structures, this structure describes the role of an ASP within an
 *  AS.  For SGP/AS structures, this structure describes the role of an SGP
 *  within an AS.
 */
typedef struct gp {
	struct {
		struct xp *xp;		/* this XP associated with this AS */
		struct gp *next;	/* next XP associated with this AS */
		struct gp **prev;	/* prev XP associated with this AS */
	} xp;
	struct {
		struct as *as;		/* this AS associated with this XP */
		struct gp *next;	/* next AS associated with this XP */
		struct gp **prev;	/* prev AS associated with this XP */
	} as;
	uint flags;			/* flags for this XP */
	uint rc;			/* resulting from registration */
	uint state;			/* state of this AS for this XP */
	uint loadshare;			/* XP loadshare selector (stripe) */
	uint broadcast;			/* XP broadcast selector (mirror) */
	uint prio;			/* priority of this XP for this AS */
	uint cost;			/* cost of using this XP for this AS */
	uint t_ack;			/* timer for ack of AS messages */
	uint t_hbt;			/* timer for ack of AS heartbeats */
	bufq_t rtb;			/* retransmission buffer */
	bufq_t buf;			/* buffer for failovers */
} gp_t;

#define ASP_INACTIVE	 6	/* same as ASP_UP */
#define ASP_BLOCKED	 7
#define ASP_PENDING	 8
#define ASP_WACK_ASPAC	 9	/* T(ack) timer running */
#define ASP_WACK_ASPIA	10	/* T(ack) timer running */
#define ASP_ACTIVE	11
#define ASP_WACK_HBEAT	12	/* T(beat) timer running */

#define ASPF_INACTIVE	(1<< ASP_INACTIVE	)
#define ASPF_BLOCKED	(1<< ASP_BLOCKED	)
#define ASPF_PENDING	(1<< ASP_PENDING	)
#define ASPF_WACK_ASPAC	(1<< ASP_WACK_ASPAC	)
#define ASPF_WACK_ASPIA	(1<< ASP_WACK_ASPIA	)
#define ASPF_ACTIVE	(1<< ASP_ACTIVE		)
#define ASPF_WACK_HBEAT	(1<< ASP_WACK_HBEAT	)

/*
 *  AS
 *  -------------------------------------------------------------------------
 *  An Application Server represents a unique Routing (Link) Key within the
 *  system.  This structure represents both AS being served to an ASP at an SG
 *  as well as AS receiving service from an SG at an ASP.  It also represents
 *  local SS7 User interfaces receiving service at an ASP, or local SS7
 *  Provider interfaces providing service at an SG.
 */
struct lsa {
	ulong x;
};
#define UA_LSA_MASK 0xff

typedef struct as {
	struct ap *ap;			/* graph of AS-U/P for this AS */
	struct gp *gp;			/* graph of ASP/SGP for this AS */
	struct pp *pp;			/* pointer to SS7-U/-P for this AS */
	struct {
		struct sp *sp;		/* this AS associated with this SP */
		struct as *next;	/* next AS associated with this SP */
		struct as **prev;	/* prev AS associated with this SP */
	} sp;
	uint flags;			/* AS flags */
	uint rc;			/* routing context */
	void *rk;			/* routing key for this AS */
	uint state;			/* state of this AS */
	uint target;			/* target state of this AS */
	uint tmode;			/* traffic mode for this AS */
	uint cid;			/* correlation id */
	size_t mina_count;		/* minimum number of active stripes */
	size_t maxa_count;		/* maximum number of active stripes */
	size_t xpat_count;		/* XPs that are attached */
	size_t xpdn_count;		/* XPs in the DOWN state */
	size_t xpur_count;		/* XPs in the UNREG state */
	size_t xpia_count;		/* XPs in the INACTIVE state */
	size_t xpac_count;		/* XPs in the ACTIVE state */
	size_t xpar_count;		/* XPs we requested activate */
	size_t xpir_count;		/* XPs we requested de-activate */
	size_t xprr_count;		/* XPs we requested registration */
	size_t spat_count;		/* SPs that are attached */
	size_t spdn_count;		/* SPs in the DOWN state */
	size_t spur_count;		/* SPs in the UNREG state */
	size_t spia_count;		/* SPs in the INACTIVE state */
	size_t spac_count;		/* SPs in the ACTIVE state */
	size_t spar_count;		/* SPs we requested activate */
	size_t spir_count;		/* SPs we requested de-activate */
	size_t sprr_count;		/* SPs we requested registration */
	struct rt *rt;			/* routing for this SP/SG for this AS */
	struct rt **rt_hash;		/* routing for this SP/SG for this AS */
	uint t_pnd;			/* timer for pending AS */
	struct lsa lsa[UA_LSA_MASK + 1];	/* load selection control array */
} as_t;

#define AS_TMODE_NONE		(0)
#define AS_TMODE_OVERRIDE	(1)	/* lines up with UA_TMODE_OVERRIDE */
#define AS_TMODE_LOADSHARE	(2)	/* lines up with UA_TMODE_LOADSHARE */
#define AS_TMODE_BROADCAST	(3)	/* lines up with UA_TMODE_BROADCAST */
#define AS_TMODE_DEFAULT	AS_TMODE_OVERRIDE

#define AS_STATIC	(1<< 0)	/* AS was statically allocated */
#define AS_DYNAMIC	(1<< 1)	/* AS was dynamically allocated */

#define AS_DOWN		 0
#define AS_WACK_ASPUP	 1
#define AS_WACK_ASPDN	 2
#define AS_UNREG	 3
#define AS_WRSP_REG	 4
#define AS_WRSP_DEREG	 5
#define AS_INACTIVE	 6
#define AS_BLOCKED	 7
#define AS_PENDING	 8
#define AS_WACK_ASPAC	 9
#define AS_WACK_ASPIA	10
#define AS_ACTIVE	11
#define AS_WACK_HBEAT	12

#define ASF_DOWN	(1<< AS_DOWN		)
#define ASF_WACK_ASPUP	(1<< AS_WACK_ASPUP	)
#define ASF_WACK_ASPDN	(1<< AS_WACK_ASPDN	)
#define ASF_UNREG	(1<< AS_UNREG		)
#define ASF_WRSP_REG	(1<< AS_WRSP_REG	)
#define ASF_WRSP_DEREG	(1<< AS_WRSP_DEREG	)
#define ASF_INACTIVE	(1<< AS_INACTIVE	)
#define ASF_BLOCKED	(1<< AS_BLOCKED		)
#define ASF_PENDING	(1<< AS_PENDING		)
#define ASF_WACK_ASPAC	(1<< AS_WACK_ASPAC	)
#define ASF_WACK_ASPIA	(1<< AS_WACK_ASPIA	)
#define ASF_ACTIVE	(1<< AS_ACTIVE		)
#define ASF_WACK_HBEAT	(1<< AS_WACK_HBEAT	)

#define ASM_TACK_STATES (ASF_WACK_ASPUP|ASF_WACK_ASPDN|ASF_WRSP_REG|ASF_WRSP_DEREG|ASF_WACK_ASPIA|ASF_WACK_ASPAC)
#define ASM_THBT_STATES (ASF_WACK_HBEAT)
#define ASM_TPND_STATES (ASF_PENDING)
#define ASM_DOWN_STATES	(ASF_DOWN      |ASF_WACK_ASPUP|ASF_WACK_ASPDN )
#define ASM_UREG_STATES	(ASF_UNREG     |ASF_WRSP_REG  |ASF_WRSP_DEREG )
#define ASM_INAC_STATES	(ASF_INACTIVE  |ASF_BLOCKED   |ASF_PENDING    |ASF_WACK_ASPAC )
#define ASM_ACTV_STATES	(ASF_WACK_ASPIA|ASF_ACTIVE    |ASF_WACK_HBEAT )

/*
 *  SP --> AS, SG
 *  -------------------------------------------------------------------------
 *  An Application Server is a collection of Application Server Process (ASP)
 *  proxies and is served by one or more Signalling Gateway processes.  A
 *  Signalling Gateway (SG) is a collection of Signalling Gateway Process
 *  (SGP) proxies and provides service to one or more Application Servers
 *  (AS).
 *
 *  Typically an AS at an ASP will have at least one internal (UA_TYPE_SS7)
 *  ASP proxy represending an SS7 user.  Typically an SG at an ASP will have
 *  at least one internal (UA_TYPE_SS7) SGP proxy representing an SS7
 *  provider.
 *
 *  For an AS node, the np graph is a graph of SGs serving this AS and the
 *  np_hash is a hash of SGs by load selector.  For an SG node, the np graph
 *  is a graph of ASs served by this SG and the np_hash is a hash of the ASs
 *  by Routing Context or Interface Identifier.
 *
 *  The overall state of the node can be down, inactive, or pending.  The
 *  pending state is used when a node does not have an active peer but is
 *  waiting in expectation that the peer will soon become active.
 *
 *  Typically at an ASP, multiple AS structures and multiple SG structures may
 *  exist.  Typically at an SGP, only one SG structure will exist (an SGP only
 *  belongs to one logical SG).
 */

typedef struct sp {
	struct as *as;			/* AS-U/P for this SP */
	struct np *np;			/* graph of peer nodes for this SP */
	struct xp *xp;			/* list of SPPs for this node */
	uint spid;			/* SP identifier */
	uint tmode;			/* traffic mode */
	uint prio;			/* priority */
	uint cost;			/* cost */
	uint aspid;			/* ASP Id */
	size_t xpat_count;		/* number of XPs that are attached */
	size_t xpdn_count;		/* number of XPs in a down state */
	size_t xpup_count;		/* number of XPs in an up state */
} sp_t;

typedef sp_t sg_t;

/*
 *  NP --> SP/SG Map
 *  -------------------------------------------------------------------------
 *  This structure describes the relationship beteen SP and SG.  For an SP,
 *  this describes the SGs that provide service to the SP.  For an SG this
 *  describes the SP that are served by the SG.
 */
typedef struct np {
	struct {
		struct sp *sp;		/* this SP associated with this SG */
		struct np *next;	/* next SP associated with this SG */
		struct np **prev;	/* prev SP associated with this SG */
	} sp;
	struct {
		struct sp *sg;		/* this SG associated with this SP */
		struct np *next;	/* next SG associated with this SP */
		struct np **prev;	/* prev SG associated with this SP */
	} sg;
} np_t;

/*
 *  AP --> AS-U/AS-P Map
 *  -------------------------------------------------------------------------
 *  This structure describes the relationship between AS and SP/SG.  For an
 *  AS, this describes the SPs that are serviced by the AS or SGs that provide
 *  service to the AS.  For an SP, this describes the AS that provide service
 *  to the SP.  For an SG, this describes the AS that are serviced by the SG.
 */

typedef struct ap {
	struct {
		struct as *as;		/* this AS-P associated wtih this AS-U */
		struct ap *next;	/* next AS-P associated with this AS-U */
		struct ap **prev;	/* prev AS-P associated with this AS-U */
	} user;
	struct {
		struct as *as;		/* this AS-U associated with this AS-P */
		struct ap *next;	/* next AS-U associated with this AS-P */
		struct ap **prev;	/* prev AS-U associated with this AS-P */
	} prov;
} ap_t;

#endif				/* __UA_DATA_H__ */


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

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

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