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


File /code/strss7/drivers/m2ua/m2ua.c



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

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

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

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

#include "m2ua.h"
#include "m2ua_data.h"

/*
 *  M2UA MULTIPLEXOR
 *  -------------------------------------------------------------------------
 *  This is a multiplexing driver for M2UA.  When M2UA 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 SL Provider.  OpenSS7 SL Provider
 *  streams are I_LINKed and I_PLINKed under the multiplexor for Signalling
 *  Gateway (SG) Use by the M2UA control stream or M2UA user stream.  SL
 *  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 M2UA_DESCRIP	"M2UA STREAMS MULTIPLEXING DRIVER."
#define M2UA_COPYRIGHT	"Copyright (c) 1997-2002 OpenSS7 Corporation.  All Rights Reserved."
#define M2UA_DEVICE	"Part of the OpenSS7 Stack for LiS STREAMS."
#define M2UA_CONTACT	"Brian Bidulock <bidulock@openss7.org>"
#define M2UA_LICENSE	"GPL"
#define M2UA_BANNER	M2UA_DESCRIP	"\n" \
			M2UA_COPYRIGHT	"\n" \
			M2UA_DEVICES	"\n" \
			M2UA_CONTACT	"\n"

#ifdef MODULE
MODULE_AUTHOR(M2UA_CONTACT);
MODULE_DESCRIPTION(M2UA_DESCRIP);
MODULE_SUPPORTED_DEVICE(M2UA_DEVICE);
#ifdef MODULE_LICENSE
MODULE_LICENSE(M2UA_LICENSE);
#endif
#define MODULE_STATIC static
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#define MODULE_STATIC
#endif

/*
 *  =========================================================================
 *
 *  STREAMS Definitions
 *
 *  =========================================================================
 */

static struct module_info m2ua_minfo = {
	M2UA_MODULE_ID,			/* Module ID number */
	"m2ua",				/* 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 m2ua_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) */
	&m2ua_minfo,			/* Information */
	NULL				/* Statistics */
};

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

MODULE_STATIC struct streamtab m2ua_info = {
	&m2ua_rinit,			/* Upper read queue */
	&m2ua_winit,			/* Upper write queue */
	&m2ua_rinit,			/* Lower read queue */
	&m2ua_winit			/* Lower write queue */
};

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

static dp_t *m2ua_opens_list = NULL;
static lp_t *m2ua_links_list = NULL;

static struct ua_driver m2ua_dinfo = {
	M2UA_CMAJOR,			/* Major device number */
	M2UA_NMINOR,			/* Number of minor devices */
	sizeof(sl_t),			/* Private structure size */
	NULL,				/* Current control queue */
	&m2ua_lmq_u_ops,		/* LMQ User operations */
	&m2ua_ss7_u_ops,		/* SS7 User operations */
	&m2ua_opens_list,		/* Opened structures list */
	&m2ua_links_list		/* Linked structures list */
};

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

static m2ua_initialized = 0;

#ifndef LIS_REGISTERED
static inline void m2ua_init(void)
#else
__initfunc(void m2ua_init(void))
#endif
{
	if (m2ua_initialized)
		return;
	m2ua_initialized = 1;
	printk(KERN_INFO M2UA_BANNER);	/* console splash */
#ifndef LIS_REGISTERED
	if (lis_register_strdev(M2UA_CMAJOR, &m2ua_info, M2UA_NMINOR, m2ua_minfo.mi_idname) < 0) {
		cmn_err(CE_NOTE, "m2ua: couldn't register module!\n");
		m2ua_minfo.mi_idnum = 0;
	}
	m2ua_minfo.mi_idnum = M2UA_CMAJOR;
#endif
	m2ua_driver = &m2ua_dinfo;
}

#ifndef LIS_REGISTERED
static inline void m2ua_terminate(void)
#else
__initfunc(void m2ua_terminate(void))
#endif
{
	if (!m2ua_initialized)
		return;
	m2ua_initialized = 0;
#ifndef LIS_REGISTERED
	if (m2ua_minfo.mi_idnum)
		if (lis_unregister_strdev(m2ua_minfo.mi_idnum) < 0)
			cmn_err(CE_WARN, "m2ua: couldn't unregister module!\n");
#endif
	m2ua_driver = NULL;
}

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

#ifdef MODULE
int init_module(void)
{
	m2ua_init();
	return (0);
}
void cleanup_module(void)
{
	m2ua_terminate();
	return;
}
#endif


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

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

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