OpenSS7 SS7 for the Common Man |
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |
||||||||||||||||||||||||||
Home | Overview | Status | News | Documentation | Resources | About | |||||||||||||||||||||
File /code/strss7/drivers/sl/sl.c#ident "@(#) $RCSfile: sl.c,v $ $Name: $($Revision: 0.8.2.2 $) $Date: 2003/04/14 12:13:23 $" static char const ident[] = "$RCSfile: sl.c,v $ $Name: $($Revision: 0.8.2.2 $) $Date: 2003/04/14 12:13:23 $"; /* * This is an SL multiplexing driver for SS7 Signalling Links. Its intention * is to support the pooling and dynamic allocation of Signalling Terminals * and Signalling Data Links. It also provides a common reference * architecture for Signalling Terminals/Data Links of all hardware and * software varieties (including Style 1 and Style 2) and provides this * common reference into MTP. * * This multiplexing driver is opened and SDT/SDL streams are I_LINKed under * the driver by the SL User or I_PLINKed under the driver by the SL control * stream for use by SL users. SL Users are associated with lower SDT/SDL * streams for module reporting and configuration management. * * This multiplexing driver also provides common Signalling Link state * machines and buffering per Q.703/ANSI T1.111.3 where necessary. It also * provides interface to SSCOP streams for Q.2140 MTP3b operation and M2PA * or M2UA streams. It gathers statistics and provides mangement * notification in a common manner for all these interfaces. * * Also included is a Dynamic Allocation stream. The purpose of this stream * is to process Dynamic Allocation of Signalling Terminal and Signalling * Data Link rkequests, permitting either a local or remote user-level * Dynamic Allocation server. Signalling links requiring dynamic allocation * consult the server on this stream. */ #define SL_DESCRIP "SL STREAMS MULTIPLEXING DRIVER." #define SL_COPYRIGHT "Copyright (c) 1997-2002 OpenSS7 Corporation. All Rights Reserved." #define SL_DEVICE "Part of the OpenSS7 Stack for LiS STREAMS." #define SL_CONTACT "Brian Bidulock <bidulock@openss7.org>" #define SL_LICENSE "GPL" #define SL_BANNER SL_DESCRIP "\n" \ SL_COPYRIGHT "\n" \ SL_DEVICE "\n" \ SL_CONTACT "\n" #ifdef MODULE MODULE_AUTHOR(SL_CONTACT); MODULE_DESCRIPTION(SL_DESCRIP); MODULE_SUPPORTED_DEVICE(SL_DEVICE); #ifdef MODULE_LICENSE MODULE_LICENSE(SL_LICENSE); #endif #define MODULE_STATIC static #else #define MOD_INC_USE_COUNT #define MOD_DEC_USE_COUNT #define MODULE_STATIC #endif #ifdef SL_DEBUG static int sl_debug = SL_DEBUG; #else static int sl_debug = 2; #endif #ifndef SL_CMAJOR #define SL_CMAJOR 249 #endif #define SL_NMINOR 255 #define SL_MODULE_ID ('s'<<24|'s'<<16|'7'<<8|SL_IOC_MAGIC) #ifdef LIS_2_12 #define INT int #else #define INT void #endif /* * ========================================================================= * * STREAMS Definitions * * ========================================================================= */ static struct module_info sccp_minfo = { SL_MODULE_ID, /* Module ID number */ "sl", /* Module name */ 1, /* Min packet size accepted *//* XXX */ 272, /* Max Packet size accepted *//* XXX */ 8 * 512, /* Hi water mark *//* XXX */ 1 * 512 /* Lo water mark *//* XXX */ }; static int sl_open(queue_t *, dev_t *, int, int, cred_t *); static int sl_close(queue_t *, int, cred_t *); static INT sl_u_rsrv(queue_t *); static INT sl_u_wput(queue_t *, mblk_t *); static INT sl_u_wsrv(queue_t *); static struct qinit sl_u_rinit = { NULL, /* Read put (msg from below) */ sl_u_rsrv, /* Read queue service */ sl_open, /* Each open */ sl_close, /* Last close */ NULL, /* Admin (not used) */ &sl_minfo, /* Information */ NULL /* Statistics */ }; static struct qinit sl_u_winit = { sl_u_wput, /* Write put (msg from below) */ sl_u_wsrv, /* Write queue service */ NULL, /* Each open */ NULL, /* Last close */ NULL, /* Admin (not used) */ &sl_minfo, /* Information */ NULL /* Statistics */ }; static INT sl_l_wsrv(queue_t *); static INT sl_l_rput(queue_t *, mblk_t *); static INT sl_l_rsrv(queue_t *); static struct qinit sl_l_winit = { NULL, /* Write put (msg from below) */ sl_l_wsrv, /* Write queue service */ NULL, /* Each open */ NULL, /* Last close */ NULL, /* Admin (not used) */ &sl_minfo, /* Information */ NULL /* Statistics */ }; static struct qinit sl_l_rinit = { sl_l_rput, /* Read put (msg from below) */ sl_l_rsrv, /* Read queue service */ NULL, /* Each open */ NULL, /* Last close */ NULL, /* Admin (not used) */ &sl_minfo, /* Information */ NULL /* Statistics */ }; MODULE_STATIC struct streamtab sl_info = { &sl_u_rinit, /* Upper read queue */ &sl_u_winit, /* Upper write queue */ &sl_l_rinit, /* Lower read queue */ &sl_l_winit /* Lower write queue */ }; /* * ========================================================================= * * SL Private Structures * * ========================================================================= */ //#include "sl_data.h" struct sl; struct sdt; typedef struct sl { struct sl *next; /* list of all SL-Users */ struct sl **prev; /* list of all SL-Users */ queue_t *q; /* associated read queue */ dev_t devid; /* device id at open */ uint state; /* interface state */ } sl_t; typedef struct sdt { struct sdt *next; /* list of all SDT-Providers */ struct sdt **prev; /* list of all SDT-Providers */ queue_t *q; /* associated read queue */ dev_t muxid; /* multiplexor id at link */ uint state; /* interface state */ } sdt_t; /* * ========================================================================= * * SL Message Structures * * ========================================================================= */ //#include "sl_msg.h" /* * This includes messages which are used for data link connection orders for * the automatic allocation of signalling data links. */ #define ......... /* * ========================================================================= * * Module --> Module Control Messages * * ========================================================================= */ static inline mblk_t *m_error(int r_error, int w_error) { mblk_t *mp; if ((mp = allocb(2, BPRI_HI))) { mp->b_datap->db_type = M_ERROR; *(mp->b_wptr++) = r_error; *(mp->b_rptr++) = w_error; } return (mp); } static inline mblk_t *m_hangup(void) { mblk_t *mp; if ((mp = allocb(0, BPRI_HI))) { mp->b_datap->db_type = M_HANGUP; } return (mp); } static inline mblk_t *m_flush(int flags, int band) { mblk_t *mp; if ((mp = allocb(2, BPRI_HI))) { mp->b_datap->db_type = M_FLUSH; *(mp->b_wptr)++ = flags; *(mp->b_wptr)++ = band; } return (mp); } /* * ========================================================================= * * SL --> SL-User (Upstream Primitives send upstream) * * ========================================================================= */ #include "../dlpi/dlpi_prov.h" /* * DL_INFO_ACK 0x03 * ----------------------------------------------------------------- */ static inline mblk_t *user_info_ack(queue_t * q) { } /* * DL_BIND_ACK 0x04 * ----------------------------------------------------------------- */ static inline mblk_t *user_bind_ack(queue_t * q) { sl_t *sl = (sl_t *) q->q_ptr; return dl_bind_ack(sl->sap, sl->cons, (caddr_t) & sl->add, sizeof(sl->add), 0); } /* * DL_ERROR_ACK 0x05 * ----------------------------------------------------------------- */ static inline mblk_t *user_error_ack(int prim, int err) { return dl_error_ack(prim, err); } /* * DL_OK_ACK 0x06 * ----------------------------------------------------------------- */ static inline mblk_t *user_ok_ack(int prim) { return dl_ok_ack(prim); } /* * DL_CONNECT_IND 0x0e * ----------------------------------------------------------------- */ static inline mblk_t *user_connect_ind(uint corr, uint32_t lpc, uint32_t apc, N_qos_sel_sl_t * qos) { return dl_connect_ind(corr, (caddr_t) & lpc, sizeof(lpc), (caddr_t) & apc, sizeof(apc), (caddr_t) qos, sizeof(*qos)); } /* * DL_CONNECT_CON 0x10 * ----------------------------------------------------------------- */ static inline mblk_t *user_connect_con(uint32_t apc, N_qos_sel_sl_t * qos) { return dl_connect_con((caddr_t) & apc, sizeof(apc), (caddr_t) qos, sizeof(*qos)); } /* * DL_TOKEN_ACK 0x12 * ----------------------------------------------------------------- */ static inline mblk_t *user_token_ack(uint token) { return dl_token_ack(token); } /* * DL_DISCONNECT_IND 0x14 * ----------------------------------------------------------------- */ static inline mblk_t *user_disconnect_ind(uint orig, uint reason, uint corr) { return dl_disconnect_ind(orig, reason, corr); } /* * DL_RESET_IND 0x18 * ----------------------------------------------------------------- */ static inline mblk_t *user_reset_ind(uint orig, uint reason) { return dl_reset_ind(uint orig, uint reason); } /* * DL_RESET_CON 0x1a * ----------------------------------------------------------------- */ static inline mblk_t *user_reset_con(void) { return dl_reset_con(); } /* * DL_SUBS_BIND_ACK 0x1c * ----------------------------------------------------------------- */ static inline mblk_t *user_subs_bind_ack(uint32_t sap) { return dl_subs_bind_ack((caddr_t) & sap, sizeof(sap)); } /* * DL_XID_IND 0x2a * ----------------------------------------------------------------- */ static inline mblk_t *user_xid_ind(uint32_t dpc, uint32_t opc, mblk_t * dp) { return dl_xid_ind(0, (caddr_t) & dpc, sizeof(dpc), (caddr_t) & opc, sizeof(opc), dp); } /* * DL_XID_CON 0x2c * ----------------------------------------------------------------- */ static inline mblk_t *user_xid_con(uint32_t dpc, uint32_t opc, mblk_t * dp) { return dl_xid_con(0, (caddr_t) & dpc, sizeof(dpc), (caddr_t) & opc, sizeof(opc), dp); } /* * DL_TEST_IND 0x2e * ----------------------------------------------------------------- */ static inline mblk_t *user_test_ind(uint32_t dpc, uint32_t opc, mblk_t * dp) { return dl_test_ind(0, (caddr_t) & dpc, sizeof(dpc), (caddr_t) & opc, sizeof(opc), dp); } /* * DL_TEST_CON 0x30 * ----------------------------------------------------------------- */ static inline mblk_t *user_test_con(uint32_t dpc, uint32_t opc, mblk_t * dp) { return dl_test_con(0, (caddr_t) & dpc, sizeof(dpc), (caddr_t) & opc, sizeof(opc), dp); } /* * ========================================================================= * * SL --> SDT (Downstream Primitives sent downstream) * * ========================================================================= */ #include "../cdi/cdi_user.h"
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |