📄 layer4.c
字号:
/********************************************************************16**
(c) COPYRIGHT 1989-2005 by
Continuous Computing Corporation.
All rights reserved.
This software is confidential and proprietary to Continuous Computing
Corporation (CCPU). No part of this software may be reproduced,
stored, transmitted, disclosed or used in any form or by any means
other than as expressly provided by the written Software License
Agreement between CCPU and its licensee.
CCPU warrants that for a period, as provided by the written
Software License Agreement between CCPU and its licensee, this
software will perform substantially to CCPU specifications as
published at the time of shipment, exclusive of any updates or
upgrades, and the media used for delivery of this software will be
free from defects in materials and workmanship. CCPU also warrants
that has the corporate authority to enter into and perform under the
Software License Agreement and it is the copyright owner of the software
as originally delivered to its licensee.
CCPU MAKES NO OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY OR FITNESS FOR
A PARTICULAR PURPOSE WITH REGARD TO THIS SOFTWARE, SERVICE OR ANY RELATED
MATERIALS.
IN NO EVENT SHALL CCPU BE LIABLE FOR ANY INDIRECT, SPECIAL,
CONSEQUENTIAL DAMAGES, OR PUNITIVE DAMAGES IN CONNECTION WITH OR ARISING
OUT OF THE USE OF, OR INABILITY TO USE, THIS SOFTWARE, WHETHER BASED
ON BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE), PRODUCT
LIABILITY, OR OTHERWISE, AND WHETHER OR NOT IT HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
Restricted Rights Legend
This software and all related materials licensed hereby are
classified as "restricted computer software" as defined in clause
52.227-19 of the Federal Acquisition Regulation ("FAR") and were
developed entirely at private expense for nongovernmental purposes,
are commercial in nature and have been regularly used for
nongovernmental purposes, and, to the extent not published and
copyrighted, are trade secrets and confidential and are provided
with all rights reserved under the copyright laws of the United
States. The government's rights to the software and related
materials are limited and restricted as provided in clause
52.227-19 of the FAR.
IMPORTANT LIMITATION(S) ON USE
The use of this software is limited to the use set
forth in the written Software License Agreement between CCPU and
its Licensee. Among other things, the use of this software
may be limited to a particular type of Designated Equipment, as
defined in such Software License Agreement.
Before any installation, use or transfer of this software, please
consult the written Software License Agreement or contact CCPU at
the location set forth below in order to confirm that you are
engaging in a permissible use of the software.
Continuous Computing Corporation
9380, Carroll Park Drive
San Diego, CA-92121, USA
Tel: +1 (858) 882 8800
Fax: +1 (858) 777 3388
Email: support@trillium.com
Web: http://www.ccpu.com
*********************************************************************17*/
/********************************************************************20**
Name: layer 4 (TCAP)
Type: C source file
Desc: C source code for SS7/TCAP Primitives.
File: layer4.c
Sid: layer4.c@@/main/9 - Fri Sep 16 02:41:26 2005
Prg: ssk
*********************************************************************21*/
#ifdef L4
/*xqc ADD L4 for map test*/
/* header include files (.h) */
#include "envopt.h" /* environment options */
#include "envdep.h" /* environment dependent */
#include "envind.h" /* environment independent */
#include "gen.h" /* general layer */
#include "ssi.h" /* system services */
#include "cm5.h"
#include "cm_ss7.h"
#include "cm_err.h" /* common error */
#include "stu.h" /* tcap upper interface */
#include "mat.h" /* inap upper interface */
#ifdef MA_FTHA
#include "sht.h"
#endif /* MA_FTHA */
#include "lma.h" /* layer management interface */
#include "ma_acc.h" /* acceptance test defines */
#include "ma.h"
#include "ma_err.h" /* error defines */
#include "ma_mf.h"
#ifdef ZJ
#include "cm_ftha.h" /* Common FTHA */
#include "cm_pftha.h" /* Common PSF defines */
#include "cm_psfft.h"
#include "cm_tupsf.h" /* Common TCAP user PSF */
#include "zj_acc.h" /* Inap Acceptance Test */
#endif /* ZJ */
/* header/extern include files (.x) */
#include "gen.x" /* general layer */
#include "ssi.x" /* system services */
#include "cm5.x"
#include "cm_ss7.x" /* Common */
#include "cm_lib.x" /* Common library headers */
#include "stu.x" /* tcap upper interface */
#include "lma.x" /* layer management interface */
#include "mat.x" /* inap upper interface */
#ifdef MA_FTHA
#include "sht.x"
#endif /* MA_FTHA */
#ifdef ZJ
#include "cm_ftha.x" /* Common FTHA */
#include "cm_pftha.x" /* Common PSF defines */
#include "cm_psfft.x"
#include "cm_tupsf.x" /* Common TCAP user PSF */
#endif
#include "ma.x"
#include "ma_acc.x" /* acceptance test defines */
/* local externs */
EXTERN MaAccCb maAccCb; /* MAP Acceptance test control block */
PUBLIC Data msg_buffer[]={0x28, 0x16, 0x06, 0x07, 0x04, 0x00, 0x00, 0x01, 0x01, 0x03, 0x01, 0xa0, 0x0b, 0x30, 0x09, 0x06, 0x07, 0x04, 0x00, 0x00, 0x01, 0x00, 0x2b, 0x03,};
/* If true L4 will ignore all the primitives from the upper layer,
else it will route them back. */
PUBLIC Bool l4Ignore = FALSE;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
/*
*
* Fun: TCAP User Bind Request
*
* Desc: This function binds an Upper Layer Entity to the TCAP
* Layer software. The TCAP layer software will register this
* new User and will allocate a Service Access Point for this
* bind. With this function both Entities will exchange ids to
* their respective Control Blocks which will be used for this
* bind.
*
* Ret: ROK - ok
*
* Notes: None
*
* File: layer4.c
*
*/
#ifdef ANSI
PUBLIC S16 StUiStuBndReq
(
Pst *pst, /* Post structure */
SuId suId, /* service user id */
SpId spId, /* service provider (TCAP) id */
Ssn ssn /* sub system number */
)
#else
PUBLIC S16 StUiStuBndReq(pst, suId, spId, ssn)
Pst *pst; /* Post Structure */
SuId suId; /* service user id */
SpId spId; /* service provider (TCAP) id */
Ssn ssn; /* sub system number */
#endif
{
Txt prntBuf[MA_PRNTBUF_SIZE];
Pst newPst;
TRC3(StUiStuBndReq)
MAACCPRINT((prntBuf, "StUiStuBndReq: suId(%d), spId(%d), ssn(%d)\n",
suId, spId, ssn));
if (l4Ignore == TRUE)
RETVALUE (ROK);
cmCopy ((U8 *)pst, (U8 *)&newPst, sizeof(Pst));
maSwapPst(&newPst);
(Void)StUiStuBndCfm(&newPst, suId, CM_BND_OK);
RETVALUE(ROK);
} /* end of StUiStuBndReq */
/*
*
* Fun: TCAP User Unbind Request
*
* Desc: This function unbinds a TCAP SAP from an Upper Layer Entity
*
* Ret: ROK - ok
*
* Notes: None
*
* File: layer4.c
*
*/
#ifdef ANSI
PUBLIC S16 StUiStuUbndReq
(
Pst *pst, /* Post structure */
SpId spId, /* service provider (TCAP) id */
Reason reason
)
#else
PUBLIC S16 StUiStuUbndReq(pst, spId, reason)
Pst *pst; /* Post Structure */
SpId spId; /* service provider (TCAP) id */
Reason reason;
#endif
{
Txt prntBuf[MA_PRNTBUF_SIZE];
TRC3(StUiStuUbndReq)
UNUSED(pst);
MAACCPRINT((prntBuf, "StUiStuUbndReq: spId(%d), reason(%d)\n",
spId, reason));
RETVALUE(ROK);
} /* end of StUiStuUbndReq */
/*
*
* Fun: TCAP Data Request
*
* Desc: Request to send a TCAP Message for structured dialogue
*
* Ret: ROK - ok
*
* Notes: This is the entry point for all of the TCAP message types
* except Uni type.
*
* File: layer4.c
*
*/
#ifdef ANSI
PUBLIC S16 StUiStuDatReq
(
Pst *pst, /* Post structure */
SpId spId, /* service provider id */
U8 msgType, /* TCAP message type */
StDlgId suDlgId, /* service user dialog id */
StDlgId spDlgId, /* service provider dialogue id */
SpAddr *dstAddr, /* SCCP destination address - if needed */
SpAddr *srcAddr, /* SCCP source address - if needed */
Bool endFlag, /* If true then pre-arranged termination */
StQosSet *qos, /* Quality of Service set for SCCP */
StDlgEv *dlgEv, /* tcap dialog portion event */
#ifdef STUV2
StDataParam *dataParam, /* Data parameter */
#endif /* STUV2 */
Buffer *uiBuf /* User info buffer */
)
#else
#ifdef STUV2
PUBLIC S16 StUiStuDatReq(pst, spId, msgType, suDlgId, spDlgId, dstAddr, srcAddr, endFlag, qos, dlgEv, dataParam, uiBuf)
#else
PUBLIC S16 StUiStuDatReq(pst, spId, msgType, suDlgId, spDlgId, dstAddr, srcAddr, endFlag, qos, dlgEv, uiBuf)
#endif
Pst *pst; /* Post structure */
SpId spId; /* service provider id */
U8 msgType; /* TCAP message type */
StDlgId suDlgId; /* service user dialog id */
StDlgId spDlgId; /* service provider dialogue id */
SpAddr *dstAddr; /* SCCP destination address - if needed */
SpAddr *srcAddr; /* SCCP source address - if needed */
Bool endFlag; /* If true then pre-arranged termination */
StQosSet *qos; /* Quality of Service set for SCCP */
StDlgEv *dlgEv; /* tcap dialog portion event */
#ifdef STUV2
StDataParam *dataParam; /* Data Parameter */
#endif /* STUV2 */
Buffer *uiBuf; /* User info buffer */
#endif
{
Txt prntBuf[200];
MaAccCmpQElm *cmpElm;
U16 dlgIdx;
U16 dDlgIdx;
Bool compFlag;
StOctet pAbtCause;
U16 qSize;
U16 i;
TRC2(StUiStuDatReq)
MAACCPRINT((prntBuf,"\n link %d - MsgType %d, SuDlgId %5ld SpDlgId %5ld\n",
spId, msgType, suDlgId, spDlgId));
/* Find the dialogue control point */
if (maAccFndDlgCp(spId, suDlgId, 0, &dlgIdx)==RFAILED)
{
if (maAccFndDlgCp(spId, 0, spDlgId, &dlgIdx)==RFAILED)
{
/* Dialogue not found */
if (uiBuf)
{
SPutMsg(uiBuf);
}
RETVALUE(RFAILED);
}
}
/* Check If the message is to be loopbacked */
if (maAccCb.curTst.loopBack)
{
/* If Pre-arranged end then don't loopback the message */
if ((msgType == STU_END) && (endFlag == TRUE))
{
(Void) maAccFlushCmpQ(dlgIdx);
if (uiBuf)
{
SPutMsg(uiBuf);
}
RETVALUE(ROK);
}
if ((msgType == STU_ABORT) && (maAccCb.curTst.id == MA_TSTID_597))
{
(Void) maAccFlushCmpQ(dlgIdx);
if (uiBuf)
{
SPutMsg(uiBuf);
}
RETVALUE(ROK);
}
/* Swap the post structure to direct the message back to MAP */
maSwapPst(pst);
/* Change the spId to inject the message at another SAP */
if (maAccSwapSpId(&spId) != ROK)
{
/* Sap Id is not recognized, drop the message request */
if (uiBuf)
{
SPutMsg(uiBuf);
}
RETVALUE(RFAILED);
}
/* Find the dialogue control point */
if (maAccFndDlgCp(spId, 0, maAccCb.dlgCp[dlgIdx].dstDlgId, &dDlgIdx))
{
/* Dialogue not found */
if (uiBuf)
{
SPutMsg(uiBuf);
}
RETVALUE(RFAILED);
}
if(msgType != STU_ABORT)
{
/* Now store the MAP dialogue id as the destination id in the
destination dialogue control point */
maAccCb.dlgCp[dDlgIdx].dmaDlgId = suDlgId;
}
/* Now get the number of component requests stored in the queue */
(Void) maAccGetCmpQSize(dlgIdx, &qSize);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -