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_input.c


File /code/strss7/drivers/tcap/tcap_input.c



#ident "@(#) $RCSfile: tcap_input.c,v $ $Name:  $($Revision: 0.8.2.2 $) $Date: 2003/04/03 19:51:40 $"

static char const ident[] =
    "$RCSfile: tcap_input.c,v $ $Name:  $($Revision: 0.8.2.2 $) $Date: 2003/04/03 19:51:40 $";

#define __NO_VERSION__

#include <linux/config.h>
#include <linux/version.h>
#ifdef MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/module.h>

#include <sys/stream.h>
#include <sys/stropts.h>
#include <sys/cmn_err.h>

#include "../debug.h"
#include "../bufq.h"

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

#include "tcap.h"
#include "tcap_data.h"
#include "tcap_msgs.h"
#include "tcap_prov.h"

/*
 *  =========================================================================
 *
 *  TCAP INPUT EVENT State Machines
 *
 *  =========================================================================
 *  These functions take an input msg at the TCAP stream and run the state
 *  machine associated with the TCAP stream.  These are the Transaction (TR)
 *  Sub-Layer services.
 */
/*
 *  TCAP_MT_UNI
 *  -----------------------------------
 */
static int tcap_i_uni(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_uni_ind_t *p;
	N_unitdata_ind_t *s = (N_unitdata_ind_t *) msg->b_cont->b_rptr;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) tcap;
	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_UNI_IND and follow with any TC_XXX_IND component
	 *  indications.
	 */
	if (!(mp = allocb(sizeof(*p), BPRI_MED)))
		return (-ENOBUFS);
	p = (TC_uni_ind_t *) mp->b_wptr;
	mp->b_datap->db_type = M_PROTO;
	p->PRIM_type = TC_UNI_IND;
	p->SRC_length = s->SRC_length;
	p->SRC_offset = s->SRC_length ? sizeof(*p) : 0;
	p->DEST_length = s->DEST_length;
	p->DEST_offset = s->DEST_length ? sizeof(*p) + s->SRC_length : 0;
	p->QOS_length = 0;
	p->QOS_offset = 0;
	p->CONTEXT_length = FIXME;
	p->CONTEXT_offset = FIXME;
	p->DIALOG_id = 0;
	p->COMP_flags = (m->parms & TCAP_PTF_CSEQ) ? 1 : 0;
	mp->b_wptr += sizeof(*p);

	return (0);
}

/*
 *  TCAP_MT_QWP
 *  -----------------------------------
 */
static int tcap_i_qwp(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_begin_ind_t *p;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) p;
	(void) mp;
	(void) m;
	(void) tcap;
	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_BEG_IND and follow with any TC_XXX_IND component
	 *  indications.
	 */
	return (0);
}

/*
 *  TCAP_MT_QWOP
 *  -----------------------------------
 */
static int tcap_i_qwop(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_begin_ind_t *p;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) p;
	(void) mp;
	(void) m;
	(void) tcap;

	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_BEG_IND and follow with any TC_XXX_IND component
	 *  indications.
	 */
	return (0);
}

/*
 *  TCAP_MT_CWP
 *  -----------------------------------
 */
static int tcap_i_cwp(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_begin_res_t *p1;
	TC_cont_ind_t *p2;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) p1;
	(void) p2;
	(void) mp;
	(void) m;
	(void) tcap;
	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_BEG_RES or TC_CONT_IND and follow with any TC_XXX_IND
	 *  component indications.
	 */
	return (0);
}

/*
 *  TCAP_MT_CWOP
 *  -----------------------------------
 */
static int tcap_i_cwop(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_begin_res_t *p1;
	TC_cont_ind_t *p2;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) p1;
	(void) p2;
	(void) mp;
	(void) m;
	(void) tcap;
	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_BEG_RES or TC_CONT_IND and follow with any TC_XXX_IND
	 *  component indications.
	 */
	return (0);
}

/*
 *  TCAP_MT_RESP
 *  -----------------------------------
 */
static int tcap_i_resp(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_end_ind_t *p;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) p;
	(void) mp;
	(void) m;
	(void) tcap;
	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_END_IND and follow with any TC_XXX_IND component
	 *  indications.
	 */
	return (0);
}

/*
 *  TCAP_MT_ABORT
 *  -----------------------------------
 */
static int tcap_i_abort(queue_t * q, mblk_t * msg)
{
	mblk_t *mp;
	TC_abort_ind_t *p;
	tcap_t *tcap = (tcap_t *) q->q_ptr;
	tr_msg_t *m = (tr_msg_t *) msg->b_rptr;
	(void) p;
	(void) mp;
	(void) m;
	(void) tcap;
	/* 
	 *  TODO: process message...
	 *
	 *  Provide a TC_ABORT_IND.
	 */
	return (0);
}

static int (*tcap_i_msgs[]) (queue_t *, mblk_t *) = {
	NULL,			/* (not used) 0 - (not used) */
	    tcap_i_uni,		/* TCAP_MT_UNI 1 - Unidirectional */
	    tcap_i_qwp,		/* TCAP_MT_QWP 2 - Query w/ permission */
	    tcap_i_qwop,	/* TCAP_MT_QWOP 3 - Query w/o permission */
	    tcap_i_cwp,		/* TCAP_MT_CWP 4 - Conversation w/ permission */
	    tcap_i_cwop,	/* TCAP_MT_CWOP 5 - Conversation w/o permission */
	    tcap_i_resp,	/* TCAP_MT_RESP 6 - Response */
	    tcap_i_abort	/* TCAP_MT_ABORT 7 - Abort */
};
static inline int tcap_i_proto(queue_t * q, mblk_t * mp)
{
	tr_msg_t *m = (tr_msg_t *) mp->b_rptr;
	return (*tcap_i_msgs[m->type]) (q, mp);
}

/*
 *  =========================================================================
 *
 *  QUEUE PUT and SERVICE routines
 *
 *  =========================================================================
 */
/*
 *  READ SERVICE (Message from below as input to TCAP State Machines)
 *  -------------------------------------------------------------------------
 */
int tcap_u_r_prim(queue_t * q, mblk_t * mp)
{
	switch (mp->b_datap->db_type) {
	case M_PROTO:
	case M_PCPROTO:
		return tcap_i_proto(q, mp);
	case M_FLUSH:
		return tcap_r_flush(q, mp);
	}
	return (5);
}


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

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

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