summaryrefslogtreecommitdiffstats
path: root/data/mnet/GP10/Host/jcc
diff options
context:
space:
mode:
Diffstat (limited to 'data/mnet/GP10/Host/jcc')
-rw-r--r--data/mnet/GP10/Host/jcc/Makefile16
-rw-r--r--data/mnet/GP10/Host/jcc/docs/LUDB.docbin0 -> 803840 bytes
-rw-r--r--data/mnet/GP10/Host/jcc/include/JCC_ED.h53
-rw-r--r--data/mnet/GP10/Host/jcc/include/LUDBOamMsgProc.h31
-rw-r--r--data/mnet/GP10/Host/jcc/include/LUDBTimerProc.h28
-rw-r--r--data/mnet/GP10/Host/jcc/include/LUDBVoipMsgProc.h40
-rw-r--r--data/mnet/GP10/Host/jcc/include/LudbHashTbl.h48
-rw-r--r--data/mnet/GP10/Host/jcc/include/LudbLinkedList.h72
-rw-r--r--data/mnet/GP10/Host/jcc/jvc_api/JCCbcCb.cpp377
-rw-r--r--data/mnet/GP10/Host/jcc/jvc_api/JcVctoVc.cpp213
-rw-r--r--data/mnet/GP10/Host/jcc/jvc_api/Makefile52
-rw-r--r--data/mnet/GP10/Host/jcc/jvc_api/viperchannel.cpp247
-rw-r--r--data/mnet/GP10/Host/jcc/src/JCC_ED.cpp397
-rw-r--r--data/mnet/GP10/Host/jcc/src/LUDBMmMsgProc.cpp470
-rw-r--r--data/mnet/GP10/Host/jcc/src/LUDBOamMsgProc.cpp88
-rw-r--r--data/mnet/GP10/Host/jcc/src/LUDBTask.cpp207
-rw-r--r--data/mnet/GP10/Host/jcc/src/LUDBTimerProc.cpp84
-rw-r--r--data/mnet/GP10/Host/jcc/src/LUDBVoipMsgProc.cpp714
-rw-r--r--data/mnet/GP10/Host/jcc/src/Makefile52
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/JCCLog.cpp107
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/JCCTimer.cpp95
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/JCCUtil.cpp97
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/LUDBInstance.cpp774
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/LudbHashTbl.cpp135
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/LudbLinkedList.cpp230
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/Makefile52
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/SubscInfoTest.cpp187
-rw-r--r--data/mnet/GP10/Host/jcc/src_api/ludbapi.cpp949
28 files changed, 5815 insertions, 0 deletions
diff --git a/data/mnet/GP10/Host/jcc/Makefile b/data/mnet/GP10/Host/jcc/Makefile
new file mode 100644
index 0000000..a5965f0
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/Makefile
@@ -0,0 +1,16 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+SUBDIRS= src src_api jvc_api
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+copyall:
+ $(CP) bin\*.out $(TOP_OF_VOB)\bin\*.out \ No newline at end of file
diff --git a/data/mnet/GP10/Host/jcc/docs/LUDB.doc b/data/mnet/GP10/Host/jcc/docs/LUDB.doc
new file mode 100644
index 0000000..38c6f00
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/docs/LUDB.doc
Binary files differ
diff --git a/data/mnet/GP10/Host/jcc/include/JCC_ED.h b/data/mnet/GP10/Host/jcc/include/JCC_ED.h
new file mode 100644
index 0000000..541aa96
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/include/JCC_ED.h
@@ -0,0 +1,53 @@
+#ifndef JCC_ED_H
+#define JCC_ED_H
+
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : JCC_ED.h
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : message and ie interface among Application (Layer 3)
+// modules.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+#include "ril3/ril3_cc_msg.h"
+#include "ril3/ril3_sms_cp.h"
+#include "ril3/ril3_mm_msg.h"
+#include "ril3/ril3_rrm_msg.h"
+#include "ril3/ril3_common.h"
+#include "ril3/ril3_result.h"
+
+#include "lapdm/lapdm_l3intf.h"
+
+extern void CNI_RIL3_ZAPMSG(void *, int length);
+
+extern T_CNI_RIL3_RESULT
+JCC_RIL3CC_Decode(
+ bool isSoftMob,
+ T_CNI_LAPDM_L3MessageUnit *, T_CNI_RIL3CC_MSG *
+);
+
+extern T_CNI_RIL3_RESULT
+JCC_RIL3SMS_Decode (bool isSoftMob, T_CNI_LAPDM_L3MessageUnit *l3MsgUnit,
+ T_CNI_RIL3SMS_CP_MSG *smsMsg );
+
+extern T_CNI_RIL3_RESULT
+JCC_RIL3MM_Decode(
+ bool isSoftMob,
+ T_CNI_LAPDM_L3MessageUnit *, T_CNI_RIL3MM_MSG *
+);
+
+#endif // JCC_ED_H
diff --git a/data/mnet/GP10/Host/jcc/include/LUDBOamMsgProc.h b/data/mnet/GP10/Host/jcc/include/LUDBOamMsgProc.h
new file mode 100644
index 0000000..3daaf21
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/include/LUDBOamMsgProc.h
@@ -0,0 +1,31 @@
+#ifndef LUDBOamMsgProc_H
+#define LUDBOamMsgProc_H
+
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBOamMsgProc.h
+// Author(s) : Kevin Lim
+// Create Date : 09-09-99
+// Description : Ludb module OAM msg handler header
+//
+// *******************************************************************
+
+// *******************************************************************
+// function prototypes
+// *******************************************************************
+
+void ludbHandleOpStChanged(INT32 value);
+void ludbHandleAuthFreqChanged(INT32 value);
+void LUDB_OAM_MsgProc(TrapMsg *trapMsg);
+
+
+#endif // LUDBOamMsgProc_H
diff --git a/data/mnet/GP10/Host/jcc/include/LUDBTimerProc.h b/data/mnet/GP10/Host/jcc/include/LUDBTimerProc.h
new file mode 100644
index 0000000..fc3fc50
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/include/LUDBTimerProc.h
@@ -0,0 +1,28 @@
+#ifndef LudbTimerProc_H
+#define LudbTimerProc_H
+
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LudbTimerProc.h
+// Author(s) : Kevin Lim
+// Create Date : 07-26-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// function prototypes
+// *******************************************************************
+
+void LudbTimerMsgProc(LudbMsgStruct *inMsg);
+
+#endif // LudbTimerProc_H
diff --git a/data/mnet/GP10/Host/jcc/include/LUDBVoipMsgProc.h b/data/mnet/GP10/Host/jcc/include/LUDBVoipMsgProc.h
new file mode 100644
index 0000000..2155921
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/include/LUDBVoipMsgProc.h
@@ -0,0 +1,40 @@
+#ifndef LUDBVoipMsgProc_H
+#define LUDBVoipMsgProc_H
+
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBVoipMsgProc.h
+// Author(s) : Kevin Lim
+// Create Date : 07-31-99
+// Description : Local User Database
+//
+// *******************************************************************
+
+#include "JCC/Ludbapi.h"
+
+bool sendMobileRegReq( T_CNI_RIL3_IE_MOBILE_ID& mobileId, short mmId, short ludbId, short fSec);
+bool sendMobileUnRegReq( T_CNI_RIL3_IE_MOBILE_ID& mobileId, short mmId, short ludbId);
+bool sendMobileSecInfoReq( T_CNI_RIL3_IE_MOBILE_ID& mobileId, short mmId, short ludbId, short fReg);
+void LUDB_VBLINK_RCFMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_RRJMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_UCFMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_URJMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_SPIMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_SRSMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_URQMsgProc(LudbMsgStruct *inMsg);
+void LUDB_VBLINK_MsgProc(LudbMsgStruct *inMsg);
+
+
+#endif // LUDBVoipMsgProc_H
+
+
+
diff --git a/data/mnet/GP10/Host/jcc/include/LudbHashTbl.h b/data/mnet/GP10/Host/jcc/include/LudbHashTbl.h
new file mode 100644
index 0000000..741494d
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/include/LudbHashTbl.h
@@ -0,0 +1,48 @@
+/*********************************************************************/
+/* */
+/* (c) Copyright Cisco 2000 */
+/* All Rights Reserved */
+/* */
+/*********************************************************************/
+
+/*********************************************************************/
+/* */
+/* File : LudbHashTbl.h */
+/* Author(s) : Kevin S. Lim */
+/* Create Date : 03-25-01 copied from GsHashTbl.h */
+/* Description : supports only IMSI(15) or TMSI(4) key */
+/* */
+/*********************************************************************/
+
+#ifndef H_LUDB_HASH_TBL
+#define H_LUDB_HASH_TBL
+
+#include "LudbLinkedList.h"
+
+#define LUDB_DEFAULT_HASH_TBL_LEN 97
+
+class LudbHashTbl
+{
+private:
+ LudbLinkedList *table;
+ int list_len;
+ int key_len;
+
+public:
+ LudbHashTbl();
+ LudbHashTbl(int l_len, int k_len);
+ ~LudbHashTbl();
+
+ int GetListLen() { return list_len; }
+ int GetKeyLen() { return key_len; }
+ virtual int GetHashInd(const void *key);
+ virtual LudbLinkedListItem *find(const void *key, int& hash_ind);
+ virtual LudbLinkedListItem *find(const int value, int& hash_ind);
+ virtual int add(void *key, const int value);
+ virtual int remove(void *key);
+ virtual int remove(int value);
+ virtual void print();
+};
+
+#endif
+
diff --git a/data/mnet/GP10/Host/jcc/include/LudbLinkedList.h b/data/mnet/GP10/Host/jcc/include/LudbLinkedList.h
new file mode 100644
index 0000000..64e2961
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/include/LudbLinkedList.h
@@ -0,0 +1,72 @@
+/*********************************************************************/
+/* */
+/* (c) Copyright Cisco 2001 */
+/* All Rights Reserved */
+/* */
+/*********************************************************************/
+
+/*********************************************************************/
+/* */
+/* File : LudbLinkedList.h */
+/* Author(s) : Kevin S. Lim */
+/* Create Date : 03-25-01 copy from GsLinkedList.h */
+/* Description : A generic linked list made for hash table entries */
+/* by adding new items to the tail */
+/* It can have two kind of keys: IMSI or TMSI */
+/* IMSI will have 15 bytes characters as digit values */
+/* TMSI will have 32 bit values - unsigned long */
+/* */
+/* Initially we will only use IMSI hash table. */
+/* */
+/*********************************************************************/
+
+#ifndef H_LUDB_LINKED_LIST
+#define H_LUDB_LINKED_LIST
+
+#define LUDB_MAX_LIST_KEY_LEN 20
+#define LUDB_MAX_IMSI_KEY_LEN 15
+#define LUDB_MAX_TMSI_KEY_LEN 4
+
+class LudbLinkedListItem {
+public:
+ LudbLinkedListItem *prev;
+ LudbLinkedListItem *next;
+ int key_len;
+ unsigned char ckey[LUDB_MAX_LIST_KEY_LEN];
+ unsigned long lkey;
+ int value; // value to store, usually other table index
+
+ LudbLinkedListItem();
+ LudbLinkedListItem(const int len, void *key, const int value);
+ ~LudbLinkedListItem();
+ virtual int same_keys(const void *key);
+ virtual void print();
+};
+
+class LudbLinkedList
+{
+private:
+ LudbLinkedListItem *head;
+ LudbLinkedListItem *tail;
+ int num_items;
+ int key_len;
+
+public:
+ LudbLinkedList();
+ LudbLinkedList(int len);
+ ~LudbLinkedList();
+
+ void SetKeyLength(int len);
+ int GetKeyLength() { return key_len; }
+ int GetNumItems() { return num_items; }
+ virtual LudbLinkedListItem *find(const void *key);
+ virtual LudbLinkedListItem *find(const int value);
+ virtual int add(void *key, const int value);
+ virtual int remove(LudbLinkedListItem *item);
+ virtual int remove(void *key);
+ virtual int remove(int value);
+ virtual void print();
+};
+
+#endif
+
diff --git a/data/mnet/GP10/Host/jcc/jvc_api/JCCbcCb.cpp b/data/mnet/GP10/Host/jcc/jvc_api/JCCbcCb.cpp
new file mode 100644
index 0000000..db8eebe
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/jvc_api/JCCbcCb.cpp
@@ -0,0 +1,377 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+#ifndef JCCbcCb_CPP
+#define JCCbcCb_CPP
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+#include "logging\vclogging.h"
+#include "JCC/viperchannel.h"
+#include "JCC/JCCbcCb.h"
+
+
+extern MSG_Q_ID rm_MsgQId;
+
+bool JcMsgRcvBySmscbc(InterRxCbcCbMsg_t *msg)
+{
+ InterTxCbcCbMsg_t ack;
+ int size;
+
+ DBG_FUNC("JcMsgRcvBySMSCBC", RM_LAYER);
+ // DBG_ENTER();
+
+ size = 12 + msg->msgData.size;
+
+ switch (msg->msgType)
+ {
+ JcVipercellId_t origVcId; // origination ViperCell Id
+ UINT32 origVcAddress; // origination ViperCell IP address
+ JcModuleId_t origModuleId; // origination Module Id
+ JcSubId_t origSubId; // optional origination Sub Id
+
+ JcVipercellId_t destVcId; // destination ViperCell Id
+ UINT32 destVcAddress; // destination ViperCell IP address
+ JcModuleId_t destModuleId; // destination Module Id
+ JcSubId_t destSubId; // optional destination Sub Id
+
+ case INTER_SMSCBC_CB_START:
+ case INTER_SMSCBC_CB_STOP:
+ //Calculate the size of the received SMSCBC message
+ size = 12 + msg->msgData.size;
+
+ //Output indication that a SMSCBC message arrived at ViperCell
+ DBG_TRACE("Received SMSCBC message: msgType=%d\n",msg->msgType);
+ DBG_HEXDUMP((unsigned char*)&msg->msgData, size);
+ //Send back acknowledgement to this msg
+ if (msg->msgType==INTER_SMSCBC_CB_START)
+ ack.msgType = INTER_SMSCBC_CB_START_ACK;
+ else if (msg->msgType==INTER_SMSCBC_CB_STOP)
+ ack.msgType = INTER_SMSCBC_CB_STOP_ACK;
+ ack.origVcId = msg->destVcId;
+ ack.origVcAddress = msg->destVcAddress;
+ ack.origModuleId = msg->destModuleId;
+ ack.origSubId = msg->destSubId;
+ ack.destVcId = msg->origVcId;
+ ack.destVcAddress = msg->origVcAddress;
+ ack.destModuleId = msg->origModuleId;
+ ack.destSubId = msg->origSubId;
+ JcMsgSendToSmscbc(&ack);
+ break;
+
+ default:
+ //Output warning that a wrong message is being delivered to RM module
+ DBG_WARNING("WARNING@JcMsgRcvBySmscbc: unsupported SMSCBC msgType=%d\n",
+ msg->msgType);
+ return (false);
+ break;
+ }
+
+ // pass up message to module RM
+ if (ERROR == msgQSend( rm_MsgQId,
+ (char *)&msg->msgData,
+ size,
+ NO_WAIT,
+ MSG_PRI_NORMAL
+ ) )
+ {
+ DBG_ERROR("ERROR@JcMsgRcvBySmscbc: failed in msgQSend, errno=%d\n ",errno);
+ return (false);
+ }
+ else
+ {
+ //DBG_TRACE("INFO@JcMsgRcvBySmscbc: Sent Message from CBC to VC: msgType=%d\n",
+ // msg->msgType);
+ return (true);
+ }
+}
+
+bool
+JcMsgSendToSmscbc(InterTxCbcCbMsg_t *msg)
+{
+ BOOL retVal;
+
+ if ((retVal = ViperChannelSendMessage((unsigned char *)msg,
+ sizeof(struct InterTxCbcCbMsg_t),
+ msg->destVcAddress
+ ))
+ == TRUE)
+ {
+ return(true);
+ }
+ else
+ {
+ return(false);
+ }
+
+}
+
+
+//test command used for pre-CB index verstion
+//void intg_JcSendCbCmd(unsigned char cmdCode,
+// unsigned short msgCode,
+// unsigned short updateNo)
+//{
+// unsigned short hdr12;
+// InterRxCbcCbMsg_t msg;
+// unsigned char buffer[88];
+//
+// switch(cmdCode)
+// {
+// case 0: //Stop sending cur CB message
+// msg.destModuleId = MODULE_SMSCBC;
+// msg.msgType = INTER_SMSCBC_CB_STOP;
+// msg.msgData.module_id = MODULE_SMSCBC;
+// msg.msgData.message_type = INTER_SMSCBC_CB_STOP;
+// msg.msgData.size = 0;
+// msg.msgData.message_id = msgCode;/*Danny, 6/29*/
+// break;
+//
+// default: //Send test CB message to DSP
+// msg.destModuleId = MODULE_SMSCBC;
+// msg.msgType = INTER_SMSCBC_CB_STOP;
+// msg.msgData.module_id = MODULE_SMSCBC;
+// msg.msgData.message_type = INTER_SMSCBC_CB_START;
+//
+// msg.msgData.module_id = MODULE_SMSCBC;
+// msg.msgData.message_type = INTER_SMSCBC_CB_START;
+// memset((char *)buffer, 0, 88);
+// hdr12=0;
+// hdr12 = (00<<14)|(msgCode<<4)|(updateNo);//00xxxxxxxxYYYY; x is msgCode, Y is Update#
+// //Serial Number:cell wide immediate display
+// buffer[0] = (unsigned char)(hdr12>>8);
+// buffer[1] = (unsigned char)(hdr12);
+// //Message Identifier: 1 assumed
+// buffer[2] = 0;
+// buffer[3] = 1;
+// //Data coding scheme: default alphabet, English
+// buffer[4] = 0x01;
+// //Page parameter: page 1 of 3
+// buffer[5] = 0x13;
+// //contents: JetCell, Cool!
+// buffer[6] = 0xca;
+// buffer[7] = 0x32;
+// buffer[8] = 0x7d;
+// buffer[9] = 0x58;
+// buffer[10] = 0x66;
+// buffer[11] = 0xb3;
+// buffer[12] = 0x59;
+// buffer[13] = 0xc3;
+// buffer[14] = 0xf7;
+// buffer[15] = 0x9b;
+// buffer[16] = 0x1d;
+// buffer[17] = 0x02;
+// buffer[18] = 0x81;
+//
+// //Generate page 1 of 3
+// buffer[5] = 0x13;
+// buffer[19] = 0x62;
+// memcpy((unsigned char*)&msg.msgData.data[0], buffer, 88);
+//
+// //Generate page 2 of 3
+// buffer[5] = 0x23;
+// buffer[19] = 0x64;
+// memcpy((unsigned char*)&msg.msgData.data[88], buffer, 88);
+//
+// //Generate page 3 of 3
+// buffer[5] = 0x33;
+// buffer[19] = 0x66;
+// memcpy((unsigned char*)&msg.msgData.data[176], buffer, 88);
+//
+// //size of this CB msg
+// msg.msgData.size = 264;
+// break;
+// }
+//
+// //Send a test CB message to RM
+// if (!JcMsgRcvBySmscbc(&msg))
+// printf("FAILED in calling intg_JcSendCbCmd: cmdCode=%d, msgCode=%d, upNo=%d\n",
+// cmdCode, msgCode, updateNo);
+// else
+// printf("SUCCESS in calling intg_JcSendCbCmd: cmdCode=%d, msgCode=%d, upNo=%d\n",
+// cmdCode, msgCode, updateNo);
+//}
+//#endif
+
+//Test command for CB index version
+//message id = 1 assumed.
+void intg_JcSendCbCmd(unsigned char cmdCode,
+ unsigned short msgCode,
+ unsigned short updateNo)
+{
+ unsigned short hdr12;
+ InterRxCbcCbMsg_t msg;
+ unsigned char buffer[88];
+
+ switch(cmdCode)
+ {
+ case 0: //Stop sending cur CB message
+ msg.destModuleId = MODULE_SMSCBC;
+ msg.msgType = INTER_SMSCBC_CB_STOP;
+
+ msg.msgData.module_id = MODULE_SMSCBC;
+ msg.msgData.message_type = INTER_SMSCBC_CB_STOP;
+ msg.msgData.size = 0;
+ msg.msgData.message_id = 1; //Danny, 6/29
+ break;
+
+ default: //Send test CB message to DSP
+ msg.destModuleId = MODULE_SMSCBC;
+ msg.msgType = INTER_SMSCBC_CB_START;
+
+ msg.msgData.module_id = MODULE_SMSCBC;
+ msg.msgData.message_type = INTER_SMSCBC_CB_START;
+ msg.msgData.message_id = 1;
+ memset((char *)buffer, 0, 88);
+ hdr12=0;
+ hdr12 = (00<<14)|(msgCode<<4)|(updateNo);//00xxxxxxxxYYYY; x is msgCode, Y is Update#
+ //Serial Number:cell wide immediate display
+ buffer[0] = (unsigned char)(hdr12>>8);
+ buffer[1] = (unsigned char)(hdr12);
+ //Message Identifier: 1 assumed
+ buffer[2] = 0;
+ buffer[3] = cmdCode;
+ //Data coding scheme: default alphabet, English
+ buffer[4] = 0x01;
+ //Page parameter: page 1 of 3
+ buffer[5] = 0x13;
+ //contents: JetCell, Cool!
+ buffer[6] = 0xca;
+ buffer[7] = 0x32;
+ buffer[8] = 0x7d;
+ buffer[9] = 0x58;
+ buffer[10] = 0x66;
+ buffer[11] = 0xb3;
+ buffer[12] = 0x59;
+ buffer[13] = 0xc3;
+ buffer[14] = 0xf7;
+ buffer[15] = 0x9b;
+ buffer[16] = 0x1d;
+ buffer[17] = 0x02;
+ buffer[18] = 0x81;
+
+ //Generate page 1 of 3
+ buffer[5] = 0x13;
+ buffer[19] = 0x62;
+ memcpy((unsigned char*)&msg.msgData.data[0], buffer, 88);
+
+ //Generate page 2 of 3
+ buffer[5] = 0x23;
+ buffer[19] = 0x64;
+ memcpy((unsigned char*)&msg.msgData.data[88], buffer, 88);
+
+ //Generate page 3 of 3
+ buffer[5] = 0x33;
+ buffer[19] = 0x66;
+ memcpy((unsigned char*)&msg.msgData.data[176], buffer, 88);
+
+ //size of this CB msg
+ msg.msgData.size = 264;
+ break;
+ }
+
+ //Send a test CB message to RM
+ if (!JcMsgRcvBySmscbc(&msg))
+ printf("FAILED in calling intg_JcSendCbCmd: cmdCode=%d, msgCode=%d, upNo=%d\n",
+ cmdCode, msgCode, updateNo);
+ else
+ printf("SUCCESS in calling intg_JcSendCbCmd: cmdCode=%d, msgCode=%d, upNo=%d\n",
+ cmdCode, msgCode, updateNo);
+}
+
+//PR 1323, Testing SMSCBC
+//message id =0 assumed, msgCode = 0x2aa
+void intg_JcSendCbcIndex(unsigned char cmdCode,
+ unsigned short msgCode,
+ unsigned short updateNo)
+{
+ unsigned short hdr12;
+ InterRxCbcCbMsg_t msg;
+ unsigned char buffer[88];
+
+ switch(cmdCode)
+ {
+ case 0: //Stop sending cur CB message
+ msg.destModuleId = MODULE_SMSCBC;
+ msg.msgType = INTER_SMSCBC_CB_STOP;
+
+ msg.msgData.module_id = MODULE_SMSCBC;
+ msg.msgData.message_type = INTER_SMSCBC_CB_STOP;
+ msg.msgData.size = 0;
+ msg.msgData.message_id = 0;/*Danny, 6/29*/
+ break;
+
+ default: //Send test CB message to DSP
+ msg.destModuleId = MODULE_SMSCBC;
+ msg.msgType = INTER_SMSCBC_CB_START;
+
+ msg.msgData.module_id = MODULE_SMSCBC;
+ msg.msgData.message_type = INTER_SMSCBC_CB_START;
+ msg.msgData.message_id = 0;
+
+
+ memset((char *)buffer, 0, 88);
+ hdr12=0;
+ hdr12 = (00<<14)|(msgCode<<4)|(updateNo);//001010101010YYYY; x is msgCode, Y is Update#
+ //Message Identifier: 0 assumed
+ buffer[2] = 0;
+ buffer[3] = 0;
+ //Data coding scheme: default alphabet, English
+ buffer[4] = 0x01;
+ //Page parameter: page 1 of 1
+ buffer[5] = 0x11;
+
+ //contents: 20 CISSOM/A CA/A2 SF --- EI1<cr><lf>20<SP>CISSOM<cr><lf>A<sp>CA<cr><lf>A2<SP>SF<cr><lf>
+ buffer[6] = 0xc5;
+ buffer[7] = 0x64;
+ buffer[8] = 0xac;
+ buffer[9] = 0xa1;
+ buffer[10] = 0x90;
+ buffer[11] = 0xc1;
+ buffer[12] = 0x40;
+ buffer[13] = 0xc3;
+
+ buffer[14] = 0xe4;
+ buffer[15] = 0x74;
+ buffer[16] = 0xfa;
+ buffer[17] = 0x6c;
+ buffer[18] = 0x2a;
+ buffer[19] = 0x82;
+
+ buffer[20] = 0xa0;
+ buffer[21] = 0x61;
+ buffer[22] = 0xb0;
+ buffer[23] = 0xa1;
+ buffer[24] = 0x0a;
+ buffer[25] = 0xca;
+ buffer[26] = 0x40;
+ buffer[27] = 0x53;
+ buffer[28] = 0x63;
+ buffer[29] = 0x43;
+ buffer[30] = 0x01;
+ buffer[31] = 0x00;
+ buffer[32] = 0x00;
+ memcpy((unsigned char*)&msg.msgData.data[0], buffer, 88);
+
+ //size of this CB msg
+ msg.msgData.size = 88;
+ break;
+ }
+
+ //Send a test CB message to RM
+ if (!JcMsgRcvBySmscbc(&msg))
+ printf("FAILED in calling intg_JcSendCbcIndex: cmdCode=%d, msgCode=%d, upNo=%d\n",
+ cmdCode, msgCode, updateNo);
+ else
+ printf("SUCCESS in calling intg_JcSendCbcIndex: cmdCode=%d, msgCode=%d, upNo=%d\n",
+ cmdCode, msgCode, updateNo);
+}
+
+#endif // JCCbcCb_CPP
+
+
diff --git a/data/mnet/GP10/Host/jcc/jvc_api/JcVctoVc.cpp b/data/mnet/GP10/Host/jcc/jvc_api/JcVctoVc.cpp
new file mode 100644
index 0000000..d0424c0
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/jvc_api/JcVctoVc.cpp
@@ -0,0 +1,213 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : JcVcToVc.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 05-01-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+#include "cc/CCInt.h"
+
+#include "JCC/JcVcToVc.h"
+#include "JCC/viperchannel.h"
+#include "JCC/JCCbcCb.h"
+
+#include "logging/VCLOGGING.h"
+
+#include "rm/rm_ccintf.h"
+
+#include "cc/CCUtil.h"
+
+#include "cc/CCSessionHandler.h"
+
+#include "JCC/JCCUtil.h"
+
+#include "cc/CCConfig.h"
+
+
+bool JcMsgRcvByCC (InterVcMsg_t *);
+bool JcMsgRcvByRM (InterVcMsg_t *);
+
+
+bool JcMsgRcvByCC (InterVcMsg_t *msg)
+{
+ DBG_FUNC ("JcMsgRcvByCC", CC_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qId ;
+ VcCcMsg_t intMsg ;
+
+ unsigned buffSize;
+ char * buffer ;
+
+ bool retVal = true;
+
+ if (msg->origModuleId == MODULE_MM)
+ { // MM->remote CC
+ buffSize = sizeof msg->msgData.postHoMobEventData.intraL3Msg ; // IntraL3Msg_t
+ buffer = (char *)&msg->msgData.postHoMobEventData.intraL3Msg;
+ }
+ else
+ { // CC->remote CC
+ buffSize = sizeof intMsg ;
+ buffer = (char *)&intMsg ;
+
+ intMsg.module_id = MODULE_EXT_VC;
+ intMsg.vcToVcMsg = *msg ;
+ }
+
+ switch (msg->msgType)
+ {
+ case INTER_VC_CC_PERFORM_HANDOVER:
+ {
+ qId = ccMsgQId;
+ break;
+ }
+
+ case INTER_VC_CC_POST_HANDOVER_DATA_EVENT:
+ default:
+ {
+ if ( (msg->destSubId >= CC_MAX_CC_CALLS_DEF_VAL) ||
+ (msg->origVcAddress == 0) )
+ return true;
+
+ qId = ccSession[msg->destSubId].msgQId;
+ break;
+ }
+ }
+
+ // send the message.
+ if (ERROR == msgQSend (qId ,
+ buffer ,
+ buffSize ,
+ NO_WAIT ,
+ MSG_PRI_NORMAL ) )
+ {
+ DBG_ERROR("EXT VC->CC Error : msgQSend (QID = %p) error\n ",
+ (int)qId);
+ retVal = false;
+ }
+ else
+ {
+ DBG_TRACE("EXT VC->CC Log: Sent Message to CC, (Msg Type = %d)\n",
+ msg->msgType);
+ retVal = true;
+ }
+
+ DBG_LEAVE();
+ return (retVal);
+}
+
+
+bool JcMsgRcvByRM(InterVcMsg_t *msg)
+{
+ DBG_FUNC("JcMsgRcvByRM", CC_LAYER);
+ DBG_ENTER();
+
+ IntraL3Msg_t *rrOutMsg;
+
+ switch (msg->msgType) {
+
+ case INTER_VC_CC_POST_HANDOVER_DATA_EVENT:
+ {
+
+ if ((!ccSession[msg->destSubId].free) &&
+ ((ccSession[msg->destSubId].sessionHandler->handoverSession)
+ == (ccSession[msg->destSubId].sessionHandler->targetHandoverSession)))
+ {
+ rrOutMsg = &msg->msgData.postHoMobEventData.intraL3Msg;
+ DBG_LEAVE();
+ return(sendRR(rrOutMsg->primitive_type,
+ rrOutMsg->message_type,
+ ccSession[msg->destSubId].sessionHandler->entryId,
+ rrOutMsg));
+ }
+ else
+ {
+ DBG_WARNING("EXT VC CC->RM Warning : Unexpected/Late Handover (Msg. Type=%d), (Session Id=%d)\n ",
+ msg->msgType,
+ msg->destSubId);
+ }
+ break;
+
+ }
+ default:
+ DBG_ERROR("EXT VC CC->RM Error : Unexpected Handover (Msg. Type=%d), (Session Id=%d)\n ",
+ msg->msgType,
+ msg->destSubId);
+ }
+
+ DBG_LEAVE();
+ return(false);
+}
+
+
+void RecvViperChannelMessage(unsigned char *Packet,int DataSize, UINT32 RemoteAddress)
+{
+ DBG_FUNC("RecvViperChannelMessage", CC_LAYER);
+ DBG_ENTER();
+
+ InterVcMsg_t *msg = (InterVcMsg_t *) Packet;
+
+ DBG_HEXDUMP(Packet, DataSize);
+
+ switch(msg->destModuleId)
+ {
+ case MODULE_CC:
+ JcMsgRcvByCC (msg);
+ break;
+
+ case MODULE_RM:
+ if (msg->origModuleId == MODULE_CC)
+ JcMsgRcvByRM (msg);
+ else
+ JcMsgRcvBySmscbc ((InterRxCbcCbMsg_t*)Packet);
+ break;
+
+ default:
+ DBG_ERROR ("Inter-Vipercell message received for unexpected (module = %d)\n",
+ msg->destModuleId);
+ break;
+ }
+
+ DBG_LEAVE();
+}
+
+
+bool JcMsgSendToVipercell(InterVcMsg_t *msg)
+{
+ DBG_FUNC("JcMsgSendToVipercell", CC_LAYER);
+ DBG_ENTER();
+
+ BOOL retVal;
+
+ if ((retVal = ViperChannelSendMessage((unsigned char *) msg,
+ sizeof(struct InterVcMsg_t),
+ msg->destVcAddress
+ ))
+ == TRUE)
+ {
+ DBG_LEAVE();
+ return(true);
+ }
+ else
+ {
+ DBG_LEAVE();
+ return(false);
+ }
+
+}
+
diff --git a/data/mnet/GP10/Host/jcc/jvc_api/Makefile b/data/mnet/GP10/Host/jcc/jvc_api/Makefile
new file mode 100644
index 0000000..fd7d369
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/jvc_api/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = jcc
+THIS_DIRECTORY = jvc_api
+MY_OUTPUT = $(OBJDIR)\jvc.out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif \ No newline at end of file
diff --git a/data/mnet/GP10/Host/jcc/jvc_api/viperchannel.cpp b/data/mnet/GP10/Host/jcc/jvc_api/viperchannel.cpp
new file mode 100644
index 0000000..146792a
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/jvc_api/viperchannel.cpp
@@ -0,0 +1,247 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+/* *
+ * File : ViperChannel.cpp *
+ * *
+ * Description : The library functions for Inter-ViperCell signalling transport*
+ * *
+ * Author : Dinesh Nambisan *
+ * *
+ *----------------------- Revision history ---------------------------------------------*
+ * Time | Date | Name | Description *
+ *--------------------------------------------------------------------------------------*
+ * 00:00 |06/8/99 | DSN | File created *
+ * | | | *
+ * | | | *
+ ****************************************************************************************
+ */
+
+/*
+ * VxWorks and ANSI C Headers
+ */
+
+#include "assert.h"
+#include "vxworks.h"
+#include "msgqlib.h"
+#include "sockLib.h"
+#include "inetLib.h"
+#include "stdioLib.h"
+#include "strLib.h"
+#include "hostLib.h"
+#include "ioLib.h"
+#include "tasklib.h"
+#include "time.h"
+#include "string.h"
+
+#include "Os/JCTask.h"
+#include "Os/JCModule.h"
+#include "GP10OsTune.h"
+#include "JCC/viperchannel.h"
+#include "MnetModuleId.h"
+
+JCTask ViperChannelTaskObj("ViperChannel");
+
+
+ViperChannelConfiguration_t ViperChannelConfig;
+static ipAddrBuff[INET_ADDR_LEN];
+
+/*
+ * SysCommand_VChan
+ */
+int SysCommand_VChan(T_SYS_CMD action)
+{
+ int tid;
+ switch(action){
+ case SYS_SHUTDOWN:
+ printf("[ViperChannel] Received system shutdown notification\n");
+ break;
+ case SYS_START:
+ printf("[ViperChannel] Received task start notification\n");
+ InitializeViperChannel(TRUE);
+ break;
+ case SYS_REBOOT:
+ printf("[ViperChannel] Reboot ready.\n");
+ break;
+
+ default:
+ printf("[ViperChannel] Unknown system command received\n");
+ }
+ return 0;
+}
+
+/*
+ * InitializeViperChannel
+ */
+void InitializeViperChannel(BOOL SpawnTask)
+{
+ memset(&ViperChannelConfig,0,sizeof(ViperChannelConfiguration_t));
+
+ ViperChannelConfig.Initialized = FALSE;
+
+
+ /* create client's socket */
+
+ if ((ViperChannelConfig.SignalSocket = socket (AF_INET, SOCK_DGRAM, 0)) == ERROR)
+ {
+ perror ("socket");
+ printf("Could not create UDP socket !!\n");
+ return;
+ }
+ else
+ {
+ int AddressSize=0;
+ AddressSize = sizeof(ViperChannelConfig.LocalAddress);
+
+ memset(&ViperChannelConfig.LocalAddress,0,AddressSize);
+ ViperChannelConfig.LocalAddress.sin_family = AF_INET;
+ ViperChannelConfig.LocalAddress.sin_port = htons (VIPERCHANNEL_PORT_NUMBER);
+ ViperChannelConfig.LocalAddress.sin_addr.s_addr = INADDR_ANY;
+
+ if (bind (ViperChannelConfig.SignalSocket,(struct sockaddr *)&ViperChannelConfig.LocalAddress,AddressSize) == ERROR) {
+ perror("bind");
+ printf("Could not bind ViperChannel to local port!!\n");
+ return;
+ }
+ else {
+ ViperChannelConfig.Initialized = TRUE;
+ if (SpawnTask)
+ {
+ if(ViperChannelTaskObj.JCTaskSpawn(
+ VPCHAN_TASK_PRIORITY,
+ VPCHAN_TASK_OPTION,
+ VPCHAN_TASK_STACK_SIZE,
+ (FUNCPTR)ViperChannel,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ MODULE_EXT_VC, JC_CRITICAL_TASK) == ERROR)
+ {
+ printf("Unable to spawn ViperChannel task!!\n");
+ return;
+ }
+ }
+
+
+ }
+
+
+
+ }
+}
+
+
+
+/*
+ * ViperChannel
+ */
+VOID ViperChannel()
+{
+ struct sockaddr_in FromAddress;
+ int AddrSize;
+ static unsigned char Buffer[8000];
+ int Status;
+
+ if (!ViperChannelConfig.Initialized) {
+ printf("Unable to start ViperChannel task since it is not initialized properly\n");
+ return;
+ }
+
+ ViperChannelTaskObj.JCTaskEnterLoop();
+ while(TRUE) {
+ AddrSize = sizeof(FromAddress);
+ memset(&FromAddress,0,AddrSize);
+ memset(Buffer,0,8000);
+ Status = recvfrom
+ (
+ ViperChannelConfig.SignalSocket,
+ (char *)Buffer,
+ 8000,
+ 0,
+ (struct sockaddr *)&FromAddress,
+ &AddrSize
+ );
+ if (Status == ERROR) {
+ printf("Error receiving packet on ViperChannel!!\n");
+ return;
+ }
+ else {
+ ViperChannelPacketHeader_t *PacketHeader;
+ PacketHeader = (ViperChannelPacketHeader_t *)Buffer;
+ if ( (PacketHeader->Magic != VIPERCHANNEL_MAGIC_VALUE) ||
+ (Status < (PacketHeader->DataSize+ sizeof(ViperChannelPacketHeader_t))) )
+ {
+ printf("Invalid packet received on ViperChannel");
+ }
+ else {
+
+#ifdef DEBUG
+ inet_ntoa_b(FromAddress.sin_addr,ipAddrBuff);
+ printf("Received ViperChannel message from ip %s of length %d bytes\n",ipAddrBuff,PacketHeader->DataSize);
+#endif
+ RecvViperChannelMessage(&Buffer[sizeof(ViperChannelPacketHeader_t)],
+ PacketHeader->DataSize,(UINT32)FromAddress.sin_addr.s_addr);
+ }
+
+ }
+ }
+ ViperChannelTaskObj.JCTaskNormExit();
+}
+
+
+
+
+
+/*
+ * ViperChannelSendMessage
+ */
+BOOL
+ViperChannelSendMessage(unsigned char *Packet, int DataSize, UINT32 RemoteAddress)
+{
+ int Status;
+ struct sockaddr_in DestAddress;
+ static char Buffer[8000];
+ ViperChannelPacketHeader_t *PacketHeader;
+ int AddrSize,TotalLen;
+ BOOL RetStatus;
+
+ memset(Buffer,0,8000);
+
+ PacketHeader = (ViperChannelPacketHeader_t *)Buffer;
+ PacketHeader->Magic = VIPERCHANNEL_MAGIC_VALUE;
+ PacketHeader->DataSize = DataSize;
+
+ AddrSize = sizeof(struct sockaddr_in);
+
+ memset(&DestAddress,0,AddrSize);
+
+ DestAddress.sin_family = AF_INET;
+ DestAddress.sin_port = htons(VIPERCHANNEL_PORT_NUMBER);
+ DestAddress.sin_addr.s_addr = RemoteAddress;
+
+ memcpy(&Buffer[sizeof(ViperChannelPacketHeader_t)],Packet,DataSize);
+
+ TotalLen = sizeof(ViperChannelPacketHeader_t) + DataSize;
+#ifdef DEBUG
+ inet_ntoa_b(DestAddress.sin_addr,ipAddrBuff);
+ printf("Sending ViperChannel message to ip %s of length %d bytes\n",ipAddrBuff,PacketHeader->DataSize);
+#endif
+
+ Status = sendto(ViperChannelConfig.SignalSocket,(char *)PacketHeader,TotalLen,0,(struct sockaddr *)&DestAddress,AddrSize);
+ if (Status != ERROR) {
+ RetStatus = TRUE;
+ }
+ else {
+ RetStatus = FALSE;
+ }
+ return(RetStatus);
+}
+
+
+
+
+
+
+
+
diff --git a/data/mnet/GP10/Host/jcc/src/JCC_ED.cpp b/data/mnet/GP10/Host/jcc/src/JCC_ED.cpp
new file mode 100644
index 0000000..095839d
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/JCC_ED.cpp
@@ -0,0 +1,397 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : JCC_ED.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : message and ie interface among Application (Layer 3)
+// modules.
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include <vxworks.h>
+#include <stdio.h>
+
+#include "JCC_ED.h"
+#include "lapdm/lapdm_l3intf.h"
+#include "lapdm/lapdm_config.h"
+#include "RIL3/ril3irt.h"
+#include "CC/CCconfig.h"
+
+// *******************************************************************
+// Local function prototypes
+// *******************************************************************
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeAlerting (T_CNI_RIL3CC_MSG_ALERTING &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeCallConfirmed(T_CNI_RIL3CC_MSG_CALL_CONFIRMED &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeConnect (T_CNI_RIL3CC_MSG_CONNECT &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeConnectAck (T_CNI_RIL3CC_MSG_CONNECT_ACK &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeSetup (T_CNI_RIL3CC_MSG_SETUP &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeDisconnect (T_CNI_RIL3CC_MSG_DISCONNECT &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeRelease (T_CNI_RIL3CC_MSG_RELEASE &);
+T_CNI_RIL3_RESULT JCC_RIL3SMS_DecodeCpData (T_CNI_RIL3SMS_MSG_CP_DATA &);
+T_CNI_RIL3_RESULT JCC_RIL3SMS_DecodeCpAck (T_CNI_RIL3SMS_MSG_CP_ACK &);
+T_CNI_RIL3_RESULT JCC_RIL3SMS_DecodeCpError (T_CNI_RIL3SMS_MSG_CP_ERROR &);
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeReleaseComplete (T_CNI_RIL3CC_MSG_RELEASE_COMPLETE &);
+T_CNI_RIL3_RESULT JCC_RIL3MM_DecodeLocationUpdateRequest(T_CNI_RIL3MM_MSG_LOCATION_UPDATE_REQUEST &);
+T_CNI_RIL3_RESULT JCC_RIL3MM_DecodeCMServiceRequest (T_CNI_RIL3MM_MSG_CM_SERVICE_REQUEST &);
+
+
+T_CNI_RIL3_IE_MOBILE_ID testIMSI[CC_MAX_CC_CALLS_DEF_VAL];
+
+short testIMSIindex;
+
+short origSoftMobDialedNumIndex;
+
+T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER testDialedNum[CC_MAX_CC_CALLS_DEF_VAL];
+
+T_CNI_IRT_ID softMobEntryId[CC_MAX_CC_CALLS_DEF_VAL]
+= {200, 201, 202, 203, 204, 205, 206};
+
+T_CNI_LAPDM_OID softMobLapdmOid[CC_MAX_CC_CALLS_DEF_VAL]
+= {200, 201, 202, 203, 204, 205, 206};
+
+int termSoftMobIndex = 1,
+ origSoftMobIndex = 0;
+
+// The only message that needs any data right now is the Called Party Number
+
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeAlerting(
+ T_CNI_RIL3CC_MSG_ALERTING &alerting
+ )
+{
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeCallConfirmed(
+ T_CNI_RIL3CC_MSG_CALL_CONFIRMED &callConfirmed
+ ) {
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeConnect(
+ T_CNI_RIL3CC_MSG_CONNECT &connect
+ ) {
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeConnectAck(
+ T_CNI_RIL3CC_MSG_CONNECT_ACK &connectAck
+ ) {
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeSetup(
+ T_CNI_RIL3CC_MSG_SETUP &setup
+ ) {
+
+ setup.calledBCD = testDialedNum[origSoftMobDialedNumIndex];
+
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeDisconnect(
+ T_CNI_RIL3CC_MSG_DISCONNECT &disconnect
+ ) {
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeRelease(
+ T_CNI_RIL3CC_MSG_RELEASE &release
+ ) {
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3CC_DecodeReleaseComplete(
+ T_CNI_RIL3CC_MSG_RELEASE_COMPLETE &releaseComplete
+ ) {
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3MM_DecodeLocationUpdateRequest(
+ T_CNI_RIL3MM_MSG_LOCATION_UPDATE_REQUEST &locationUpdateRequest
+ ) {
+ // mandatory IEs
+
+ //T_CNI_RIL3_IE_LOCATION_UPDATE_TYPE
+ locationUpdateRequest.locationUpdateType.locationUpdateType = CNI_RIL3_LOCATION_UPDATE_TYPE_NORMAL;
+
+ // 10.5.3.5
+ // T_CNI_RIL3_IE_CIPHER_KEY
+ locationUpdateRequest.cipherKey.keySeq = CNI_RIL3_NO_KEY_AVAILABLE;
+
+ // 10.5.1.2
+ // T_CNI_RIL3_IE_LOCATION_AREA_ID
+ locationUpdateRequest.locationId.mcc[0] = 2 ;
+ locationUpdateRequest.locationId.mcc[1] = 1 ;
+ locationUpdateRequest.locationId.mcc[2] = 2 ;
+
+ locationUpdateRequest.locationId.mnc[0] = 1;
+ locationUpdateRequest.locationId.mnc[1] = 3;
+
+ locationUpdateRequest.locationId.lac = 5 ;
+
+ // 10.5.1.3
+ // T_CNI_RIL3_IE_MS_CLASSMARK_1
+ locationUpdateRequest.classmark1.revLevel = CNI_RIL3_REV_LEVEL_PHASE1;
+ locationUpdateRequest.classmark1.esInd = CNI_RIL3_EARLY_CLASSMARK_SENDING_NOT_IMPLEMENTED;
+ locationUpdateRequest.classmark1.a51 = CNI_RIL3_A51_AVAILABLE;
+ locationUpdateRequest.classmark1.rfPowerCap = CNI_RIL3_GSM_CLASS_1;
+
+ // 10.5.1.5
+ // T_CNI_RIL3_IE_MOBILE_ID
+ locationUpdateRequest.mobileId = testIMSI[testIMSIindex];
+
+ // 10.5.1.4
+
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+T_CNI_RIL3_RESULT JCC_RIL3MM_DecodeCMServiceRequest(
+ T_CNI_RIL3MM_MSG_CM_SERVICE_REQUEST &cmServiceRequest
+ ) {
+ // mandatory IEs
+
+ // T_CNI_RIL3_IE_CM_SERVICE_TYPE
+ cmServiceRequest.cmServiceType.serviceType =
+ CNI_RIL3_CM_SERVICE_TYPE_MO_CALL_OR_PACKET_MODE;
+ // 10.5.3.3
+
+ // T_CNI_RIL3_IE_CIPHER_KEY
+ cmServiceRequest.cipherKey.keySeq = CNI_RIL3_NO_KEY_AVAILABLE;
+ // 10.5.1.2
+
+ // T_CNI_RIL3_IE_MS_CLASSMARK_2
+ cmServiceRequest.classmark2.revLevel = CNI_RIL3_REV_LEVEL_PHASE1;
+ cmServiceRequest.classmark2.esInd = CNI_RIL3_EARLY_CLASSMARK_SENDING_NOT_IMPLEMENTED;
+ cmServiceRequest.classmark2.a51 = CNI_RIL3_A51_AVAILABLE;
+ cmServiceRequest.classmark2.rfPowerCap = CNI_RIL3_GSM_CLASS_1;
+ cmServiceRequest.classmark2.psCap = CNI_RIL3_PS_CAPABILITY_NOT_PRESENT;
+ cmServiceRequest.classmark2.ssScreening = CNI_RIL3_SS_SCREENING_PHASE1_DEFAULT;
+ cmServiceRequest.classmark2.smCap = CNI_RIL3_SM_MT_PTP_NOT_SUPPORTED;
+ cmServiceRequest.classmark2.fcFreqCap = CNI_RIL3_GSM_EXTENTION_BAND_G1_NOT_SUPPORTED;
+ cmServiceRequest.classmark2.classmark3 = CNI_RIL3_CLASSMARK3_INFO_NOTAVAILABLE;
+
+ /* Classmark3 not available
+ cmServiceRequest.classmark2.cmsp = 0;
+ cmServiceRequest.classmark2.a53 = 0;
+ cmServiceRequest.classmark2.a52 = 0;
+ */
+ // 10.5.1.6
+
+ // T_CNI_RIL3_IE_MOBILE_ID
+ cmServiceRequest.mobileId = testIMSI[testIMSIindex];
+ // 10.5.1.4
+
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+
+// SMS-PP CP-messages
+T_CNI_RIL3_RESULT JCC_RIL3SMS_DecodeCpData (T_CNI_RIL3SMS_MSG_CP_DATA &cp_data )
+{
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+
+T_CNI_RIL3_RESULT JCC_RIL3SMS_DecodeCpAck (T_CNI_RIL3SMS_MSG_CP_ACK &cp_ack )
+{
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+
+T_CNI_RIL3_RESULT JCC_RIL3SMS_DecodeCpError (T_CNI_RIL3SMS_MSG_CP_ERROR &cp_error)
+{
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+
+T_CNI_RIL3_RESULT
+JCC_RIL3CC_Decode(
+ bool isSoftMob,
+ T_CNI_LAPDM_L3MessageUnit *l3MsgUnit, T_CNI_RIL3CC_MSG *ccMsg)
+{
+ if (isSoftMob == false)
+ return (CNI_RIL3CC_Decode(l3MsgUnit,ccMsg));
+
+ unsigned char *buffer = l3MsgUnit->buffer;
+ int length = l3MsgUnit->msgLength;
+
+ if (length < 2) return CNI_RIL3_INCORRECT_LENGTH;
+
+ // zap the output ccMsg
+ CNI_RIL3_ZAPMSG(ccMsg, sizeof(T_CNI_RIL3CC_MSG));
+
+ // get skip indicator
+ ccMsg->header.si_ti =
+ (T_CNI_RIL3_SI_TI) (buffer[0] >> 4);
+
+ // get message type
+ ccMsg->header.message_type =
+ (T_CNI_RIL3_MESSAGE_TYPE) (buffer[1] & 0x3f);
+
+ switch (ccMsg->header.message_type)
+ {
+ case CNI_RIL3CC_MSGID_ALERTING:
+ return JCC_RIL3CC_DecodeAlerting(
+ ccMsg->alerting
+ );
+ case CNI_RIL3CC_MSGID_CALL_CONFIRMED:
+ return JCC_RIL3CC_DecodeCallConfirmed(
+ ccMsg->callConfirmed
+ );
+ case CNI_RIL3CC_MSGID_CONNECT:
+ return JCC_RIL3CC_DecodeConnect(
+ ccMsg->connect
+ );
+ case CNI_RIL3CC_MSGID_CONNECT_ACKNOWLEDGE:
+ return JCC_RIL3CC_DecodeConnectAck(
+ ccMsg->connectAck
+ );
+ case CNI_RIL3CC_MSGID_EMERGENCY_SETUP:
+ return CNI_RIL3_RESULT_SUCCESS;
+ case CNI_RIL3CC_MSGID_SETUP:
+ return JCC_RIL3CC_DecodeSetup(
+ ccMsg->setup
+ );
+ case CNI_RIL3CC_MSGID_MODIFY:
+ case CNI_RIL3CC_MSGID_MODIFY_COMPLETE:
+ case CNI_RIL3CC_MSGID_MODIFY_REJECT:
+ return CNI_RIL3_RESULT_SUCCESS;
+ case CNI_RIL3CC_MSGID_DISCONNECT:
+ return JCC_RIL3CC_DecodeDisconnect(
+ ccMsg->disconnect
+ );
+ case CNI_RIL3CC_MSGID_RELEASE:
+ return JCC_RIL3CC_DecodeRelease(
+ ccMsg->release
+ );
+ case CNI_RIL3CC_MSGID_RELEASE_COMPLETE:
+ return JCC_RIL3CC_DecodeReleaseComplete(
+ ccMsg->releaseComplete
+ );
+ case CNI_RIL3CC_MSGID_CONGESTION_CONTROL:
+ case CNI_RIL3CC_MSGID_NOTIFY:
+ case CNI_RIL3CC_MSGID_STATUS:
+ case CNI_RIL3CC_MSGID_STATUS_ENQUIRY:
+ default:
+ return CNI_RIL3_UNKNOWN_MESSAGE_TYPE;
+ }
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+
+T_CNI_RIL3_RESULT
+JCC_RIL3MM_Decode(
+ bool isSoftMob,
+ T_CNI_LAPDM_L3MessageUnit *l3MsgUnit, T_CNI_RIL3MM_MSG *mmMsg)
+{
+ if (isSoftMob == false)
+ return (CNI_RIL3MM_Decode(l3MsgUnit,mmMsg));
+
+ unsigned char *buffer = l3MsgUnit->buffer;
+ int length = l3MsgUnit->msgLength;
+
+ if (length < 2) return CNI_RIL3_INCORRECT_LENGTH;
+
+ // zap the output mmMsg
+ CNI_RIL3_ZAPMSG(mmMsg, sizeof(T_CNI_RIL3MM_MSG));
+
+ // get message type
+ mmMsg->header.message_type =
+ (T_CNI_RIL3_MESSAGE_TYPE) (buffer[1] & 0x3f);
+
+ switch (mmMsg->header.message_type)
+ {
+ case CNI_RIL3MM_MSGID_IMSI_DETACH_INDICATION:
+ case CNI_RIL3MM_MSGID_LOCATION_UPDATING_REQUEST:
+ return JCC_RIL3MM_DecodeLocationUpdateRequest(
+ mmMsg->locationUpdateRequest
+ );
+ case CNI_RIL3MM_MSGID_AUTHENTICATION_RESPONSE:
+ case CNI_RIL3MM_MSGID_IDENTITY_RESPONSE:
+ case CNI_RIL3MM_MSGID_TMSI_REALLOCATION_COMPLETE:
+ return CNI_RIL3_RESULT_SUCCESS;
+
+ case CNI_RIL3MM_MSGID_CM_SERVICE_ABORT:
+ return CNI_RIL3_RESULT_SUCCESS;
+
+ case CNI_RIL3MM_MSGID_CM_SERVICE_REQUEST:
+ return JCC_RIL3MM_DecodeCMServiceRequest(
+ mmMsg->cmServiceRequest
+ );
+ case CNI_RIL3MM_MSGID_CM_REESTABLISHMENT_REQUEST:
+ case CNI_RIL3MM_MSGID_MM_NULL:
+ default:
+ return CNI_RIL3_UNKNOWN_MESSAGE_TYPE;
+ }
+ return CNI_RIL3_RESULT_SUCCESS;
+}
+
+
+T_CNI_RIL3_RESULT JCC_RIL3SMS_Decode (bool isSoftMob,
+ T_CNI_LAPDM_L3MessageUnit *l3MsgUnit,
+ T_CNI_RIL3SMS_CP_MSG *smsMsg )
+{
+ T_CNI_RIL3_RESULT retVal;
+
+ if (isSoftMob == false)
+ {
+ retVal = CNI_RIL3SMS_CP_Decode (l3MsgUnit, smsMsg); //Real Mode
+ }
+ else
+ {
+ // Test mode
+ unsigned char *buffer = l3MsgUnit->buffer ;
+ int length = l3MsgUnit->msgLength;
+
+ if (length < 2)
+ retVal = CNI_RIL3_INCORRECT_LENGTH;
+ else
+ {
+ // zap the output ccMsg
+ CNI_RIL3_ZAPMSG (smsMsg, sizeof(T_CNI_RIL3SMS_CP_MSG));
+
+ // get skip indicator
+ smsMsg->header.si_ti = (T_CNI_RIL3_SI_TI) (buffer[0] >> 4);
+
+ // get message type
+ smsMsg->header.message_type = (T_CNI_RIL3_CP_MESSAGE_TYPE) (buffer[1] & 0x3f);
+
+ switch (smsMsg->header.message_type)
+ {
+ case CNI_RIL3SMS_MSGID_CP_DATA :
+ retVal = JCC_RIL3SMS_DecodeCpData (smsMsg->cp_data );
+ break;
+
+ case CNI_RIL3SMS_MSGID_CP_ACK :
+ retVal = JCC_RIL3SMS_DecodeCpAck (smsMsg->cp_ack );
+ break;
+
+ case CNI_RIL3SMS_MSGID_CP_ERROR:
+ retVal = JCC_RIL3SMS_DecodeCpError (smsMsg->cp_error);
+ break;
+
+ default:
+ retVal = CNI_RIL3_UNKNOWN_MESSAGE_TYPE;
+ break;
+ }
+ }
+ }
+
+ return (retVal);
+}
+
+
diff --git a/data/mnet/GP10/Host/jcc/src/LUDBMmMsgProc.cpp b/data/mnet/GP10/Host/jcc/src/LUDBMmMsgProc.cpp
new file mode 100644
index 0000000..b973902
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/LUDBMmMsgProc.cpp
@@ -0,0 +1,470 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBMmMsgProc.cpp
+// Author(s) : Kevin S. Lim
+// Create Date : 07-31-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "stdLib.h"
+#include "vxWorks.h"
+#include "taskLib.h"
+#include "usrLib.h"
+#include "errnoLib.h"
+#include "string.h"
+
+// from common vob
+#include "subsc/SubscInfoType.h"
+#include "subsc/SubscInfoUtil.h"
+
+#include "LOGGING/vcmodules.h"
+#include "LOGGING/vclogging.h"
+
+// included L3 Message header for messages from other Layer 3 modules
+#include "JCC/JCCL3Msg.h"
+
+#include "JCC/JCCUtil.h"
+#include "JCC/JCCTimer.h"
+#include "JCC/LUDB.h"
+#include "JCC/LUDBapi.h"
+#include "JCC/LUDBConfig.h"
+
+#include "JCC/LUDBMmMsgProc.h"
+#include "LUDBVoipMsgProc.h"
+
+// Global variable for Message Queue
+extern MSG_Q_ID mmMsgQId;
+extern LUDB gLUDB;
+extern short ludb_auth_required;
+
+// ****************************************************************************
+bool sendLudbRspToMM(LudbMsgStruct *rsp)
+{
+ DBG_FUNC("sendLudbRspToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ rsp->module_id = MODULE_LUDB;
+ STATUS stat = msgQSend(mmMsgQId, (char *) rsp,
+ sizeof(LudbMsgStruct),
+ NO_WAIT, MSG_PRI_NORMAL);
+ if(stat == ERROR){
+ DBG_ERROR("msgQSend Error\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileRelReqToMM(short mmId)
+{
+ DBG_FUNC("sendMobileRelReqToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_REL_REQ;
+ LudbResponse.mm_id = mmId;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileRegCnfToMM(short mmId, short ludbId, short forceAuth)
+{
+ DBG_FUNC("sendMobileRegCnfToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ gLUDB.update(ludbId, LUDBEntry::ACTIVE);
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_REG_CNF;
+ LudbResponse.mm_id = mmId;
+ LudbResponse.ludb_id = ludbId;
+ LudbResponse.forceAuth = forceAuth;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendEmergRspToMM(short mmId, short ludbId)
+{
+ DBG_FUNC("sendEmergRspToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ gLUDB.update(ludbId, LUDBEntry::EMERGENCY);
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_EMERG_RSP;
+ LudbResponse.mm_id = mmId;
+ LudbResponse.ludb_id = ludbId;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendRemEmergRspToMM(short mmId)
+{
+ DBG_FUNC("sendRemEmergRspToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_REM_EMERG_CNF;
+ LudbResponse.mm_id = mmId;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileSecRspToMM(short mmId, short ludbId)
+{
+ DBG_FUNC("sendMobileSecRspToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ gLUDB.update(ludbId, LUDBEntry::ACTIVE);
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_SEC_RSP;
+ LudbResponse.mm_id = mmId;
+ LudbResponse.ludb_id = ludbId;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileRegRejToMM(short mmId, T_CNI_RIL3_REJECT_CAUSE_VALUE cause)
+{
+ DBG_FUNC("sendMobileRegRejToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_REG_REJ;
+ LudbResponse.mm_id = mmId;
+ LudbResponse.cause = cause;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileUnRegCnfToMM(short mmId)
+{
+ DBG_FUNC("sendMobileUnRegCnfToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_UNREG_CNF;
+ LudbResponse.mm_id = mmId;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileUnRegRejToMM(short mmId)
+{
+ DBG_FUNC("sendMobileUnRegRejToMM", LUDB_LAYER);
+ DBG_ENTER();
+
+ LudbMsgStruct LudbResponse;
+ LudbResponse.msg_type = LUDB_MM_UNREG_REJ;
+ LudbResponse.mm_id = mmId;
+
+ bool status = sendLudbRspToMM(&LudbResponse);
+ if(!status) {
+ DBG_ERROR("LudbRespsonse send unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+void LUDB_MM_EmergReqProc(T_CNI_RIL3_IE_MOBILE_ID& mobile_id, short mmId)
+{
+ DBG_FUNC("LUDB_MM_RegReqProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = gLUDB.registerUser(mobile_id);
+ if(ludb_id != -1){
+ T_SUBSC_INFO subsc;
+ char msisdn[MAX_NUM_SUBSC_ISDN];
+ char imsi[MAX_NUM_SUBSC_IMSI];
+ int i, len;
+
+ subscInfoInitialize(&subsc);
+ switch(mobile_id.mobileIdType){
+ case CNI_RIL3_IMSI:
+ len = (mobile_id.numDigits > MAX_NUM_SUBSC_IMSI)?
+ MAX_NUM_SUBSC_IMSI:mobile_id.numDigits;
+ for(i=0; i<len; i++)
+ imsi[i] = mobile_id.digits[i] + '0';
+ imsi[i] = '\0';
+ subscSetIMSI(&subsc, imsi);
+ case CNI_RIL3_IMEI:
+ case CNI_RIL3_IMEISV:
+ len = (mobile_id.numDigits > MAX_NUM_SUBSC_ISDN)?
+ MAX_NUM_SUBSC_ISDN:mobile_id.numDigits;
+ for(i=0; i<len; i++)
+ msisdn[i] = mobile_id.digits[i] + '0';
+ msisdn[i] = '\0';
+ break;
+ default:
+ DBG_ERROR("unsupported mobile id for EmergencyReq %d\n",
+ mobile_id.mobileIdType);
+ msisdn[0] = '\0';
+ }
+ subscSetMSISDN(&subsc, msisdn);
+ subscSetUserInfo(&subsc, "ViperCell");
+ ludbSetSubscInfoExists(ludb_id, true);
+ gLUDB.update(ludb_id, subsc);
+
+ bool status = sendEmergRspToMM(mmId, ludb_id);
+ if(!status){
+ ludbEntryInit(ludb_id);
+ }
+ }
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_MM_RemEmergReqProc(short mmId, short ludb_id)
+{
+ DBG_FUNC("LUDB_MM_RemEmergReqProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ if(ludb_id != -1){
+ LUDBEntry::LUDBState state = gLUDB.getState(ludb_id);
+ if(state == LUDBEntry::EMERGENCY){
+ ludbEntryInit(ludb_id);
+ }
+ else{
+ DBG_ERROR("ludb entry not expecting REM_EMERG_REQ %d\n", ludb_id);
+ }
+ }
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_MM_RegReqProc(T_CNI_RIL3_IE_MOBILE_ID& mobile_id, short mmId)
+{
+ DBG_FUNC("LUDB_MM_RegReqProc", LUDB_LAYER);
+ DBG_ENTER();
+ short ludb_id = gLUDB.getEntry(mobile_id);
+
+ if(ludb_id == JCC_ERROR){ // mobile doesn't exist in LUDB
+ ludb_id = gLUDB.registerUser(mobile_id);
+ if(ludb_id != JCC_ERROR){
+ bool status = sendMobileRegReq(mobile_id, mmId, ludb_id, ludb_auth_required);
+ if(!status){
+ ludbEntryInit(ludb_id);
+ sendMobileRegRejToMM(mmId, CNI_RIL3_REJECT_NETWORK_FAILURE);
+ }
+ }
+ else{
+ DBG_ERROR("registerUser failed\n");
+ sendMobileRegRejToMM(mmId, CNI_RIL3_REJECT_CONGESTION);
+ }
+ }
+ else{ // mobile exists in LUDB
+ LUDBEntry::LUDBState state = gLUDB.getState(ludb_id);
+// if(state == LUDBEntry::ACTIVE){
+// sendMobileRegCnfToMM(mmId, ludb_id);
+// }
+// else if((state == LUDBEntry::INACTIVE)||
+// (state == LUDBEntry::LUUNREGISTRJ)){
+ if((state == LUDBEntry::ACTIVE)||
+ (state == LUDBEntry::UNREGREQ) ||
+ (state == LUDBEntry::INACTIVE)){
+ bool status = sendMobileRegReq(mobile_id, mmId, ludb_id, ludb_auth_required);
+ if(!status){
+ ludbEntryInit(ludb_id);
+ sendMobileRegRejToMM(mmId, CNI_RIL3_REJECT_NETWORK_FAILURE);
+ }
+ }
+ else{
+ DBG_ERROR("Ignored: LUDB entry %d was waiting for Network response.\n", ludb_id);
+ sendMobileRelReqToMM(mmId);
+ }
+ }
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_MM_UnRegReqProc(T_CNI_RIL3_IE_MOBILE_ID& mobile_id, short mmId)
+{
+ DBG_FUNC("LUDB_MM_UnRegReqProc", LUDB_LAYER);
+ DBG_ENTER();
+ short ludb_id = gLUDB.getEntry(mobile_id);
+
+ if(ludb_id != JCC_ERROR){ // mobile exists in LUDB
+ LUDBEntry::LUDBState state = gLUDB.getState(ludb_id);
+
+ if((state == LUDBEntry::UNREGREQ) ||
+ (state == LUDBEntry::INACTIVE)) {
+ sendMobileUnRegRejToMM(mmId);
+ }
+ else{
+ ludbStartPurgeTimer(ludb_id);
+ gLUDB.update(ludb_id, LUDBEntry::INACTIVE);
+ bool status = sendMobileUnRegCnfToMM(mmId);
+ if(!status) {
+ DBG_ERROR("UnRegistration Confirm send to MM failed\n");
+ }
+
+ // VOIP_MOBILE_HANDLE mobile_handle = gLUDB.getMobileHandle(ludb_id);
+ // DBG_TRACE("Unregister mobile handle %d\n", (int)mobile_handle);
+ // bool status = sendMobileUnRegReq(mobile_handle, mmId, ludb_id);
+ // if(!status){
+ // sendMobileUnRegRejToMM(mmId);
+ // }
+ }
+ }
+ else{ // mobile doesn't exist in LUDB
+ DBG_ERROR("Received IMSI Detach but Mobile not in LUDB\n");
+ sendMobileUnRegRejToMM(mmId);
+ }
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_MM_SecReqProc(short mm_id, short ludb_id)
+{
+ DBG_FUNC("LUDB_MM_SecReqProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ T_CNI_RIL3_IE_MOBILE_ID mobile_id = ludbGetMobileId(ludb_id);
+ ludbSetMMId(ludb_id, mm_id);
+
+ bool status = sendMobileSecInfoReq(mobile_id, mm_id, ludb_id, 0);
+ if(!status) {
+ DBG_ERROR("Security Request send to VB failed\n");
+ }
+
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_MM_CipherSetProc(short mm_id, short ludb_id, short algo)
+{
+ DBG_FUNC("LUDB_MM_CipherSetProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ ludbSetCipherAlgo(ludb_id, algo);
+
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_MM_MsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_MM_MsgProc", LUDB_LAYER);
+ DBG_ENTER();
+ short mmId = inMsg->mm_id;
+ T_CNI_RIL3_IE_MOBILE_ID mobile_id;
+
+ switch(inMsg->msg_type)
+ {
+ case LUDB_MM_REG_REQ:
+ DBG_TRACE("LUDB_MM_REG_REQ Received mmId %d\n", mmId);
+ mobile_id = inMsg->mobile_id;
+ LUDB_MM_RegReqProc(mobile_id, mmId);
+ break;
+
+ case LUDB_MM_UNREG_REQ:
+ DBG_TRACE("LUDB_MM_UNREG_REQ Received mmId %d\n", mmId);
+ mobile_id = inMsg->mobile_id;
+ LUDB_MM_UnRegReqProc(mobile_id, mmId);
+ break;
+
+ case LUDB_MM_SEC_REQ:
+ DBG_TRACE("LUDB_MM_SEC_REQ Received mmId %d\n", mmId);
+ LUDB_MM_SecReqProc(mmId, inMsg->ludb_id);
+ break;
+
+ case LUDB_MM_EMERG_REQ:
+ DBG_TRACE("LUDB_MM_EMERG_REQ Received mmId %d\n", mmId);
+ mobile_id = inMsg->mobile_id;
+ LUDB_MM_EmergReqProc(mobile_id, mmId);
+ break;
+
+ case LUDB_MM_REM_EMERG_REQ:
+ DBG_TRACE("LUDB_MM_REM_EMERG_REQ Received mmId %d\n", mmId);
+ LUDB_MM_RemEmergReqProc(mmId, inMsg->ludb_id);
+ break;
+
+ case LUDB_MM_CIPHER_SET:
+ DBG_TRACE("LUDB_MM_CIPHER_SET Received ludbId %d\n", inMsg->ludb_id);
+ LUDB_MM_CipherSetProc(mmId, inMsg->ludb_id, inMsg->algo);
+ break;
+
+
+
+ default:
+ DBG_ERROR("Ludb Error:Unexpected message type %d\n", inMsg->msg_type);
+ }
+ DBG_LEAVE();
+}
+
diff --git a/data/mnet/GP10/Host/jcc/src/LUDBOamMsgProc.cpp b/data/mnet/GP10/Host/jcc/src/LUDBOamMsgProc.cpp
new file mode 100644
index 0000000..adcec7d
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/LUDBOamMsgProc.cpp
@@ -0,0 +1,88 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LudbOamMsgProc.cpp
+// Author(s) : Kevin Lim
+// Create Date : 09-09-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "stdio.h"
+#include "string.h"
+#include "LOGGING/vcmodules.h"
+#include "LOGGING/vclogging.h"
+#include "oam_api.h"
+
+// Ludb Message Constants
+#include "LudbOamMsgProc.h"
+#include "JCC/LudbApi.h"
+
+// OAM Config Data
+
+// Global variable for Message Queue
+extern MSG_Q_ID ludbMsgQId;
+
+
+// ****************************************************************************
+void ludbHandleOpStChanged(INT32 value)
+{
+ DBG_FUNC("ludbHandleOpStChange", LUDB_LAYER);
+ DBG_ENTER();
+ if(value){
+ }
+ else{
+ ludbDataInit();
+ }
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void ludbHandleAuthFreqChanged(INT32 value)
+{
+ DBG_FUNC("ludbHandleAuthFreqChange", LUDB_LAYER);
+ DBG_ENTER();
+ ludbSetAuthFreq((int)value);
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+void LUDB_OAM_MsgProc(TrapMsg *trapMsg)
+{
+ DBG_FUNC("LUDB_OAM_MsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ if(trapMsg->valType != VT_VALUE){
+ DBG_ERROR("Unexpected valType from OAM trap message: %d\n", trapMsg->valType);
+ DBG_LEAVE();
+ return;
+ }
+
+ switch(trapMsg->mibTag)
+ {
+ case MIB_bts_operationalState:
+ DBG_TRACE("ludbOpStatus MIB Trap received : %d\n", trapMsg->val.varVal);
+ ludbHandleOpStChanged(trapMsg->val.varVal);
+ break;
+ case MIB_rm_nim_0_7:
+ DBG_TRACE("ludbOpStatus MIB Trap received : %d\n", trapMsg->val.varVal);
+ ludbHandleAuthFreqChanged(trapMsg->val.varVal);
+ break;
+
+ default:
+ DBG_ERROR("Unexpected mib tag %d\n", trapMsg->mibTag);
+ }
+ DBG_LEAVE();
+}
diff --git a/data/mnet/GP10/Host/jcc/src/LUDBTask.cpp b/data/mnet/GP10/Host/jcc/src/LUDBTask.cpp
new file mode 100644
index 0000000..6dee184
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/LUDBTask.cpp
@@ -0,0 +1,207 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBTask.cpp
+// Author(s) : Kevin S. Lim
+// Create Date : 04-27-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "stdLib.h"
+#include "vxWorks.h"
+#include "taskLib.h"
+#include "usrLib.h"
+#include "errnoLib.h"
+#include "string.h"
+
+#include "Os/JCTask.h"
+#include "Os/JCModule.h"
+#include "GP10OsTune.h"
+#include "LOGGING//vcmodules.h"
+#include "LOGGING/vclogging.h"
+#include "oam_api.h"
+
+// included L3 Message header for messages from other Layer 3 modules
+#include "JCC/JCCL3Msg.h"
+
+#include "JCC/JCCUtil.h"
+#include "JCC/JCCTimer.h"
+
+#include "JCC/Ludb.h"
+#include "JCC/LUDBConfig.h"
+#include "JCC/LUDBApi.h"
+#include "JCC/LUDBMmMsgProc.h"
+
+#include "LUDBVoipMsgProc.h"
+#include "LUDBOamMsgProc.h"
+#include "LUDBTimerProc.h"
+#include "LudbHashTbl.h"
+
+extern LudbHashTbl *ludbImsiHash;
+
+extern MSG_Q_ID ludbMsgQId;
+JCTask ludbTaskObj("LUDBTask");
+
+// function forward declaration
+int ludbTaskMain();
+void ludbTaskInit();
+
+
+// ****************************************************************************
+int SysCommand_Ludb(T_SYS_CMD action)
+{
+ int tid;
+
+ switch(action){
+ case SYS_SHUTDOWN:
+ printf("[LUDB] Received system shutdown notification\n");
+ ludbDataPrint();
+ break;
+ case SYS_START:
+ printf("[LUDB] Received task start notification\n");
+ ludbTaskInit();
+ tid = ludbTaskObj.JCTaskSpawn(
+ LUDB_TASK_PRIORITY,
+ LUDB_TASK_OPTION,
+ LUDB_TASK_STACK_SIZE,
+ (FUNCPTR)ludbTaskMain,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ MODULE_LUDB, JC_CRITICAL_TASK);
+ break;
+ case SYS_REBOOT:
+ delete ludbImsiHash;
+ printf("[LUDB] Reboot ready.\n");
+ break;
+ default:
+ printf("[LUDB] Unknown system command received\n");
+ }
+ return 0;
+}
+
+// *******************************************************************
+void ludbCfgRead()
+{
+ INT_32_T oam_freq;
+ DBG_FUNC("ludbCfgRead", MM_LAYER);
+ DBG_ENTER();
+
+ STATUS ret;
+
+ if(ret = oam_getMibIntVar(MIB_rm_nim_0_7, &oam_freq)){
+ DBG_ERROR("Failed to initialize auth_freq with OAM:%d\n", ret);
+ DBG_ERROR("Initialized with hard coded default values.\n");
+ }
+ else{
+ ludbHandleAuthFreqChanged(oam_freq);
+ }
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void ludbSetOAMTraps()
+{
+ DBG_FUNC("ludbSetOAMTraps", LUDB_LAYER);
+ DBG_ENTER();
+ STATUS oamStatus;
+
+ if((oamStatus = oam_setTrap(MODULE_LUDB, ludbMsgQId, MIB_bts_operationalState))
+ != STATUS_OK){
+ DBG_ERROR("oam_setTrap failed (stauts=%d) on MIB_bts_operationalState\n", oamStatus);
+ }
+ if((oamStatus = oam_setTrap(MODULE_LUDB, ludbMsgQId, MIB_rm_nim_0_7))
+ != STATUS_OK){
+ DBG_ERROR("oam_setTrap failed (stauts=%d) on MIB_rm_nim_0_7\n", oamStatus);
+ }
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void ludbTaskInit()
+{
+ DBG_FUNC("ludbTaskInit", LUDB_LAYER);
+ DBG_ENTER();
+
+ ludbCfgRead();
+
+ ludbDataInit();
+
+ ludbImsiHash = new LudbHashTbl(LUDB_IMSI_HASH_NUM_BUCKET, LUDB_MAX_IMSI_KEY_LEN);
+
+ // create message queue
+ ludbMsgQId = msgQCreate(LUDB_MAX_INCOMING_MSG,
+ LUDB_MAX_MSG_LENGTH,
+ MSG_Q_FIFO);
+
+ if(ludbMsgQId == NULL){
+ DBG_ERROR("Fatal Error on msgQCreate : %d\n", errnoGet());
+ return;
+ }
+
+ ludbSetOAMTraps();
+
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+int ludbTaskMain()
+{
+ DBG_FUNC("ludbTaskMain", LUDB_LAYER);
+ DBG_ENTER();
+
+ char inMsg[LUDB_MAX_MSG_LENGTH];
+
+ ludbTaskObj.JCTaskEnterLoop();
+
+ while(true)
+ {
+ if(msgQReceive( ludbMsgQId, inMsg,
+ LUDB_MAX_MSG_LENGTH,
+ WAIT_FOREVER)
+ == ERROR)
+ {
+ DBG_ERROR("Fatal Error on msgQReceive : %d\n", errnoGet());
+ DBG_LEAVE();
+ return ERROR;
+ }
+
+ switch(inMsg[0]){
+ case MODULE_MM:
+ LUDB_MM_MsgProc((LudbMsgStruct *)inMsg);
+ break;
+
+ case MODULE_H323:
+ LUDB_VBLINK_MsgProc((LudbMsgStruct *)inMsg);
+ break;
+
+ case MODULE_OAM:
+ LUDB_OAM_MsgProc((TrapMsg *)inMsg);
+ break;
+
+ case MODULE_LUDB:
+ LudbTimerMsgProc((LudbMsgStruct *)inMsg);
+ break;
+
+ default:
+ DBG_ERROR("Message from unexpected Module: %d\n", inMsg[0]);
+ DBG_LEAVE();
+ return ERROR;
+ }
+ }
+ ludbTaskObj.JCTaskNormExit();
+ DBG_LEAVE();
+ return 0;
+}
+
diff --git a/data/mnet/GP10/Host/jcc/src/LUDBTimerProc.cpp b/data/mnet/GP10/Host/jcc/src/LUDBTimerProc.cpp
new file mode 100644
index 0000000..fff946c
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/LUDBTimerProc.cpp
@@ -0,0 +1,84 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LudbTimerProc.cpp
+// Author(s) : Kevin Lim
+// Create Date : 07-26-99
+// Description :
+//
+// *******************************************************************
+
+// #define DEBUG_MM_HANDOVER
+// #define DEBUG_MM_HANDOVER_EFR
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "taskLib.h"
+#include "stdLib.h"
+#include "string.h"
+#include "LOGGING/vcmodules.h"
+#include "LOGGING/vclogging.h"
+#include "oam_api.h"
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+#include "JCC/JCCL3Msg.h"
+
+#include "JCC/JCCUtil.h"
+#include "JCC/JCCTimer.h"
+
+// MM Message Constants
+#include "JCC/LUDB.h"
+#include "JCC/LUDBApi.h"
+#include "JCC/LUDBMMMsgProc.h"
+#include "LUDBVoipMsgProc.h"
+
+extern LUDB gLUDB;
+
+// ****************************************************************************
+void LudbTimerMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_Timer_MsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = inMsg->ludb_id;
+ short mmId = ludbGetMMId(ludb_id);
+ bool status;
+ switch(inMsg->msg_type)
+ {
+ case LUDB_VBREQ_TIMEOUT:
+ DBG_TRACE("ludb %d vb request timeout\n", ludb_id);
+ status = sendMobileRegRejToMM(mmId, CNI_RIL3_REJECT_NETWORK_FAILURE);
+ if(!status) {
+ DBG_ERROR("Registration Reject send to MM failed\n");
+ }
+ if(gLUDB.getState(ludb_id) == LUDBEntry::SECREQ)
+ gLUDB.update(ludb_id, LUDBEntry::ACTIVE);
+ else
+ ludbEntryInit(ludb_id);
+ break;
+ case LUDB_PURGE_TIMEOUT:
+ DBG_TRACE("ludb %d purge timeout\n", ludb_id);
+
+ T_CNI_RIL3_IE_MOBILE_ID mobile_id = ludbGetMobileId(ludb_id);
+ status = sendMobileUnRegReq(mobile_id, mmId, ludb_id);
+ if(!status){
+ DBG_ERROR("UnRegistration Request send to VB failed\n");
+ }
+ // ludbEntryInit(ludb_id);
+ break;
+ default:
+ DBG_TRACE("Unknown message received from Timer, Msg Type: %d\n", inMsg->msg_type);
+ }
+ DBG_LEAVE();
+}
+
diff --git a/data/mnet/GP10/Host/jcc/src/LUDBVoipMsgProc.cpp b/data/mnet/GP10/Host/jcc/src/LUDBVoipMsgProc.cpp
new file mode 100644
index 0000000..270f438
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/LUDBVoipMsgProc.cpp
@@ -0,0 +1,714 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBVoipMsgProc.cpp
+// Author(s) : Kevin S. Lim
+// Create Date : 07-31-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "stdLib.h"
+#include "vxWorks.h"
+#include "taskLib.h"
+#include "sysLib.h"
+#include "usrLib.h"
+#include "errnoLib.h"
+#include "string.h"
+
+#include "LOGGING/vcmodules.h"
+#include "LOGGING/vclogging.h"
+
+// included L3 Message header for messages from other Layer 3 modules
+#include "JCC/JCCL3Msg.h"
+
+#include "JCC/JCCUtil.h"
+#include "JCC/JCCTimer.h"
+
+#include "JCC/LUDB.h"
+#include "JCC/LUDBConfig.h"
+#include "JCC/LUDBApi.h"
+#include "JCC/LUDBMMMsgProc.h"
+
+#include "LUDBVoipMsgProc.h"
+
+#include "voip/vblink.h"
+#include "cc/cc_util_ext.h"
+
+extern LUDB gLUDB;
+extern short ludb_auth_required;
+
+extern void ludbMakeDefaultSubscMsg(char *msg, short *size);
+
+bool ludbRunRegTest = false;
+T_CNI_RIL3_IE_MOBILE_ID ludbRunRegTestMob;
+WDOG_ID ludbRunRegTestWID;
+int ludbRunRegTestTick;
+
+bool ludbAutoLog = false;
+
+bool ludb_auth_testmode = false;
+char ludb_auth_testcksn = 0;
+T_AUTH_TRIPLET cipher_testtriplet;
+
+// ****************************************************************************
+// StartAuthMode sets test mode for Authentication testing.
+// ****************************************************************************
+int StartAuthMode(int cksn, unsigned char lsb)
+{
+ int i;
+ if(ludb_auth_testmode){
+ printf("[LUDB] Test Authentication Mode already turned on.\n");
+ return -1;
+ }
+ else{
+ ludb_auth_testmode = 1;
+ ludb_auth_required = 1;
+ if(cksn >= 7)
+ printf(" CKSN value should be smaller than 7\n");
+ else
+ ludb_auth_testcksn = cksn;
+
+ for(i=0; i<SEC_RAND_LEN; i++) cipher_testtriplet.RAND[i] = 0xFF;
+ cipher_testtriplet.RAND[SEC_RAND_LEN-1] = lsb;
+
+ printf("\n[LUDB] Test Authentication Mode is now turned on.\n");
+ printf("(Mobile Location Update will initiate authentication without VB auth.)\n\n");
+ printf("StartAuthMode(cksn=%d, Random LSB=0x%x)\n", cksn, lsb);
+ printf("Random is set to: 0x");
+ for(i=0; i<SEC_RAND_LEN; i++) printf("%02x", cipher_testtriplet.RAND[i]);
+ printf("\n");
+ return 0;
+ }
+}
+
+// ****************************************************************************
+int StopAuthMode()
+{
+ if(!ludb_auth_testmode){
+ printf("[LUDB] Test Authentication Mode already turned off.\n");
+ return -1;
+ }
+ else{
+ ludb_auth_testmode = 0;
+ ludb_auth_required = 0;
+ printf("[LUDB] Test Authentication Mode is now turned off.\n");
+ printf(" (Mobile Location Update will work normal.)\n");
+ return 0;
+ }
+}
+
+// ****************************************************************************
+void ludbSendRegTest()
+{
+ if(!ludbRunRegTest) return;
+
+ short ludbId = ludbGetEntryByMobileId(ludbRunRegTestMob);
+
+ bool status;
+ if(ludbId > -1){
+ printf("\n[LUDB] Sending UnReg Request.\n");
+ status = VBLinkUnregisterMobile(ludbRunRegTestMob);
+ if(!status) {
+ printf("UnRegistration API call unsuccessful\n");
+ }
+ else{
+ printf("ludb %d ->VBLink MobileUnRegRequest\n", ludbId);
+ ludbStartVBReqTimer(ludbId);
+ gLUDB.update(ludbId, LUDBEntry::UNREGREQ);
+ }
+ }
+ else{
+ ludbId = gLUDB.registerUser(ludbRunRegTestMob);
+ printf("\n[LUDB] Sending Reg Request.\n");
+ status = VBLinkRegisterMobile(ludbRunRegTestMob);
+ if(!status) {
+ printf("Registration API call unsuccessful\n");
+ }
+ else{
+ printf("ludb %d ->VBLink MobileRegRequest\n", ludbId);
+ ludbStartVBReqTimer(ludbId);
+ gLUDB.update(ludbId, LUDBEntry::REGREQ);
+ }
+ }
+
+ if(ludbRunRegTest){
+ if(wdStart(ludbRunRegTestWID, ludbRunRegTestTick,
+ (FUNCPTR)ludbSendRegTest, ludbId)){
+ printf("[LUDB] wdStart Error!\n");
+ }
+ }
+
+}
+
+// ****************************************************************************
+int ludbRegTestStart(char *imsi, int interval)
+{
+ if(imsi == 0){
+ printf("usage: ludbRegTestStart(char *imsi, int interval) - interval in seconds\n");
+ return -1;
+ }
+ if(interval == 0){
+ printf("usage: ludbRegTestStart(char *imsi, int interval) - interval in seconds\n");
+ return -1;
+ }
+ if(ludbRunRegTest){
+ printf("[LUDB] RegTest already started.\n");
+ return -1;
+ }
+ else{
+ printf("[LUDB] RegTest is now started.\n");
+ printf("[LUDB] IMSI: %s\n", imsi);
+ printf("[LUDB] every %d seconds\n", interval);
+ int len = strlen(imsi);
+
+ ludbRunRegTestMob.mobileIdType = CNI_RIL3_IMSI;
+ ludbRunRegTestMob.ie_present = true;
+ ludbRunRegTestMob.numDigits = len;
+ for(int i=0; i<len; i++){
+ ludbRunRegTestMob.digits[i] = imsi[i] - '0';
+ }
+ ludbRunRegTest = true;
+ ludbRunRegTestWID = wdCreate();
+ ludbRunRegTestTick = interval * sysClkRateGet();
+ ludbSendRegTest();
+ return 0;
+ }
+}
+
+// ****************************************************************************
+int ludbRegTestStop()
+{
+ if(!ludbRunRegTest){
+ printf("[LUDB] RegTest already stopped.\n");
+ return -1;
+ }
+ else{
+ printf("[LUDB] RegTest is now stopped.\n");
+ ludbRunRegTest = false;
+
+ return 0;
+ }
+}
+
+// ****************************************************************************
+// message sent to vblink
+// RRQ
+// URQ
+// SRQ
+// ****************************************************************************
+bool sendMobileRegReq( T_CNI_RIL3_IE_MOBILE_ID& mobileId, short mmId, short ludbId, short fSec)
+{
+ DBG_FUNC("sendMobileRegReq", LUDB_LAYER);
+ DBG_ENTER();
+
+ ludbStopPurgeTimer(ludbId); // stop purge timer if it was running
+
+ ludbSetMMId(ludbId, mmId);
+
+ bool status = VBLinkRegisterMobile(mobileId);
+ if(!status) {
+ DBG_ERROR("Registration API call unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ else{
+ DBG_TRACE("ludb %d ->VBLink MobileRegRequest\n", ludbId);
+ ludbStartVBReqTimer(ludbId);
+ if(fSec)
+ gLUDB.update(ludbId, LUDBEntry::REGTHENSEC);
+ else
+ gLUDB.update(ludbId, LUDBEntry::REGREQ);
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileUnRegReq( T_CNI_RIL3_IE_MOBILE_ID& mobileId, short mmId, short ludbId)
+{
+ DBG_FUNC("sendMobileUnRegReq", LUDB_LAYER);
+ DBG_ENTER();
+
+ bool status = VBLinkUnregisterMobile(mobileId);
+ if(!status) {
+ DBG_ERROR("UnRegistration API call unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ else{
+ DBG_TRACE("ludb %d ->VBLink MobileUnRegRequest\n", ludbId);
+ ludbStartVBReqTimer(ludbId);
+ gLUDB.update(ludbId, LUDBEntry::UNREGREQ);
+ }
+ DBG_LEAVE();
+ return true;
+}
+
+// ****************************************************************************
+bool sendMobileSecInfoReq( T_CNI_RIL3_IE_MOBILE_ID& mobileId, short mmId, short ludbId, short fReg)
+{
+ DBG_FUNC("sendMobileSecInfoReq", LUDB_LAYER);
+ DBG_ENTER();
+
+ ludbSetMMId(ludbId, mmId);
+
+ bool status = VBLinkSecurityRequest(mobileId);
+ if(!status) {
+ DBG_ERROR("Security Info Req API call unsuccessful\n");
+ DBG_LEAVE();
+ return false;
+ }
+ else{
+ DBG_TRACE("ludb %d ->VBLink SecurityInfoRequest\n", ludbId);
+ ludbStartVBReqTimer(ludbId);
+ if(fReg)
+ gLUDB.update(ludbId, LUDBEntry::SECINREG);
+ else
+ gLUDB.update(ludbId, LUDBEntry::SECREQ);
+ }
+
+ DBG_LEAVE();
+ return true;
+}
+
+// *******************************************************************
+// message received from vblink
+// RCF
+// RRJ
+// UCF
+// URJ
+// SPI
+// SRS
+// URQ
+// *******************************************************************
+void LUDB_VBLINK_RCFMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_RCFMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received RCF on entry that can't be found by mobile_id\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ DBG_TRACE("ludb %d registration confirmed\n", ludb_id);
+ ludbStopVBReqTimer(ludb_id);
+
+ if(ludbRunRegTest){
+ printf("[LUDB] Registration Confirm Received.\n");
+ gLUDB.update(ludb_id, LUDBEntry::ACTIVE);
+ return;
+ }
+
+/* shmin 08/20 changed mcpla: this funtion to Profile function
+
+ short mmId = ludbGetMMId(ludb_id);
+ if(mmId == -1){
+ DBG_ERROR("Received RCF on entry that has no mm_id set\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ LUDBEntry::LUDBState state = gLUDB.getState(ludb_id);
+ bool status;
+ if(state == LUDBEntry::REGREQ){
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 0);
+ if(!status) {
+ DBG_ERROR("Registration Confirm send to MM failed\n");
+ }
+ }
+ else if(state == LUDBEntry::REGTHENSEC){
+ if(ludb_auth_testmode){
+ DBG_TRACE("auth_testmode encountered. bypass sec req to VB.\n");
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 0);
+ DBG_LEAVE();
+ return;
+ }
+
+ short ret = ludbCheckAuthCount(ludb_id);
+ if(ret == 0){ // okay to use the cureent security key
+ DBG_TRACE("Reuse Security Key for ludb %d\n", ludb_id);
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 0);
+ if(!status) {
+ DBG_ERROR("Registration Confirm send to MM failed\n");
+ }
+ }
+ else if(ret == 1){ // get a new set
+ DBG_TRACE("Get a new Security Key for ludb %d\n", ludb_id);
+ status = sendMobileSecInfoReq(inMsg->mobile_id, mmId, ludb_id, 1);
+ if(!status) {
+ DBG_ERROR("SecReq after RegCnf to VB failed\n");
+ }
+ }
+ else if(ret == -1){
+ DBG_ERROR("possible error: ludb_id out of bound\n");
+ }
+ }
+ else{
+ DBG_ERROR("unknown state in RegCnf: %d\n", state);
+ }
+*/
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void LUDB_VBLINK_RRJMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_RRJMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received RRJ on entry that can't be found by mobile_id\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ DBG_TRACE("ludb %d registration rejected by VBLINK\n", ludb_id);
+ ludbStopVBReqTimer(ludb_id);
+
+ if(ludbRunRegTest){
+ printf("[LUDB] Registration Reject Received. ludb_id %d\n", ludb_id);
+ ludbEntryInit(ludb_id);
+ return;
+ }
+
+ short mmId = ludbGetMMId(ludb_id);
+ if(mmId == -1){
+ DBG_ERROR("Received RRJ on entry that has no mm_id set\n");
+ DBG_LEAVE();
+ return;
+ }
+ bool status = sendMobileRegRejToMM(mmId, CNI_RIL3_REJECT_NATIONAL_ROAMING_NOT_ALLOWED);
+ if(!status) {
+ DBG_ERROR("Registration Reject send to MM failed\n");
+ }
+
+ ludbEntryInit(ludb_id);
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void LUDB_VBLINK_UCFMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_UCFMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received UCF on entry that can't be found by mobile_id\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ DBG_TRACE("ludb %d unregistration confirmed\n", ludb_id);
+ ludbStopVBReqTimer(ludb_id);
+
+// VOIP_MOBILE_HANDLE mobile_handle = VOIP_NULL_MOBILE_HANDLE;
+// gLUDB.update(ludb_id, mobile_handle);
+// ludbStartPurgeTimer(ludb_id);
+// gLUDB.update(ludb_id, LUDBEntry::INACTIVE);
+
+// short mmId = ludbGetMMId(ludb_id);
+// bool status = sendMobileUnRegCnfToMM(mmId);
+// if(!status) {
+// DBG_ERROR("UnRegistration Confirm send to MM failed\n");
+// }
+
+ ludbEntryInit(ludb_id);
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void LUDB_VBLINK_URJMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_URJMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received URJ on entry that can't be found by mobile_id\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ DBG_TRACE("ludb %d unregistration rejected by VBLINK\n", ludb_id);
+ ludbStopVBReqTimer(ludb_id);
+
+ short mmId = ludbGetMMId(ludb_id);
+
+ bool status = sendMobileUnRegRejToMM(mmId);
+ if(!status) {
+ DBG_ERROR("UnRegistration Reject send to MM failed\n");
+ }
+
+ ludbEntryInit(ludb_id);
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void LUDB_VBLINK_SPIMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_PRSMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received SPI on entry that can't be found by mobile_id\n");
+ ludb_id = gLUDB.registerUser(inMsg->mobile_id);
+ if(ludb_id < 0){
+ DBG_LEAVE();
+ return;
+ }
+ ludbStopVBReqTimer(ludb_id);
+ gLUDB.update(ludb_id, LUDBEntry::ACTIVE);
+ }
+
+ DBG_TRACE("ludb %d user profile received\n", ludb_id);
+
+ short size = (short)inMsg->vb_msg_size;
+ char vb_msg[400];
+ char *msg;
+
+ if(size > VB_MAX_MSG_LENGTH){
+ DBG_ERROR("Profile from ViperBase is too large\n");
+ DBG_LEAVE();
+ return;
+ }
+ else if(size == 0) {
+ msg = vb_msg;
+ ludbMakeDefaultSubscMsg(msg, &size);
+ }
+ else{
+ msg = inMsg->vb_msg;
+ }
+
+ short ret = ludbSetDecodeSubscInfo(ludb_id, (unsigned char *)msg, size);
+ if(ret){
+ DBG_ERROR("ludbSetDecodeSubscInfo returned Error\n");
+ printSubscMsg((unsigned char *)msg, size);
+ }
+ else{
+ ludbSetSubscInfoExists(ludb_id, true);
+ }
+ short mmId = ludbGetMMId(ludb_id);
+ if(mmId == -1){
+ DBG_ERROR("Received RCF on entry that has no mm_id set\n");
+ DBG_LEAVE();
+ return;
+ }
+
+// shmin 08/20 mcpla function change the RegCnfToMM message to here
+
+ LUDBEntry::LUDBState state = gLUDB.getState(ludb_id);
+ bool status;
+ if(state == LUDBEntry::REGREQ){
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 0);
+ if(!status) {
+ DBG_ERROR("Registration Confirm send to MM failed\n");
+ }
+ }
+ else if(state == LUDBEntry::REGTHENSEC){
+ if(ludb_auth_testmode){
+ DBG_TRACE("auth_testmode encountered. bypass sec req to VB.\n");
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 0);
+ DBG_LEAVE();
+ return;
+ }
+
+ short ret = ludbCheckAuthCount(ludb_id);
+ if(ret == 0){ // okay to use the cureent security key
+ DBG_TRACE("Reuse Security Key for ludb %d\n", ludb_id);
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 0);
+ if(!status) {
+ DBG_ERROR("Registration Confirm send to MM failed\n");
+ }
+ }
+ else if(ret == 1){ // get a new set
+ DBG_TRACE("Get a new Security Key for ludb %d\n", ludb_id);
+ status = sendMobileSecInfoReq(inMsg->mobile_id, mmId, ludb_id, 1);
+ if(!status) {
+ DBG_ERROR("SecReq after RegCnf to VB failed\n");
+ }
+ }
+ else if(ret == -1){
+ DBG_ERROR("possible error: ludb_id out of bound\n");
+ }
+ }
+ else{
+ DBG_ERROR("unknown state in RegCnf: %d\n", state);
+ }
+
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void LUDB_VBLINK_SRSMsgProc(LudbMsgStruct *inMsg)
+{
+ short AuC_failure = 0;
+
+ DBG_FUNC("LUDB_VBLINK_SRSMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received SRS on entry that can't be found by mobile_id\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ DBG_TRACE("ludb %d security info received\n", ludb_id);
+ ludbStopVBReqTimer(ludb_id);
+
+ if(inMsg->vb_msg_size == 1){
+ T_AUTH_TRIPLET triplet;
+ memcpy((char *)&triplet, inMsg->vb_msg, sizeof(T_AUTH_TRIPLET));
+ gLUDB.update(ludb_id, triplet);
+ }
+ else{
+ AuC_failure = 1;
+ DBG_TRACE("!!!!zero SRS!!!!\n");
+ }
+
+ short mmId = ludbGetMMId(ludb_id);
+ if(mmId == -1){
+ DBG_ERROR("No mmId in ludb entry for SRS\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ LUDBEntry::LUDBState state = gLUDB.getState(ludb_id);
+ bool status;
+ if(state == LUDBEntry::SECINREG){
+ if(AuC_failure){
+ status = sendMobileRegRejToMM(mmId, CNI_RIL3_REJECT_NETWORK_FAILURE);
+ if(!status) {
+ DBG_ERROR("Registration Reject send to MM failed\n");
+ }
+ status = sendMobileUnRegReq(inMsg->mobile_id, mmId, ludb_id);
+ if(!status){
+ DBG_ERROR("UnRegistration Request send to VB failed\n");
+ }
+ }
+ else{
+ status = sendMobileRegCnfToMM(mmId, ludb_id, 1);
+ if(!status) {
+ DBG_ERROR("Registration Confirm send to MM failed\n");
+ }
+ }
+ }
+ else if(state == LUDBEntry::SECREQ){
+ status = sendMobileSecRspToMM(mmId, ludb_id);
+ if(!status) {
+ DBG_ERROR("Security Info Response send to MM failed\n");
+ }
+ }
+ else{
+ DBG_ERROR("unknown state in SRS\n");
+ }
+ DBG_LEAVE();
+}
+
+// *******************************************************************
+void LUDB_VBLINK_URQMsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_URQMsgProc", LUDB_LAYER);
+ DBG_ENTER();
+
+ short ludb_id = ludbGetEntryByMobileId(inMsg->mobile_id);
+ if(ludb_id == -1){
+ DBG_ERROR("Received URQ on entry that can't be found by mobile_id\n");
+ DBG_LEAVE();
+ return;
+ }
+
+ // <Igal: 04-10-01>
+ // Notify affected CC Sessions
+ CcNotifyPurge (ludb_id);
+ DBG_TRACE("ludb %d unregistered by VBLINK request\n", ludb_id);
+ ludbEntryInit(ludb_id);
+ DBG_LEAVE();
+}
+
+// ****************************************************************************
+// ****************************************************************************
+int ludbAutoLogStart()
+{
+ if(ludbAutoLog){
+ printf("[LUDB] AutoLog already started.\n");
+ return -1;
+ }
+ else{
+ printf("[LUDB] AutoLog is now started.\n");
+ ludbAutoLog = true;
+ return 0;
+ }
+}
+
+// ****************************************************************************
+int ludbAutoLogStop()
+{
+ if(!ludbAutoLog){
+ printf("[LUDB] AutoLog already stopped.\n");
+ return -1;
+ }
+ else{
+ printf("[LUDB] AutoLog is now stopped.\n");
+ ludbAutoLog = false;
+ return 0;
+ }
+}
+
+// *******************************************************************
+void LUDB_VBLINK_MsgProc(LudbMsgStruct *inMsg)
+{
+ DBG_FUNC("LUDB_VBLINK_MsgProc", LUDB_LAYER);
+ DBG_ENTER();
+ // force mobile_id type fields
+ inMsg->mobile_id.ie_present = 1;
+ inMsg->mobile_id.mobileIdType = CNI_RIL3_IMSI;
+ switch(inMsg->msg_type){
+ case VOIP_LUDB_REG_CNF:
+ LUDB_VBLINK_RCFMsgProc(inMsg);
+ break;
+ case VOIP_LUDB_REG_REJ:
+ LUDB_VBLINK_RRJMsgProc(inMsg);
+ break;
+ case VOIP_LUDB_UNREG_CNF:
+ LUDB_VBLINK_UCFMsgProc(inMsg);
+ break;
+ case VOIP_LUDB_UNREG_REJ:
+ LUDB_VBLINK_URJMsgProc(inMsg);
+ break;
+ case VOIP_LUDB_SPI_IND:
+ LUDB_VBLINK_SPIMsgProc(inMsg);
+ break;
+ case VOIP_LUDB_SEC_RSP:
+ LUDB_VBLINK_SRSMsgProc(inMsg);
+ break;
+ case VOIP_LUDB_UNREG_REQ:
+ LUDB_VBLINK_URQMsgProc(inMsg);
+ break;
+ default:
+ DBG_ERROR("Received unknown message type from VOIP: %d\n",
+ inMsg->msg_type);
+ }
+ if((ludbRunRegTest)||(ludbAutoLog)) ludbDataPrint();
+ DBG_LEAVE();
+}
+
diff --git a/data/mnet/GP10/Host/jcc/src/Makefile b/data/mnet/GP10/Host/jcc/src/Makefile
new file mode 100644
index 0000000..50a370e
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = jcc
+THIS_DIRECTORY = src
+MY_OUTPUT = $(OBJDIR)\$(THIS_APP_DIR).out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif \ No newline at end of file
diff --git a/data/mnet/GP10/Host/jcc/src_api/JCCLog.cpp b/data/mnet/GP10/Host/jcc/src_api/JCCLog.cpp
new file mode 100644
index 0000000..d8ccb84
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/JCCLog.cpp
@@ -0,0 +1,107 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : JCCLog.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 10-19-98
+// Description : implementation for - JCCLog
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "JCC/JCCLog.h"
+#include "vxWorks.h"
+#include "logLib.h"
+#include "time.h"
+#include "string.h"
+
+int __JCCLog(const char *logText)
+{
+ struct tm currTime;
+
+ time_t timeInSecs = time(NULL);
+
+ char outText[161];
+
+ // Initialize to an empty string
+ outText[0] = '\0';
+
+ strcat(outText, "T::%d:%d:%d: ");
+
+ strcat(outText, logText);
+
+ localtime_r(&timeInSecs, &currTime);
+
+ logMsg(outText, currTime.tm_hour, currTime.tm_min, currTime.tm_sec, 0, 0, 0);
+}
+
+int __JCCLog1(const char *logText, int arg1)
+{
+ struct tm currTime;
+
+ time_t timeInSecs = time(NULL);
+
+ char outText[161];
+
+ // Initialize to an empty string
+ outText[0] = '\0';
+
+ strcat(outText, "T::%d:%d:%d: ");
+
+ strcat(outText, logText);
+
+ localtime_r(&timeInSecs, &currTime);
+
+ logMsg(outText, currTime.tm_hour, currTime.tm_min, currTime.tm_sec, arg1, 0, 0);
+}
+
+int __JCCLog2(const char *logText, int arg1, int arg2)
+{
+ struct tm currTime;
+
+ time_t timeInSecs = time(NULL);
+
+ char outText[161];
+
+ // Initialize to an empty string
+ outText[0] = '\0';
+
+ strcat(outText, "T::%d:%d:%d: ");
+
+ strcat(outText, logText);
+
+ localtime_r(&timeInSecs, &currTime);
+
+ logMsg(outText, currTime.tm_hour, currTime.tm_min, currTime.tm_sec, arg1, arg2, 0);
+}
+
+int __JCCLog3(const char *logText, int arg1, int arg2, int arg3)
+{
+ struct tm currTime;
+
+ time_t timeInSecs = time(NULL);
+
+ char outText[161];
+
+ // Initialize to an empty string
+ outText[0] = '\0';
+
+ strcat(outText, "T::%d:%d:%d: ");
+
+ strcat(outText, logText);
+
+ localtime_r(&timeInSecs, &currTime);
+
+ logMsg(outText, currTime.tm_hour, currTime.tm_min, currTime.tm_sec, arg1, arg2, arg3);
+}
diff --git a/data/mnet/GP10/Host/jcc/src_api/JCCTimer.cpp b/data/mnet/GP10/Host/jcc/src_api/JCCTimer.cpp
new file mode 100644
index 0000000..546a2d8
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/JCCTimer.cpp
@@ -0,0 +1,95 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : JCCTimer.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 10-19-98
+// Description : interface specification for - JCCTimer
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "JCC/JCCTimer.h"
+
+#include "JCC/JCCLog.h"
+
+void JCCTimer::cancelTimer()
+{
+ if (timerSet_ == true)
+ {
+ wdCancel(timerId_);
+ timerSet_ = false;
+ }
+}
+
+JCCTimer::~JCCTimer()
+{
+ wdDelete(timerId_);
+}
+
+JCCTimer::JCCTimer( FUNCPTR fPtr,
+ int timerData )
+ :timerData_(timerData),
+ funcPtr_(fPtr),
+ timerSet_(false)
+{
+
+ if ((timerId_ = wdCreate()) == NULL)
+ {
+ // Handle Operating System Resource Allocation Error
+ JCCLog("JCC Error - Operating System Resource Allocation Error:\n");
+ JCCLog(" - WatchDog Timer could not be created.\n");
+ }
+}
+
+JCCTimer::JCCTimer( FUNCPTR fPtr)
+ :timerData_(-1),
+ funcPtr_(fPtr),
+ timerSet_(false)
+{
+
+ if ((timerId_ = wdCreate()) == NULL)
+ {
+ // Handle Operating System Resource Allocation Error
+ JCCLog("JCC Error - Operating System Resource Allocation Error:\n");
+ JCCLog(" - WatchDog Timer could not be created.\n");
+ }
+}
+
+void JCCTimer::setTimer(int howLong)
+{
+ if (timerSet_ == true)
+ {
+ cancelTimer();
+ }
+
+ wdStart(timerId_, howLong, funcPtr_, timerData_);
+ timerSet_ = true;
+
+}
+
+void JCCTimer::setTimer(int howLong, int timerData)
+{
+ if (timerSet_ == true)
+ {
+ cancelTimer();
+ }
+
+ timerData_ = timerData;
+ wdStart(timerId_, howLong, funcPtr_, timerData_);
+ timerSet_ = true;
+
+}
+
+
diff --git a/data/mnet/GP10/Host/jcc/src_api/JCCUtil.cpp b/data/mnet/GP10/Host/jcc/src_api/JCCUtil.cpp
new file mode 100644
index 0000000..2d82112
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/JCCUtil.cpp
@@ -0,0 +1,97 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : JCCUtil.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include <stdio.h>
+
+// included MD and IRT headers
+#include "JCC/JCCUtil.h"
+#include "JCC/JCCEvent.h"
+#include "JCC/JCCState.h"
+
+// Utility functions
+
+int
+operator==(const T_CNI_L3_ID& lhs, const T_CNI_L3_ID& rhs) {
+
+ return ( (lhs.msgq_id == rhs.msgq_id) &&
+ (lhs.sub_id == lhs.sub_id) );
+}
+
+
+
+// Mobile Id comparison. -gz
+int
+operator==(const T_CNI_RIL3_IE_MOBILE_ID& lhs,
+ const T_CNI_RIL3_IE_MOBILE_ID& rhs)
+{
+
+ if ( ( lhs.ie_present && rhs.ie_present) &&
+ lhs.mobileIdType == rhs.mobileIdType )
+ {
+ if (lhs.mobileIdType == CNI_RIL3_TMSI)
+ {
+ return (lhs.tmsi == rhs.tmsi);
+ }
+ else
+ {
+ if (lhs.numDigits == rhs.numDigits)
+ {
+ for (short i = 0; i< lhs.numDigits; i++)
+ {
+ if(lhs.digits[i] != rhs.digits[i])
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+
+
+ return false;
+}
+
+
+// add print mobile Id. -gz
+
+void printMobileId(const T_CNI_RIL3_IE_MOBILE_ID& mobileId)
+{
+ if (mobileId.mobileIdType == CNI_RIL3_TMSI)
+ {
+ printf("TMSI ");
+ }
+ else if (mobileId.mobileIdType == CNI_RIL3_IMSI)
+ {
+ for (short i = 0; i< mobileId.numDigits; i++)
+ {
+ printf("%d", mobileId.digits[i]);
+ }
+ }
+ else
+ printf("Unknown ID Type %d",mobileId.mobileIdType);
+}
+
+
+T_CNI_RIL3_PROTOCOL_DISCRIMINATOR extractPd (const T_CNI_LAPDM_L3MessageUnit *msInMsg)
+{
+ return ((T_CNI_RIL3_PROTOCOL_DISCRIMINATOR)(msInMsg->buffer[0] & 0x0f));
+}
+
diff --git a/data/mnet/GP10/Host/jcc/src_api/LUDBInstance.cpp b/data/mnet/GP10/Host/jcc/src_api/LUDBInstance.cpp
new file mode 100644
index 0000000..22baed9
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/LUDBInstance.cpp
@@ -0,0 +1,774 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBInstance.cpp
+// Author(s) : Bhava Nelakanti
+// Create Date : 11-01-98
+// Description : Local User Database.
+//
+// Modified History:
+// merge mmcc-h323 with integration. -03/04/99
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// from common vob
+#include "subsc/SubscInfoType.h"
+#include "subsc/SubscInfoUtil.h"
+
+#include "JCC/LUDB.h"
+#include "JCC/LUDBConfig.h"
+#include "JCC/JCCL3Msg.h"
+#include "JCC/JCCUtil.h"
+#include "JCC/LUDBApi.h"
+
+#include "LudbHashTbl.h"
+
+#include "semLib.h"
+#include "stdioLib.h"
+#include "sysLib.h"
+
+#include "LOGGING/vcmodules.h"
+#include "LOGGING/vclogging.h"
+
+// *******************************************************************
+// forward declarations.
+// *******************************************************************
+
+// *******************************************************************
+// Constant Definitions
+// *******************************************************************
+extern int ludb_purge_timer_sec;
+
+extern LUDB gLUDB;
+extern short ludb_auth_required;
+extern short ludb_auth_freq;
+bool srs_debug_mode = false;
+
+extern LudbHashTbl *ludbImsiHash;
+
+//*****************************************************************************
+LUDBEntry::LUDBEntry()
+{
+ ludbSemId = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
+ VBReqTimer = new JCCTimer((FUNCPTR)ludbVBReqTimeout);
+ PurgeTimer = new JCCTimer((FUNCPTR)ludbPurgeTimeout);
+ init();
+}
+
+
+//*****************************************************************************
+void LUDBEntry::init()
+{
+ // take the semaphore
+ semTake(ludbSemId, WAIT_FOREVER);
+ mobileId.mobileIdType = CNI_RIL3_NO_MOBILE_ID;
+ classmarkType = NULL_CLASSMARK;
+ free = true;
+ state = IDLE;
+ mobileHandle = NULL;
+ mm_id = -1;
+ subsc_exist = false;
+ stopVBReqTimer();
+ stopPurgeTimer();
+ auth_reuse_count = 0;
+ sec_exist = false;
+ cur_cksn = 0x07;
+ cur_algo = 0;
+
+ // Now let go of the semaphores.
+ semGive(ludbSemId);
+}
+
+
+//*****************************************************************************
+void LUDBEntry::isFree (bool free)
+{
+ semTake(ludbSemId, WAIT_FOREVER);
+ LUDBEntry::free = free;
+ semGive(ludbSemId);
+}
+
+//*****************************************************************************
+void LUDBEntry::setSubscExist (bool flag)
+{
+ semTake(ludbSemId, WAIT_FOREVER);
+ LUDBEntry::subsc_exist = flag;
+ semGive(ludbSemId);
+}
+
+//*****************************************************************************
+void LUDBEntry::setSecExist (bool flag)
+{
+ semTake(ludbSemId, WAIT_FOREVER);
+ LUDBEntry::sec_exist = flag;
+ semGive(ludbSemId);
+}
+
+//*****************************************************************************
+char *LUDBEntry::getStateString()
+{
+ switch(state){
+ case IDLE: return("IDLE ");
+ case REGREQ: return("WAIT4REG ");
+ case REGTHENSEC: return("WAIT4REG* ");
+ case SECREQ: return("WAIT4SEC ");
+ case SECINREG: return("WAIT4SEC* ");
+ case ACTIVE: return("ACTIVE ");
+ case UNREGREQ: return("WAIT4UNREG");
+ case INACTIVE: return("INACTIVE ");
+ case UNREGRJT: return("UNREG_REJ ");
+ case EMERGENCY: return("EMERGENCY ");
+ default: return("UNKNOWN ");
+ }
+}
+
+//*****************************************************************************
+void LUDBEntry::startVBReqTimer(int sec, short ludb_id)
+{
+ int tick = sec * sysClkRateGet();
+ VBReqTimer->setTimer(tick, (int)ludb_id);
+}
+
+//*****************************************************************************
+void LUDBEntry::stopVBReqTimer()
+{
+ VBReqTimer->cancelTimer();
+}
+
+//*****************************************************************************
+void LUDBEntry::startPurgeTimer(int sec, short ludb_id)
+{
+ int tick = sec * sysClkRateGet();
+ PurgeTimer->setTimer(tick, (int)ludb_id);
+}
+
+//*****************************************************************************
+void LUDBEntry::stopPurgeTimer()
+{
+ PurgeTimer->cancelTimer();
+}
+
+//*****************************************************************************
+T_AUTH_TRIPLET* LUDBEntry::curTripletPtr()
+{
+ if(secExist()){
+ return &sec_info;
+ }
+ else{
+ return 0; // error
+ }
+}
+
+//*****************************************************************************
+// LUDB
+//*****************************************************************************
+LUDB::LUDB()
+{
+ semId = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE);
+ init();
+}
+
+
+//*****************************************************************************
+void LUDB::init()
+{
+ for(int i=0; i< LUDB_MAX_NUM_ENTRY; i++) {
+ if(!entries[i].isFree()){
+ int bucket_id;
+ if(ludbImsiHash->find(i, bucket_id)) ludbImsiHash->remove(i);
+ }
+ entries[i].init();
+ }
+}
+
+
+//*****************************************************************************
+// clean up entry - klim 3/29/99
+void LUDB::init(const short index)
+{
+ if(inRange(index)){
+ entries[index].init();
+ int bucket_id;
+ if(ludbImsiHash->find(index, bucket_id)) ludbImsiHash->remove(index);
+ }
+}
+
+
+//*****************************************************************************
+short LUDB::entryAlloc()
+{
+ semTake(semId, WAIT_FOREVER);
+
+ for(short i=0; i< LUDB_MAX_NUM_ENTRY;i++)
+ {
+ if (entries[i].isFree() == true)
+ {
+ entries[i].isFree(false);
+ semGive(semId);
+ return i;
+ }
+ }
+ semGive(semId);
+ return JCC_ERROR;
+}
+
+
+//*****************************************************************************
+void LUDB::entryDealloc(short i)
+{
+ if(inRange(i)){
+ semTake(semId, WAIT_FOREVER);
+ entries[i].init();
+ semGive(semId);
+ }
+}
+
+
+//*****************************************************************************
+bool LUDB::startVBReqTimer(short i)
+{
+ if(inRange(i)){
+ entries[i].startVBReqTimer(VB_REQ_TIMER_SEC, i);
+ return true;
+ }
+ else{
+ return false;
+ }
+}
+
+//*****************************************************************************
+bool LUDB::stopVBReqTimer(short i)
+{
+ if(inRange(i)){
+ entries[i].stopVBReqTimer();
+ return true;
+ }
+ else{
+ return false;
+ }
+}
+
+//*****************************************************************************
+bool LUDB::startPurgeTimer(short i)
+{
+ if(inRange(i)){
+ entries[i].startPurgeTimer(ludb_purge_timer_sec, i);
+ return true;
+ }
+ else{
+ return false;
+ }
+}
+
+//*****************************************************************************
+bool LUDB::stopPurgeTimer(short i)
+{
+ if(inRange(i)){
+ entries[i].stopPurgeTimer();
+ return true;
+ }
+ else{
+ return false;
+ }
+}
+
+//*****************************************************************************
+void LUDB::setMMId(const short i, short mmId)
+{
+ if(inRange(i)){
+ entries[i].mm_id = mmId;
+ }
+}
+
+//*****************************************************************************
+short LUDB::getMMId(const short i)
+{
+ if(inRange(i)){
+ return(entries[i].mm_id);
+ }
+ else{
+ return -1;
+ }
+}
+
+//*****************************************************************************
+// Print LUDB Data
+void LUDB::print()
+{
+ printf(" [ID] IMSI STATE Voip Number\n");
+ for(short i=0; i<LUDB_MAX_NUM_ENTRY;i++)
+ {
+ if (entries[i].isFree())
+ {
+ // printf("LUDB Entry %d is free.\n", i);
+ }
+ else
+ {
+ printf(" [%2d] ", i);
+ printMobileId(entries[i].mobileId);
+ printf(" %s", entries[i].getStateString());
+ printf(" %08x ", entries[i].mobileHandle);
+ ludbPrintIsdn(i);
+ printf("\n");
+ }
+ }
+
+}
+
+//*****************************************************************************
+// Register user
+short LUDB::registerUser(T_CNI_RIL3_IE_MOBILE_ID mobileId)
+{
+ short i = JCC_ERROR;
+
+ if ( (i = entryAlloc()) != JCC_ERROR)
+ {
+ // take the semaphore
+ semTake(semId, WAIT_FOREVER);
+ entries[i].mobileId = mobileId;
+ semGive(semId);
+
+ ludbImsiHash->add(mobileId.digits, i);
+ }
+
+ return i;
+}
+
+
+//*****************************************************************************
+//get LUDB index for given IMSI
+short LUDB::getEntry (T_CNI_RIL3_IE_MOBILE_ID mobileId)
+{
+ short index = JCC_ERROR;
+
+ int bucket_id;
+ LudbLinkedListItem *item = ludbImsiHash->find(mobileId.digits, bucket_id);
+ if(item)
+ index = item->value;
+
+ return index;
+}
+
+
+//*****************************************************************************
+void LUDB::update (short index, LUDBEntry::LUDBState state)
+{
+ DBG_FUNC("LUDB::update(state)", LUDB_LAYER);
+ DBG_ENTER();
+
+ // index range check and state check.
+ if ((state >= LUDBEntry::IDLE)&&(state <= LUDBEntry::MAXLUDBSTATE)
+ &&(inRange(index)))
+ entries[index].state = state;
+ else
+ DBG_ERROR("invalid state %d or invalid index %d\n", state, index);
+
+ DBG_LEAVE();
+}
+
+//*****************************************************************************
+void LUDB::update (short index, VOIP_MOBILE_HANDLE mobileHandle)
+{
+ DBG_FUNC("LUDB::update(voip_handle)", LUDB_LAYER);
+ DBG_ENTER();
+
+ if(inRange(index))
+ {
+ // check if ludb is free
+ if(entries[index].isFree())
+ DBG_ERROR("ludb entry is Free, index %d\n", index);
+ else
+ entries[index].mobileHandle = mobileHandle;
+ }
+ else
+ DBG_ERROR("ludb entry invalid index %d\n", index);
+
+ DBG_LEAVE();
+}
+
+//*****************************************************************************
+short LUDB::update (short index, T_SUBSC_INFO info)
+{
+ DBG_FUNC("LUDB::update(subsc_info)", LUDB_LAYER);
+ DBG_ENTER();
+
+ if(inRange(index))
+ {
+ // check if ludb is free
+ if(entries[index].isFree()){
+ DBG_ERROR("ludb entry is Free, index %d\n", index);
+ DBG_LEAVE();
+ return 1;
+ }
+ else{
+ entries[index].subsc_info = info;
+ DBG_LEAVE();
+ return 0;
+ }
+ }
+ else{
+ DBG_ERROR("ludb entry invalid index %d\n", index);
+ DBG_LEAVE();
+ return 1;
+ }
+}
+
+//*****************************************************************************
+void LUDB::printSRS(short index)
+{
+ int i;
+ if(!inRange(index)) return;
+
+ printf("SRS_DEBUG---------------------------------------------------\n");
+ printf("RAND: ");
+ for(i=0; i<SEC_RAND_LEN; i++) printf("%02X ", entries[index].sec_info.RAND[i]);
+ printf("\n");
+ printf("SRES: ");
+ for(i=0; i<SEC_SRES_LEN; i++) printf("%02X ", entries[index].sec_info.SRES[i]);
+ printf("\n");
+ printf("KC: ");
+ for(i=0; i<SEC_KC_LEN; i++) printf("%02X ", entries[index].sec_info.Kc[i]);
+ printf("\n");
+ printf("------------------------------------------------------------\n");
+}
+
+//*****************************************************************************
+short LUDB::update (short index, T_AUTH_TRIPLET info)
+{
+ DBG_FUNC("LUDB::update(sec_info)", LUDB_LAYER);
+ DBG_ENTER();
+
+ if(inRange(index)){
+ if(entries[index].isFree()){ // check if ludb is free
+ DBG_ERROR("ludb entry is Free, index %d\n", index);
+ DBG_LEAVE();
+ return 1;
+ }
+ else{
+ setSecExist(index, true);
+ incCKSN(index);
+ entries[index].sec_info = info;
+ entries[index].auth_reuse_count = 0;
+ if(srs_debug_mode) ludbPrintSRS(index);
+ DBG_LEAVE();
+ return 0;
+ }
+ }
+ else{
+ DBG_ERROR("ludb entry invalid index %d\n", index);
+ DBG_LEAVE();
+ return 1;
+ }
+}
+
+//*****************************************************************************
+LUDBEntry::LUDBState LUDB::getState(const short index)
+{
+ if(inRange(index))
+ return entries[index].state;
+ else
+ return LUDBEntry::IDLE;
+}
+
+//*****************************************************************************
+bool LUDB::isFree(const short index)
+{
+ if(inRange(index))
+ return entries[index].isFree();
+ else
+ return false;
+}
+
+//*****************************************************************************
+bool LUDB::getSubscExist(short index)
+{
+ if(inRange(index))
+ return entries[index].subscExist();
+ else
+ return false;
+}
+
+//*****************************************************************************
+void LUDB::setSubscExist(short index, bool flag)
+{
+ if(inRange(index))
+ entries[index].setSubscExist(flag);
+}
+
+//*****************************************************************************
+bool LUDB::getSecExist(short index)
+{
+ if(inRange(index))
+ return entries[index].secExist();
+ else
+ return false;
+}
+
+//*****************************************************************************
+void LUDB::setSecExist(short index, bool flag)
+{
+ if(inRange(index))
+ entries[index].setSecExist(flag);
+}
+
+//*****************************************************************************
+short LUDB::checkAuthCount(const short index)
+{
+ short count;
+
+ DBG_FUNC("LUDB::checkAuthCount(index)", LUDB_LAYER);
+ DBG_ENTER();
+
+ if(inRange(index)){
+ if(!ludbGetSecInfoExists(index)){
+ DBG_TRACE("no sec info exist\n");
+ DBG_LEAVE();
+ return 1;
+ }
+
+ if(++entries[index].auth_reuse_count >= ludb_auth_freq){
+ DBG_TRACE("Hit ludb_auth_freq! resetting ludb_auth_count to 0\n");
+ DBG_LEAVE();
+ return 1; // need to fetch new set
+ }
+ }
+ else{
+ DBG_LEAVE();
+ return -1;
+ }
+
+ DBG_TRACE("auth_reuse_count [%d]: %d\n", index, entries[index].auth_reuse_count);
+ DBG_LEAVE();
+ return 0; // okay to use current key
+}
+
+//*****************************************************************************
+T_AUTH_TRIPLET* LUDB::curTripletPtr(short index)
+{
+ if(inRange(index)){
+ return entries[index].curTripletPtr();
+ }
+ else
+ return 0;
+}
+
+//*****************************************************************************
+short LUDB::curAlgo(short i)
+{
+ if(inRange(i)){
+ return entries[i].cur_algo;
+ }
+ else
+ return -1;
+}
+
+//*****************************************************************************
+void LUDB::setAlgo(short i, short algo)
+{
+ DBG_FUNC("LUDB::setAlgo", LUDB_LAYER);
+ DBG_ENTER();
+ if(inRange(i)){
+ if(!entries[i].isFree()){
+ DBG_TRACE("setting ludb %d algo to %d\n", i, algo);
+ entries[i].cur_algo = algo;
+ }
+ }
+ DBG_LEAVE();
+}
+
+//*****************************************************************************
+char LUDB::curCKSN(short index)
+{
+ if(inRange(index)){
+ return entries[index].cur_cksn;
+ }
+ else
+ return (char)0x07;
+}
+
+//*****************************************************************************
+char LUDB::incCKSN(short index)
+{
+ if(inRange(index)){
+ entries[index].cur_cksn = (entries[index].cur_cksn + 1) % 7;
+ return entries[index].cur_cksn;
+ }
+ else
+ return (char)0x07;
+}
+
+//*****************************************************************************
+VOIP_MOBILE_HANDLE LUDB::getMobileHandle (const short index)
+{
+ DBG_FUNC("LUDB::getMobileHandle", LUDB_LAYER);
+ DBG_ENTER();
+ VOIP_MOBILE_HANDLE retVal = VOIP_NULL_MOBILE_HANDLE;
+
+ if(inRange(index))
+ {
+ //check if ludb is free
+ if(entries[index].isFree())
+ DBG_ERROR("ludb entry is Free, index %d\n", index);
+ else
+ retVal = entries[index].mobileHandle;
+ }
+ else
+ DBG_ERROR("ludb entry invalid index %d\n", index);
+
+ DBG_LEAVE();
+ return retVal;
+}
+
+
+
+//*****************************************************************************
+bool LUDB::authTerm(const short index,
+ const T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER& cpn)
+{
+ // For now, don't have to check anything, no profile yet.
+ if(inRange(index)){
+ if (!isFree(index)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+//*****************************************************************************
+bool LUDB::authOrig(const short index,
+ const T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER& cpn)
+{
+ // For now, don't have to check anything, no profile yet.
+ if(inRange(index)){
+ if(!isFree(index)){
+ return true;
+ }
+ }
+ return false;
+}
+
+//*****************************************************************************
+// Stage 2 LUDB changes needed for Orig and Term Calls - Begin
+T_CNI_RIL3_IE_MOBILE_ID
+LUDB::getMobileId (const short index)
+{
+ T_CNI_RIL3_IE_MOBILE_ID retval;
+
+ retval.mobileIdType = CNI_RIL3_NO_MOBILE_ID;
+
+ if(inRange(index)&&(!entries[index].isFree()))
+ {
+ return (entries[index].mobileId);
+ }
+
+ return (retval);
+
+}
+// Stage 2 LUDB changes needed for Orig and Term Calls - End
+
+//*****************************************************************************
+bool LUDB::inRange(short index)
+{
+ if((index >= 0)&&(index < LUDB_MAX_NUM_ENTRY)){
+ return true;
+ }
+ else{
+ return false;
+ }
+}
+
+//*****************************************************************************
+T_SUBSC_INFO* LUDB::getSubscInfoPtr(const short index)
+{
+ if(inRange(index))
+ return(&entries[index].subsc_info);
+ else{
+ printf("LUDB::getSubscInfoPtr - index out of bound\n");
+ return 0;
+ }
+}
+
+//*****************************************************************************
+T_SUBSC_IE_MOBILE_ID_IMSI* LUDB::getMobileIdPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->imsi);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_ISDN* LUDB::getMSISDNPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->msisdn);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_PROVISION_BS* LUDB::getProvBSPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->prov_bs);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_PROVISION_TS* LUDB::getProvTSPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->prov_ts);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_PROVISION_SS* LUDB::getProvSSPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->prov_ss);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_SUBSC_STATUS* LUDB::getSubscStatusPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->status);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_ODB_DATA* LUDB::getODBDataPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->odb_data);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_SS_INFO_LIST* LUDB::getSSInfoListPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->ss_info_list);
+ else return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_USER_INFO* LUDB::getUserInfoPtr(const short index)
+{
+ T_SUBSC_INFO *info = getSubscInfoPtr(index);
+ if(info != 0) return(&info->user);
+ else return 0;
+}
+
diff --git a/data/mnet/GP10/Host/jcc/src_api/LudbHashTbl.cpp b/data/mnet/GP10/Host/jcc/src_api/LudbHashTbl.cpp
new file mode 100644
index 0000000..21ec466
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/LudbHashTbl.cpp
@@ -0,0 +1,135 @@
+/*********************************************************************/
+/* */
+/* (c) Copyright Cisco 2000 */
+/* All Rights Reserved */
+/* */
+/*********************************************************************/
+
+/*********************************************************************/
+/* */
+/* File : LudbHashTbl.cpp */
+/* Author(s) : Kevin S. Lim */
+/* Create Date : 03-25-01 copied from GsHashTbl.cpp */
+/* Description : supports only IMSI(15) or TMSI(4) key */
+/* */
+/*********************************************************************/
+
+#include "string.h"
+#include "stdio.h"
+
+#include "LudbHashTbl.h"
+
+int ludb_hash_tbl_debug = 0;
+
+LudbHashTbl::LudbHashTbl()
+{
+ list_len = LUDB_DEFAULT_HASH_TBL_LEN;
+ table = new LudbLinkedList[list_len];
+ key_len = LUDB_MAX_IMSI_KEY_LEN;
+ for(int i=0; i<list_len; i++){
+ table[i].SetKeyLength(key_len);
+ }
+
+ if(ludb_hash_tbl_debug)
+ printf("Hash created with length %d\n", list_len);
+}
+
+LudbHashTbl::LudbHashTbl(int l_len, int k_len)
+{
+ list_len = l_len;
+ table = new LudbLinkedList[list_len];
+ if((k_len == LUDB_MAX_IMSI_KEY_LEN)||(k_len == LUDB_MAX_TMSI_KEY_LEN)){
+ key_len = k_len;
+ for(int i=0; i<list_len; i++){
+ table[i].SetKeyLength(key_len);
+ }
+ }
+ else{
+ printf("LudbHashTbl::LudbHashTbl unsupported key len encountered %d\n",k_len);
+ }
+
+ if(ludb_hash_tbl_debug)
+ printf("Hash created with length %d\n", list_len);
+}
+
+LudbHashTbl::~LudbHashTbl()
+{
+
+}
+
+int LudbHashTbl::GetHashInd(const void *key)
+{
+ unsigned long temp = 0;
+ int i;
+
+ for(i=0; i<key_len; i++) temp += ((unsigned char *)key)[i];
+
+ if(ludb_hash_tbl_debug)
+ printf("LudbHashTbl::HashInd returns %d\n", temp % list_len);
+
+ return (temp % list_len);
+}
+
+LudbLinkedListItem *LudbHashTbl::find(const void *key, int& hash_ind)
+{
+ hash_ind = GetHashInd(key);
+ return (table[hash_ind].find(key));
+}
+
+LudbLinkedListItem *LudbHashTbl::find(const int value, int& hash_ind)
+{
+ LudbLinkedListItem *item;
+ for(int i=0; i<list_len; i++){
+ item = table[i].find(value);
+ if(item != NULL){
+ hash_ind = i;
+ return item;
+ }
+ }
+ hash_ind = -1;
+ return NULL;
+}
+
+int LudbHashTbl::add(void *key, const int value)
+{
+ int hash_ind = GetHashInd(key);
+ if(table[hash_ind].find(value) != NULL){
+ printf("LudbHashTbl::add() value %d already exists\n", value);
+ return -1;
+ }
+ return (table[hash_ind].add(key, value));
+}
+
+int LudbHashTbl::remove(void *key)
+{
+ int hash_ind = GetHashInd(key);
+ if(table[hash_ind].find(key) != NULL){
+ return (table[hash_ind].remove(key));
+ }
+ else{
+ printf("LudbHashTbl::remove() key 0x%08x doesn't exist\n", key);
+ return -1;
+ }
+}
+
+int LudbHashTbl::remove(int value)
+{
+ int hash_ind;
+ LudbLinkedListItem *item = find(value, hash_ind);
+ if(item != NULL)
+ return (table[hash_ind].remove(value));
+ else{
+ printf("LudbHashTbl::remove() value %d doesn't exist\n", value);
+ return -1;
+ }
+}
+
+void LudbHashTbl::print()
+{
+ for(int i=0; i<list_len; i++){
+ if(table[i].GetNumItems() > 0){
+ printf("bucket [%03d] \n", i);
+ table[i].print();
+ }
+ }
+}
diff --git a/data/mnet/GP10/Host/jcc/src_api/LudbLinkedList.cpp b/data/mnet/GP10/Host/jcc/src_api/LudbLinkedList.cpp
new file mode 100644
index 0000000..b6d5f47
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/LudbLinkedList.cpp
@@ -0,0 +1,230 @@
+/*********************************************************************/
+/* */
+/* (c) Copyright Cisco 2001 */
+/* All Rights Reserved */
+/* */
+/*********************************************************************/
+
+/*********************************************************************/
+/* */
+/* File : LudbLinkedList.cpp */
+/* Author(s) : Kevin S. Lim */
+/* Create Date : 03-25-01 copied from GsLinkedList.cpp */
+/* Description : A generic linked list made for hash table entries */
+/* by adding new items to the tail */
+/* It can have two kind of keys: IMSI or TMSI */
+/* IMSI will have 15 bytes characters as digit values */
+/* TMSI will have 32 bit values - unsigned long */
+/* */
+/*********************************************************************/
+
+#include "string.h"
+#include "stdio.h"
+
+#include "LudbLinkedList.h"
+
+int ludb_linked_list_debug = 0;
+
+/*********************************************************************/
+LudbLinkedListItem::LudbLinkedListItem()
+{
+ prev = NULL;
+ next = NULL;
+ key_len = LUDB_MAX_IMSI_KEY_LEN;
+}
+
+LudbLinkedListItem::LudbLinkedListItem(const int len, void *key, const int value)
+{
+ prev = NULL;
+ next = NULL;
+
+ if(len == LUDB_MAX_IMSI_KEY_LEN){
+ key_len = len;
+ for(int i=0; i<LUDB_MAX_IMSI_KEY_LEN; i++){
+ ckey[i] = ((unsigned char *)key)[i];
+ }
+ }
+ else if(len == LUDB_MAX_TMSI_KEY_LEN){
+ key_len = LUDB_MAX_TMSI_KEY_LEN;
+ lkey = *(unsigned long *)key;
+ }
+ else{
+ printf("LudbLinkedListItem::LudbLinkedListItem() unsupported hash key length encountered %d\n", len);
+ }
+ this->value = value;
+}
+
+LudbLinkedListItem::~LudbLinkedListItem()
+{
+
+}
+
+int LudbLinkedListItem::same_keys(const void *key)
+{
+ if(key_len == LUDB_MAX_TMSI_KEY_LEN){
+ return(lkey == *(unsigned long *)key);
+ }
+ else{
+ for(int i=0; i<key_len; i++){
+ if(ckey[i] != ((unsigned char *)key)[i])
+ return 0;
+ }
+ return 1;
+ }
+}
+
+void LudbLinkedListItem::print()
+{
+ if(key_len == LUDB_MAX_TMSI_KEY_LEN){
+ printf("key: 0x%08x value: %03d\n", lkey, value);
+ }
+ else{
+ printf("key: ");
+ for(int i=0; i<key_len; i++){
+ printf("%d", ckey[i]);
+ }
+ printf(" value: %03d\n", value);
+ }
+}
+
+/*********************************************************************/
+LudbLinkedList::LudbLinkedList()
+{
+ head = NULL;
+ tail = NULL;
+ num_items = 0;
+ key_len = LUDB_MAX_LIST_KEY_LEN;
+
+ if(ludb_linked_list_debug)
+ printf("Hash list created\n");
+}
+
+LudbLinkedList::LudbLinkedList(int len)
+{
+ head = NULL;
+ tail = NULL;
+ num_items = 0;
+ key_len = len;
+
+ if(ludb_linked_list_debug)
+ printf("Hash list created\n");
+}
+
+LudbLinkedList::~LudbLinkedList()
+{
+
+}
+
+void LudbLinkedList::SetKeyLength(int len)
+{
+ key_len = len;
+}
+
+LudbLinkedListItem *LudbLinkedList::find(const void *key)
+{
+ LudbLinkedListItem *item;
+
+ item = head;
+ while(item != NULL){
+ if(item->same_keys(key)){
+ return item;
+ }
+ else{
+ item = item->next;
+ }
+ }
+ return NULL;
+}
+
+LudbLinkedListItem *LudbLinkedList::find(const int value)
+{
+ LudbLinkedListItem *item;
+
+ item = head;
+ while(item != NULL){
+ if(item->value == value){
+ return item;
+ }
+ else{
+ item = item->next;
+ }
+ }
+ return NULL;
+}
+
+int LudbLinkedList::add(void *key, const int value)
+{
+ LudbLinkedListItem *temp = tail;
+
+ if(head == NULL){ // first one
+ head = tail = new LudbLinkedListItem(key_len, key, value);
+ }
+ else{
+ temp->next = new LudbLinkedListItem(key_len, key, value);
+ tail = tail->next;
+ tail->prev = temp;
+ }
+ num_items++;
+ return 0;
+}
+
+int LudbLinkedList::remove(LudbLinkedListItem *item)
+{
+ if(item == tail){
+ if(item == head){ // tail and head
+ head = NULL;
+ tail = NULL;
+ }
+ else{ // tail, not head
+ tail = tail->prev;
+ tail->next = NULL;
+ }
+ }
+ else{
+ if(item == head){ // not tail, but head
+ head = head->next;
+ head->prev = NULL;
+ }
+ else{ // not tail, not head
+ item->prev->next = item->next;
+ item->next->prev = item->prev;
+ }
+ }
+
+ delete item;
+ num_items--;
+ return 0;
+}
+
+int LudbLinkedList::remove(void *key)
+{
+ LudbLinkedListItem *item = find(key);
+ if(item == NULL) return -1;
+ else remove(item);
+ return 0;
+}
+
+int LudbLinkedList::remove(int value)
+{
+ LudbLinkedListItem *item = find(value);
+ if(item == NULL) return -1;
+ else remove(item);
+ return 0;
+}
+
+void LudbLinkedList::print()
+{
+ if(head == NULL){
+ printf("EMPTY\n");
+ return;
+ }
+
+ LudbLinkedListItem *item = head;
+ printf("--------------------------------------------------------------\n");
+ while(item != NULL){
+ printf(" ");
+ item->print();
+ item = item->next;
+ }
+ printf("--------------------------------------------------------------\n");
+}
diff --git a/data/mnet/GP10/Host/jcc/src_api/Makefile b/data/mnet/GP10/Host/jcc/src_api/Makefile
new file mode 100644
index 0000000..48f33f5
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/Makefile
@@ -0,0 +1,52 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..\..
+
+# These Must be Properly Defined
+THIS_APP_DIR = jcc
+THIS_DIRECTORY = src_api
+MY_OUTPUT = $(OBJDIR)\jcc_api.out
+
+# Name(s) of Common VOB directories to include
+COMMON_BLD_DIR =
+
+include $(TOP_OF_VOB)\l3defs.mk
+
+all: makeCommonObjs $(MY_OUTPUT)
+
+# Adds the .o file(s) list needed from the Common VOB
+makeCommonObjs:
+ifneq ($(COMMON_BLD_DIR),)
+ @for %f in ($(COMMON_BLD_DIR)) do \
+ make -C $(COMMON_VOB_APP_DIR)\%f \
+ all VOB=$(VOBNAME) APPDIR=Host\$(THIS_APP_DIR)\$(THIS_DIRECTORY)
+endif
+
+# If Common VOB directories to include get the .o files from bin
+$(MY_OUTPUT): $(MODULE_OBJS)
+ifneq ($(COMMON_BLD_DIR),)
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS) $(wildcard ./bin/*.o)
+else
+ $(LD) -r -o $@.tmp $() $(MODULE_OBJS)
+endif
+ $(NM) $@.tmp | munch > _ctdt.c
+ $(CC) -traditional $(CC_ARCH_SPEC) -c _ctdt.c
+ $(LD) -r -o $@ _ctdt.o $@.tmp
+ $(RM)$(subst /,$(DIRCHAR), _ctdt.c _ctdt.o $@.tmp)
+
+cleanall:
+ @for %f in ($(notdir $(MODULE_OBJS))) do \
+ $(RM) ..\bin\%f
+
+ $(RM) $(MY_OUTPUT)
+
+ifneq ($(COMMON_BLD_DIR),)
+ $(RM) bin\*.o
+ $(RM) bin\*.out
+endif \ No newline at end of file
diff --git a/data/mnet/GP10/Host/jcc/src_api/SubscInfoTest.cpp b/data/mnet/GP10/Host/jcc/src_api/SubscInfoTest.cpp
new file mode 100644
index 0000000..ee072b5
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/SubscInfoTest.cpp
@@ -0,0 +1,187 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : SubscInfoTest.cpp
+// Author(s) : Kevin Lim
+// Create Date : 06-16-99
+// Description : subscriber information structure and en/decoding function
+// for messages
+//
+// *******************************************************************
+#include "stdio.h"
+#include "string.h"
+
+// from common vob
+#include "subsc/SubscInfoType.h"
+#include "subsc/SubscInfoUtil.h"
+
+#include "JCC/LUDBapi.h"
+
+void ludbMakeDefaultSubscMsg(char *msg, short *size)
+{
+ T_SUBSC_INFO test_info;
+ short ret;
+
+ test_info.imsi.num_digit = 15;
+ test_info.imsi.imsi[0] = 0;
+ test_info.imsi.imsi[1] = 0;
+ test_info.imsi.imsi[2] = 1;
+ test_info.imsi.imsi[3] = 0;
+ test_info.imsi.imsi[4] = 1;
+ test_info.imsi.imsi[5] = 1;
+ test_info.imsi.imsi[6] = 2;
+ test_info.imsi.imsi[7] = 3;
+ test_info.imsi.imsi[8] = 4;
+ test_info.imsi.imsi[9] = 5;
+ test_info.imsi.imsi[10] = 6;
+ test_info.imsi.imsi[11] = 7;
+ test_info.imsi.imsi[12] = 8;
+ test_info.imsi.imsi[13] = 9;
+ test_info.imsi.imsi[14] = 0;
+ test_info.msisdn.num_digit = 13;
+ test_info.msisdn.digits[0] = 0;
+ test_info.msisdn.digits[1] = 0;
+ test_info.msisdn.digits[2] = 1;
+ test_info.msisdn.digits[3] = 6;
+ test_info.msisdn.digits[4] = 5;
+ test_info.msisdn.digits[5] = 0;
+ test_info.msisdn.digits[6] = 3;
+ test_info.msisdn.digits[7] = 3;
+ test_info.msisdn.digits[8] = 0;
+ test_info.msisdn.digits[9] = 2;
+ test_info.msisdn.digits[10] = 8;
+ test_info.msisdn.digits[11] = 9;
+ test_info.msisdn.digits[12] = 0;
+ test_info.prov_bs.num_srv = 1;
+ test_info.prov_bs.bs_code[0] = DATA_CDA_9600BPS;
+ test_info.prov_ts.num_srv = 3;
+ test_info.prov_ts.ts_code[0] = TELEPHONY_SERVICES;
+ test_info.prov_ts.ts_code[1] = EMERGENCY_CALLS;
+ test_info.prov_ts.ts_code[2] = SMS_MT_PP;
+ test_info.prov_ss.num_srv = 4;
+ test_info.prov_ss.ss_code[0] = SUPP_SERV_CLIP;
+ test_info.prov_ss.ss_code[1] = SUPP_SERV_COLP;
+ test_info.prov_ss.ss_code[2] = SUPP_SERV_CFU;
+ test_info.prov_ss.ss_code[3] = SUPP_SERV_CW;
+ test_info.status.status = SUBSC_STATUS_ODBARRING;
+ test_info.odb_data.odb_general.all_og_barred=false;
+ test_info.odb_data.odb_general.intrn_og_barred=false;
+ test_info.odb_data.odb_general.intrn_og_not_hplmn_barred=false;
+ test_info.odb_data.odb_general.premium_info_og_barred=false;
+ test_info.odb_data.odb_general.premium_enter_og_barred=false;
+ test_info.odb_data.odb_general.ss_access_barred=true;
+ test_info.odb_data.odb_general.intrz_og_barred=false;
+ test_info.odb_data.odb_general.intrz_og_not_hplmn_barred=false;
+ test_info.odb_data.odb_general.intrz_intrn_og_not_hplmn_barred=false;
+ test_info.odb_data.odb_general.all_ect_barred=false;
+ test_info.odb_data.odb_general.chargeable_ect_barred=false;
+ test_info.odb_data.odb_general.intrn_ect_barred=false;
+ test_info.odb_data.odb_general.intrz_ect_barred=false;
+ test_info.odb_data.odb_general.double_chargeable_ect_barred=false;
+ test_info.odb_data.odb_general.multiple_ect_barred=true;
+ test_info.odb_data.odb_plmn.plmn_specific_type1=false;
+ test_info.odb_data.odb_plmn.plmn_specific_type2=true;
+ test_info.odb_data.odb_plmn.plmn_specific_type3=false;
+ test_info.odb_data.odb_plmn.plmn_specific_type4=false;
+ test_info.ss_info_list.num_ss_info = 3;
+ test_info.ss_info_list.ss_info_forw[0].ss_code = SUPP_SERV_ALL_FWD;
+ test_info.ss_info_list.ss_info_forw[0].num_feature = 1;
+ test_info.ss_info_list.ss_info_forw[0].list[0].basic_service.service_type = BEARER_SERVICE_TYPE;
+ test_info.ss_info_list.ss_info_forw[0].list[0].basic_service.ex_bs_code[0] = DATA_CDA_9600BPS;
+ test_info.ss_info_list.ss_info_forw[0].list[0].basic_service.ex_bs_code[1] = 0; // reserved byte filler
+ test_info.ss_info_list.ss_info_forw[0].list[0].basic_service.ex_bs_code[2] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].basic_service.ex_bs_code[3] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].basic_service.ex_bs_code[4] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].ss_status.ss_status_A = 1;
+ test_info.ss_info_list.ss_info_forw[0].list[0].ss_status.ss_status_R = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].ss_status.ss_status_P = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].ss_status.ss_status_Q = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.num_digit = 13;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[0] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[1] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[2] = 1;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[3] = 5;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[4] = 1;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[5] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[6] = 5;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[7] = 7;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[8] = 4;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[9] = 0;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[10] = 4;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[11] = 3;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_to_num.digits[12] = 6;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_options.notify_forw_party = NOTIFICATION_TO_FORWARDING;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_options.notify_calling_party = NOTIFICATION_TO_CALLING;
+ test_info.ss_info_list.ss_info_forw[0].list[0].forw_options.forw_reason = NO_REPLY;
+ test_info.ss_info_list.ss_info_bar[0].ss_code = SUPP_SERV_BAOC;
+ test_info.ss_info_list.ss_info_bar[0].num_feature = 1;
+ test_info.ss_info_list.ss_info_bar[0].list[0].basic_service.service_type = TELE_SERVICE_TYPE;
+ test_info.ss_info_list.ss_info_bar[0].list[0].basic_service.ex_ts_code[0] = TELEPHONY_SERVICES;
+ test_info.ss_info_list.ss_info_bar[0].list[0].basic_service.ex_ts_code[1] = 0; // reserved byte filler
+ test_info.ss_info_list.ss_info_bar[0].list[0].basic_service.ex_ts_code[2] = 0;
+ test_info.ss_info_list.ss_info_bar[0].list[0].basic_service.ex_ts_code[3] = 0;
+ test_info.ss_info_list.ss_info_bar[0].list[0].basic_service.ex_ts_code[4] = 0;
+ test_info.ss_info_list.ss_info_bar[0].list[0].ss_status.ss_status_A = 1;
+ test_info.ss_info_list.ss_info_bar[0].list[0].ss_status.ss_status_R = 0;
+ test_info.ss_info_list.ss_info_bar[0].list[0].ss_status.ss_status_P = 0;
+ test_info.ss_info_list.ss_info_bar[0].list[0].ss_status.ss_status_Q = 0;
+ test_info.ss_info_list.ss_info_data[0].ss_code = SUPP_SERV_CW;
+ test_info.ss_info_list.ss_info_data[0].ss_status.ss_status_A = 1;
+ test_info.ss_info_list.ss_info_data[0].ss_status.ss_status_R = 0;
+ test_info.ss_info_list.ss_info_data[0].ss_status.ss_status_P = 1;
+ test_info.ss_info_list.ss_info_data[0].ss_status.ss_status_Q = 0;
+ test_info.user.len = 5;
+ test_info.user.name[0] = 'K';
+ test_info.user.name[1] = 'e';
+ test_info.user.name[2] = 'v';
+ test_info.user.name[3] = 'i';
+ test_info.user.name[4] = 'n';
+
+ ret = EncodeSubscInfo((unsigned char *)msg, size, &test_info);
+ printf("Encoder return val: %d, msg size return: %d\n", ret, *size);
+
+ printSubscMsg((unsigned char *)msg, *size);
+
+ ret = DecodeSubscInfo((unsigned char *)msg, *size, &test_info);
+ printf("Decoder return val: %d\n", ret);
+
+ subscPrintInfo(&test_info);
+}
+
+short subscTest1()
+{
+ T_SUBSC_INFO subsc;
+ char msg[200] = {
+ 1, 51, 49, 48, 49, 55, 48, 49, 48, 55,
+ 50, 55, 57, 52, 56, 56, 2, 4, 50, 50,
+ 48, 57, 5, 0, 6, 0, 7, 9, 17, 18,
+ 19, 33, 41, 42, 43, 65, 66, 8, 0, 9,
+ 0, 0, 0, 0, 0, 0, 0, 0, 10, 4,
+ 1, 33, 1, 1, 0, 0, 0, 0, 0, 1,
+ 2, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 41, 0, 1,
+ 42, 0, 1, 43, 0, 11, 13, 32, 77,111,
+ 116,111,114,111,108, 97, 32, 45, 32, 49,
+ };
+
+ return DecodeSubscInfo((unsigned char *)msg, 110, &subsc);
+}
+
+void ludbPrintSubscInfoSize()
+{
+ printf("sizeof(T_SUBSC_INFO) : %d\n", sizeof(T_SUBSC_INFO));
+}
+
+void ludbPrintLudbMsgSize()
+{
+ printf("sizeof(LudbMsgStruct) : %d\n", sizeof(LudbMsgStruct));
+}
diff --git a/data/mnet/GP10/Host/jcc/src_api/ludbapi.cpp b/data/mnet/GP10/Host/jcc/src_api/ludbapi.cpp
new file mode 100644
index 0000000..463c940
--- /dev/null
+++ b/data/mnet/GP10/Host/jcc/src_api/ludbapi.cpp
@@ -0,0 +1,949 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : LUDBapi.cpp
+// Author(s) : Kevin Lim
+// Create Date : 08-10-99
+// Description :
+//
+// *******************************************************************
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+// included L3 Message header for messages from other Layer 3 modules (CC, RR)
+
+// from common vob
+#include "subsc/SubscInfoType.h"
+#include "subsc/SubscInfoUtil.h"
+
+#include "MnetModuleId.h"
+#include "JCC/LUDB.h"
+#include "JCC/LUDBapi.h"
+#include "LUDBVoipMsgProc.h"
+#include "LudbHashTbl.h"
+
+#include "LOGGING/vcmodules.h"
+#include "LOGGING/vclogging.h"
+
+
+// global variables
+int ludb_purge_timer_sec = 1;
+MSG_Q_ID ludbMsgQId;
+LUDB gLUDB;
+short ludb_auth_required = 0;
+short ludb_auth_freq = 1;
+LudbHashTbl *ludbImsiHash;
+
+// ****************************************************************************
+void ludbSetPurgeTimer(int sec)
+{
+ if(sec == 0){
+ printf("usage: ludbSetPurgeTimer(seconds)\n");
+ printf("current: %d\n", ludb_purge_timer_sec);
+ }
+ else{
+ ludb_purge_timer_sec = sec;
+ }
+}
+
+// ****************************************************************************
+void ludbSetAuthRequired(int flag)
+{
+ if(ludb_auth_required != flag){
+ ludb_auth_required = flag;
+ printf("ludb_auth_required is now set to %d\n", ludb_auth_required);
+ }
+ else{
+ printf("ludb_auth_required is already set to %d\n", ludb_auth_required);
+ }
+}
+
+// ****************************************************************************
+void ludbSetAuthFreq(int freq)
+{
+ if(freq == 0){
+ printf("usage: ludbSetAuthFreq(freq)\n");
+ printf("freq : 1..5\n");
+ printf("current: %d\n", ludb_auth_freq);
+ }
+ else{
+ ludb_auth_freq = freq;
+ }
+}
+
+// ****************************************************************************
+int ludbVBReqTimeout(int ludb_id)
+{
+ DBG_FUNC("ludbVBReqTimeout", LUDB_LAYER);
+ DBG_ENTER();
+ DBG_TRACE("VBReq Timeout on entry: %d\n", ludb_id);
+
+ LudbMsgStruct timeout;
+
+ timeout.module_id = MODULE_LUDB;
+ timeout.msg_type = LUDB_VBREQ_TIMEOUT;
+ timeout.ludb_id = ludb_id;
+ if (ERROR == msgQSend( ludbMsgQId,
+ (char *) &timeout,
+ sizeof(LudbMsgStruct),
+ NO_WAIT, // important, timer handler shouldn't wait
+ MSG_PRI_NORMAL
+ ))
+ {
+ DBG_ERROR("ludbVBReqTimeout msgQSend (QID=%d) error\n", (int)ludbMsgQId);
+ }
+ DBG_LEAVE();
+ return 0;
+}
+
+// ****************************************************************************
+bool ludbStartVBReqTimer(short ludb_id)
+{
+ return gLUDB.startVBReqTimer(ludb_id);
+}
+
+// ****************************************************************************
+bool ludbStopVBReqTimer(short ludb_id)
+{
+ return gLUDB.stopVBReqTimer(ludb_id);
+}
+
+// ****************************************************************************
+int ludbPurgeTimeout(int ludb_id)
+{
+ DBG_FUNC("ludbPurgeTimeout", LUDB_LAYER);
+ DBG_ENTER();
+ DBG_TRACE("Purge Timeout on entry: %d\n", ludb_id);
+
+ LudbMsgStruct timeout;
+
+ timeout.module_id = MODULE_LUDB;
+ timeout.msg_type = LUDB_PURGE_TIMEOUT;
+ timeout.ludb_id = ludb_id;
+ if (ERROR == msgQSend( ludbMsgQId,
+ (char *) &timeout,
+ sizeof(LudbMsgStruct),
+ NO_WAIT, // important, timer handler shouldn't wait
+ MSG_PRI_NORMAL
+ ))
+ {
+ DBG_ERROR("ludbPurgeTimeout msgQSend (QID=%d) error\n", (int)ludbMsgQId);
+ }
+ DBG_LEAVE();
+ return 0;
+}
+
+// ****************************************************************************
+bool ludbStartPurgeTimer(short ludb_id)
+{
+ return gLUDB.startPurgeTimer(ludb_id);
+}
+
+// ****************************************************************************
+bool ludbStopPurgeTimer(short ludb_id)
+{
+ return gLUDB.stopPurgeTimer(ludb_id);
+}
+
+// ****************************************************************************
+char *getLudbMsgTypeString(LudbMsgType msg_type)
+{
+ switch(msg_type){
+ case LUDB_MM_REG_REQ: return("Registration Request"); break;
+ case LUDB_MM_UNREG_REQ: return("UnRegistration Request"); break;
+ case LUDB_MM_SEC_REQ: return("SecurityInfo Request"); break;
+ case LUDB_MM_REG_CNF: return("Registration Confirm"); break;
+ case LUDB_MM_REG_REJ: return("Registration Reject"); break;
+ case LUDB_MM_UNREG_CNF: return("UnRegistration Confirm"); break;
+ case LUDB_MM_UNREG_REJ: return("UnRegistration Reject"); break;
+ case LUDB_MM_SEC_RSP: return("Security Response"); break;
+
+ case VOIP_LUDB_REG_CNF: return("Registration Confirm"); break;
+ case VOIP_LUDB_REG_REJ: return("Registration Reject"); break;
+ case VOIP_LUDB_UNREG_CNF: return("UnRegistration Confirm"); break;
+ case VOIP_LUDB_UNREG_REJ: return("UnRegistration Reject"); break;
+ case VOIP_LUDB_SPI_IND: return("Subscriber Profile"); break;
+ case VOIP_LUDB_SEC_RSP: return("SecurityInfo Response"); break;
+
+ case VOIP_LUDB_UNREG_REQ: return("UnRegistration Request"); break;
+ default: return("Unknown"); break;
+ }
+}
+
+// ****************************************************************************
+bool ludbProfileUpdate(T_CNI_RIL3_IE_MOBILE_ID mobile_id, short len, char *buf)
+{
+ DBG_FUNC("ludbProfileUpdate", LUDB_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qid = ludbMsgQId;
+ LudbMsgStruct ludbInMsg;
+ ludbInMsg.module_id = MODULE_H323;
+ ludbInMsg.mobile_id = mobile_id;
+ ludbInMsg.msg_type = VOIP_LUDB_SPI_IND;
+
+ if(len <= VB_MAX_MSG_LENGTH){
+ ludbInMsg.vb_msg_size = len;
+ for(int i=0; i<len; i++)
+ ludbInMsg.vb_msg[i] = buf[i];
+ }
+ else{
+ DBG_ERROR("msg size bigger than %d\n", VB_MAX_MSG_LENGTH);
+ DBG_LEAVE();
+ return (false);
+ }
+
+ STATUS stat = msgQSend( qid, (char *) &ludbInMsg,
+ sizeof(LudbMsgStruct),
+ NO_WAIT, MSG_PRI_NORMAL );
+ if(stat == ERROR){
+ DBG_ERROR("msgQSend error\n");
+ DBG_LEAVE();
+ return (false);
+ }
+ else {
+ DBG_TRACE("Voip->Ludb MsgHandler MsgType: %s\n",
+ getLudbMsgTypeString(ludbInMsg.msg_type));
+ DBG_LEAVE();
+ return (true);
+ }
+}
+
+// ****************************************************************************
+bool ludbSRSUpdate(T_CNI_RIL3_IE_MOBILE_ID mobile_id, short num, T_AUTH_TRIPLET *triplet)
+{
+ DBG_FUNC("ludbSRSUpdate", LUDB_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qid = ludbMsgQId;
+ LudbMsgStruct ludbInMsg;
+ ludbInMsg.module_id = MODULE_H323;
+ ludbInMsg.mobile_id = mobile_id;
+ ludbInMsg.msg_type = VOIP_LUDB_SEC_RSP;
+
+ if(num == 1){
+ ludbInMsg.vb_msg_size = 1;
+ memcpy(ludbInMsg.vb_msg, triplet, sizeof(T_AUTH_TRIPLET));
+ }
+ else{
+ ludbInMsg.vb_msg_size = 0;
+ }
+
+ STATUS stat = msgQSend( qid, (char *) &ludbInMsg,
+ sizeof(LudbMsgStruct),
+ NO_WAIT, MSG_PRI_NORMAL );
+ if(stat == ERROR){
+ DBG_ERROR("msgQSend error\n");
+ DBG_LEAVE();
+ return (false);
+ }
+ else {
+ DBG_TRACE("Voip->Ludb MsgHandler MsgType: %s\n",
+ getLudbMsgTypeString(ludbInMsg.msg_type));
+ DBG_LEAVE();
+ return (true);
+ }
+}
+
+// ****************************************************************************
+bool LudbVBLinkMessageHandler(VBLINK_MOBILE_REG_EVENT event,
+ T_CNI_RIL3_IE_MOBILE_ID mobile_id)
+{
+ DBG_FUNC("LudbVBLinkMessageHandler", LUDB_LAYER);
+ DBG_ENTER();
+
+ MSG_Q_ID qid = ludbMsgQId;
+ LudbMsgStruct ludbInMsg;
+
+ ludbInMsg.module_id = MODULE_H323;
+ ludbInMsg.mobile_id = mobile_id;
+
+ switch (event) {
+ case VBLINK_MOBILE_REG_EVENT_RECV_URQ:
+ ludbInMsg.msg_type = VOIP_LUDB_UNREG_REQ;
+ break;
+
+ case VBLINK_MOBILE_REG_EVENT_RECV_RCF:
+ ludbInMsg.msg_type = VOIP_LUDB_REG_CNF;
+ break;
+
+ case VBLINK_MOBILE_REG_EVENT_RECV_RRJ:
+ ludbInMsg.msg_type = VOIP_LUDB_REG_REJ;
+ break;
+
+ case VBLINK_MOBILE_REG_EVENT_RECV_UCF:
+ ludbInMsg.msg_type = VOIP_LUDB_UNREG_CNF;
+ break;
+
+ case VBLINK_MOBILE_REG_EVENT_RECV_URJ:
+ ludbInMsg.msg_type = VOIP_LUDB_UNREG_REJ;
+ break;
+
+ default:
+ DBG_ERROR("Unexpected RegEvent Type : %d\n", event);
+ DBG_LEAVE();
+ return (false);
+ }
+
+ // send the message.
+ STATUS stat = msgQSend( qid, (char *) &ludbInMsg,
+ sizeof(LudbMsgStruct),
+ NO_WAIT, MSG_PRI_NORMAL );
+ if(stat == ERROR){
+ DBG_ERROR("msgQSend error\n");
+ DBG_LEAVE();
+ return (false);
+ }
+ else {
+ DBG_TRACE("Voip->Ludb MsgHandler MsgType: %s\n",
+ getLudbMsgTypeString(ludbInMsg.msg_type));
+ DBG_LEAVE();
+ return (true);
+ }
+}
+
+
+//*****************************************************************************
+//support legcy functions.
+//*****************************************************************************
+bool ludbGetSubscInfoExists(short index)
+{
+ return gLUDB.getSubscExist(index);
+}
+
+
+//*****************************************************************************
+void ludbSetSubscInfoExists(short index, bool flag)
+{
+ gLUDB.setSubscExist(index, flag);
+}
+
+
+//*****************************************************************************
+bool ludbGetSecInfoExists(short index)
+{
+ return gLUDB.getSecExist(index);
+}
+
+
+//*****************************************************************************
+void ludbSetSecInfoExists(short index, bool flag)
+{
+ gLUDB.setSecExist(index, flag);
+}
+
+
+//*****************************************************************************
+short ludbCheckAuthCount(short index)
+{
+ gLUDB.checkAuthCount(index);
+}
+
+//*****************************************************************************
+T_AUTH_TRIPLET *ludbCurTriplet(short index)
+{
+ return gLUDB.curTripletPtr(index);
+}
+
+//*****************************************************************************
+char ludbCKSN(short index)
+{
+ return gLUDB.curCKSN(index);
+}
+
+//*****************************************************************************
+char ludbIncCKSN(short index)
+{
+ return gLUDB.incCKSN(index);
+}
+
+//*****************************************************************************
+short ludbCountBeingUsed()
+{
+ short count=0;
+ for(int i=0; i<LUDB_MAX_NUM_ENTRY; i++){
+ if(!gLUDB.isFree(i)) count++;
+ }
+ return count;
+}
+
+//*****************************************************************************
+short ludbPercentBeingUsed()
+{
+ return (ludbCountBeingUsed() * 100)/LUDB_MAX_NUM_ENTRY;
+}
+
+//*****************************************************************************
+void ludbDataPrint()
+{
+ printf("LUDB Data *********************************************************\n");
+ printf(" %d out of %d entries (%d percent) is being used.\n",
+ ludbCountBeingUsed(), LUDB_MAX_NUM_ENTRY, ludbPercentBeingUsed());
+ gLUDB.print();
+ printf("*******************************************************************\n");
+}
+
+//*****************************************************************************
+void ludbHashPrint()
+{
+ printf("LUDB Hash *********************************************************\n");
+ ludbImsiHash->print();
+ printf("*******************************************************************\n");
+}
+
+//*****************************************************************************
+void ludbDataInit()
+{
+ gLUDB.init();
+}
+
+
+//*****************************************************************************
+void ludbEntryInit(const short index) // clean up entry - klim 3/29/99
+{
+ DBG_FUNC("ludbEntryInit", LUDB_LAYER);
+ DBG_ENTER();
+ gLUDB.init(index);
+ DBG_TRACE("entry %d initialized\n", index);
+ DBG_LEAVE();
+}
+
+//*****************************************************************************
+void ludbSetMMId(const short index, short mmId)
+{
+ DBG_FUNC("ludbSetMMId", LUDB_LAYER);
+ DBG_ENTER();
+ gLUDB.setMMId(index, mmId);
+ DBG_LEAVE();
+}
+
+//*****************************************************************************
+short ludbGetMMId(const short index)
+{
+ DBG_FUNC("ludbSetMMId", LUDB_LAYER);
+ DBG_ENTER();
+ DBG_LEAVE();
+ return(gLUDB.getMMId(index));
+}
+
+//*****************************************************************************
+T_CNI_RIL3_IE_MOBILE_ID ludbGetMobileId(short index)
+{
+ return gLUDB.getMobileId(index);
+}
+
+//*****************************************************************************
+short ludbGetEntryByMobileId(T_CNI_RIL3_IE_MOBILE_ID id)
+{
+ return gLUDB.getEntry(id);
+}
+
+//*****************************************************************************
+T_SUBSC_INFO* ludbGetSubscInfoPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getSubscInfoPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_MOBILE_ID_IMSI* ludbGetMobileIdPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getMobileIdPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_ISDN* ludbGetMSISDNPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getMSISDNPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_PROVISION_BS* ludbGetProvBSPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getProvBSPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_PROVISION_TS* ludbGetProvTSPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getProvTSPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_PROVISION_SS* ludbGetProvSSPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getProvSSPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_SUBSC_STATUS* ludbGetSubscStatusPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getSubscStatusPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_ODB_DATA* ludbGetODBDataPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getODBDataPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_SS_INFO_LIST* ludbGetSSInfoListPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getSSInfoListPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+T_SUBSC_IE_USER_INFO* ludbGetUserInfoPtr(const short index)
+{
+ if(ludbGetSubscInfoExists(index))
+ return gLUDB.getUserInfoPtr(index);
+ else
+ return 0;
+}
+
+//*****************************************************************************
+//*****************************************************************************
+bool ludbIsProvSMS_MT(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscProvSMS_MT_PP(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvSMS_MO(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscProvSMS_MO_PP(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCLIP(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCLIP(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCLIR(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCLIR(ss));
+}
+
+//*****************************************************************************
+// shmin
+
+int ludbGetCLIROption(const short index, T_SS_SUBSC_CLIR_OPTION *option, bool *isProvCLIR)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ if(subscIsProvCLIR(ss) == 0){
+ *isProvCLIR = 1;
+ return 0;
+ }
+ else{
+ *isProvCLIR = 0;
+ return(subscGetCLIROption(ss,option));
+ }
+}
+
+void testludbGetCLIROption(const short index)
+{
+int ret;
+T_SS_SUBSC_CLIR_OPTION *option;
+bool *isProvCLIR;
+
+ ret = ludbGetCLIROption(index, option, isProvCLIR);
+ printf("LUDB return %d ludbGetCLIROption index %d, isProvCLIR %d, option %d", ret, index, *isProvCLIR, *option);
+}
+
+//*****************************************************************************
+bool ludbIsProvCOLP(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCOLP(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCOLR(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCOLR(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCFU(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCFU(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCFB(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCFB(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCFNRY(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCFNRY(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCFNRC(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCFNRC(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvECT(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvECT(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvCW(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvCW(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvHOLD(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvHOLD(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvMPTY(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvMPTY(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvBAOC(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvBAOC(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvBOIC(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvBOIC(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvBOICE(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvBOICE(ss));
+}
+
+//*****************************************************************************
+bool ludbIsProvBAIC(const short index)
+{
+ T_SUBSC_INFO* ss = ludbGetSubscInfoPtr(index);
+ return(subscIsProvBAIC(ss));
+}
+
+//*****************************************************************************
+bool ludbIsActiveCFU(const short index)
+{
+ T_SUBSC_IE_SS_INFO_LIST *info_list = ludbGetSSInfoListPtr(index);
+ return(subscIsActiveCF(info_list, SUPP_SERV_CFU));
+}
+
+//*****************************************************************************
+bool ludbIsActiveCFB(const short index)
+{
+ T_SUBSC_IE_SS_INFO_LIST *info_list = ludbGetSSInfoListPtr(index);
+ return(subscIsActiveCF(info_list, SUPP_SERV_CFB));
+}
+
+//*****************************************************************************
+bool ludbIsActiveCFNRY(const short index)
+{
+ T_SUBSC_IE_SS_INFO_LIST *info_list = ludbGetSSInfoListPtr(index);
+ return(subscIsActiveCF(info_list, SUPP_SERV_CFNRY));
+}
+
+//*****************************************************************************
+int ludbGetTimerCFNRY(const short index)
+{
+ T_SUBSC_IE_SS_INFO_LIST *info_list = ludbGetSSInfoListPtr(index);
+ return(subscGetTimerCFNRY(info_list));
+}
+
+//*****************************************************************************
+bool ludbIsActiveCFNRC(const short index)
+{
+ T_SUBSC_IE_SS_INFO_LIST *info_list = ludbGetSSInfoListPtr(index);
+ return(subscIsActiveCF(info_list, SUPP_SERV_CFNRC));
+}
+
+//*****************************************************************************
+bool ludbIsActiveCW(const short index)
+{
+ T_SUBSC_IE_SS_INFO_LIST *info_list = ludbGetSSInfoListPtr(index);
+ return(subscIsActiveCW(info_list));
+}
+
+//*****************************************************************************
+// prints
+//*****************************************************************************
+void ludbPrintSubscInfo(const short index)
+{
+ subscPrintInfo(ludbGetSubscInfoPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintImsi(const short index)
+{
+ subscPrintImsi(ludbGetMobileIdPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintIsdn(const short index)
+{
+ subscPrintIsdn(ludbGetMSISDNPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintProvBS(const short index)
+{
+ subscPrintProvBS(ludbGetProvBSPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintProvTS(const short index)
+{
+ subscPrintProvTS(ludbGetProvTSPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintProvSS(const short index)
+{
+ subscPrintProvSS(ludbGetProvSSPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintSubscStatus(const short index)
+{
+ subscPrintSubscStatus(ludbGetSubscStatusPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintODBData(const short index)
+{
+ subscPrintODBData(ludbGetODBDataPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintSSInfoList(const short index)
+{
+ subscPrintSSInfoList(ludbGetSSInfoListPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintUserInfo(const short index)
+{
+ subscPrintUserInfo(ludbGetUserInfoPtr(index));
+}
+
+//*****************************************************************************
+void ludbPrintSRS(const short index)
+{
+ gLUDB.printSRS(index);
+}
+
+//*****************************************************************************
+//*****************************************************************************
+short ludbSetDecodeSubscInfo(const short index, unsigned char *msg, short size)
+{
+ T_SUBSC_INFO subsc;
+ short ret;
+
+ ret = DecodeSubscInfo(msg, size, &subsc);
+ if(ret)
+ return ret;
+ else
+ return gLUDB.update(index, subsc);
+}
+
+//*****************************************************************************
+// VOIP support
+//*****************************************************************************
+bool ludbGetMobileNumber(const short ludbId, char *num)
+{
+ if(num == 0) return false;
+
+ T_SUBSC_IE_ISDN* msisdn;
+ msisdn = ludbGetMSISDNPtr(ludbId);
+ if(msisdn == 0) return false;
+ if(msisdn->num_digit > MAX_NUM_SUBSC_ISDN) return false;
+ for(int i=0; i<msisdn->num_digit; i++)
+ num[i] = msisdn->digits[i];
+ num[i] = '\0';
+ return true;
+}
+
+//*****************************************************************************
+bool ludbGetMobileName(const short ludbId, char *name)
+{
+ if(name == 0) return false;
+
+ T_SUBSC_IE_USER_INFO* user;
+ user = ludbGetUserInfoPtr(ludbId);
+ if(user == 0) return false;
+ if(user->len > MAX_NUM_USER_INFO) return false;
+ for(int i=0; i<user->len; i++)
+ name[i] = user->name[i];
+ name[i] = '\0';
+ return true;
+}
+
+//*****************************************************************************
+bool isSameISDN(T_SUBSC_IE_ISDN *isdn, char *num)
+{
+ if(isdn->num_digit == 0) return false;
+ if(isdn->num_digit != strlen(num)) return false;
+ for(int i=0; i<isdn->num_digit; i++){
+ if(isdn->digits[i] != num[i])
+ return false;
+ }
+ return true;
+}
+
+//*****************************************************************************
+bool ludbIsMobileRegistered(char *num, short *ludbId)
+{
+ T_SUBSC_IE_ISDN* isdn;
+ DBG_FUNC("ludbIsMobileRegistered", LUDB_LAYER);
+ DBG_ENTER();
+ for(int i=0; i<LUDB_MAX_NUM_ENTRY; i++){
+ if((isdn = ludbGetMSISDNPtr(i)) != 0){
+ if(isSameISDN(isdn, num)){
+ *ludbId = i;
+ DBG_TRACE("Found Mobile %s in LUDB [%d]\n", num, i);
+ DBG_LEAVE();
+ return true;
+ }
+ }
+ }
+ DBG_WARNING("Mobile %s not registered in LUDB\n", num);
+ DBG_LEAVE();
+ return false;
+}
+
+//*****************************************************************************
+VOIP_MOBILE_HANDLE ludbGetVoipMobileHandle(const short ludbId)
+{
+// printf("[ludbGetVoipMobileHandle] Voip Mobile Handle is no longer supported\n");
+ return 0;
+}
+
+
+//*****************************************************************************
+void ludbSetCipherAlgo(short index, short algo)
+{
+ gLUDB.setAlgo(index, algo);
+}
+
+//*****************************************************************************
+short ludbGetCipherAlgo(short index, IntraL3CipherModeCommand_t *cmd)
+{
+ DBG_FUNC("ludbGetCipherAlgo", LUDB_LAYER);
+ DBG_ENTER();
+ short algo = gLUDB.curAlgo(index);
+ if(algo == -1){
+ DBG_ERROR("index out of range %d\n", index);
+ DBG_LEAVE();
+ return -1;
+ }
+ if(cmd == 0){
+ DBG_ERROR("null pointer for cmd field\n");
+ DBG_LEAVE();
+ return -1;
+ }
+
+ if(algo == 0){
+ cmd->cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ for(int i=0; i<SEC_KC_LEN; i++) cmd->Kc[i] = 0xFF;
+ DBG_LEAVE();
+ return 0;
+ }
+ else if(algo == 1){
+ cmd->cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_START_CIPHERING;
+ cmd->cmd.cipherModeSetting.algorithm = CNI_RIL3_CIPHER_ALGORITHM_A51;
+ }
+ else if(algo == 2){
+ cmd->cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_START_CIPHERING;
+ cmd->cmd.cipherModeSetting.algorithm = CNI_RIL3_CIPHER_ALGORITHM_A52;
+ }
+ else{
+ DBG_ERROR("ludb %d, cipher mode was not set previously\n");
+ cmd->cmd.cipherModeSetting.ciphering = CNI_RIl3_CIPHER_NO_CIPHERING;
+ }
+ DBG_TRACE("ludb %d, cipherModeSetting.ciphering: %d\n", index, cmd->cmd.cipherModeSetting.ciphering);
+ DBG_TRACE("ludb %d, cipherModeSetting.algorithm: %d\n", index, cmd->cmd.cipherModeSetting.algorithm);
+
+ T_AUTH_TRIPLET *triplet = ludbCurTriplet(index);
+ if(triplet == 0){
+ DBG_ERROR("triplet returned 0 in CipherModeCmd for ludb %d\n", index);
+ DBG_LEAVE();
+ return -1;
+ }
+ else{
+ for(int i=0; i<SEC_KC_LEN; i++)
+ cmd->Kc[i] = triplet->Kc[i];
+ }
+
+ DBG_LEAVE();
+ return 0;
+}
+