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/ua/lm.c


File /code/strss7/drivers/ua/lm.c



#ident "@(#) $RCSfile: lm.c,v $ $Name:  $($Revision: 0.8.2.4 $) $Date: 2003/04/14 12:13:55 $"

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

#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 <ss7/ua_lm.h>
#include <ss7/ua_lm_ioctl.h>

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

#include "lm.h"
#include "lm_data.h"

/*
 *  SIGTRAN UA/LM MULTIPLEXOR
 *  -------------------------------------------------------------------------
 *  THis is a multiplexing driver for UA/LM.  When the UA/LM is opened by its
 *  control stream (typically a ua configuration daemon), it provides a
 *  control channel for configuration and routing.  Transport streams
 *  (typically SCTP) are I_LINKed or I_PLINKed under the multiplexor for
 *  either Application Server Process (ASP) or Signalling Gateway Process
 *  (SGP) use.
 */

#define LM_DESCRIP	"SIGTRAN UA/LM STREAMS MULTIPLEXING DRIVER."
#define LM_COPYRIGHT	"Copyright (c) 1997-2002 OpenSS7 Corporation.  All Rights Reserved."
#define LM_DEVICE	"Part of the OpenSS& Stack for LiS STREAMS."
#define LM_CONTACT	"Brian Bidulock <bidulock@openss7.org>"
#define LM_LICENSE	"GPL"
#define LM_BANNER	LM_DESCRIP	"\n" \
			LM_COPYRIGHT	"\n" \
			LM_DEVICE	"\n" \
			LM_CONTACT	"\n"

#ifdef MODULE
MODULE_AUTHOR(LM_CONTACT);
MODULE_DESCRIPTION(LM_DESCRIP);
MODULE_SUPPORTED_DEVICE(LM_DEVICE);
#ifdef MODULE_LICENSE
MODULE_LICENSE(LM_LICENSE);
#endif
#define MODULE_STATIC static
#else
#define MOD_INC_USE_COUNT
#define MOD_DEC_USE_COUNT
#define MODULE_STATIC
#endif

/*
 *  =========================================================================
 *
 *  STREAMS Definition
 *
 *  =========================================================================
 */

/*
 *  STREAMS Definitions for UA/LM streams.
 */
static struct module_info lm_minfo = {
	LM_MODULE_ID,			/* Module ID number */
	"lm",				/* 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 lm_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) */
	&lm_minfo,			/* Information */
	NULL				/* Statistics */
};
static struct qinit lm_winit = {
	ua_wput,			/* Read put (msg from below) */
	ua_wsrv,			/* Read queue service */
	NULL,				/* Each open */
	NULL,				/* Last close */
	NULL,				/* Admin (not used) */
	&lm_minfo,			/* Information */
	NULL				/* Statistics */
};
MODULE_STATIC struct streamtab lm_info = {
	&lm_rinit,			/* Upper read queue */
	&lm_winit,			/* Upper write queue */
	&lm_rinit,			/* Lower read queue */
	&lm_winit			/* Lower write queue */
};

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

static struct ua_driver lm_dinfo = {
	LM_CMAJOR,			/* Major device number */
	LM_NMINOR,			/* Minor device number */
	sizeof(lm_t),			/* Private structure size */
	NULL,				/* Private structure cache */
	NULL,				/* Current control queue */
	NULL,				/* Opened structures list */
	NULL,				/* Linked structures list */
	&lm_lmq_u_ops,			/* LMQ User operations */
	NULL				/* SS7 User operations */
};

/*
 *  =========================================================================
 *
 *  LiS STREAM INITIALIZATION
 *
 *  =========================================================================
 */
static int lm_initialized = 0;

#ifndef LIS_REGISTERED
static inline int lm_init(void)
#else
__initfunc(int lm_init(void))
#endif
{
	int err;
	if (lm_initialized)
		return (0);
	lm_initialized = 1;
	cmn_err(CE_NOTE, LM_BANNER);	/* console splash */
#ifndef LIS_REGISTERED
	if ((err = lis_register_strdev(LM_CMAJOR, &lm_info, LM_NMINOR, lm_minfo.mi_idname)) < 0) {
		cmn_err(CE_WARN, "lm: couldn't register driver!\n");
		return (err);
	}
#endif
	ua_driver = &lm_dinfo;
	return (0);
}

#ifndef LIS_REGISTERED
static inline void lm_terminate(void)
#else
__initfunc(void lm_terminate(void))
#endif
{
	if (!lm_initialized)
		return;
	lm_initialized = 0;
#ifndef LIS_REGISTERED
	if (lis_unregister_strdev(LM_CMAJOR) < 0)
		cmn_err(CE_WARN, "lm: couldn't unregsiter driver!\n");
#endif
	ua_driver = NULL;
}

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

#ifdef MODULE
int init_module(void)
{
	return lm_init();
}
void cleanup_module(void)
{
	lm_terminate();
}
#endif


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

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

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