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/tua/tua.c


File /code/strss7/drivers/tua/tua.c



#ident "@(#) $RCSfile: tua.c,v $ $Name:  $($Revision: 0.8.2.3 $) $Date: 2003/04/14 12:13:52 $"

static char const ident[] =
    "$RCSfile: tua.c,v $ $Name:  $($Revision: 0.8.2.3 $) $Date: 2003/04/14 12:13:52 $";

#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 "tua.h"
#include "tua_data.h"

/*
 *  TUA MULTIPLEXOR
 *  -------------------------------------------------------------------------
 *  This is a multiplexing driver for TUA.  When TUA is opened by its control
 *  stream (typically a ua configuration daemon), it provides a control
 *  channel for configuration and routing.  When opened normally, by a user
 *  process, it provides an OpenSS7 TCAP Provider.  OpenSS7 TCAP Provider
 *  streams are I_LINKed and I_PLINKed under the multiplexor for Signalling
 *  Gateway (SG) Use by the TUA control stream or TUA user stream.  TCAP
 *  Provider streams can be opened for Application Server (AS) use.  Transport
 *  streams (typically SCTP) are I_LINKed or I_PLINKed under the multiplexor
 *  for both SG and AS use by the UA/LM control stream.
 */

#define TUA_DESCRIP	"TUA STREAMS MULTIPLEXING DRIVER."
#define TUA_COPYRIGHT	"Copyright (c) 1997-2002 OpenSS7 Corporation.  All Rights Reserved."
#define TUA_DEVICE	"Part of the OpenSS7 Stack for LiS STREAMS."
#define TUA_CONTACT	"Brian Bidulock <bidulock@openss7.org>"
#define TUA_LICENSE	"GPL"
#define TUA_BANNER	TUA_DESCRIP	"\n" \
			TUA_COPYRIGHT	"\n" \
			TUA_DEVICE	"\n" \
			TUA_CONTACT	"\n"

#ifdef MODULE
MODULE_AUTHOR(TUA_CONTACT);
MODULE_DESCRIPTION(TUA_DESCRIP);
MODULE_SUPPORTED_DEVICE(TUA_DEVICE);
#ifdef MODULE_LICENSE
MODULE_LICENSE(TUA_LICENSE);
#endif
#define MODULE_STATIC static
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#define MODULE_STATIC
#endif

static struct module_info tua_minfo = {
	TUA_MODULE_ID,			/* Module ID number */
	"tua",				/* Module name */
	1,				/* Min packet size accepted *//* XXX */
	512,				/* Max packet size accepted *//* XXX */
	8 * 512,			/* Hi water mark *//* XXX */
	1 * 512				/* Lo water mark *//* XXX */
};
static struct qinit tua_rinit = {
	ua_rput,			/* Read put (msg from below) */
	ua_rsrv,			/* Read queue service */
	ua_open,			/* Each open */
	ua_close,			/* Last close */
	NULL,				/* Admin (not used) */
	&tua_minfo,			/* Information */
	NULL				/* Statistics */
};
static struct qinit tua_winit = {
	ua_wput,			/* Write put (msg from above) */
	ua_wsrv,			/* Write queue service */
	NULL,				/* Each open */
	NULL,				/* Last close */
	NULL,				/* Admin (not used) */
	&tua_minfo,			/* Information */
	NULL				/* Statistics */
};
MODULE_STATIC struct streamtab tua_info = {
	&tua_rinit,			/* Upper read queue */
	&tua_winit,			/* Upper write queue */
	&tua_rinit,			/* Lower read queue */
	&tua_winit			/* Lower write queue */
};

/*
 *  =========================================================================
 *
 *  OPEN and CLOSE
 *
 *  =========================================================================
 */

static dp_t *tua_opens_list = NULL;
static lp_t *tua_links_list = NULL;

static struct ua_driver tua_dinfo = {
	TUA_CMAJOR,			/* Major device number */
	TUA_NMINOR,			/* Number of minor devices */
	sizeof(tcap_t),			/* Private structure size */
	NULL,				/* Current control queue */
	&tua_lmq_u_ops,			/* LMQ User operations */
	&tua_ss7_u_ops,			/* SS7 User operations */
	&tua_opens_list,		/* Opened structures list */
	&tua_links_list			/* Linked strcutures list */
};

/*
 *  =========================================================================
 *  
 *  LiS MODULE INITIALIZATION
 *  
 *  =========================================================================
 */

static tua_initialized = 0;

#ifndef LiS_REGISTERED
static inline void tua_init(void)
#else
__initfunc(void tua_init(void))
#endif
{
	if (tua_initialized)
		return;
	printk(KERN_INFO TUA_BANNER);	/* console splash */
#ifndef LIS_REGISTERED
	if (lis_register_strdev(TUA_CMAJOR, &tua_info, TUA_NMINOR, tua_minfo.mi_idname) < 0) {
		cmn_err(CE_NOTE, "tua: couldn't register driver!\n");
		tua_minfo.mi_idnum = 0;
	}
	tua_minfo.mi_idnum = TUA_MODULE_ID;
#endif
	tua_driver = &tua_dinfo;
}

#ifndef LIS_REGISTERED
static inline void tua_terminate(void)
#else
__initfunc(void tua_terminate(void))
#endif
{
	if (!tua_initialized)
		return;
	tua_intialized = 0;
#ifndef LIS_REGISTERED
	if (tua_minfo.mi_idnum)
		if (lis_unregister_strdev(tua_minfo.mi_idnum) < 0)
			cmn_err(CE_WARN, "tua: couldn't unregister driver!\n");
#endif
	tua_driver = NULL;
}

/*
 *  =========================================================================
 *  
 *  LINUX KERNEL MODULE INITIALIZATION
 *  
 *  =========================================================================
 */

#ifdef MODULE
int init_module(void)
{
	tua_init();
	return (0);
}
void cleanup_module(void)
{
	tua_terminate();
	return;
}
#endif


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

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

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