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


File /code/strss7/drivers/m3ua/m3ua.c



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

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

#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 "m3ua.h"
#include "m3ua_data.h"

/*
 *  M3UA MULTIPLEXOR
 *  -------------------------------------------------------------------------
 *  This is a multiplexing driver for M3UA.  When M3UA 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 MTP Provider.  OpenSS7 MTP Provider
 *  streams are I_LINKed and I_PLINKed under the multiplexor for Signalling
 *  Gateway (SG) Use by the M3UA control stream or M3UA user stream.  MTP
 *  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 M3UA_DESCRIP	"M3UA STREAMS MULTIPLEXING DRIVER."
#define M3UA_COPYRIGHT	"Copyright (c) 1997-2002 OpenSS7 Corp.  All Rights Reserved."
#define M3UA_DEVICE	"Part of the OpenSS7 Stack for LiS STREAMS."
#define M3UA_CONTACT	"Brian Bidulock <bidulock@openss7.org>"
#define M3UA_LICENSE	"GPL"
#define M3UA_BANNER	M3UA_DESCRIP	"\n" \
			M3UA_COPYRIGHT	"\n" \
			M3UA_DEVICE	"\n" \
			M3UA_CONTACT	"\n"

#ifdef MODULE
MODULE_AUTHOR(M3UA_CONTACT);
MODULE_DESCRIPTION(M3UA_DESCRIP);
MODULE_SUPPORTED_DEVICE(M3UA_DEVICE);
#ifdef MODULE_LICENSE
MODULE_LICENSE(M3UA_LICENSE);
#endif
#define MODULE_STATIC static
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#endif
/*
 *  =========================================================================
 *
 *  STREAMS Definitions
 *
 *  =========================================================================
 */

static struct module_info m3ua_minfo = {
	0,				/* Module ID number */
	"m3ua",				/* 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 m3ua_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) */
	&m3ua_minfo,			/* Information */
	NULL				/* Statistics */
};

static struct qinit m3ua_winit = {
	ua_wput,			/* Write put (msg from above) */
	ua_wsrv,			/* Write queue service */
	NULL,				/* Each open */
	NULL,				/* Last close */
	NULL,				/* Admin (not used) */
	&m3ua_minfo,			/* Information */
	NULL				/* Statistics */
};

MODULE_STATIC struct streamtab m3ua_info = {
	&m3ua_rinit,			/* Upper read queue */
	&m3ua_winit,			/* Upper write queue */
	&m3ua_rinit,			/* Lower read queue */
	&m3ua_winit			/* Lower write queue */
};

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

static dp_t *m3ua_opens_list = NULL;
static lp_t *m3ua_links_list = NULL;

static struct ua_driver m3ua_dinfo = {
	M3UA_CMAJOR,			/* Major device number */
	M3UA_CMINOR,			/* Number of minor devices */
	sizeof(mtp_t),			/* Private structure size */
	NULL,				/* Current control queue */
	&m3ua_lmq_u_ops,		/* LMQ User operations */
	&m3ua_ss7_u_ops,		/* SS7 User operations */
	&m3ua_opens_list,		/* Opened structures list */
	&m3ua_links_list		/* LInked structures list */
};

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

static m3ua_initialized = 0;

#ifndef LIS_REGISTERED
static inline void m3ua_init(void)
#else
__initfunc(void m3ua_init(void))
#endif
{
	if (m3ua_initialized)
		return;
	m3ua_initialized = 1;
	printk(KERN_INFO M2UA_BANNER);	/* console splash */
#ifndef LIS_REGISTERED
	if (lis_register_strdev(M2UA_CMAJOR, &m3ua_info, M2UA_NMINOR, m3ua_minfo.mi_idname) < 0) {
		cmn_err(CE_NOTE, "m3ua: couldn't register driver!\n");
		m3ua_minfo.mi_idnum = 0;
	}
	m3ua_minfo.mi_idnum = M2UA_CMAJOR;
#endif
	m3ua_driver = &m3ua_dinfo;
}

#ifndef LIS_REGISTERED
static inline void m3ua_terminate(void)
#else
__initfunc(void m3ua_terminate(void))
#endif
{
	if (!m3ua_initialized)
		return;
	m3ua_initialized = 0;
#ifndef LIS_REGISTERED
	if (m3ua_minfo.mi_idnum)
		if (lis_unregister_strdev(m3ua_minfo.mi_idnum) < 0)
			cmn_err(CE_WARN, "m3ua: couldn't unregister driver!\n");
#endif
	m3ua_driver = NULL;
}

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

#ifdef MODULE
int init_module(void)
{
	m3ua_init();
	return (0);
}
void cleanup_module(void)
{
	m3ua_terminate();
	return;
}
#endif


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

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

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