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


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



#ifndef __UA_MSGS_H__
#define __UA_MSGS_H__

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

/*
 *  =========================================================================
 *
 *  SCTP USER ADAPTATION LAYER MESSAGE DEFINITIONS:-
 *
 *  =========================================================================
 */
#define UA_VERSION 1
#define UA_PAD4(__len) (((__len)+3)&~0x3)
#define UA_MHDR(__version, __spare, __class, __type) \
	(__constant_htonl(((__version)<<24)|((__spare)<<16)|((__class)<<8)|(__type)))

#define UA_MSG_VERS(__hdr) ((ntohl(__hdr)>>24)&0xff)
#define UA_MSG_CLAS(__hdr) ((ntohl(__hdr)>> 8)&0xff)
#define UA_MSG_TYPE(__hdr) ((ntohl(__hdr)>> 0)&0xff)
#define UA_MSG_MTAG(__hdr) ((ntohl(__hdr))&0xffff)
#define UA_MSG_CTAG(__hdr) ((ntohl(__hdr))&0xffff)

#define __UA_MSG_VERS(__hdr) ((__constant_ntohl(__hdr)>>24)&0xff)
#define __UA_MSG_CLAS(__hdr) ((__constant_ntohl(__hdr)>> 8)&0xff)
#define __UA_MSG_TYPE(__hdr) ((__constant_ntohl(__hdr)>> 0)&0xff)
#define __UA_MSG_MTAG(__hdr) ((__constant_ntohl(__hdr))&0xffff)
#define __UA_MSG_CTAG(__hdr) ((__constant_ntohl(__hdr))&0xffff)
/*
 *  MESSAGE CLASES:-
 */
#define UA_CLASS_MGMT	0x00	/* UA Management (MGMT) Message */
#define UA_CLASS_XFER	0x01	/* M3UA Data transfer messages */
#define UA_CLASS_SSNM	0x02	/* Signalling Network Mgmt (SNM) Msgs */
#define UA_CLASS_ASPS	0x03	/* ASP State Maint. (ASPSM) Messages */
#define UA_CLASS_ASPT	0x04	/* ASP Traffic Maint. (ASPTM) Messages */
#define UA_CLASS_Q921	0x05	/* Q.931 user part messages */
#define UA_CLASS_MAUP	0x06	/* M2UA Messages */
#define UA_CLASS_CNLS	0x07	/* SUA Connectionless Messages */
#define UA_CLASS_CONS	0x08	/* SUA Connection-Oriented Messages */
#define UA_CLASS_RKMM	0x09	/* Routing Key Management (RKM) Msgs */
#define UA_CLASS_TDHM	0x0a	/* TUA Dialong Handling Message */
#define UA_CLASS_TCHM	0x0b	/* TUA Component Handling Message */
#define UA_CLASS_LAST   0x0b

/*
 *  MESSAGES DEFINED IN EACH CLASS:-
 */
#define UA_MGMT_ERR		UA_MHDR(UA_VERSION, 0, UA_CLASS_MGMT, 0x00)
#define UA_MGMT_NTFY		UA_MHDR(UA_VERSION, 0, UA_CLASS_MGMT, 0x01)
#define UA_MGMT_LAST		0x01

#define UA_SSNM_DUNA		UA_MHDR(UA_VERSION, 0, UA_CLASS_SSNM, 0x01)
#define UA_SSNM_DAVA		UA_MHDR(UA_VERSION, 0, UA_CLASS_SSNM, 0x02)
#define UA_SSNM_DAUD		UA_MHDR(UA_VERSION, 0, UA_CLASS_SSNM, 0x03)
#define UA_SSNM_SCON		UA_MHDR(UA_VERSION, 0, UA_CLASS_SSNM, 0x04)
#define UA_SSNM_DUPU		UA_MHDR(UA_VERSION, 0, UA_CLASS_SSNM, 0x05)
#define UA_SSNM_DRST		UA_MHDR(UA_VERSION, 0, UA_CLASS_SSNM, 0x06)
#define UA_SSNM_LAST		0x06

#define UA_ASPS_ASPUP_REQ	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPS, 0x01)
#define UA_ASPS_ASPDN_REQ	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPS, 0x02)
#define UA_ASPS_HBEAT_REQ	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPS, 0x03)
#define UA_ASPS_ASPUP_ACK	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPS, 0x04)
#define UA_ASPS_ASPDN_ACK	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPS, 0x05)
#define UA_ASPS_HBEAT_ACK	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPS, 0x06)
#define UA_ASPS_LAST		0x06

#define UA_ASPT_ASPAC_REQ	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPT, 0x01)
#define UA_ASPT_ASPIA_REQ	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPT, 0x02)
#define UA_ASPT_ASPAC_ACK	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPT, 0x03)
#define UA_ASPT_ASPIA_ACK	UA_MHDR(UA_VERSION, 0, UA_CLASS_ASPT, 0x04)
#define UA_ASPT_LAST		0x04

#define UA_RKMM_REG_REQ		UA_MHDR(UA_VERSION, 0, UA_CLASS_RKMM, 0x01)
#define UA_RKMM_REG_RSP		UA_MHDR(UA_VERSION, 0, UA_CLASS_RKMM, 0x02)
#define UA_RKMM_DEREG_REQ	UA_MHDR(UA_VERSION, 0, UA_CLASS_RKMM, 0x03)
#define UA_RKMM_DEREG_RSP	UA_MHDR(UA_VERSION, 0, UA_CLASS_RKMM, 0x04)
#define UA_RKMM_LAST		0x04

#define UA_MHDR_SIZE (sizeof(uint32_t)*2)
#define UA_PHDR_SIZE (sizeof(uint32_t))
#define UA_MAUP_SIZE (UA_MHDR_SIZE + UA_PHDR_SIZE + sizeof(uint32_t))

#define UA_TAG(__phdr)		(ntohl((__phdr))>>16)
#define UA_TAG_MASK		(__constant_htonl(0xffff0000))
#define UA_LENGTH(__phdr)	(ntohl(__phdr)&0xffff)
#define UA_SIZE(__phdr)		(__constant_htonl(__phdr)&0xffff)
#define UA_PHDR(__phdr, __length) \
	(((__phdr)&UA_TAG_MASK)|htonl((__length)+sizeof(uint32_t)))
#define UA_PARM(__tag,__length) \
	__constant_htonl(((__tag)<<16)|(((__length)+sizeof(uint32_t))&0xffff))

#define UA_WORDS(_len)		(((_len)+3)>>2)
/*
 *  COMMON PARAMETERS:-
 *
 *  Common parameters per draft-ietf-sigtran-m2ua-11.txt
 *  Common parameters per draft-ietf-sigtran-m3ua-10.txt
 *  Common parameters per draft-ietf-sigtran-sua-09.txt
 *  Common parameters per rfc3057.txt
 *  -------------------------------------------------------------------
 */
#define UA_PARM_RESERVED	UA_PARM(0x0000,0)
#define UA_PARM_IID		UA_PARM(0x0001,sizeof(uint32_t))
#define UA_PARM_IID_TEXT	UA_PARM(0x0003,0)
#define UA_PARM_INFO		UA_PARM(0x0004,0)
#define UA_PARM_DLCI		UA_PARM(0x0005,sizeof(uint32_t))	/* rfc3057 */
#define UA_PARM_RC		UA_PARM(0x0006,sizeof(uint32_t))
#define UA_PARM_DIAG		UA_PARM(0x0007,0)
#define UA_PARM_IID_RANGE	UA_PARM(0x0008,0)	/* rfc3057 */
#define UA_PARM_HBDATA		UA_PARM(0x0009,0)
#define UA_PARM_REASON		UA_PARM(0x000a,sizeof(uint32_t))
#define UA_PARM_TMODE		UA_PARM(0x000b,sizeof(uint32_t))
#define UA_PARM_ECODE		UA_PARM(0x000c,sizeof(uint32_t))
#define UA_PARM_STATUS		UA_PARM(0x000d,sizeof(uint32_t))
#define UA_PARM_PROT_DATA	UA_PARM(0x000e,sizeof(uint32_t))	/* rfc3057 */
#define UA_PARM_REL_REASON	UA_PARM(0x000f,sizeof(uint32_t))	/* rfc3057 */
#define UA_PARM_TEI_STATUS	UA_PARM(0x0010,sizeof(uint32_t))	/* rfc3057 */
#define UA_PARM_ASPID		UA_PARM(0x0011,sizeof(uint32_t))
#define UA_PARM_APC		UA_PARM(0x0012,sizeof(uint32_t))
#define UA_PARM_CORR_ID		UA_PARM(0x0013,sizeof(uint32_t))
/*
 *  Extension parameters
 */
#define UA_PARM_PROTO_LIMITS	UA_PARM(0x0014,5*sizeof(uint32_t))	/* draft-bidulock-sigtran-sginfo-00 
									 */
#define UA_PARM_ASPEXT		UA_PARM(0x0015,0)	/* draft-bidulock-sigtran-aspext-00 */
#define UA_PARM_LOAD_DIST	UA_PARM(0x0016,sizeof(uint32_t))	/* draft-bidulock-sigtran-loadgrp-00 
									 */
#define UA_PARM_LOAD_SEL	UA_PARM(0x0017,sizeof(uint32_t))	/* draft-bidulock-sigtran-loadsel-00 
									 */

#define UA_ASPEXT_NONE		(0x00)
#define	UA_ASPEXT_LOADSEL	(0x01)
#define UA_ASPEXT_CORID		(0x02)
#define UA_ASPEXT_SESSID	(0x03)
#define	UA_ASPEXT_LOADGRP	(0x04)
#define UA_ASPEXT_REGEXT	(0x05)

/*
 *  Somewhat common field values:
 *  (Updated to m2ua-12, m3ua-11, sua-10).
 */
#define   UA_ECODE_INVALID_VERSION		(0x01)
#define   UA_ECODE_INVALID_IID			(0x02)
#define   UA_ECODE_UNSUPPORTED_MESSAGE_CLASS	(0x03)
#define   UA_ECODE_UNSUPPORTED_MESSAGE_TYPE	(0x04)
#define   UA_ECODE_UNSUPPORTED_TRAFFIC_MODE	(0x05)
#define   UA_ECODE_UNEXPECTED_MESSAGE		(0x06)
#define   UA_ECODE_PROTOCOL_ERROR		(0x07)
#define   UA_ECODE_UNSUPPORTED_IID_TYPE		(0x08)
#define   UA_ECODE_INVALID_STREAM_IDENTIFIER	(0x09)
#define   UA_ECODE_UNASSIGNED_TEI		(0x0a)
#define	  UA_ECODE_UNRECOGNIZED_SAPI		(0x0b)
#define	  UA_ECODE_INVALID_TEI_SAPI_COMBINATION	(0x0c)
#define   UA_ECODE_REFUSED_MANAGEMENT_BLOCKING	(0x0d)
#define   UA_ECODE_ASP_IDENTIFIER_REQUIRED	(0x0e)
#define   UA_ECODE_INVALID_ASP_IDENTIFIER	(0x0f)
#define   UA_ECODE_ASP_ACTIVE_FOR_IIDS		(0x10)
#define  SUA_ECODE_INVALID_ROUTING_CONTEXT	(0x10)
#define	  UA_ECODE_INVALID_PARAMETER_VALUE	(0x11)
#define	  UA_ECODE_PARAMETER_FIELD_ERROR	(0x12)
#define	  UA_ECODE_UNEXPECTED_PARAMETER		(0x13)
#define	  UA_ECODE_DESTINATION_STATUS_UNKNOWN	(0x14)
#define	  UA_ECODE_INVALID_NETWORK_APPEARANCE	(0x15)
#define	  UA_ECODE_MISSING_PARAMETER		(0x16)
#define	  UA_ECODE_ROUTING_KEY_CHANGE_REFUSED	(0x17)
#define	  UA_ECODE_INVALID_LOADSHARING_LABEL	(0x18)
#define	  UA_ECODE_INVALID_ROUTING_CONTEXT	(0x19)
#define	  UA_ECODE_NO_CONFIGURED_AS_FOR_ASP	(0x1a)

#define UA_STATUS_AS_DOWN			(0x00010001)
#define UA_STATUS_AS_INACTIVE			(0x00010002)
#define UA_STATUS_AS_ACTIVE			(0x00010003)
#define UA_STATUS_AS_PENDING			(0x00010004)
#define UA_STATUS_AS_INSUFFICIENT_ASPS		(0x00020001)
#define UA_STATUS_ALTERNATE_ASP_ACTIVE		(0x00020002)
#define UA_STATUS_ASP_FAILURE			(0x00020003)
#define UA_STATUS_AS_MINIMUM_ASPS		(0x00020004)

#define UA_TMODE_OVERRIDE			(0x1)
#define UA_TMODE_LOADSHARE			(0x2)
#define UA_TMODE_BROADCAST			(0x3)

#define UA_RESULT_SUCCESS			(0x00)
#define UA_RESULT_FAILURE			(0x01)

/*
 *  Stuff for generic parm decoding.
 */
typedef struct ua_parm {
	union {
		unsigned char *uptr;	/* address pointer for strings */
		caddr_t cptr;		/* address pointer for strings */
		uint32_t *wptr;		/* word pointer for fields */
	} u;
	size_t num;			/* occurences in messgae */
	size_t len;			/* length in message in bytes */
	uint32_t val;			/* value of first uint32_t */
} parm_t;

#define UA_PARM_BASE 0x0001
typedef struct ua_parms {
	parm_t iid;
	parm_t iid_range;
	parm_t iid_text;
	parm_t info;
	parm_t apc;
	parm_t rc;
	parm_t diag;
	parm_t iid_range1;
	parm_t hbdata;
	parm_t reason;
	parm_t tmode;
	parm_t ecode;
	parm_t status;
	parm_t prot_data;
	parm_t rel_reason;
	parm_t tei_status;
	parm_t aspid;
	parm_t corr_id;
#define UA_PARM_MAX 18
} ua_parms_t;

struct msg_class {
	int (**farr) (queue_t *, mblk_t *);
	uint last;
};

static inline int ua_find_parm(mblk_t * mp, uint32_t phdr, parm_t * parm)
{
	/* 
	 *  FIXME: Write this function.  Scan the message for the first
	 *  occurence of the specified parameter.
	 */
	fixme(("Write this function\n"));
	return (-EFAULT);
}

/*
 *  =========================================================================
 *
 *  UA --> UA Peer Messages
 *
 *  =========================================================================
 *  These are UA -> UA Peer send message functions.  They normally take a
 *  queue on which to generate a bufcall if they are unsuccessful, an
 *  indication of the queue on which to send the message, and some of the
 *  extra parameter of the message as arguments.  All of thsee messages
 *  utilize the bufcall procedures above to generate buffer calls if they
 *  cannot allocate the necessary buffer.
 *
 *  Note that these messages are also appropriate for placing on SS7-U read
 *  queues and SS7-P write queues.  The SS7-U or SS7-P read or write queue
 *  service routines wll translate the UA message into SS7 primitives before
 *  forwarding them outside the multiplexor.
 */
/*
 *  ERR
 *  -----------------------------------
 */
static inline int ua_reply_err(queue_t * q, queue_t * oq, uint ecode, uint32_t * rc, uint32_t * apc,
			       uint32_t * na, mblk_t * dp)
{
	mblk_t *mp;
	size_t dlen = dp ? min(40, dp->b_wptr - dp->b_rptr) : 0;
	size_t mlen = 16 + rc ? 8 : 0 + apc ? 8 : 0 + na ? 8 : 0 + dlen ? 4 + dlen : 0;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_DATA;
		*((uint32_t *) mp->b_wptr)++ = UA_MGMT_ERR;
		*((uint32_t *) mp->b_wptr)++ = htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_ECODE;
		*((uint32_t *) mp->b_wptr)++ = htonl(ecode);
		if (rc) {
			*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
			*((uint32_t *) mp->b_wptr)++ = *rc;
		}
		if (apc) {
			*((uint32_t *) mp->b_wptr)++ = UA_PARM_APC;
			*((uint32_t *) mp->b_wptr)++ = *apc;
		}
#if 0
		if (na) {
			*((uint32_t *) mp->b_wptr)++ = M3UA_PARM_NA;
			*((uint32_t *) mp->b_wptr)++ = *na;
		}
#else
		(void) na;
#endif
		if (dlen) {
			*((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_DIAG, dlen);;
			bcopy(dp->b_rptr, mp->b_wptr, dlen);
			mp->b_wptr += dlen;
		}
		putq(oq, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  NOREPLY ERR
 *  -----------------------------------
 */
static inline int ua_noreply_err(queue_t * q, uint ecode, uint32_t * rc, uint32_t * apc,
				 uint32_t * na, mblk_t * dp)
{
	(void) q;
	(void) ecode;
	(void) rc;
	(void) apc;
	(void) na;
	return (-EPROTO);
}

/*
 *  SEND NTFY
 *  -----------------------------------
 *  Sends a notification to a spcific ASP.
 */
static inline int ua_send_ntfy(queue_t * q, queue_t * oq, uint * rc, uint * aspid, uint status)
{
	mblk_t *mp;
	size_t mlen = 16 + (rc ? 8 : 0) + (aspid ? 8 : 0);
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_DATA;
		*((uint32_t *) mp->b_wptr)++ = UA_MGMT_NTFY;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_STATUS;
		*((uint32_t *) mp->b_wptr)++ = htonl(status);
		if (rc) {
			*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
			*((uint32_t *) mp->b_wptr)++ = htonl(*rc);
		}
		if (aspid) {
			*((uint32_t *) mp->b_wptr)++ = UA_PARM_ASPID;
			*((uint32_t *) mp->b_wptr)++ = htonl(*aspid);
		}
		putq(oq, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  NTFY AS CHANGE
 *  -----------------------------------
 *  Notifies all of the ASPs not in the ASP_DOWN (or unregistered) state with
 *  respect to an Application Server of an Application Server state change.
 */
static inline int ua_ntfy_as_change(queue_t * q, as_t * as, uint status)
{
	int err;
	gp_t *gp;
	trace();
	for (gp = as->gp; gp; gp = gp->xp.next) {
		if ((1 << gp->state) & ~(ASM_DOWN_STATES | ASM_UREG_STATES)) {
			queue_t *oq = gp->xp.xp->pp.pp->wq;
			if ((err = ua_send_ntfy(q, oq, &gp->rc, NULL, status)))
				return (err);
		}
	}
	return (0);
}

/*
 *  SEND ASPUP REQ
 *  -----------------------------------
 *  Send an ASPUP Request to an SGP.
 *
 *  TODO: We probably want to add the option to include UA_PARM_ASPEXT
 *  parameter in this message to support draft-bidulock-sigtran-aspext-00.txt.
 */
static inline int ua_send_aspup_req(queue_t * q, uint32_t aspid)
{
	mblk_t *mp;
	static const size_t mlen = 16;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPUP_REQ;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_ASPID;
		*((uint32_t *) mp->b_wptr)++ = htonl(aspid);
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPUP ACK
 *  -----------------------------------
 *  Send an ASPUP Ack to an ASP.
 *
 *  TODO: We probably want to add the option to include UA_PARM_ASPEXT
 *  parameter in this message to support draft-bidulock-sigtran-aspext-00.txt.
 */
static inline int ua_send_aspup_ack(queue_t * q, uint32_t aspid)
{
	mblk_t *mp;
	static const size_t mlen = 16;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPUP_ACK;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_ASPID;
		*((uint32_t *) mp->b_wptr)++ = htonl(aspid);
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPDN REQ
 *  -----------------------------------
 *  Send an ASPDN Req to an SGP.
 */
static inline int ua_send_aspdn_req(queue_t * q)
{
	mblk_t *mp;
	static const size_t mlen = 8;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPDN_REQ;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPDN ACK
 *  -----------------------------------
 *  Send an ASPDN Ack to an ASP.
 */
static inline int ua_send_aspdn_ack(queue_t * q)
{
	mblk_t *mp;
	static const size_t mlen = 8;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPDN_ACK;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND BEAT REQ
 *  -----------------------------------
 *  Send a BEAT Request to an UA peer.
 */
static inline int ua_send_hbeat_req(queue_t * q)
{
	(void) q;
	fixme(("SWERR: Unimplemented function\n"));
	return (-EFAULT);
}

/*
 *  SEND HBEAT ACK
 *  -----------------------------------
 *  Send a BEAT Ack to an UA peer.
 */
static inline int ua_send_hbeat_ack(queue_t * q, caddr_t hptr, size_t hlen)
{
	mblk_t *mp;
	size_t mlen = 8 + hlen ? 4 + UA_PAD4(hlen) : 0;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPS_HBEAT_ACK;
		*((uint32_t *) mp->b_wptr)++ = htonl(mlen);
		if (hlen) {
			*((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_HBDATA, hlen);
			bcopy(hptr, mp->b_wptr, hlen);
			mp->b_wptr += hlen;
			bzero(mp->b_wptr, UA_PAD4(hlen) - hlen);
			mp->b_wptr += UA_PAD4(hlen) - hlen;
		}
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPAC REQ
 *  -----------------------------------
 *  Send an ASPAC Request to an SGP.
 *
 *  TODO:  We probably want to add some optional extension paraemers to this
 *  message to support a number of extension drafts.
 */
static inline int ua_send_aspac_req(queue_t * q, queue_t * oq, uint32_t tmode, uint32_t rc)
{
	mblk_t *mp;
	static const size_t mlen = 24;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_DATA;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPAC_REQ;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_TMODE;
		*((uint32_t *) mp->b_wptr)++ = htonl(tmode);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
		*((uint32_t *) mp->b_wptr)++ = htonl(rc);
		putq(oq, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPAC ACK
 *  -----------------------------------
 *  Send an ASPAC Ack to an ASP.
 *
 *  TODO:  We probably want to add some optional extension paraemers to this
 *  message to support a number of extension drafts.
 */
static inline int ua_send_aspac_ack(queue_t * q, queue_t * oq, uint32_t tmode, uint32_t rc)
{
	mblk_t *mp;
	static const size_t mlen = 24;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_DATA;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPAC_ACK;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_TMODE;
		*((uint32_t *) mp->b_wptr)++ = htonl(tmode);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
		*((uint32_t *) mp->b_wptr)++ = htonl(rc);
		putq(oq, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPIA REQ
 *  -----------------------------------
 *  Send an ASPIA Request to an SGP.
 */
static inline int ua_send_aspia_req(queue_t * q, queue_t * oq, uint32_t rc)
{
	mblk_t *mp;
	static const size_t mlen = 16;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_DATA;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPIA_REQ;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
		*((uint32_t *) mp->b_wptr)++ = htonl(rc);
		putq(oq, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND ASPIA ACK
 *  -----------------------------------
 *  Send an ASPIA Ack to an ASP.
 */
static inline int ua_send_aspia_ack(queue_t * q, queue_t * oq, uint32_t rc)
{
	mblk_t *mp;
	static const size_t mlen = 16;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_DATA;
		*((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPIA_ACK;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
		*((uint32_t *) mp->b_wptr)++ = htonl(rc);
		putq(oq, mp);
		return (0);
	}
	return (-ENOBUFS);
}

#if 0
/*
 *  SEND REG REQ
 *  -----------------------------------
 *  Send a REG Request to an SGP.
 */
static inline int ua_send_reg_req(queue_t * q, as_t * as)
{
	mblk_t *mp;
	mtp_addr_t *rk = as->rk;
	static const size_t klen = 44;
	static const size_t mlen = 8 + klen;
	trace();
	ensure(rk, return -EFAULT);
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_RKMM_REG_REQ;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PHDR(M3UA_PARM_ROUTING_KEY, klen);
		*((uint32_t *) mp->b_wptr)++ = M3UA_PARM_LOC_KEY_ID;
		*((uint32_t *) mp->b_wptr)++ = (uint32_t) as;
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_TMODE;
		*((uint32_t *) mp->b_wptr)++ = htonl(as->tmode);
		*((uint32_t *) mp->b_wptr)++ = M3UA_PARM_DPC;
		*((uint32_t *) mp->b_wptr)++ = htonl(rk->pc);
		*((uint32_t *) mp->b_wptr)++ = M3UA_PARM_NA;
		*((uint32_t *) mp->b_wptr)++ = htonl(rk->ni);
		*((uint32_t *) mp->b_wptr)++ = UA_PHDR(M3UA_PARM_NA, 1);
		*((uint32_t *) mp->b_wptr)++ = htonl(rk->si << 24);
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}
#endif
/*
 *  SEND REG RSP
 *  -----------------------------------
 *  Send a REG Response to an ASP.
 */
static inline int ua_send_reg_rsp(queue_t * q)
{
	(void) q;
	fixme(("SWERR: Unimplemented function\n"));
	return (-EFAULT);
}

/*
 *  SEND DEREG REQ
 *  -----------------------------------
 *  Send a DEREG Request to an SGP.
 */
static inline int ua_send_dereg_req(queue_t * q, uint32_t rc)
{
	mblk_t *mp;
	static const size_t mlen = 16;
	trace();
	if ((mp = ua_allocb(q, mlen, BPRI_MED))) {
		mp->b_datap->db_type = M_CTL;
		*((uint32_t *) mp->b_wptr)++ = UA_RKMM_DEREG_REQ;
		*((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen);
		*((uint32_t *) mp->b_wptr)++ = UA_PARM_RC;
		*((uint32_t *) mp->b_wptr)++ = htonl(rc);
		putq(q, mp);
		return (0);
	}
	return (-ENOBUFS);
}

/*
 *  SEND DEREG RSP
 *  -----------------------------------
 *  Send a DEREG Response to an ASP.
 */
static inline int ua_send_dereg_rsp(queue_t * q)
{
	(void) q;
	fixme(("SWERR: Unimplemented function\n"));
	return (-EFAULT);
}

#endif				/* __UA_MSGS_H__ */


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

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

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