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/tcap/tcap_prov.h


File /code/strss7/drivers/tcap/tcap_prov.h



#ifndef __TCAP_PROV_H__
#define __TCAP_PROV_H__

#ident "@(#) $RCSfile: tcap_prov.h,v $ $Name:  $($Revision: 0.8.2.1 $) $Date: 2002/10/18 02:29:53 $"

#include "../../include/ss7/tcap.h"

/*
 *  =========================================================================
 *
 *  TCAP --> TCAP-User (Upstream Primitives sent upstream)
 *
 *  =========================================================================
 */

#define FIXME 0

/*
 *  TC_INFO_ACK      12 - Information acknowledgement
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_info_ack(void)
{
	mblk_t *mp;
	TC_info_ack_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_info_ack_t *) mp->b_wptr;
		p->PRIM_type = TC_INFO_ACK;
		p->TSDU_size = FIXME;	/* maximum TSDU size */
		p->ETSDU_size = FIXME;	/* maximum ETSDU size */
		p->CDATA_size = FIXME;	/* connect data size */
		p->DDATA_size = FIXME;	/* discon data size */
		p->ADDR_size = FIXME;	/* address size */
		p->ADDR_length = FIXME;	/* address length */
		p->ADDR_offset = FIXME;	/* address offset */
		p->QOS_length = FIXME;	/* QOS values length */
		p->QOS_offset = FIXME;	/* QOS values offset */
		p->QOS_range_length = FIXME;	/* length of QOS values' range */
		p->QOS_range_offset = FIXME;	/* offset of QOS values' range */
		p->OPTIONS_flags = FIXME;	/* bit masking for options supported */
		p->TIDU_size = FIXME;	/* transaction i/f data unit size */
		p->SERV_type = FIXME;	/* service type */
		p->CURRENT_state = FIXME;	/* current state */
		p->PROVIDER_type = FIXME;	/* type of TR provider */
		p->TODU_size = FIXME;	/* optimal TSDU size */
		p->PROTOID_length = FIXME;	/* length of bound protocol ids */
		p->PROTOID_offset = FIXME;	/* offset of bound protocol ids */
		p->TRPI_version = FIXME;	/* version # of trpi that is supported */
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_BIND_ACK      13 - Bound to network address
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_bind_ack(uint cons, ulong token,
				  caddr_t add_ptr, size_t add_len, caddr_t pro_ptr, size_t pro_len)
{
	mblk_t *mp;
	TC_bind_ack_t *p;
	if ((mp = allocb(sizeof(*p) + add_len + pro_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_bind_ack_t *) mp->b_wptr;
		p->PRIM_type = TC_BIND_ACK;
		p->ADDR_length = add_len;
		p->ADDR_offset = add_len ? sizeof(*p) : 0;
		p->XACT_number = cons;
		p->TOKEN_value = token;
		p->PROTOID_length = pro_len;
		p->PROTOID_offset = pro_len ? sizeof(*p) + add_len : 0;
		mp->b_wptr += sizeof(*p);
		bcopy(add_ptr, mp->b_wptr, add_len);
		mp->b_wptr += add_len;
		bcopy(pro_ptr, mp->b_wptr, pro_len);
		mp->b_wptr += pro_len;
	}
	return (mp);
}

/*
 *  TC_OK_ACK        15 - Success acknowledgement
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_ok_ack(int prim)
{
	mblk_t *mp;
	TC_ok_ack_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_ok_ack_t *) mp->b_wptr;
		p->PRIM_type = TC_OK_ACK;
		p->CORRECT_prim = prim;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_ERROR_ACK     16 - Error acknowledgement
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_error_ack(int prim, int err)
{
	mblk_t *mp;
	TC_error_ack_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_error_ack_t *) mp->b_wptr;
		p->PRIM_type = TC_ERROR_ACK;
		p->ERROR_prim = prim;
		p->TRPI_error = err < 0 ? TCSYSERR : err;
		p->UNIX_error = err < 0 ? -err : 0;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_OPTMGMT_ACK   17 - Optionas management acknowledgement
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_optmgmt_ack(uint flags, caddr_t opt_ptr, size_t opt_len)
{
	mblk_t *mp;
	TC_optmgmt_ack_t *p;
	if ((mp = allocb(sizeof(*p) + opt_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_optmgmt_ack_t *) mp->b_wptr;
		p->PRIM_type = TC_OPTMGMT_ACK;
		p->OPT_length = opt_len;
		p->OPT_offset = opt_len ? sizeof(*p) : 0;
		p->MGMT_flags = flags;
		mp->b_wptr += sizeof(*p);
		bcopy(opt_ptr, mp->b_wptr, opt_len);
		mp->b_wptr += opt_len;
	}
	return (mp);
}

/*
 *  TC_UNI_IND       18 - Unidirectional indication
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_uni_ind(ulong id, uint flags,
				 caddr_t src_ptr, size_t src_len,
				 caddr_t dst_ptr, size_t dst_len,
				 caddr_t qos_ptr, size_t qos_len,
				 caddr_t ctx_ptr, size_t ctx_len, mblk_t * dp)
{
	mblk_t *mp;
	TC_uni_ind_t *p;
	if ((mp = allocb(sizeof(*p) + src_len + dst_len + qos_len + ctx_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_uni_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_UNI_IND;
		p->SRC_length = src_len;
		p->SRC_offset = src_len ? sizeof(*p) : 0;
		p->DEST_length = dst_len;
		p->DEST_offset = dst_len ? sizeof(*p) + src_len : 0;
		p->QOS_length = qos_len;
		p->QOS_offset = qos_len ? sizeof(*p) + src_len + dst_len : 0;
		p->CONTEXT_length = ctx_len;
		p->CONTEXT_offset = ctx_len ? sizeof(*p) + src_len + dst_len + qos_len : 0;
		p->DIALOG_id = id;
		p->COMP_flags = flags;
		mp->b_wptr += sizeof(*p);
		bcopy(src_ptr, mp->b_wptr, src_len);
		mp->b_wptr += src_len;
		bcopy(dst_ptr, mp->b_wptr, dst_len);
		mp->b_wptr += dst_len;
		bcopy(qos_ptr, mp->b_wptr, qos_len);
		mp->b_wptr += qos_len;
		bcopy(ctx_ptr, mp->b_wptr, ctx_len);
		mp->b_wptr += ctx_len;
		mp->b_cont = dp;
	}
	return (mp);
}

/*
 *  TC_BEGIN_IND     19 - Begin transaction indication
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_begin_ind(ulong id, uint flags,
				   caddr_t src_ptr, size_t src_len,
				   caddr_t dst_ptr, size_t dst_len,
				   caddr_t qos_ptr, size_t qos_len,
				   caddr_t ctx_ptr, size_t ctx_len, mblk_t * dp)
{
	mblk_t *mp;
	TC_begin_ind_t *p;
	if ((mp = allocb(sizeof(*p) + src_len + dst_len + qos_len + ctx_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_begin_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_BEGIN_IND;
		p->SRC_length = src_len;
		p->SRC_offset = src_len ? sizeof(*p) : 0;
		p->DEST_length = dst_len;
		p->DEST_offset = dst_len ? sizeof(*p) + src_len : 0;
		p->QOS_length = qos_len;
		p->QOS_offset = qos_len ? sizeof(*p) + src_len + dst_len : 0;
		p->CONTEXT_length = ctx_len;
		p->CONTEXT_offset = ctx_len ? sizeof(*p) + src_len + dst_len + qos_len : 0;
		p->DIALOG_id = id;
		p->COMP_flags = flags;
		mp->b_wptr += sizeof(*p);
		bcopy(src_ptr, mp->b_wptr, src_len);
		mp->b_wptr += src_len;
		bcopy(dst_ptr, mp->b_wptr, dst_len);
		mp->b_wptr += dst_len;
		bcopy(qos_ptr, mp->b_wptr, qos_len);
		mp->b_wptr += qos_len;
		bcopy(ctx_ptr, mp->b_wptr, ctx_len);
		mp->b_wptr += ctx_len;
		mp->b_cont = dp;
	}
	return (mp);
}

/*
 *  TC_BEGIN_CON     20 - Begin transaction confirmation-Continue
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_begin_con(ulong id, uint flags,
				   caddr_t qos_ptr, size_t qos_len,
				   caddr_t ctx_ptr, size_t ctx_len, mblk_t * dp)
{
	mblk_t *mp;
	TC_begin_con_t *p;
	if ((mp = allocb(sizeof(*p) + qos_len + ctx_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_begin_con_t *) mp->b_wptr;
		p->PRIM_type = TC_BEGIN_CON;
		p->QOS_length = qos_len;
		p->QOS_offset = qos_len ? sizeof(*p) : 0;
		p->CONTEXT_length = ctx_len;
		p->CONTEXT_offset = ctx_len ? sizeof(*p) + qos_len : 0;
		p->DIALOG_id = id;
		p->COMP_flags = flags;
		mp->b_wptr += sizeof(*p);
		bcopy(qos_ptr, mp->b_wptr, qos_len);
		mp->b_wptr += qos_len;
		bcopy(ctx_ptr, mp->b_wptr, ctx_len);
		mp->b_wptr += ctx_len;
		mp->b_cont = dp;
	}
	return (mp);
}

/*
 *  TC_CONT_IND      21 - Continue transaction indication
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_cont_ind(ulong id, uint flags, caddr_t qos_ptr, size_t qos_len)
{
	mblk_t *mp;
	TC_cont_ind_t *p;
	if ((mp = allocb(sizeof(*p) + qos_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_cont_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_CONT_IND;
		p->QOS_length = qos_len;
		p->QOS_offset = qos_len ? sizeof(*p) : 0;
		p->DIALOG_id = id;
		p->COMP_flags = flags;
		mp->b_wptr += sizeof(*p);
		bcopy(qos_ptr, mp->b_wptr, qos_len);
		mp->b_wptr += qos_len;
	}
	return (mp);
}

/*
 *  TC_END_IND       22 - End transaction indication
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_end_ind(ulong id, uint flags,
				 caddr_t qos_ptr, size_t qos_len,
				 caddr_t ctx_ptr, size_t ctx_len, mblk_t * dp)
{
	mblk_t *mp;
	TC_end_ind_t *p;
	if ((mp = allocb(sizeof(*p) + qos_len + ctx_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_end_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_END_IND;
		p->QOS_length = qos_len;
		p->QOS_offset = qos_len ? sizeof(*p) : 0;
		p->CONTEXT_length = ctx_len;
		p->CONTEXT_offset = ctx_len ? sizeof(*p) + qos_len : 0;
		p->DIALOG_id = id;
		p->COMP_flags = flags;
		mp->b_wptr += sizeof(*p);
		bcopy(qos_ptr, mp->b_wptr, qos_len);
		mp->b_wptr += qos_len;
		bcopy(ctx_ptr, mp->b_wptr, ctx_len);
		mp->b_wptr += ctx_len;
		mp->b_cont = dp;
	}
	return (mp);
}

/*
 *  TC_ABORT_IND     23 - TC-User abort indication
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_abort_ind(ulong id, uint orig, uint reason,
				   caddr_t qos_ptr, size_t qos_len,
				   caddr_t ctx_ptr, size_t ctx_len, mblk_t * dp)
{
	mblk_t *mp;
	TC_abort_ind_t *p;
	if ((mp = allocb(sizeof(*p) + qos_len + ctx_len, BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_abort_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_ABORT_IND;
		p->QOS_length = qos_len;
		p->QOS_offset = qos_len ? sizeof(*p) : 0;
		p->CONTEXT_length = ctx_len;
		p->CONTEXT_offset = ctx_len ? sizeof(*p) + qos_len : 0;
		p->DIALOG_id = id;
		p->ABORT_reason = reason;
		p->ORIGINATOR = orig;
		mp->b_wptr += sizeof(*p);
		bcopy(qos_ptr, mp->b_wptr, qos_len);
		mp->b_wptr += qos_len;
		bcopy(ctx_ptr, mp->b_wptr, ctx_len);
		mp->b_wptr += ctx_len;
		mp->b_cont = dp;
	}
	return (mp);
}

/*
 *  TC_NOTICE_IND    24 - Network Service Provider notice
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_notice_ind(ulong id, uint cause)
{
	mblk_t *mp;
	TC_notice_ind_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_notice_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_NOTICE_IND;
		p->DIALOG_id = id;
		p->REPORT_cause = cause;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_INVOKE_IND    32 - Invocation of an operation
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_invoke_ind(ulong id, uint opclass, uint iid, uint lid, uint op, uint more)
{
	mblk_t *mp;
	TC_invoke_ind_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_invoke_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_INVOKE_IND;
		p->DIALOG_id = id;
		p->OP_class = opclass;
		p->INVOKE_id = iid;
		p->LINKED_id = lid;
		p->OPERATION = op;
		p->MORE_flag = more;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_RESULT_IND    33 - Result of a successful operation
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_result_ind(ulong id, uint iid, uint op, uint more)
{
	mblk_t *mp;
	TC_result_ind_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_result_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_RESULT_IND;
		p->DIALOG_id = id;
		p->INVOKE_id = iid;
		p->OPERATION = op;
		p->MORE_flag = more;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_ERROR_IND     34 - Error reply to an invoked operation
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_error_ind(ulong id, uint iid, uint ecode)
{
	mblk_t *mp;
	TC_error_ind_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_error_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_ERROR_IND;
		p->DIALOG_id = id;
		p->INVOKE_id = iid;
		p->ERROR_code = ecode;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_CANCEL_IND    35 - Termination of an operation invocation
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_cancel_ind(ulong id, uint iid)
{
	mblk_t *mp;
	TC_cancel_ind_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_cancel_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_CANCEL_IND;
		p->DIALOG_id = id;
		p->INVOKE_id = iid;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

/*
 *  TC_REJECT_IND    36 - Rejection of a component
 *  -------------------------------------------------------------------------
 */
static inline mblk_t *tc_reject_ind(ulong id, uint iid, uint orig, uint pcode)
{
	mblk_t *mp;
	TC_reject_ind_t *p;
	if ((mp = allocb(sizeof(*p), BPRI_MED))) {
		mp->b_datap->db_type = M_PROTO;
		p = (TC_reject_ind_t *) mp->b_wptr;
		p->PRIM_type = TC_REJECT_IND;
		p->DIALOG_id = id;
		p->INVOKE_id = iid;
		p->ORIGINATOR = orig;
		p->PROBLEM_code = pcode;
		mp->b_wptr += sizeof(*p);
	}
	return (mp);
}

#endif				/* __TCAP_PROV_H__ */


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

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

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