summaryrefslogtreecommitdiffstats
path: root/data/mnet/Common/cdr
diff options
context:
space:
mode:
Diffstat (limited to 'data/mnet/Common/cdr')
-rw-r--r--data/mnet/Common/cdr/Makefile47
-rw-r--r--data/mnet/Common/cdr/certificate/Readme.txt2
-rw-r--r--data/mnet/Common/cdr/certificate/ca.pem18
-rw-r--r--data/mnet/Common/cdr/certificate/ca_cert/cakey.pem18
-rw-r--r--data/mnet/Common/cdr/certificate/cdrpwd.datbin0 -> 32 bytes
-rw-r--r--data/mnet/Common/cdr/certificate/cert.pem50
-rw-r--r--data/mnet/Common/cdr/certificate/key.pem18
-rw-r--r--data/mnet/Common/cdr/include/CdrBase.h179
-rw-r--r--data/mnet/Common/cdr/include/CdrCommon.h132
-rw-r--r--data/mnet/Common/cdr/include/CdrInterface.h87
-rw-r--r--data/mnet/Common/cdr/include/CdrModule.h200
-rw-r--r--data/mnet/Common/cdr/include/CdrMsg.h112
-rw-r--r--data/mnet/Common/cdr/include/CdrRef.h38
-rw-r--r--data/mnet/Common/cdr/include/CdrRefSem.h42
-rw-r--r--data/mnet/Common/cdr/include/CdrRemClientSocket.h61
-rw-r--r--data/mnet/Common/cdr/include/CdrShellIntf.h39
-rw-r--r--data/mnet/Common/cdr/include/ConnList.h98
-rw-r--r--data/mnet/Common/cdr/include/msgProc.h47
-rw-r--r--data/mnet/Common/cdr/src/CdrRef.cpp49
-rw-r--r--data/mnet/Common/cdr/src/Makefile61
-rw-r--r--data/mnet/Common/cdr/src/readme.txt1
-rw-r--r--data/mnet/Common/cdr/src_client/CdrApi.cpp159
-rw-r--r--data/mnet/Common/cdr/src_client/CdrBase.cpp222
-rw-r--r--data/mnet/Common/cdr/src_client/CdrMain.cpp212
-rw-r--r--data/mnet/Common/cdr/src_client/CdrModule.cpp521
-rw-r--r--data/mnet/Common/cdr/src_client/CdrRefSem.cpp42
-rw-r--r--data/mnet/Common/cdr/src_client/CdrRemClientSocket.cpp71
-rw-r--r--data/mnet/Common/cdr/src_client/CdrSSA.cpp124
-rw-r--r--data/mnet/Common/cdr/src_client/CdrSystem.cpp98
-rw-r--r--data/mnet/Common/cdr/src_client/Makefile61
-rw-r--r--data/mnet/Common/cdr/src_client/readme.txt1
-rw-r--r--data/mnet/Common/cdr/src_server/ConnList.cpp177
-rw-r--r--data/mnet/Common/cdr/src_server/Makefile62
-rw-r--r--data/mnet/Common/cdr/src_test/simulator.cpp278
34 files changed, 3327 insertions, 0 deletions
diff --git a/data/mnet/Common/cdr/Makefile b/data/mnet/Common/cdr/Makefile
new file mode 100644
index 0000000..21cc2e2
--- /dev/null
+++ b/data/mnet/Common/cdr/Makefile
@@ -0,0 +1,47 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+# Use Examples:
+#
+# Case 1:
+# make all VOB=GP10 -
+# Places .out in VOB/bin directory
+#
+# Case 2:
+# make all VOB=GP10 APPDIR=Host\<Application Name>\<Source Directory> -
+# Places .o file(s) in VOB\$(APPDIR)\bin directory.
+#
+# <Application Name> = Name of Application directory
+# <Source Directory> = application sub directory where the calling
+# Makefile resides.
+#
+# Example: make all VOB=GP10 APPDIR=Host\vxTemplate\src
+#
+# (OPTIONAL) Append REPLACE - Replaces the List of directories
+# to be used in the SUBDIRS variable
+#
+# Example: make all VOB=GP10 APPDIR=Host\vxTemplate\src REPLACE="src_api src_debug"
+#
+# Note: This make file must reference a VOB that
+# has a defs.mk in the top level directory.
+#
+##########################################################
+
+SUBDIRS = src src_client src_server
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..
+
+VOBDIR = $(TOP_OF_VOB)/../$(VOB)
+
+# Allows a sub-set of the source code directories to be used
+
+ifneq ($(REPLACE),)
+ SUBDIRS = $(REPLACE)
+endif
+
+include $(VOBDIR)\l3defs.mk
+
+
diff --git a/data/mnet/Common/cdr/certificate/Readme.txt b/data/mnet/Common/cdr/certificate/Readme.txt
new file mode 100644
index 0000000..170c88b
--- /dev/null
+++ b/data/mnet/Common/cdr/certificate/Readme.txt
@@ -0,0 +1,2 @@
+This directory contains default certificate, key and password files for the MNET CDR subsystem.
+Encrypted password is "cdr_password". \ No newline at end of file
diff --git a/data/mnet/Common/cdr/certificate/ca.pem b/data/mnet/Common/cdr/certificate/ca.pem
new file mode 100644
index 0000000..5571166
--- /dev/null
+++ b/data/mnet/Common/cdr/certificate/ca.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC0jCCAjugAwIBAgIBADANBgkqhkiG9w0BAQQFADCBrjELMAkGA1UEBhMCVVMx
+EzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRwwGgYDVQQK
+ExNDSVNDTyBTeXN0ZW1zLCBJbmMuMQwwCgYDVQQLEwNNV0cxKTAnBgNVBAMTIENJ
+U0NPIE1ORVQgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MSAwHgYJKoZIhvcNAQkBFhFz
+dXBwb3J0QGNpc2NvLmNvbTAeFw0wMTA3MjQwMTU4MTZaFw0wMjA3MjQwMTU4MTZa
+MIGuMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMI
+U2FuIEpvc2UxHDAaBgNVBAoTE0NJU0NPIFN5c3RlbXMsIEluYy4xDDAKBgNVBAsT
+A01XRzEpMCcGA1UEAxMgQ0lTQ08gTU5FVCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkx
+IDAeBgkqhkiG9w0BCQEWEXN1cHBvcnRAY2lzY28uY29tMIGfMA0GCSqGSIb3DQEB
+AQUAA4GNADCBiQKBgQCz+izH0Rff1+xzN3QWcxAwLdhBagel0q5rsxuS5PZofSkx
+FVTFx00I759+bXrBVOGFki4M9vlhDscrihwnL5mH3Eh8U0HcB0ec9nPY0fGj5XZ0
+NLetHmoUoTyXR8sPxvR3iaLJSbftl5H9/LJLZ1ZWsQWxrm3wUGNNRAfYq2c9GQID
+AQABMA0GCSqGSIb3DQEBBAUAA4GBAENH4Ck+zskqIm6iTm1iS+b6R2JNiWXRsaib
+ANoq+D6lw0kT1hPvQ0DF9LgcaE+b3FeyI8afie3snSX+7OKDzo//hSpeXUxMBu7G
+mt43B7cNOVzIrADHJUSYdMwHZYLrS2HGHEkA71QAQJ7q9X+kVRBzbsFZftNFfiGk
+mrUxmRSi
+-----END CERTIFICATE-----
diff --git a/data/mnet/Common/cdr/certificate/ca_cert/cakey.pem b/data/mnet/Common/cdr/certificate/ca_cert/cakey.pem
new file mode 100644
index 0000000..95fa181
--- /dev/null
+++ b/data/mnet/Common/cdr/certificate/ca_cert/cakey.pem
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,63A6C5E14DF8F30B
+
+KumNLa3hHfOLuZU1It0ZSaMGFoRVyvzlt1BbmwP1r5IYZd7evHOOzrJsOhJ32UHY
+QVWmLgMEv+0FigRw8wqUhW8QT3Wohrd0kTEoxXPrENzK3K6g+/HlBvBhjci6BUjP
+HfE+qJ6dDsc/oIUTDqoZJwf+M8mlVvOzPALr979EdlFES8MrZj7hT0LLHO4xyhdn
+jSbgEbPimCR3AybuniPjpPHuNs2hGcQZ4lEZ/rl78OQIW3CLvqRWrZhZmuzzNMPx
+61vv/ezaX8iXdg5bkz34qE/2KNsmXH+wLRWkU9unYdoxisjhesvaRhNQKkQ6onBX
+jn8eDRHg+4ortHMQVWTETsPl/b3QVZXO4w6e1A08MVFhFiHt+uTEd/XP0wjgHICs
+llBcjPP90kOmRG8UJT0mwfUtsR26C3eZ5BUz2H8uxRRSPMU1Iwro4XvuD8Jtv9uU
+TJycEA+82BBfu94jEE4MLx+6h35mmf9HldaXb3ZONd9Ji34IBF+cp4+Wf3Fjsaj2
+k6FQO/ib4N3FZF8fEa/dcpbN1kBzXJTyy56i5wIskQHWe4yEgfT9NeBP/SyNG9KZ
+ZFaUR5Dqmuy2e2BG7TBC2dLDJ7q3SYGqTyi1S0Vp352kqKmwgNIi76nnZdWWcL4T
+Gt8WMEVpp+1rroXGHpliZ3GsN4AqdaT7IsEqWWk8fXiYlkYcKdjjzGWTQ96CBwz9
+KsL5eAqyRA2bnS+veUhEC5ZAzu7ATaDb+YmY2L+sa0jALqIw2Vw/JxM1FwuFvcp6
+e99uudN6LipqOolOs1aO5SAW2WeulfuNIrvNm2gabqKhpyNHU8oLPg==
+-----END RSA PRIVATE KEY-----
diff --git a/data/mnet/Common/cdr/certificate/cdrpwd.dat b/data/mnet/Common/cdr/certificate/cdrpwd.dat
new file mode 100644
index 0000000..7a3205c
--- /dev/null
+++ b/data/mnet/Common/cdr/certificate/cdrpwd.dat
Binary files differ
diff --git a/data/mnet/Common/cdr/certificate/cert.pem b/data/mnet/Common/cdr/certificate/cert.pem
new file mode 100644
index 0000000..68b7290
--- /dev/null
+++ b/data/mnet/Common/cdr/certificate/cert.pem
@@ -0,0 +1,50 @@
+Certificate:
+ Data:
+ Version: 1 (0x0)
+ Serial Number: 6503 (0x1967)
+ Signature Algorithm: md5WithRSAEncryption
+ Issuer: C=US, ST=California, L=San Jose, O=CISCO Systems, Inc., OU=MWG, CN=CISCO MNET Certificate Authority/Email=support@cisco.com
+ Validity
+ Not Before: Jul 24 01:58:18 2001 GMT
+ Not After : Jul 24 01:58:18 2002 GMT
+ Subject: C=US, ST=California, L=San Jose, O=CISCO Systems, Inc., OU=MWG, CN=CISCO MNET CDR USER/Email=support@cisco.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:e2:a5:09:d8:49:90:1e:0c:0e:ca:f7:e8:b5:b3:
+ 79:c3:d3:33:5d:25:3c:03:c2:9a:6e:4a:09:9c:c1:
+ cc:dc:34:3b:c9:0a:ef:84:45:05:ff:b3:5a:c6:73:
+ 33:9a:08:52:c5:7c:68:6e:f1:24:c9:7d:23:ad:9f:
+ a4:57:8b:63:07:21:bd:c9:f6:3f:b9:65:10:3f:8b:
+ 64:e7:44:d6:41:1e:c7:67:48:42:07:42:0a:df:a4:
+ 79:29:9a:ff:7a:ed:0a:68:e8:3b:eb:f0:e6:a7:bc:
+ 15:27:62:20:53:26:5b:0d:d9:21:f7:38:8d:36:7d:
+ 5d:28:65:a1:b6:9f:4e:24:b3
+ Exponent: 65537 (0x10001)
+ Signature Algorithm: md5WithRSAEncryption
+ 10:19:72:22:6a:94:00:a9:fd:cf:3f:ef:1a:d8:3c:c3:d0:7b:
+ c8:04:92:fe:d2:ef:34:f7:ba:f0:84:a2:34:77:89:c3:5e:7b:
+ 32:be:55:06:06:46:f8:93:72:20:13:d1:b9:4c:da:3b:77:70:
+ 9c:86:29:2d:d9:df:67:47:21:55:88:b8:08:08:bb:bc:33:ec:
+ 02:68:f6:5f:d1:e6:1b:2d:0a:bf:a2:c7:a1:f2:b4:cd:16:29:
+ 4d:55:f0:90:0b:2a:b2:52:1b:9e:6f:46:da:6b:a3:7b:a9:b8:
+ 2d:ad:00:8f:bc:b1:3a:72:b7:52:92:be:7c:31:5d:87:4d:b8:
+ f7:a2
+-----BEGIN CERTIFICATE-----
+MIICwTCCAioCAhlnMA0GCSqGSIb3DQEBBAUAMIGuMQswCQYDVQQGEwJVUzETMBEG
+A1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxHDAaBgNVBAoTE0NJ
+U0NPIFN5c3RlbXMsIEluYy4xDDAKBgNVBAsTA01XRzEpMCcGA1UEAxMgQ0lTQ08g
+TU5FVCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxIDAeBgkqhkiG9w0BCQEWEXN1cHBv
+cnRAY2lzY28uY29tMB4XDTAxMDcyNDAxNTgxOFoXDTAyMDcyNDAxNTgxOFowgaEx
+CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4g
+Sm9zZTEcMBoGA1UEChMTQ0lTQ08gU3lzdGVtcywgSW5jLjEMMAoGA1UECxMDTVdH
+MRwwGgYDVQQDExNDSVNDTyBNTkVUIENEUiBVU0VSMSAwHgYJKoZIhvcNAQkBFhFz
+dXBwb3J0QGNpc2NvLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA4qUJ
+2EmQHgwOyvfotbN5w9MzXSU8A8KabkoJnMHM3DQ7yQrvhEUF/7NaxnMzmghSxXxo
+bvEkyX0jrZ+kV4tjByG9yfY/uWUQP4tk50TWQR7HZ0hCB0IK36R5KZr/eu0KaOg7
+6/Dmp7wVJ2IgUyZbDdkh9ziNNn1dKGWhtp9OJLMCAwEAATANBgkqhkiG9w0BAQQF
+AAOBgQAQGXIiapQAqf3PP+8a2DzD0HvIBJL+0u8097rwhKI0d4nDXnsyvlUGBkb4
+k3IgE9G5TNo7d3Cchikt2d9nRyFViLgICLu8M+wCaPZf0eYbLQq/oseh8rTNFilN
+VfCQCyqyUhueb0baa6N7qbgtrQCPvLE6crdSkr58MV2HTbj3og==
+-----END CERTIFICATE-----
diff --git a/data/mnet/Common/cdr/certificate/key.pem b/data/mnet/Common/cdr/certificate/key.pem
new file mode 100644
index 0000000..f3b1221
--- /dev/null
+++ b/data/mnet/Common/cdr/certificate/key.pem
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,9D40E0AEA9699CC6
+
+o0x1NO0OC0zVke5WybdCdgnBtIm5wagFNHUCgUyj2ONTSDVdr4Aj+Rwa1nZVcxKo
+P3Vs3Juv58dlBUiPuxep7+nFY/W5xlcmt8TCuZwFjQgD4caCHDQ50m2XWq9OJ18Q
+L9Xsytx+KHYFcR7g/zkCYXzVU2D5Z2Mvvdx/vbMllcbjC5pGz0OhfPSe2HfuTzgo
+mHpdy8MfexLjqvGVu+XWvNEb7BkR1LxfKoAo84sIZpT8WvonSQLp19qmY6U65iWu
+cMI2JIgAv+oMa5tbRh51jthrFyVDf2c1cMosVVlK118bQmUjqw816GzmI8ml2n25
+MgW2Zt0j7CSqKX9zqncHpuOxLru3SlwDG2LGhmWJtlAOkaSxdopPw+ZminpHBPyy
+/+xIkzGrPCu6E7nogrmnxnR1lFG80T8OAebsCbumMdvi2WIPNYnL+vhaW++NMXeM
+Fj62dVaIl0+ozM5vr/C/puaVYeBS1+2dZMA+w9eP3r2yp7gn+uQb9BlQrFVG55yJ
+1TInbpYGrD8K3RmMsnY6iL7QyhdsRpXgo/fJOEd/bH89a8Ajuq+wbWz1EX0q4QeD
+LuI+cDOjNt64cHbIFQlYEGUxzvH9+Wdc0aFgFFxpoFR8e+/p/9OVpj4kxJMFdcDI
+CBhyJjIOORC/RBpcquUN//KrlpOuR0kx9W2LRK5+ufotDOSEYKKHXlQPKOm+hSIt
+zFCr7qfSXF6ibDQfzLSaP1N6r9QdParx8cL3aOoaoR5Ke3Ti8kPzl7G4bpswsId2
+g/mwVPXrkoAWNt1PzKIOuZzZkywyvT6sEV5ucNqD6qWQc8cqG+CVAQ==
+-----END RSA PRIVATE KEY-----
diff --git a/data/mnet/Common/cdr/include/CdrBase.h b/data/mnet/Common/cdr/include/CdrBase.h
new file mode 100644
index 0000000..ffd97b1
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrBase.h
@@ -0,0 +1,179 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+// CdrBase.h: interface for the CCdrBase class.
+//
+//////////////////////////////////////////////////////////////////////
+#ifndef _CDR_BASE_H_
+#define _CDR_BASE_H_
+
+#include <time.h>
+
+#include "CdrInterface.h"
+
+#include "subsc/SubscInfoType.h" // in common vob - klim 11/09/00
+#include "ril3/ril3msgheader.h"
+#include "ril3/ril3_common.h"
+#include "ril3/ie_cause.h"
+#include "ril3/ie_calling_bcd.h"
+#include "ril3/ie_called_bcd.h"
+
+
+#define CNI_RIL3_CAUSE_SUCCESS ((T_CNI_RIL3_CAUSE_VALUE)255)
+#define CDR_CURRENT_VERSION_NUM 2
+
+typedef ubyte4 T_CDR_EVENT_REFERENCE_NUMBER;
+
+
+// CDR data types
+typedef enum
+{
+ CDR_REC_NORM_RELEASE = 0,
+ CDR_REC_PARTIAL = 1,
+ CDR_REC_PARTIAL_REC_CALL_REESTABLISHMENT = 2,
+ CDR_REC_UNSUCCESSFUL_CALL_ATTEMPT = 3,
+ CDR_REC_STABLE_CALL_ABNORMAL_TERM = 4,
+ CDR_REC_CAMEL_INIT_CALL_RELEASE = 5
+
+} CdrRecCauseTerm_t;
+
+
+typedef enum {
+ CDR_RECORD_TYPE_MOC =0 ,
+ CDR_RECORD_TYPE_MTC =1 ,
+ CDR_RECORD_TYPE_MOSMS =6 ,
+ CDR_RECORD_TYPE_MTSMS =7 ,
+ CDR_RECORD_TYPE_SSA =10,
+ CDR_RECORD_TYPE_CTR =11,
+ CDR_RECORD_TYPE_INVALID =99,
+} T_CDR_RECORD_TYPE;
+
+
+typedef enum {
+ CDR_FIELD_NOT_SET = 0, // the field has not being set at all
+ CDR_FIELD_SET_AND_PRINTED = 1, // the field has been set and has been printed already
+ CDR_FIELD_SET_BUT_NOT_PRINT = 2 // the field has been set but never been printed yet.
+} T_CDR_FIELD_STATUS;
+
+
+// CDR Field E164
+class CCdrFieldE164
+{
+public:
+ T_CDR_FIELD_STATUS status ;
+ char buffer[23]; // pre-formated ascii string
+
+ void initialize () { buffer[0]='\0'; status=CDR_FIELD_NOT_SET;};
+ CCdrFieldE164() { initialize(); };
+ virtual ~CCdrFieldE164() {};
+ char * string ();
+ void set (T_SUBSC_IE_ISDN *p_e164);
+ void set (T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER *);
+ void set (T_CNI_RIL3_IE_CALLING_PARTY_BCD_NUMBER *);
+};
+
+// CDR Field IMSI
+class CCdrFieldIMSI
+{
+public:
+ T_CDR_FIELD_STATUS status ;
+ char buffer[16]; // pre-formated ascii string
+
+ void initialize () { buffer[0]='\0'; status=CDR_FIELD_NOT_SET;};
+ CCdrFieldIMSI() { initialize(); };
+ virtual ~CCdrFieldIMSI() {};
+ void set (T_SUBSC_IE_MOBILE_ID_IMSI *p_IMSI) ;
+ char * string ();
+};
+
+// CDR Field IMEI
+class CCdrFieldIMEI
+{
+public:
+ T_CDR_FIELD_STATUS status ;
+ char buffer[20]; // pre-formated ascii string
+
+ void initialize () { buffer[0]='\0'; status=CDR_FIELD_NOT_SET;};
+ CCdrFieldIMEI() { initialize();};
+ virtual ~CCdrFieldIMEI() {};
+ void set (T_CNI_RIL3_IE_MOBILE_ID *p_IMEI) ;
+ char * string ();
+};
+
+// CDR Field LACID
+class CCdrFieldLACID
+{
+public:
+ T_CDR_FIELD_STATUS status;
+ char buffer[20]; // pre-formated ascii string
+
+ void initialize () { buffer[0]='\0'; status=CDR_FIELD_NOT_SET;};
+ CCdrFieldLACID() { initialize();};
+ virtual ~CCdrFieldLACID() {};
+ void set (T_CNI_RIL3_IE_LOCATION_AREA_ID *p_la_id ,
+ T_CNI_RIL3_IE_CELL_ID *p_cell_id);
+ char * string ();
+};
+
+
+// CDR FIeld Date and Time
+class CCdrFieldDateTime
+{
+private:
+ time_t lTime ; // current system time (not UTC)
+ char buffer[16]; // pre-formated ascii string
+
+public:
+ T_CDR_FIELD_STATUS status;
+
+ CCdrFieldDateTime() { initialize();};
+ virtual ~CCdrFieldDateTime() {};
+
+ void initialize () { buffer[0] = '\0' ;
+ lTime = 0 ;
+ status = CDR_FIELD_NOT_SET;};
+ time_t getTime () { return (lTime); }
+ void stamp (); // stamp the current date and time into buffer
+ char * string ();
+};
+
+
+// CDR Base Class
+class CCdrBase
+{
+protected:
+ T_CDR_RECORD_TYPE record_type;
+ T_CDR_EVENT_REFERENCE_NUMBER event_ref_number;
+ CCdrFieldIMSI served_imsi;
+ CCdrFieldE164 served_msisdn;
+
+public:
+ unsigned short count;
+ CdrMessage_t cdr_msg;
+
+ CCdrBase();
+ virtual ~CCdrBase();
+
+ virtual void initialize ();
+
+ void setRecordType (T_CDR_RECORD_TYPE type) { cdr_msg.msgType=record_type=type; };
+ T_CDR_RECORD_TYPE getRecordType () { return record_type; };
+ void setServedIMSI (T_SUBSC_IE_MOBILE_ID_IMSI *p_imsi)
+ { served_imsi.set(p_imsi); };
+ void setServedMSISDN(T_SUBSC_IE_ISDN *p_msisdn)
+ { served_msisdn.set(p_msisdn); };
+ void printBaseFields(); // print all the fields into outbuffer
+ void generateRecord (); // send the record to the CDR client
+ T_CDR_EVENT_REFERENCE_NUMBER
+ getEventRefNumber() { return event_ref_number; };
+
+};
+
+
+// This class should NOT be used directly. This is a base class to derive
+// CTR, VoiceCall, SSA, and SMS records
+
+#endif // _CDR_BASE_H_ \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/CdrCommon.h b/data/mnet/Common/cdr/include/CdrCommon.h
new file mode 100644
index 0000000..9bf7fd9
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrCommon.h
@@ -0,0 +1,132 @@
+#ifndef __CDRCOMMON_H__
+#define __CDRCOMMON_H__
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrCommon.h
+// Author(s) : Igal Gutkin
+// Create Date : 06/20/00
+// Description :
+//
+// *******************************************************************
+
+#include "defs.h"
+
+// TCP Port number for CDR client to CDR server level 1 connection
+#define AM_MAIN_SERVER_PORT 11790
+
+// TCP Port number for client connection to CDR server level 2
+//#define CDR_MAIN_CONTROL_PORT 11792
+//#define CDR_MAIN_DATA_PORT 11793
+#define CDR_IPC_PORT 11794
+
+#define CDR_HEADER_SIZE 1 // CDR header length
+
+#define CDR_MAX_HEADER_LEN 100
+#define CDR_MAX_DATA_LENGTH 1200
+#define CDR_MAX_RECORD_LEN (CDR_MAX_DATA_LENGTH+CDR_MAX_HEADER_LEN)
+
+
+#define CDR_GENERIC_MSG_TYPE (0x1A2B3C4DL)
+
+#define CDR_FIELD_DELIMETER ' '
+
+// CDR Reference definitions
+#define CDR_INVALID_REFERENCE (0)
+#define CDR_MIN_REFERENCE (1)
+#define CDR_MAX_REFERENCE (0xFFFF)
+
+// CDR Version numbers
+#define CDR_INVALID_FORMAT_VER 0
+#define CDR_FORMAT_VER_1 1
+#define CDR_FORMAT_VER_2 2
+#define CDR_FORMAT_VER_3 3
+#define CDR_FORMAT_VER_4 4
+#define CDR_FORMAT_VER_5 5
+
+//Cdr Error codes
+#define CDR_STATUS_OK SOCKET_STATUS_OK
+#define CDR_STATUS_MSG_TOO_LONG SOCKET_STATUS_MSG_TOO_LONG
+#define CDR_STATUS_TEMP_SOC_ERR SOCKET_STATUS_TEMP_SOC_ERR
+#define CDR_STATUS_FATAL_SOC_ERR SOCKET_STATUS_FATAL_SOC_ERR
+
+// Buffer lengths
+#define CTRL_SOC_RCV_BUFF_LEN (0x1000)
+#define CTRL_SOC_SND_BUFF_LEN (0x1000)
+#define DATA_SOC_RCV_BUFF_LEN (0x500)
+#define DATA_SOC_SND_BUFF_LEN (0x10000)
+
+typedef char CdrLogPool_t [CDR_MAX_RECORD_LEN ];
+typedef char CdrRecPool_t [CDR_MAX_DATA_LENGTH];
+
+
+// CDR password filename
+#define CDR_PWD_FILE_NAME "cdrpwd.dat"
+
+
+typedef enum
+{
+ SOCK_ERROR = SOC_STATUS_ERROR,
+ SOCK_NORMAL = 0,
+ SOCKET_CLOSED = 1,
+ FILE_FULL = 2,
+ REGISTER_TIMEOUT = 3,
+ STATUS_QUERY_TIMEOUT= 4,
+ FILE_ACK_TIMEOUT = 5,
+ DATA_TIMEOUT = 6,
+ SHUTDOWN_CLIENT = 7
+
+} CDR_SOCK_RESULT;
+
+enum RegisterCause
+{
+ INIT_CAUSE,
+ FILE_TRANSFER_CAUSE
+};
+
+typedef enum
+{
+ CURRENT ,
+ FINISHED,
+ UNACK ,
+ ACK
+}CDR_FILE_EXTENSIONS;
+
+typedef enum
+{
+ DELETE_ENTRY ,
+ ADD_ENTRY ,
+ WRITE_FILE_CLOSE_TIME ,
+ WRITE_FILE_TRANSFER_TIME ,
+ WRITE_FILE_TRANSFER_STATUS
+
+} CDR_TIMESTAMP_FILE_OP;
+
+struct timeStampRec
+{
+ char fileName[MAX_PATH-1];
+ bool fileTransfer;
+ ubyte4 fileOpenTime;
+ ubyte4 fileCloseTime;
+ ubyte4 fileTransferTime;
+
+};
+
+typedef struct
+{
+ struct timeStampRec* rec;
+ sbyte4 numEntries;
+
+} timeStampStruct;
+
+
+#endif //__CDRCOMMON_H__
diff --git a/data/mnet/Common/cdr/include/CdrInterface.h b/data/mnet/Common/cdr/include/CdrInterface.h
new file mode 100644
index 0000000..701216f
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrInterface.h
@@ -0,0 +1,87 @@
+#ifndef CDR_INTERFACE_H
+#define CDR_INTERFACE_H
+
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc, 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrInterface.h
+// Author(s) : Igal Gutkin
+// Create Date : 07-25-00
+// Description : CDR module interface to the CDR application classes
+//
+// *******************************************************************
+
+#ifndef __CDRCOMMON_H__
+#include "CdrCommon.h"
+#endif //__CDRCOMMON_H__
+
+
+// CDR message storage
+typedef struct
+{
+ ubyte4 msgType;
+ CdrRecPool_t record ;
+} CdrMessage_t;
+
+
+#ifdef __cplusplus
+ extern "C"
+ {
+
+ // CDR control functions
+ /*-------------------------------------------------------------*/
+
+ // Stop CDR logging
+ void cdrStopLog ();
+
+ // Start/resume CDR logging
+ void cdrStartLog ();
+
+ // CDR info functions
+ bool cdrGetStatus ();
+
+ bool _cdrSwitchServer (LPSTR ipAddr);
+
+ // CDR user functions
+ /*-------------------------------------------------------------*/
+
+ // Return unique CDR reference number
+ ubyte4 cdrAllocateRef ();
+
+ // Provide the local host IP address (network byte order!!!)
+ ubyte4 cdrGetLocalIp ();
+
+ // Send log to CDR subsystem
+ bool cdrSendLog (CdrMessage_t *);
+
+ // Save CDR password to the file
+ bool cdrSavePwd (LPCSTR lpPasswd);
+ }
+
+#else
+
+ // CDR control functions
+ void cdrStopLog (void);
+ void cdrStartLog (int );
+ bool cdrGetStatus (void);
+ bool _cdrSwitchServer (LPSTR ipAddr);
+
+ // CDR user functions
+ ubyte4 cdrAllocateRef (void);
+ ubyte4 cdrGetLocalIp (void);
+ bool cdrSendLog (CdrMessage_t *);
+
+ bool cdrSavePwd (LPCSTR lpPasswd);
+
+#endif // __cplusplus
+
+
+#endif // CDR_INTERFACE_H \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/CdrModule.h b/data/mnet/Common/cdr/include/CdrModule.h
new file mode 100644
index 0000000..d03f45c
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrModule.h
@@ -0,0 +1,200 @@
+#ifndef __CDCMODULE_H__
+#define __CDRMODULE_H__
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrModule.h
+// Author(s) : Igal Gutkin
+// Create Date : 10/02/00
+// Description : CDR module class interface
+// Call Detail Recording (CDR) Client
+// Call Detail Recording is split into two parts. Much
+// of the work is done through the api functions providing
+// access to the record classes. However, a separate task
+// is used to perform network IO that is required to forward
+// the records to CDR Server which can cause some delay.
+// Thus, potentially lengthy operations can be done in the
+// background at a lower priority than call processing.
+// *******************************************************************
+
+#include "Os\JCModule.h"
+#include "Os\JCMsgQueue.h"
+#include "Os\JCTask.h"
+
+#include <usrLib.h>
+
+#include "AlarmCode.h"
+
+#include "CdrShellIntf.h"
+
+#include "CdrInterface.h"
+#include "cdrdefs.h"
+
+#include "CdrRefSem.h"
+#include "CdrRemClientSocket.h"
+
+
+// system definitions
+
+#define CDR_MSG_Q_MAX 128 // max msgs that can be queued
+#define CDR_MSG_SIZE_MAX sizeof (CdrMessage_t) // max bytes in a msg
+#define CDR_Q_OPTIONS JC_MSG_Q_FIFO // system options
+
+
+class CdrModule
+{
+// methods
+ public:
+
+// CDR API functions. Used by the CDR record classes
+friend void cdrDataPrint ();
+friend void cdrStartLog ();
+friend void cdrStopLog ();
+friend bool cdrGetStatus ();
+friend bool cdrSendLog (CdrMessage_t* msg);
+friend ubyte4 cdrAllocateRef ();
+friend ubyte4 cdrGetLocalIp ();
+friend int SysCommand_CDR (T_SYS_CMD cmd);
+
+ // Main loop entry point
+ static bool mainTaskHandle();
+
+ // Main access interface
+ static CdrModule *getInstance () {return (pCdr_) ;}
+
+ // Encrypts & write CDR access password to the file
+ static bool savePwd (LPCSTR lpPasswd);
+
+ // Alarm handling
+ static void raiseSslAlarm ();
+ static void cleanSslAlarm ();
+
+ static void raiseModuleAlarm (AlarmCode_t code);
+ static void cleanModuleAlarm ();
+
+ // Print operational information
+ void printInfo ();
+
+ // Test whether the CDR module is properly initialized
+ bool isSet () {return (pMainQueue_ != NULL && pSoc_ != NULL);}
+
+ // Test whether there is a connection to CDR server
+ bool isConnected () {return (srvOnline_);}
+
+ ubyte4 getServerIp () {return (srvrIp_ );}
+ ubyte2 getServerPort () {return (srvrPort_ );}
+
+ // use for debug purpose only
+ bool switchServer (ubyte4 newSrvrIp);
+
+ bool enableExtraInfo () { bExtraInfo_ = true ; }
+ bool disableExtraInfo () { bExtraInfo_ = false; }
+
+ private:
+
+ // Constructors & Destructor
+ CdrModule ();
+ ~CdrModule ();
+
+
+ // Create the module instance
+ static void create ();
+
+ // System Root control interface
+ static int sysCmdHandler (T_SYS_CMD cmd);
+
+ static bool readPwd ();
+
+ static LPSTR getPswdFile ();
+
+ // Setup the module task(s) and queue(s)
+ bool start ();
+
+ // Load init data
+ bool loadData ();
+
+ // Send log to the CDR module
+ bool submitRec (CdrMessage_t* msg);
+
+ // receive Msg from the incoming Queue
+ bool getMsg ();
+
+ // Access the module input queue
+ JCMsgQueue *getCdrMainQ () {return (pMainQueue_);}
+
+ // Allocate new CDR reference number
+ ubyte4 getNewRef () {return (localRef_.allocateRef());}
+
+ // setup socket connection to the CDR server
+ bool socketInit ();
+
+ // re-establish socket connection to the CDR server
+ bool socketReset ();
+
+ // Logging control interface
+ void enable () {logStatus_ = true ;}
+ void disable () {logStatus_ = false ;}
+ bool getStatus () {return (logStatus_);}
+
+
+// data members
+ private:
+
+ // provides information about using SSL
+ static bool bUseSSL_ ,
+ bUseMibSSL_;
+
+ static bool bExtraInfo_;
+
+
+ static char sPasswd_[SSL_MAX_PASSWORD_LENGTH+2];
+
+ // pointer to the module instance
+ static CdrModule *pCdr_ ;
+
+ // module system elements
+ static JCMsgQueue *pMainQueue_;
+ JCTask mainTask_ ;
+ JCMsgQueue *pReplayQ_ ;
+
+ // Alarm code
+ static AlarmCode_t majorAlarmCode_,
+ infoAlarmCode_ ;
+
+ // Client socket to the server
+ CdrRemClientSocket *pSoc_ ;
+
+ // CDR server parameters
+ ubyte4 srvrIp_ ;
+ ubyte2 srvrPort_ ;
+
+ // Local reference allocator
+ CdrRefSem localRef_ ;
+
+ // CDR Logging status
+ bool logStatus_;
+
+ // Cdr connection indicator
+ bool srvOnline_;
+
+ unsigned sentRecs_ ;
+ unsigned lostRecs_ ;
+
+ // message handling
+ unsigned inMsgSize_;
+ unsigned inMsgType_;
+ CdrMessage_t inMsgBuf_ ;
+ MNET_MODULE_ID fromModId_;
+
+};
+
+
+#endif //__CDRMODULE_H__ \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/CdrMsg.h b/data/mnet/Common/cdr/include/CdrMsg.h
new file mode 100644
index 0000000..adb41d6
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrMsg.h
@@ -0,0 +1,112 @@
+#ifndef _CDRMSG_H_
+#define _CDRMSG_H_
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrMsg.h
+// Author(s) : Sandeep A.
+// Create Date : 9/26/00
+// Description :
+//
+// *******************************************************************
+
+#include "msgProc.h"
+
+
+#define INPUT_SIZE 8192 // Ananth: need to revisit the size
+#define REGISTER_MSG_TYPE (0x10000021)
+#define REGISTER_ACK_MSG_TYPE (0x10000031)
+
+#define FILE_ACK_MSG_TYPE (0x10000051)
+#define STATUS_QUERY_MSG_TYPE (0x10000061)
+#define STATUS_RESPONSE_MSG_TYPE (0x10000071)
+#define IPC_FILE_FULL_MSG_TYPE (0x10000151)
+
+#define REGISTER_TIMEOUT_MSG_TYPE (0x10000201)
+#define FILE_ACK_TIMEOUT_MSG_TYPE (0x10000211)
+#define STATUS_QUERY_TIMEOUT_MSG_TYPE (0x10000221)
+#define DATA_TIMEOUT_MSG_TYPE (0x10000231)
+
+// New error codes
+#define CDR_STATUS_FILE_TRANSFER_ERROR 5
+#define CDR_STATUS_NON_FATAL_SEND_ERROR 6
+#define CDR_STATUS_FATAL_SEND_ERROR 7
+
+#define CDR_NAME_MAX_SIZE 32
+
+#define FILE_ERROR (~1)
+
+
+typedef struct
+{
+ ubyte4 cause;
+ sbyte cdr1Name[CDR_NAME_MAX_SIZE];
+} RegisterData_t;
+
+typedef struct
+{
+ ubyte4 cdr1Id;
+} RegisterAckData_t;
+
+
+typedef struct
+{
+ // ubyte4 lastValidFileId;
+} FileAckData_t;
+
+typedef struct
+{
+ ubyte4 lastValidFileId;
+} StatusResponseData_t;
+
+typedef struct
+{
+ ubyte4 cdr1Id;
+ ubyte4 fileId;
+ sbyte4 fileSize;
+ ubyte4 fileOpenTime;
+ ubyte4 fileCloseTime;
+} StatusQueryData_t;
+
+typedef struct CdrControlMsg_t
+{
+ ClientInterfaceMsgHeader_t hdr;
+ union {
+ RegisterData_t registerData;
+ RegisterAckData_t registerAckData;
+ FileAckData_t fileAckData;
+ StatusQueryData_t statusQueryData;
+ StatusResponseData_t statusResponseData;
+ }body;
+} CdrControlMsg;
+
+typedef struct
+{
+ ubyte4 cdr1Id;
+ sbyte inmsgPool[INPUT_SIZE - 4];
+} FirstData_t;
+
+typedef struct
+{
+ sbyte inmsgPool[INPUT_SIZE];
+} NextData_t;
+
+
+typedef struct CdrDataMsg_t
+{
+ union {
+ FirstData_t firstData;
+ NextData_t nextData;
+ }data;
+}CdrDataMsg;
+
+#endif
diff --git a/data/mnet/Common/cdr/include/CdrRef.h b/data/mnet/Common/cdr/include/CdrRef.h
new file mode 100644
index 0000000..4723474
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrRef.h
@@ -0,0 +1,38 @@
+#ifndef __CDRREF_H__
+#define __CDRREF_H__
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// File : cdrRef.h
+// Author(s) : Igal Gutkin
+// Create Date : 06/20/00
+// Description : interface for the CdrRef class
+//
+// *******************************************************************
+
+#include "CdrCommon.h"
+
+class CdrRef
+{
+public:
+ CdrRef() {;}
+ virtual ~CdrRef() {;}
+
+ static ubyte4 allocateRef ();
+ static ubyte4 getLastRef ();
+
+// data members
+private:
+ static ubyte4 lastRefNum_;
+};
+
+
+#endif // __CDRREF_H__ \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/CdrRefSem.h b/data/mnet/Common/cdr/include/CdrRefSem.h
new file mode 100644
index 0000000..793f12c
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrRefSem.h
@@ -0,0 +1,42 @@
+#ifndef __CDRREFSEM_H__
+#define __CDRREFSEM_H__
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// File : CdrRefSem.h
+// Author(s) : Igal Gutkin
+// Create Date : 11/08/00
+// Description : Interface for the CdrRefSem class
+// Provides semaphore protection in the multitask environment
+// *******************************************************************
+
+#include "Os\JCMutex.h"
+
+#include "CdrCommon.h"
+
+#include "CdrRef.h"
+
+class CdrRefSem : public CdrRef
+{
+public:
+ CdrRefSem () : CdrRef (), mutex_() {}
+ virtual ~CdrRefSem () {}
+
+ ubyte4 allocateRef ();
+
+// data members
+private:
+ // Preserves generation of unique CDR ref numbers
+ JCMutex mutex_;
+};
+
+
+#endif // __CDRREFSEM_H__ \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/CdrRemClientSocket.h b/data/mnet/Common/cdr/include/CdrRemClientSocket.h
new file mode 100644
index 0000000..3642373
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrRemClientSocket.h
@@ -0,0 +1,61 @@
+#ifndef __CDRREMCLIENTSOCKET_H__
+#define __CDRREMCLIENTSOCKET_H__
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrRemClientSocket.h
+// Author(s) : Igal Gutkin
+// Create Date : 06/20/00
+// Description : interface for the CdrRemClientSocket class.
+//
+// *******************************************************************
+
+#include "socket\GenClientSocket.h"
+
+#include "msgProc.h"
+
+
+#define CDR_CLIENT_SOC_RCV_BUFF_LEN (0x500)
+#define CDR_CLIENT_SOC_SND_BUFF_LEN (0x1024)
+
+class CdrRemClientSocket : public GenClientSocket
+{
+public:
+
+ CdrRemClientSocket ()
+ : GenClientSocket (CDR_CLIENT_SOC_SND_BUFF_LEN, CDR_CLIENT_SOC_RCV_BUFF_LEN)
+ {;}
+
+ CdrRemClientSocket (bool bEnableSSL, bool bEnableEncryption = true)
+ : GenClientSocket (CDR_CLIENT_SOC_SND_BUFF_LEN,
+ CDR_CLIENT_SOC_RCV_BUFF_LEN,
+ bEnableSSL ,
+ bEnableEncryption ) { ; }
+
+ virtual
+ ~CdrRemClientSocket () { ; }
+
+ int sendData (LPSTR szData);
+
+protected:
+
+private:
+ void zapLog ();
+
+// data members
+private:
+
+ ClientMsg_t outMsg_;
+
+};
+
+#endif //__CDRREMCLIENTSOCKET_H__ \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/CdrShellIntf.h b/data/mnet/Common/cdr/include/CdrShellIntf.h
new file mode 100644
index 0000000..fe47d40
--- /dev/null
+++ b/data/mnet/Common/cdr/include/CdrShellIntf.h
@@ -0,0 +1,39 @@
+#ifndef __CDRSHELLINTF_H__
+#define __CDRSHELLINTF_H__
+// *******************************************************************
+//
+// (c) Copyright Cisco Systems Inc, 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrShellIntf.h
+// Author(s) : Igal Gutkin
+// Create Date : 11/21/00
+// Description : CDR module shell interface definitions
+//
+// *******************************************************************
+
+#ifdef __cplusplus
+ extern "C"
+ {
+ void CdrDataPrint ();
+ void CdrEnableExtraInfo ();
+ void CdrDisableExtraInfo ();
+ int SavePwdCdr (LPCSTR lpPasswd);
+ void _CdrSendDebug ();
+ }
+#else
+ void CdrDataPrint (void);
+ void CdrEnableExtraInfo (void);
+ void CdrDisableExtraInfo (void);
+ int SavePwdCdr (LPCSTR lpPasswd);
+ void _CdrSendDebug (void);
+#endif //__cplusplus
+
+
+#endif //__CDRSHELLINTF_H__ \ No newline at end of file
diff --git a/data/mnet/Common/cdr/include/ConnList.h b/data/mnet/Common/cdr/include/ConnList.h
new file mode 100644
index 0000000..dea5486
--- /dev/null
+++ b/data/mnet/Common/cdr/include/ConnList.h
@@ -0,0 +1,98 @@
+#ifndef _CONNLIST_H_
+#define _CONNLIST_H_
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ConnList.h
+// Author(s) : Igal Gutkin
+// Create Date : 6/22/00
+// Description :
+//
+// *******************************************************************
+
+#include "socket\GenSocket.h"
+
+// Forward declarations
+class ClientConnectionList;
+class ClientConnListIterator;
+
+
+// *******************************************************************
+// Class ClientConnection
+// *******************************************************************
+class ClientConnection {
+public:
+ friend class ClientConnectionList;
+ friend class ClientConnListIterator;
+
+ ClientConnection (GenSocket&);
+
+ virtual ~ClientConnection ();
+
+ OS_SPECIFIC_SOCKET_HANDLE getSocket() {return (connSock_.getSocket());}
+ GenSocket *getClient() {return (&connSock_) ;}
+
+ int serveClient (const fd_set *set);
+
+
+private:
+ GenSocket & connSock_;
+ ClientConnection *next_ ;
+
+ // No default constructor
+ ClientConnection();
+};
+
+
+// *******************************************************************
+// Class ClientConnectionList
+// *******************************************************************
+class ClientConnectionList {
+public:
+ friend class ClientConnListIterator;
+
+ ClientConnectionList ();
+ ~ClientConnectionList();
+
+ SOC_STATUS InsertClientConnection (ClientConnection *pConn);
+ SOC_STATUS DeleteClientConnection (ClientConnection *pConn);
+
+private:
+ ClientConnection *pConnListHead_;
+};
+
+
+// *******************************************************************
+// Class ClientConnListIterator
+// *******************************************************************
+class ClientConnListIterator {
+public:
+ ClientConnListIterator (ClientConnectionList& List) : theList_(List)
+ { pClientConn_ = theList_.pConnListHead_; }
+ ~ClientConnListIterator() {}
+
+ void Reset() { pClientConn_ = theList_.pConnListHead_; }
+ ClientConnection *Next ()
+ {
+ ClientConnection *pCurrConn = pClientConn_;
+ return (pCurrConn ? (pClientConn_ = pCurrConn->next_) : pCurrConn);
+ }
+
+ ClientConnection *Current() { return pClientConn_;}
+
+private:
+ ClientConnection *pClientConn_;
+ ClientConnectionList& theList_ ;
+};
+
+
+#endif /* _CONNLIST_H_ */
diff --git a/data/mnet/Common/cdr/include/msgProc.h b/data/mnet/Common/cdr/include/msgProc.h
new file mode 100644
index 0000000..4b30fd1
--- /dev/null
+++ b/data/mnet/Common/cdr/include/msgProc.h
@@ -0,0 +1,47 @@
+#ifndef _MSGPROC_H_
+#define _MSGPROC_H_
+
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : msgProc.h
+// Author(s) : Igal Gutkin
+// Create Date : 6/21/00
+// Description :
+//
+// *******************************************************************
+
+
+
+/* CDR Message common header */
+typedef struct
+{
+ ubyte4 msgType; // reserved for the future use
+ ubyte4 dataLen;
+} ClientInterfaceMsgHeader_t;
+
+#define clientMsgHdrLen (sizeof(ClientInterfaceMsgHeader_t))
+
+
+typedef struct
+{
+ char logData [CDR_MAX_DATA_LENGTH];
+} ClientCdrData_t;
+
+
+typedef struct
+{
+ ClientInterfaceMsgHeader_t hdr;
+ ClientCdrData_t msg;
+} ClientMsg_t;
+
+
+#endif /* _MSGPROC_H_ */
diff --git a/data/mnet/Common/cdr/src/CdrRef.cpp b/data/mnet/Common/cdr/src/CdrRef.cpp
new file mode 100644
index 0000000..54a3641
--- /dev/null
+++ b/data/mnet/Common/cdr/src/CdrRef.cpp
@@ -0,0 +1,49 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 2.0
+// File : CdrRef.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 06/20/00
+// Description : implementation of the CdrRef class.
+//
+// *******************************************************************
+
+#include "cdrRef.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// Static Data members declarations
+//////////////////////////////////////////////////////////////////////
+
+ubyte4 CdrRef::lastRefNum_ = CDR_INVALID_REFERENCE;
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////
+// Primary behaviour methods
+//////////////////////////////////////////////////////////////////////
+
+ubyte4 CdrRef::allocateRef ()
+{
+ if (++lastRefNum_ > CDR_MAX_REFERENCE)
+ lastRefNum_ = CDR_MIN_REFERENCE;
+
+ return (lastRefNum_);
+}
+
+
+ubyte4 CdrRef::getLastRef()
+{
+ return (lastRefNum_);
+}
diff --git a/data/mnet/Common/cdr/src/Makefile b/data/mnet/Common/cdr/src/Makefile
new file mode 100644
index 0000000..ca246f8
--- /dev/null
+++ b/data/mnet/Common/cdr/src/Makefile
@@ -0,0 +1,61 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+# Use Examples:
+#
+# Case 1:
+# make all VOB=GP10 -
+# Places .out in VOB/bin directory
+#
+# Case 2:
+# make all VOB=GP10 APPDIR=Host\<Application Name>\<Source Directory> -
+# Places .o file(s) in VOB\$(APPDIR)\bin directory.
+#
+# <Application Name> = Name of Application directory
+# <Source Directory> = application sub directory where the calling
+# Makefile resides.
+#
+# Example: make all VOB=GP10 APPDIR=Host\vxTemplate\src
+#
+#
+# Note: This make file must reference a VOB that
+# has a defs.mk in the top level directory.
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..
+
+# Name of this App's Directory
+THIS_APP_DIR = cdr
+
+VOB2DIR = $(TOP_OF_VOB)\..\$(VOB)
+BINDIR = ..\bin
+
+ifeq ($(APPDIR),)
+ MY_OUTPUT = $(VOB2DIR)\bin\cdr_com.out
+else
+ MY_OUTPUT = $(OBJDIR)\cdr_com.out
+endif
+
+include $(VOB2DIR)\l3defs.mk
+
+
+all: $(MY_OUTPUT)
+
+$(MY_OUTPUT): $(MODULE_OBJS)
+ $(LD) -r -o $@.tmp $(MODULE_OBJS)
+ $(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)
+
+
diff --git a/data/mnet/Common/cdr/src/readme.txt b/data/mnet/Common/cdr/src/readme.txt
new file mode 100644
index 0000000..8a52ae0
--- /dev/null
+++ b/data/mnet/Common/cdr/src/readme.txt
@@ -0,0 +1 @@
+This folder contains source files common to CDR Client and CRD Server applications.
diff --git a/data/mnet/Common/cdr/src_client/CdrApi.cpp b/data/mnet/Common/cdr/src_client/CdrApi.cpp
new file mode 100644
index 0000000..c4e6a8e
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrApi.cpp
@@ -0,0 +1,159 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 2.0
+// File : CdrApi.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 11/08/00
+// Description : Application interface for the CDR subsystem
+//
+// *******************************************************************
+
+#include "stdafx.h"
+
+#include "CdrModule.h"
+
+/*******************************************************************************
+ *
+ * cdrStartLog, cdrStopLog, cdrGetStatus
+ *
+ * These functions are used to turn CDR logging On/Off and check current
+ * logging status
+ *
+ ********************************************************************************/
+
+void cdrStartLog ()
+{
+ if (CdrModule::getInstance())
+ CdrModule::getInstance()->enable();
+}
+
+
+void cdrStopLog ()
+{
+ if (CdrModule::getInstance())
+ CdrModule::getInstance()->disable();
+}
+
+
+bool cdrGetStatus ()
+{
+ if (CdrModule::getInstance())
+ return (CdrModule::getInstance()->getStatus());
+}
+
+
+/*******************************************************************************
+ *
+ * cdrAllocateRef Allocate a Call Detail Record
+ *
+ * This function is used to allocate a CDR record. Since CDR records are
+ * stored in the application context only new CDR Reference number will
+ * be issued.
+ *
+ * Call: newRefNum = cdrAllocateRef()
+ *
+ * newRefNum - This is a unique 16 bit number that can be used
+ * to identify the record by.
+ * Note: After reaching max value (65,536), the number
+ * will wrap and we start re-using the reference numbers.
+ *
+ ******************************************************************************/
+ubyte4 cdrAllocateRef ()
+{
+ ubyte4 newRef = 0;
+
+ AM_FUNC ("cdrAllocateRef", LAYER_ID);
+ AM_ENTER();
+
+ if (CdrModule::getInstance())
+ newRef = CdrModule::getInstance()->getNewRef();
+
+ AM_LEAVE ();
+ return (newRef);
+}
+
+
+/*******************************************************************************
+ *
+ * cdrGetLocalIp Provides the local host IP address to the CDR classes
+ *
+ * This function is using cached value initialized during the init.
+ *
+ * Call : uIpAddrr = cdrGetLocalIp()
+ *
+ * Return value: NULL on error;
+ *
+ ******************************************************************************/
+ubyte4 cdrGetLocalIp ()
+{
+ return (htonl(GenSocket::getLocalHostAddress()));
+}
+
+
+/*******************************************************************************
+ *
+ * cdrSendLog API for sending prepared CDR log to the CDR subsystem
+ *
+ * This function is used to send CDR log from the application to CDR subsystem.
+ * Should be invoked only by the CDR base class
+ * being allocated.
+ *
+ * Call: result = cdrSendLog (&recordPool)
+ *
+ * Return Value: true if success, otherwise - false
+ *
+ ******************************************************************************/
+bool cdrSendLog (CdrMessage_t* msg)
+{
+ if (CdrModule::getInstance())
+ return (CdrModule::getInstance()->submitRec (msg));
+ else
+ return (false);
+}
+
+
+/*******************************************************************************
+ *
+ * _cdrSwitchServer API for changing CDR Server IP address
+ *
+ * This function should be used for changing CDR Server IP address
+ * for DEBUG purposes ONLY!!!
+ * Should be invoked only by the CDR base class being allocated.
+ *
+ * Call: result = _cdrSwitchServer (char* ipAddress)
+ *
+ * Input Parameter: string containing an (Ipv4) Internet Protocol dotted address
+ * Return Value : true if success, otherwise - false
+ *
+ ******************************************************************************/
+bool _cdrSwitchServer (LPSTR ipAddr)
+{
+ bool retVal = false ;
+ unsigned len = strlen(ipAddr);
+ ubyte4 srvrIp ;
+
+ if (len < 7 || len > 15)
+ {
+ printf ("Invalid IP address length.\n");
+ }
+ else if ((srvrIp=inet_addr(ipAddr)) == INADDR_NONE)
+ {
+ printf ("Invalid IP address (%s) is provided\n", ipAddr);
+ }
+ else
+ {
+ if (CdrModule::getInstance())
+ retVal = CdrModule::getInstance()->switchServer(srvrIp);
+ else
+ printf ("Cdr Client module is not allocated properly.\n");
+ }
+
+ return (retVal);
+} \ No newline at end of file
diff --git a/data/mnet/Common/cdr/src_client/CdrBase.cpp b/data/mnet/Common/cdr/src_client/CdrBase.cpp
new file mode 100644
index 0000000..158f6ae
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrBase.cpp
@@ -0,0 +1,222 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+// CdrBase.cpp: implementation of the CCdrBase class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "StdAfx.h"
+
+#include "CdrBase.h"
+
+bool CDR_Enable_Debug = false;
+
+
+// CDR Field E164
+
+void CCdrFieldE164::set(T_SUBSC_IE_ISDN *p_e164)
+{
+ if (p_e164->num_digit)
+ {
+ p_e164->digits[ (p_e164->num_digit>MAX_NUM_SUBSC_ISDN)? MAX_NUM_SUBSC_ISDN : p_e164->num_digit]=0;
+ sprintf (buffer, "%02X%s", (p_e164->num_plan[0] & 0x7F), p_e164->digits);
+ status = CDR_FIELD_SET_BUT_NOT_PRINT;
+ }
+}
+
+void CCdrFieldE164::set (T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER *pNum)
+{
+ unsigned offset ,
+ index = 0,
+ numDigits = (pNum->numDigits > CNI_RIL3_MAX_BCD_DIGITS)
+ ? CNI_RIL3_MAX_BCD_DIGITS
+ : pNum->numDigits ;
+
+ // correction for zero lenght number
+ if (pNum->numDigits)
+ {
+ offset = sprintf (buffer, "%1X%1X", pNum->numberType, pNum->numberingPlan);
+
+ // print BCD digits
+ while (index < numDigits)
+ {
+ *(buffer + offset + index) = 0x30 + pNum->digits [index++];
+ }
+
+ *(buffer + offset + index) = '\0';
+
+ status=CDR_FIELD_SET_BUT_NOT_PRINT;
+ }
+}
+
+void CCdrFieldE164::set (T_CNI_RIL3_IE_CALLING_PARTY_BCD_NUMBER *pNum)
+{
+ T_CNI_RIL3_IE_CALLED_PARTY_BCD_NUMBER shortForm;
+
+ shortForm.ie_present = pNum->ie_present ;
+ shortForm.numberType = pNum->numberType ;
+ shortForm.numberingPlan = pNum->numberingPlan;
+ shortForm.numDigits = pNum->numDigits ;
+ memcpy (shortForm.digits, pNum->digits, CNI_RIL3_MAX_BCD_DIGITS);
+
+ set (&shortForm);
+}
+
+
+char * CCdrFieldE164::string()
+{
+ status=CDR_FIELD_SET_AND_PRINTED;
+ return buffer;
+};
+
+
+// CDR Field IMSI
+
+void CCdrFieldIMSI::set(T_SUBSC_IE_MOBILE_ID_IMSI *p_IMSI)
+{
+ p_IMSI->imsi[ (p_IMSI->num_digit>MAX_NUM_SUBSC_IMSI) ? MAX_NUM_SUBSC_ISDN : p_IMSI->num_digit ]=0;
+ sprintf(buffer, "%s", p_IMSI->imsi);
+ status=CDR_FIELD_SET_BUT_NOT_PRINT;
+};
+
+char * CCdrFieldIMSI::string()
+{
+ status=CDR_FIELD_SET_AND_PRINTED;
+ return buffer;
+};
+
+void CCdrFieldIMEI::set (T_CNI_RIL3_IE_MOBILE_ID *pIMEI)
+{
+ unsigned index = 0;
+
+ // print BCD digits
+ while (index < 15)
+ {
+ buffer [index] = 0x30 + pIMEI->digits [index++];
+ }
+
+ buffer[index] = '\0';
+
+ status = CDR_FIELD_SET_BUT_NOT_PRINT;
+}
+
+
+char * CCdrFieldIMEI::string()
+{
+ status = CDR_FIELD_SET_AND_PRINTED;
+ return (buffer);
+}
+
+// CDR Field LACID
+
+void CCdrFieldLACID::set(T_CNI_RIL3_IE_LOCATION_AREA_ID *p_la_id, T_CNI_RIL3_IE_CELL_ID *p_cell_id)
+{
+ sprintf (buffer, "%1u%1u%1u%1u%1u%1x%04X%04X",
+ p_la_id->mcc[0], p_la_id->mcc[1], p_la_id->mcc[2],
+ p_la_id->mnc[0], p_la_id->mnc[1], ((unsigned)p_la_id->mnc[2] > 9) ? 0xF : p_la_id->mnc[2],
+ (unsigned short)p_la_id->lac , (unsigned short)p_cell_id->value);
+
+ status = CDR_FIELD_SET_BUT_NOT_PRINT;
+};
+
+char * CCdrFieldLACID::string()
+{
+ status = CDR_FIELD_SET_AND_PRINTED;
+ return buffer;
+};
+
+
+// CDR Field Date and Time
+
+void CCdrFieldDateTime::stamp()
+{
+ // The following time function comes from standard ANSI library.
+ // Therefore, the body of the code, including type/structure definition are
+ // the same for both Windows NT and VxWorks environment. No conditional
+ // compilation is needed between the two operating systems.
+
+ struct tm *gmt;
+
+ time (&lTime); // get local time
+ gmt = gmtime (&lTime); // convert to UTC time
+
+ // the final format is UTC time, YYMMDDhhmmss
+ sprintf(buffer,"%02d%02d%02d%02d%02d%02d",
+ gmt->tm_year % 100, // year since 1900
+ gmt->tm_mon + 1 , // month since Jan 0..11
+ gmt->tm_mday , // day of the month 1..31
+ gmt->tm_hour , // hours after midnight 0..23
+ gmt->tm_min , // minutes after hour 0..59
+ gmt->tm_sec // seconds after minutes 0..59
+ );
+
+ status = CDR_FIELD_SET_BUT_NOT_PRINT;
+}
+
+
+char * CCdrFieldDateTime::string()
+{
+ status=CDR_FIELD_SET_AND_PRINTED;
+ return buffer;
+};
+
+// CDR Base class
+void CCdrBase::initialize()
+{
+ count =0 ;
+ cdr_msg.record[0] ='\0';
+ record_type = CDR_RECORD_TYPE_INVALID;
+ event_ref_number = cdrAllocateRef () ;
+
+ served_imsi.initialize ();
+ served_msisdn.initialize ();
+}
+
+
+CCdrBase::CCdrBase()
+{
+ initialize();
+}
+
+CCdrBase::~CCdrBase()
+{
+}
+
+void CCdrBase::printBaseFields()
+{
+ // print all the fields of this class to the outbuffer
+ //
+ // A2=IP-address field of the recording entity
+ // A3=Event Reference Number
+ // A4=Served IMSI
+ // A5=Served MSISDN
+ // A6=CDR Format Version (current = 2)
+ // A7=Record Type
+ count+=sprintf(&cdr_msg.record[count],"A2=%08X", cdrGetLocalIp());
+ count+=sprintf(&cdr_msg.record[count],"%cA3=%d",CDR_FIELD_DELIMETER,event_ref_number);
+ if(served_imsi.status==CDR_FIELD_SET_BUT_NOT_PRINT)
+ count+=sprintf(&cdr_msg.record[count],"%cA4=%s",CDR_FIELD_DELIMETER,served_imsi.string());
+ if(served_msisdn.status==CDR_FIELD_SET_BUT_NOT_PRINT)
+ count+=sprintf(&cdr_msg.record[count],"%cA5=%s",CDR_FIELD_DELIMETER,served_msisdn.string());
+ count+=sprintf(&cdr_msg.record[count],"%cA6=%u",CDR_FIELD_DELIMETER, CDR_CURRENT_VERSION_NUM);
+ count+=sprintf(&cdr_msg.record[count],"%cA7=%d",CDR_FIELD_DELIMETER,(unsigned long)record_type);
+}
+
+
+void CCdrBase::generateRecord()
+{
+ // print to stdout under debug control flag
+ if(CDR_Enable_Debug) printf("%s\n", cdr_msg.record);
+
+ // send the record to the CDR client
+ cdrSendLog(&cdr_msg);
+
+ // reset the output buffer to its initial state
+ count=0;
+ cdr_msg.record[0]='\0';
+}
+
+
diff --git a/data/mnet/Common/cdr/src_client/CdrMain.cpp b/data/mnet/Common/cdr/src_client/CdrMain.cpp
new file mode 100644
index 0000000..057a92a
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrMain.cpp
@@ -0,0 +1,212 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems Inc., 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 2.0
+// Status : Under development
+// File : CdrMain.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 09-09-00
+// Description : CDR client module main task function implementation
+//
+// *******************************************************************
+
+
+// *******************************************************************
+// Include Files.
+// *******************************************************************
+
+#include "StdAfx.h"
+
+#include <msgQLib.h>
+
+#include "AlarmCode.h"
+
+#include "CdrModule.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// Static data members
+//////////////////////////////////////////////////////////////////////
+bool CdrModule::bExtraInfo_ =
+#ifdef _AM_DEBUG_
+ true;
+#else
+ false;
+#endif // _AM_DEBUG_
+
+//////////////////////////////////////////////////////////////////////
+// Cdr task main loop functions
+//////////////////////////////////////////////////////////////////////
+
+bool CdrModule::mainTaskHandle ()
+{
+ int errorCode;
+ bool retVal = true;
+
+ CdrModule * module = CdrModule::getInstance();
+
+ AM_FUNC ("CdrModule::mainTaskHandle", LAYER_ID);
+ AM_ENTER();
+
+ if (module && pMainQueue_)
+ {
+ // Load system data
+ if ((retVal = module->loadData()) == false)
+ {
+ raiseModuleAlarm (EC_CDR_CLIENT_INIT_FAILED);
+ module->disable ();
+
+ // keep going in order to allow the user to update a MIB variable when MIB is not
+ // initialized properly
+ // AM_RETURN (retVal);
+ }
+ else
+ {
+ cleanModuleAlarm ();
+ cleanSslAlarm ();
+
+ // Setup CDR Server connection
+ if (!module->socketInit())
+ {
+ AM_TRACE (("CDR Client: Unable to establish link to CDR Server.\n"));
+ // Continue. Will try to establish connection later
+ }
+
+ AM_TRACE (("CDR Server IP address is set to %#08lx (%s)\n", module->srvrIp_,
+ GenSocket::getIp(module->srvrIp_) ));
+
+ if (bExtraInfo_)
+ module->printInfo ();
+ }
+
+ module->mainTask_.JCTaskEnterLoop();
+
+ while (true)
+ {
+ // Allow other tasks with the same priority to run before retriving the next
+ // message from the Queue.
+ taskDelay (NO_WAIT);
+
+ if (module->getMsg () == true)
+ {
+ AM_DEBUG (("CDR Client receivced a new message\n"));
+
+ if (!module->getStatus())
+ {
+ ++(module->lostRecs_);
+ AM_TRACE ( ("CDR Client: Logging is disabled. Discard the record %d.\n %s",
+ (module->sentRecs_+module->lostRecs_),
+ module->inMsgBuf_.record ) );
+ continue;
+ }
+
+ if (!module->isConnected() && !module->socketReset())
+ {
+ ++(module->lostRecs_);
+
+ raiseSslAlarm ();
+ raiseModuleAlarm (EC_CDR_CLIENT_UNABLE_CONNECT_SERVER);
+
+ AM_TRACE (("CDR Client: Failed connect to server. Discard the record %d:\n %s\n",
+ (module->sentRecs_+module->lostRecs_),
+ module->inMsgBuf_.record ));
+ continue;
+ }
+
+ cleanModuleAlarm ();
+ cleanSslAlarm ();
+
+ if (module->inMsgBuf_.msgType == CDR_GENERIC_MSG_TYPE)
+ {
+ AM_DEBUG (("CDR Client: Processing new log:\n%100s\n", module->inMsgBuf_.record));
+
+ errorCode = module->pSoc_->sendData (module->inMsgBuf_.record);
+
+ switch (errorCode)
+ {
+ case CDR_STATUS_OK:
+ ++(module->sentRecs_);
+ AM_TRACE (("CDR Client: Record %d sent successully\n",
+ (module->sentRecs_+module->lostRecs_)));
+ break;
+
+ case CDR_STATUS_MSG_TOO_LONG:
+ // message can't be sent over the network
+ ++(module->lostRecs_);
+ AM_WARNING (("CDR Client: Record is too long. Discard record %d.\n",
+ (module->sentRecs_+module->lostRecs_) ));
+ break;
+
+ case CDR_STATUS_FATAL_SOC_ERR:
+ // fatal socket error
+ // attempt to reconnect to the CDR server
+ AM_TRACE (("CDR Client: Server connection is broken. Attempt to reconnect.\n"));
+ if (!module->socketReset())
+ {
+ ++(module->lostRecs_);
+
+ cleanModuleAlarm ();
+ raiseModuleAlarm (EC_CDR_CLIENT_UNABLE_CONNECT_SERVER);
+
+ AM_TRACE (("CDR Client: Failed reconnect to server. Discard record %d.\n",
+ (module->sentRecs_+module->lostRecs_)));
+ break;
+ }
+ // break is omitted intentionally, continue to resend
+
+ case CDR_STATUS_TEMP_SOC_ERR:
+ // non-fatal error
+ // buffer overloading. It's possible to retry
+ if (module->pSoc_->sendData (module->inMsgBuf_.record) == CDR_STATUS_OK)
+ {
+ ++(module->sentRecs_);
+ AM_TRACE (("CDR Client: Record %d resent successully\n",
+ (module->sentRecs_+module->lostRecs_)) );
+ }
+ else
+ {
+ ++(module->lostRecs_);
+ AM_TRACE (("CDR Client: Record sending has failed. Discard record %d.\n",
+ (module->sentRecs_+module->lostRecs_)) ) ;
+ }
+ break;
+
+ default:
+ AM_TRACE (("CDR Client: Unknown return code %d from CdrRemClientSocket::sendData.\n",
+ errorCode));
+ break;
+ }
+ }
+ else
+ {
+ ++(module->lostRecs_);
+ AM_TRACE (("CDR Client: Unknown CDR Message type %lx. Discard record %d.\n",
+ module->inMsgBuf_.msgType, (module->sentRecs_+module->lostRecs_)));
+ }
+ }
+ else if (pMainQueue_)
+ { // Error on the Queue
+ AM_ERROR (("CDR Client: Error on CDR task queue read attempt.\n"));
+ }
+ else
+ { // Queue is deleted. Exit
+ break;
+ }
+ } // while
+
+ }
+ else
+ {
+ AM_ERROR (("CDR Client module is not initialised.\n"));
+ retVal = false;
+ }
+
+ AM_RETURN (retVal);
+}
+
diff --git a/data/mnet/Common/cdr/src_client/CdrModule.cpp b/data/mnet/Common/cdr/src_client/CdrModule.cpp
new file mode 100644
index 0000000..f3d8389
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrModule.cpp
@@ -0,0 +1,521 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrModule.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 10/02/00
+// Description : CDR client module class implementation
+//
+// *******************************************************************
+
+#include "StdAfx.h"
+
+#include "CdrModule.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// Static Data members declarations
+//////////////////////////////////////////////////////////////////////
+
+CdrModule *CdrModule::pCdr_ = NULL ;
+JCMsgQueue *CdrModule::pMainQueue_= NULL ;
+
+// SSL related variables
+bool CdrModule::bUseSSL_ = false;
+bool CdrModule::bUseMibSSL_= false;
+char CdrModule::sPasswd_[SSL_MAX_PASSWORD_LENGTH+2] = "";
+
+AlarmCode_t CdrModule::majorAlarmCode_ = EC_NOERROR;
+AlarmCode_t CdrModule::infoAlarmCode_ = EC_NOERROR;
+
+
+//////////////////////////////////////////////////////////////////////
+// Constructors/Destructors
+//////////////////////////////////////////////////////////////////////
+
+CdrModule::CdrModule ()
+ : mainTask_ ("tCdrClient" ),
+ fromModId_ (MNET_MAX_MODULE_IDS),
+ srvrPort_ (AM_MAIN_SERVER_PORT),
+ pReplayQ_ (NULL ),
+ pSoc_ (NULL ),
+ logStatus_ (true ),
+ srvOnline_ (false),
+ srvrIp_ (0),
+ sentRecs_ (0),
+ lostRecs_ (0),
+ inMsgType_ (0),
+ inMsgSize_ (0),
+ localRef_ ( )
+{
+ pCdr_ = this;
+}
+
+
+CdrModule::~CdrModule ()
+{
+ int tId = mainTask_.GetTaskId();
+
+ // Suspend CDR task
+ if (tId)
+ taskSuspend (tId);
+
+ mainTask_.JCTaskNormExit();
+
+ // Close opened files, sockets and etc. before the shutdown
+
+ if (pMainQueue_)
+ delete pMainQueue_;
+
+ if (pSoc_)
+ delete pSoc_;
+
+ pMainQueue_ = NULL;
+ pCdr_ = NULL;
+ pSoc_ = NULL;
+
+ bUseSSL_ = false;
+ *sPasswd_ = '\0';
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Static methods
+//////////////////////////////////////////////////////////////////////
+
+void CdrModule::create ()
+{
+ if (!pCdr_)
+ { // Create a single CDR client module instance
+ new CdrModule ();
+ }
+}
+
+
+int CdrModule::sysCmdHandler (T_SYS_CMD sysCmd)
+{
+ int retVal = true;
+
+ AM_FUNC ("CdrModule::sysCmdHandler", LAYER_ID);
+ AM_ENTER();
+
+ switch (sysCmd)
+ {
+ case SYS_START:
+ printf ("[CDR client] Received start notification.\n");
+
+ create ();
+
+ if (pCdr_)
+ {
+ if ((retVal = pCdr_->start()) == false)
+ delete pCdr_;
+ }
+ break;
+
+ case SYS_SHUTDOWN:
+ printf ("[CDR client] Received system shutdown notification.\n");
+
+ if (pCdr_)
+ delete pCdr_;
+
+ break;
+
+ case SYS_REBOOT:
+
+ printf ("[CDR client] Reboot ready.\n");
+
+ if (pCdr_)
+ delete pCdr_;
+
+ break;
+
+ default:
+ printf ("[CDR client] Ignore unknown system command %d.\n", sysCmd);
+ break;
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+// Public methods
+//////////////////////////////////////////////////////////////////////
+void CdrModule::printInfo ()
+{
+ SslError_t tmpError;
+
+ printf ("=====================================\n");
+ printf ("CDR Client logging is %s\n", (getStatus() ? "On" : "Off"));
+
+ printf ("CDR Client Security is%s supported, %s \n",
+ (pSoc_->isSupportSSL() ? "" : " not" ),
+ (pSoc_->isEnableSSL () ? "enabled" : "disabled"));
+
+ if (bExtraInfo_ && isSSL())
+ {
+ if ((tmpError = pSoc_->getError()) != SSL_NO_ERROR)
+ printf ("Last SSL error detected = %u\n", tmpError);
+ }
+
+ if (isSet())
+ {
+ if (bExtraInfo_)
+ {
+ printf ("CDR Client is initialized properly.\nCDR Server socket Info:\n");
+ pSoc_->printInfo();
+ }
+ else
+ {
+ printf ("CDR Client is initialized properly.\nCDR Server is set to %s\n",
+ GenSocket::getIp(getServerIp()) );
+ }
+
+ printf ("CDR stats: records sent %lu, records lost %lu\n",
+ sentRecs_, lostRecs_ );
+ }
+ else
+ {
+ printf ("CDR Socket is not initialized properly.\n");
+
+ printf ("CDR server address is set to (%s)\n",
+ GenSocket::getIp(getServerIp()) );
+ }
+
+ printf ("=====================================\n");
+}
+
+
+
+//////////////////////////////////////////////////////////////////////
+// Private methods
+//////////////////////////////////////////////////////////////////////
+
+bool CdrModule::start ()
+{
+ bool retVal = false;
+
+ AM_FUNC ("CdrModule::start", LAYER_ID);
+ AM_ENTER();
+
+ pMainQueue_ = new JCMsgQueue (CDR_MSG_Q_MAX , // max msgs that can be queued
+ CDR_MSG_SIZE_MAX, // max bytes in a msg
+ CDR_Q_OPTIONS ); // message queue options
+
+ // spawn CDR task(s)
+ if (pMainQueue_)
+ {
+ retVal = (mainTask_.JCTaskSpawn (CDR_TASK_PRIORITY ,
+ CDR_TASK_OPTION ,
+ CDR_TASK_STACK_SIZE ,
+ (FUNCPTR)mainTaskHandle,
+ 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0,
+ CDR_MODULE_ID ,
+ JC_CRITICAL_TASK ) != 0);
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+bool CdrModule::submitRec (CdrMessage_t* msg)
+{
+ bool retVal = false;
+ size_t recLen = strlen (msg->record);
+
+ AM_FUNC ("CdrModule::submitRec", LAYER_ID);
+ AM_ENTER ();
+
+ if (recLen >= CDR_HEADER_SIZE &&
+ recLen < CDR_MAX_DATA_LENGTH )
+ {
+ msg->msgType = CDR_GENERIC_MSG_TYPE ;
+ recLen += sizeof(msg->msgType) + 1;
+
+ retVal = (pMainQueue_->JCMsgQSend (pMainQueue_ ,
+ msg->msgType ,
+ CDR_MODULE_ID ,
+ (char *)msg ,
+ recLen ,
+ JC_WAIT_FOREVER ,
+ JC_MSG_PRI_NORMAL) == OK);
+ }
+ else
+ {
+ AM_TRACE (("Invalid record length %d. Discard message:\n %100s\n",
+ recLen, msg->record));
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+bool CdrModule::getMsg ()
+{
+ // receive messages from the queue
+ return (pMainQueue_->JCMsgQReceive (&pReplayQ_ ,
+ (unsigned *)&inMsgType_,
+ &fromModId_ ,
+ (char * )&inMsgBuf_ ,
+ &inMsgSize_ ,
+ WAIT_FOREVER ) != ERROR);
+}
+
+
+bool CdrModule::socketInit ()
+{
+ bool retVal = false;
+ AM_FUNC ("CdrModule::socketInit", LAYER_ID);
+ AM_ENTER();
+
+ if (!pSoc_) // Create a socket
+ {
+ // Use SSL function only when both SSL MIB variable is true
+ // and socket library supports SSL
+ // bUseMibSSL_ is preset with the MIB value
+ bUseSSL_ = bUseMibSSL_ && GenSocketSSL::isSupportSSL();
+
+ AM_DEBUG (("Cdr Client%s using SSL\n", (bUseSSL_ ? "" : " is not") ));
+
+ // set password and initalize SSL Client context
+ if (bUseSSL_)
+ GenClientSocket::initSslContext (strlen(sPasswd_) ? sPasswd_ : NULL);
+
+ pSoc_ = new CdrRemClientSocket (bUseSSL_);
+ }
+
+ if (pSoc_)
+ {
+ retVal = pSoc_->connectServer(srvrIp_, srvrPort_);
+ srvOnline_ = retVal;
+
+ if (!srvOnline_)
+ raiseSslAlarm();
+
+#ifdef _AM_DEBUG_
+ pSoc_->printInfo ();
+#endif // _AM_DEBUG
+ }
+ else
+ {
+ AM_ERROR (("CDR Client: unable to initiate link to CDR Server on %s:%u\n",
+ GenSocket::getIp(srvrIp_), srvrPort_ ));
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+bool CdrModule::socketReset ()
+{
+ bool retVal = false;
+
+ AM_FUNC ("CdrModule::socketReset", LAYER_ID);
+ AM_ENTER();
+
+ if (!pSoc_) // Create it upon need
+ retVal = socketInit ();
+ else
+ { // reset the server conection
+ retVal = pSoc_->reconnect();
+ }
+
+ srvOnline_ = retVal;
+
+ AM_TRACE (("CDR server reconnect result %d\n", retVal));
+
+ AM_RETURN (retVal);
+}
+
+
+// Raise alarm for the recognized SSL problems (only first time)
+void CdrModule::raiseSslAlarm ()
+{
+ AM_FUNC ("CdrModule::raiseSslAlarm", LAYER_ID);
+ AM_ENTER();
+
+ if (infoAlarmCode_ == EC_NOERROR)
+ {
+ switch (GenSocketSSL::getError())
+ {
+ case SSL_BAD_PASSWORD:
+ infoAlarmCode_ = EC_CDR_CLIENT_BAD_SSL_PASSWORD_FILE;
+ break;
+ case SSL_BAD_KEY:
+ infoAlarmCode_ = EC_CDR_CLIENT_BAD_SSL_KEY_FILE ;
+ break;
+ case SSL_BAD_CA_ERROR:
+ case SSL_BAD_USER_CERT:
+ infoAlarmCode_ = EC_CDR_CLIENT_BAD_LOCAL_CERTIFICATE;
+ break;
+ case SSL_BAD_PEER_CERT:
+ infoAlarmCode_ = EC_CDR_CLIENT_BAD_PEER_CERTIFICATE ;
+ break;
+ default:
+ // either non-SSL or unrecognized error
+ // will open general communication problem alarm only
+ break;
+ }
+
+ if (infoAlarmCode_ != EC_NOERROR)
+ {
+ AM_DEBUG (("Raise CDR SSL alarm %u\n", infoAlarmCode_));
+ alarm_raise (CDR_MODULE_ID, CDR_CLIENT_ALARM_ERRCODE, infoAlarmCode_);
+ }
+ }
+
+ AM_LEAVE();
+}
+
+
+// Clean SSL alarm if any
+void CdrModule::cleanSslAlarm ()
+{
+ if (infoAlarmCode_ != EC_NOERROR)
+ {
+ alarm_clear (CDR_MODULE_ID, CDR_CLIENT_ALARM_ERRCODE, infoAlarmCode_);
+ infoAlarmCode_ = EC_NOERROR;
+ }
+}
+
+
+void CdrModule::raiseModuleAlarm (AlarmCode_t code)
+{
+ // raise new CDR alarm
+ if (majorAlarmCode_ == EC_NOERROR)
+ {
+ majorAlarmCode_ = code;
+ alarm_raise (CDR_MODULE_ID, CDR_CLIENT_ALARM_ERRCODE, majorAlarmCode_);
+ }
+}
+
+
+void CdrModule::cleanModuleAlarm ()
+{
+ if (majorAlarmCode_ != EC_NOERROR)
+ {
+ alarm_clear (CDR_MODULE_ID, CDR_CLIENT_ALARM_ERRCODE, majorAlarmCode_);
+ majorAlarmCode_ = EC_NOERROR;
+ }
+}
+
+
+
+// This function should be used for debug purpose only
+bool CdrModule::switchServer (ubyte4 newSrvrIp)
+{
+ bool retVal = false;
+
+ AM_FUNC ("CdrModule::switchServer", LAYER_ID);
+ AM_ENTER();
+
+ srvrIp_ = newSrvrIp;
+
+ if (pSoc_) // Release connection to the old server
+ {
+ delete pSoc_;
+ pSoc_ = NULL;
+ }
+
+ if (retVal = socketInit())
+ {
+ AM_TRACE (("Connected to the new CDR server %s \n", GenSocket::getIp(srvrIp_)));
+ }
+ else
+ {
+ AM_TRACE (("Failed connect to the new CDR server %s \n", GenSocket::getIp(srvrIp_)));
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+bool CdrModule::savePwd (LPCSTR lpPasswd)
+{
+ bool retVal = false;
+
+ AM_FUNC ("CdrModule::savePwd", LAYER_ID);
+ AM_ENTER();
+
+ if (GenSocketSSL::isSupportSSL())
+ {
+ retVal = encryptPassword (lpPasswd, getPswdFile());
+ }
+ else
+ {
+ AM_ERROR (("SSL is not supported.\n"));
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+bool CdrModule::readPwd ()
+{
+ bool retVal = false;
+
+ AM_FUNC ("CdrModule::readPwd", LAYER_ID);
+ AM_ENTER();
+
+ // Read password from the password file
+ if (GenSocketSSL::isSupportSSL() && !GenSocketSSL::isPswdSet())
+ {
+ retVal = decryptPassword (sPasswd_, getPswdFile());
+
+#ifdef _AM_DEBUG_
+ AM_DEBUG (("SSL password is \"%s\" of length %u\n",
+ sPasswd_, strlen (sPasswd_) ));
+#endif // _AM_DEBUG
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+LPSTR CdrModule::getPswdFile ()
+{
+ static char szFile [MAX_PATH] = "" ;
+ static bool bSet = false;
+
+ if (!bSet)
+ {
+ LPSTR pRoot = NULL;
+ size_t length = 0 ;
+
+ // Construct full pathname for the SSL password file
+ pRoot = getenv ("MNET_BASE");
+
+ if (!pRoot || !*pRoot || (strlen (pRoot) > MAX_PATH - 10))
+ {
+ pRoot = DEF_ROOT_DIR;
+ }
+
+ if (pRoot)
+ length = strlen(pRoot);
+
+ sprintf (szFile, "%s%c%s", pRoot, ((length) ? DIR_DELIMITER : '\0'), CDR_PWD_FILE_NAME);
+
+ bSet = true;
+ }
+
+ return (szFile);
+}
+
+
+// Interface for the HTTP module
+int SavePwdCdr (LPCSTR lpPasswd)
+{
+ return ((int)CdrModule::savePwd(lpPasswd));
+}
+
+
diff --git a/data/mnet/Common/cdr/src_client/CdrRefSem.cpp b/data/mnet/Common/cdr/src_client/CdrRefSem.cpp
new file mode 100644
index 0000000..e3e9a87
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrRefSem.cpp
@@ -0,0 +1,42 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 2.0
+// File : CdrRefSem.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 06/20/00
+// Description : implementation of the CdrRefSem class.
+//
+// *******************************************************************
+
+#include "CdrRefSem.h"
+
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////
+// Primary behaviour methods
+//////////////////////////////////////////////////////////////////////
+
+ubyte4 CdrRefSem::allocateRef ()
+{
+ ubyte4 newRef;
+
+ mutex_.take ();
+
+ newRef = CdrRef::allocateRef();
+
+ mutex_.give ();
+
+ return (newRef);
+}
diff --git a/data/mnet/Common/cdr/src_client/CdrRemClientSocket.cpp b/data/mnet/Common/cdr/src_client/CdrRemClientSocket.cpp
new file mode 100644
index 0000000..8a517c8
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrRemClientSocket.cpp
@@ -0,0 +1,71 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 2.0
+// Status : Under development
+// File : CdrRemClientSocket.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 06/20/00
+// Description : Implementation of the CdrRemClient class.
+//
+// *******************************************************************
+
+#include "StdAfx.h"
+#include "CdrCommon.h"
+
+#include "CdrRemClientSocket.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// Primary behaviour methods
+//////////////////////////////////////////////////////////////////////
+
+int CdrRemClientSocket::sendData (LPSTR szData)
+{
+ AM_FUNC ("CdrRemClientSocket::sendData", LAYER_ID);
+ AM_ENTER ();
+
+ int retVal = CDR_STATUS_FATAL_SOC_ERR;
+ size_t inDataLen = strlen (szData) + 1; // correction for terminating '0'
+ int sentDataLen , socError;
+
+ if (inDataLen <= CDR_MAX_DATA_LENGTH)
+ {
+ // Prepare the message structure
+ outMsg_.hdr.msgType = htonl (CDR_GENERIC_MSG_TYPE);
+ outMsg_.hdr.dataLen = htonl (inDataLen);
+ memcpy (outMsg_.msg.logData, szData, inDataLen);
+
+ inDataLen +=clientMsgHdrLen;
+
+ retVal = tcpSend ((sbyte *)&outMsg_, inDataLen);
+ }
+ else
+ {
+ retVal = CDR_STATUS_MSG_TOO_LONG;
+
+ AM_TRACE (("CDR data length %u exciding maximum. Discard the record.\n",
+ inDataLen));
+ }
+
+ AM_RETURN (retVal);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Service methods
+//////////////////////////////////////////////////////////////////////
+
+
+void CdrRemClientSocket::zapLog()
+{
+ memset ((char *)&outMsg_, 0, sizeof outMsg_);
+}
+
+
diff --git a/data/mnet/Common/cdr/src_client/CdrSSA.cpp b/data/mnet/Common/cdr/src_client/CdrSSA.cpp
new file mode 100644
index 0000000..271d75d
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrSSA.cpp
@@ -0,0 +1,124 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+// CdrSSA.cpp: implementation of the CCdrSSA class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "StdAfx.h"
+
+#include "Cdr\CdrSSA.h"
+
+
+CCdrSSA::CCdrSSA()
+ : CCdrBase (),
+ isInit (true )
+{
+ initialize ();
+}
+
+CCdrSSA::~CCdrSSA()
+{
+}
+
+void CCdrSSA::initialize ()
+{
+ // skip in for the very first time when is called by the constructor
+ if (!isInit)
+ CCdrBase::initialize ();
+ else
+ isInit = false;
+
+ setRecordType (CDR_RECORD_TYPE_SSA);
+
+ basic_service_code = 0 ;
+ basic_service_selector = 0 ;
+ basic_service_set = false;
+ correlated_event_ref_number = 0 ;
+ correlated_event_ref_number_set = false;
+
+ redirected_dn.initialize ();
+ transfer_dn.initialize ();
+ translated_redirected_dn.initialize ();
+ translated_transfer_dn.initialize ();
+}
+
+void CCdrSSA::setBearerServiceCode(unsigned char code)
+{
+ basic_service_set=true;
+ basic_service_selector=1;
+ basic_service_code=code;
+}
+
+void CCdrSSA::setTeleServiceCode(unsigned char code)
+{
+ basic_service_set=true;
+ basic_service_selector=2;
+ basic_service_code=code;
+}
+
+void CCdrSSA::setCorrelatedEventRefNumber( T_CDR_EVENT_REFERENCE_NUMBER event_number)
+{
+ correlated_event_ref_number_set=true;
+ correlated_event_ref_number=event_number;
+}
+
+void CCdrSSA::setRedirectedNumber(T_SUBSC_IE_ISDN * p_DN) { redirected_dn.set(p_DN); }
+void CCdrSSA::setTranslatedRedirectedNumber(T_SUBSC_IE_ISDN * p_DN){ translated_redirected_dn.set(p_DN); }
+void CCdrSSA::setTransferNumber(T_SUBSC_IE_ISDN * p_DN) { transfer_dn.set(p_DN); }
+void CCdrSSA::setTranslatedTransferNumber(T_SUBSC_IE_ISDN * p_DN) { translated_transfer_dn.set(p_DN); }
+
+void CCdrSSA::generateRecord(
+ T_CDR_SS_ACTION ss_action,
+ unsigned char ss_code,
+ T_CNI_RIL3_CAUSE_VALUE ss_cause
+ )
+{
+ CCdrFieldDateTime ss_action_time;
+
+ // get current time
+ ss_action_time.stamp();
+
+ // first generate common header fields
+ printBaseFields();
+
+ // print all the fields of this class to the outbuffer
+ //
+ // K1=SS Action
+ // K2=SS Code
+ // K3=SS Cause
+ // T5=SS Action Time
+ // N5=Redirected Number
+ // N6=Translated Redirected Number
+ // N7=Transfer Number
+ // N8=Translated Transfer Number
+ // B1=Basic Service Code
+ // R1=Correlated Event Reference Number
+ //
+ count+=sprintf(&cdr_msg.record[count],"%cK1=%02X",CDR_FIELD_DELIMETER,(unsigned long)ss_action);
+ count+=sprintf(&cdr_msg.record[count],"%cK2=%02X",CDR_FIELD_DELIMETER, ss_code);
+ count+=sprintf(&cdr_msg.record[count],"%cK3=%03d" ,CDR_FIELD_DELIMETER, ss_cause);
+
+ count+=sprintf(&cdr_msg.record[count],"%cT5=%s",CDR_FIELD_DELIMETER,ss_action_time.string());
+
+ if(redirected_dn.status==CDR_FIELD_SET_BUT_NOT_PRINT)
+ count+=sprintf(&cdr_msg.record[count],"%cN5=%s",CDR_FIELD_DELIMETER,redirected_dn.string());
+ if(translated_redirected_dn.status==CDR_FIELD_SET_BUT_NOT_PRINT)
+ count+=sprintf(&cdr_msg.record[count],"%cN6=%s",CDR_FIELD_DELIMETER,translated_redirected_dn.string());
+ if(transfer_dn.status==CDR_FIELD_SET_BUT_NOT_PRINT)
+ count+=sprintf(&cdr_msg.record[count],"%cN7=%s",CDR_FIELD_DELIMETER,transfer_dn.string());
+ if(translated_transfer_dn.status==CDR_FIELD_SET_BUT_NOT_PRINT)
+ count+=sprintf(&cdr_msg.record[count],"%cN8=%s",CDR_FIELD_DELIMETER,translated_transfer_dn.string());
+ if(basic_service_set)
+ count+=sprintf(&cdr_msg.record[count],"%cB1=%1d%02X",CDR_FIELD_DELIMETER,
+ basic_service_selector, basic_service_code );
+ if(correlated_event_ref_number_set)
+ count+=sprintf(&cdr_msg.record[count],"%cR1=%d",CDR_FIELD_DELIMETER, correlated_event_ref_number );
+
+ // send the generated record off to the CDR client
+ CCdrBase::generateRecord();
+}
+
diff --git a/data/mnet/Common/cdr/src_client/CdrSystem.cpp b/data/mnet/Common/cdr/src_client/CdrSystem.cpp
new file mode 100644
index 0000000..6f7f55a
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/CdrSystem.cpp
@@ -0,0 +1,98 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : CdrSystem.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 10/02/00
+// Description : System interface for CDR module
+//
+// *******************************************************************
+
+
+#include "stdafx.h"
+
+#include "CdrModule.h"
+
+
+int SysCommand_CDR (T_SYS_CMD cmd)
+{
+ return (CdrModule::sysCmdHandler (cmd));
+}
+
+
+void CdrDataPrint ()
+{
+ CdrModule * pInst = CdrModule::getInstance();
+
+ if (pInst)
+ pInst->printInfo();
+ else
+ printf ("CDR module is not started.\n");
+}
+
+
+bool cdrSavePwd (LPCSTR lpPasswd)
+{
+ bool retVal = false;
+ CdrModule * pInst = CdrModule::getInstance();
+
+ if (pInst)
+ retVal = pInst->savePwd (lpPasswd);
+ else
+ printf ("CDR module is not started.\n");
+
+ return (retVal);
+}
+
+
+void CdrEnableExtraInfo ()
+{
+ CdrModule::getInstance()->enableExtraInfo();
+}
+
+
+void CdrDisableExtraInfo ()
+{
+ CdrModule::getInstance()->disableExtraInfo();
+}
+
+
+// CDR debug input
+void _CdrSendDebug ()
+{
+ static CdrMessage_t msg ;
+ sbyte szHostName[MAX_PATH] ;
+ ubyte4 uHostIp = 0;
+ int ch ;
+
+ struct tm *currTime;
+ time_t lTime ;
+
+ // get a local host name
+ if (gethostname (szHostName, sizeof(szHostName)) != SOC_STATUS_ERROR)
+ {
+ uHostIp = htonl (cdrGetLocalIp());
+ }
+ else
+ *szHostName = '\0';
+
+ msg.msgType = CDR_GENERIC_MSG_TYPE;
+
+ /* Obtain coordinated universal time: */
+ time (&lTime );
+ currTime = gmtime (&lTime);
+ sprintf ((char *)msg.record, "Test CDR log number %d from virtual client on host %s (%s), %s",
+ cdrAllocateRef(), szHostName, GenSocket::getIp(uHostIp), asctime(currTime));
+
+ printf ("Sending CDR log: %s\n", msg.record);
+
+ cdrSendLog (&msg);
+}
diff --git a/data/mnet/Common/cdr/src_client/Makefile b/data/mnet/Common/cdr/src_client/Makefile
new file mode 100644
index 0000000..252ec4a
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/Makefile
@@ -0,0 +1,61 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+# Use Examples:
+#
+# Case 1:
+# make all VOB=GP10 -
+# Places .out in VOB/bin directory
+#
+# Case 2:
+# make all VOB=GP10 APPDIR=Host\<Application Name>\<Source Directory> -
+# Places .o file(s) in VOB\$(APPDIR)\bin directory.
+#
+# <Application Name> = Name of Application directory
+# <Source Directory> = application sub directory where the calling
+# Makefile resides.
+#
+# Example: make all VOB=GP10 APPDIR=Host\vxTemplate\src
+#
+#
+# Note: This make file must reference a VOB that
+# has a defs.mk in the top level directory.
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..
+
+# Name of this App's Directory
+THIS_APP_DIR = cdr
+
+VOB2DIR = $(TOP_OF_VOB)\..\$(VOB)
+BINDIR = ..\bin
+
+ifeq ($(APPDIR),)
+ MY_OUTPUT = $(VOB2DIR)\bin\cdr_client.out
+else
+ MY_OUTPUT = $(OBJDIR)\cdr_client.out
+endif
+
+include $(VOB2DIR)\l3defs.mk
+
+
+all: $(MY_OUTPUT)
+
+$(MY_OUTPUT): $(MODULE_OBJS)
+ $(LD) -r -o $@.tmp $(MODULE_OBJS)
+ $(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)
+
+
diff --git a/data/mnet/Common/cdr/src_client/readme.txt b/data/mnet/Common/cdr/src_client/readme.txt
new file mode 100644
index 0000000..de5c2c5
--- /dev/null
+++ b/data/mnet/Common/cdr/src_client/readme.txt
@@ -0,0 +1 @@
+This folder contains source files common for the CDR Client applications.
diff --git a/data/mnet/Common/cdr/src_server/ConnList.cpp b/data/mnet/Common/cdr/src_server/ConnList.cpp
new file mode 100644
index 0000000..8ea9a77
--- /dev/null
+++ b/data/mnet/Common/cdr/src_server/ConnList.cpp
@@ -0,0 +1,177 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems Inc. 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 1.0
+// Status : Under development
+// File : ConnList.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 6/21/00
+// Description :
+//
+// *******************************************************************
+
+
+#include "stdAfx.h"
+#include "ConnList.h"
+
+// *******************************************************************
+// Class ClientConnection
+// *******************************************************************
+
+/*----------------------------------------------------------------------------**
+**
+** METHOD NAME: ClientConnection constructor
+**
+** PURPOSE: Save the socket for this connection and initialize the next
+** pointer to be null.
+**
+** INPUT PARAMETERS: sock - socket for the new client connection
+**
+** RETURN VALUE(S): none
+**
+**----------------------------------------------------------------------------*/
+ClientConnection::ClientConnection (GenSocket& Client)
+ : connSock_ (Client), next_ (NULL)
+{
+ ;
+}
+
+
+/*----------------------------------------------------------------------------**
+**
+** METHOD NAME: ClientConnection destructor
+**
+** PURPOSE: Delete ClientConnection data members.
+**
+** INPUT PARAMETERS: none
+**
+** RETURN VALUE(S): none
+**
+**----------------------------------------------------------------------------*/
+ClientConnection::~ClientConnection ()
+{
+ delete &connSock_;
+}
+
+
+int ClientConnection::serveClient (const fd_set *set)
+{
+ GenSocket * notInUse = NULL; // dummy value
+
+ return (getClient()->serve(set, notInUse));
+}
+
+
+
+// *******************************************************************
+// Class ClientConnectionList
+// *******************************************************************
+
+/*----------------------------------------------------------------------------**
+**
+** METHOD NAME: ClientConnectionList constructor
+**
+** PURPOSE: Initialize list to be null.
+**
+** INPUT PARAMETERS: none
+**
+** RETURN VALUE(S): none
+**
+**----------------------------------------------------------------------------*/
+ClientConnectionList::ClientConnectionList()
+{
+ pConnListHead_ = NULL;
+}
+
+
+/*----------------------------------------------------------------------------**
+**
+** METHOD NAME: ClientConnectionList destructor
+**
+** PURPOSE: Delete ClientConnectionList data members.
+**
+** INPUT PARAMETERS: none
+**
+** RETURN VALUE(S): none
+**
+**----------------------------------------------------------------------------*/
+ClientConnectionList::~ClientConnectionList()
+{
+ ClientConnection *pPrevConn, *pCurrConn = pConnListHead_;
+
+ while (pCurrConn)
+ {
+ pPrevConn = pCurrConn;
+ pCurrConn = pCurrConn->next_;
+ delete pPrevConn;
+ }
+}
+
+/*----------------------------------------------------------------------------**
+**
+** METHOD NAME: InsertClientConnection
+**
+** PURPOSE: Insert an client connection at the head of the list.
+**
+** INPUT PARAMETERS: pConn - pointer to the connection object to be added.
+**
+** RETURN VALUE(S): SOC_STATUS_OK - for success
+** SOC_STATUS_ERROR - for failure
+**
+**----------------------------------------------------------------------------*/
+SOC_STATUS ClientConnectionList::InsertClientConnection (ClientConnection *pConn)
+{
+ pConn->next_ = pConnListHead_;
+ pConnListHead_ = pConn;
+ return (SOC_STATUS_OK);
+}
+
+/*----------------------------------------------------------------------------**
+**
+** METHOD NAME: DeleteClientConnection
+**
+** PURPOSE: Remove an client connection from the list of client connections.
+** The socket is used as the identifier to locate the client connection.
+**
+** INPUT PARAMETERS: sock - socket for the desired client connection
+**
+** RETURN VALUE(S): SOC_STATUS_OK - for success
+** SOC_STATUS_ERROR - for failure
+**
+**----------------------------------------------------------------------------*/
+SOC_STATUS ClientConnectionList::DeleteClientConnection (ClientConnection *pConn)
+{
+ ClientConnection *pCurrConn, *pPrevConn;
+ OS_SPECIFIC_SOCKET_HANDLE Socket = pConn->getSocket();
+
+ pCurrConn = pPrevConn = pConnListHead_;
+
+ while (pCurrConn)
+ {
+ if (pCurrConn->connSock_.getSocket() == Socket)
+ {
+ if (pCurrConn == pConnListHead_)
+ {
+ pConnListHead_ = pCurrConn->next_;
+ }
+ else
+ {
+ pPrevConn->next_ = pCurrConn->next_;
+ }
+
+ delete pCurrConn;
+ break;
+ }
+
+ pPrevConn = pCurrConn;
+ pCurrConn = pCurrConn->next_;
+ }
+
+ return (SOC_STATUS_OK);
+}
diff --git a/data/mnet/Common/cdr/src_server/Makefile b/data/mnet/Common/cdr/src_server/Makefile
new file mode 100644
index 0000000..3c7aaeb
--- /dev/null
+++ b/data/mnet/Common/cdr/src_server/Makefile
@@ -0,0 +1,62 @@
+##########################################################
+#
+# (c) Copyright Cisco 2000
+# All Rights Reserved
+#
+# Use Examples:
+#
+# Case 1:
+# make all VOB=GP10 -
+# Places .out in VOB/bin directory
+#
+# Case 2:
+# make all VOB=GP10 APPDIR=Host\<Application Name>\<Source Directory> -
+# Places .o file(s) in VOB\$(APPDIR)\bin directory.
+#
+# <Application Name> = Name of Application directory
+# <Source Directory> = application sub directory where the calling
+# Makefile resides.
+#
+# Example: make all VOB=GP10 APPDIR=Host\vxTemplate\src
+#
+#
+# Note: This make file must reference a VOB that
+# has a defs.mk in the top level directory.
+#
+##########################################################
+
+# TOP_OF_VOB must be defined before including l3defs.mk
+TOP_OF_VOB = ..\..
+
+# Name of this App's Directory
+THIS_APP_DIR = cdrserver
+
+VOB2DIR = $(TOP_OF_VOB)\..\$(VOB)
+BINDIR = ..\bin
+
+ifeq ($(APPDIR),)
+ MY_OUTPUT = $(VOB2DIR)\bin\cdr_common_src_server.out
+else
+ MY_OUTPUT = $(OBJDIR)\cdr_common_src_server.out
+endif
+
+include $(VOB2DIR)\l3defs.mk
+CC_INCLUDE += -I$(COMMON_VOB_DIR)/os
+
+all: $(MY_OUTPUT)
+
+$(MY_OUTPUT): $(MODULE_OBJS)
+ $(LD) -r -o $@.tmp $(MODULE_OBJS)
+ $(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)
+
+
diff --git a/data/mnet/Common/cdr/src_test/simulator.cpp b/data/mnet/Common/cdr/src_test/simulator.cpp
new file mode 100644
index 0000000..fd723a0
--- /dev/null
+++ b/data/mnet/Common/cdr/src_test/simulator.cpp
@@ -0,0 +1,278 @@
+// *******************************************************************
+//
+// (c) Copyright CISCO Systems, Inc 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+// *******************************************************************
+//
+// Version : 2.0
+// File : simulator.cpp
+// Author(s) : Igal Gutkin
+// Create Date : 08/28/01
+// Description : Cdr Client simulator
+//
+// *******************************************************************
+
+#include "stdafx.h"
+#include "Os\JCCTimer.h"
+#include "Os\JCMsgQueue.h"
+#include "Os\JCTask.h"
+
+#include "CdrModule.h"
+
+#define CDR_DEFAULT_PERIOD 10
+#define CDR_SIM_PIPE "/pipe/cdrSimPipe"
+
+#ifdef __cplusplus
+ extern "C"
+ {
+ bool _CdrInitTest ();
+ void _CdrCleanTest ();
+
+ bool _CdrStartTest (unsigned period = 0, unsigned num = 0);
+ void _CdrStopTest ();
+
+ void _CdrSimCallback ();
+ bool _CdrSimHandle ();
+
+ void _CdrTestStatus ();
+ void _CdrSimHelp ();
+
+ }
+#endif
+
+// CDR message resend timer
+static JCCTimer *pCdrSimTimer;
+static JCMsgQueue *pCdrSimQueue;
+static JCTask *pCdrSimTask ;
+
+static unsigned uTime = CDR_DEFAULT_PERIOD;
+
+static int iMaxTimes = 0,
+ iCount = 0;
+
+static bool bCdrSimSet = false,
+ bCdrTestStart = false;
+
+//===================================================================
+
+void _CdrSimHelp ()
+{
+ printf ("Cdr Client Simulator Commands:\n\
+ _CdrTestStatus - print simulation status\n\
+ _CdrInitTest - initialize simulator\n\
+ _CdrCleanTest - remove simulator\n\
+ _CdrStartTest - begin simulation\n\
+ Parameters : (period [in 100 mS], number of messages [0 - unlimited]\n\
+ _CdrStopTest - end simulation\n");
+}
+
+
+bool _CdrInitTest ()
+{
+ bool retVal = false;
+
+ if (bCdrSimSet)
+ {
+ printf ("CDR simulator is initialized already\n");
+ return (true);
+ }
+
+ if ((pCdrSimTimer = new JCCTimer((FUNCPTR)_CdrSimCallback)) != NULL)
+ {
+ if ((pCdrSimQueue = new JCMsgQueue (200 , // max num of msgs
+ sizeof (int) , // max size of a msg
+ JC_MSG_Q_FIFO )) // message queue options
+ != NULL)
+ { // create and spawn simulator task
+ if (pCdrSimTask = new JCTask ("tCdrSim"))
+ {
+ if (pCdrSimTask->JCTaskSpawn (100, 0, 5000 ,
+ (FUNCPTR)_CdrSimHandle,
+ 0, 0, 0, 0, 0 ,
+ 0, 0, 0, 0, 0 ,
+ CDR_MODULE_ID ,
+ JC_NON_CRITICAL_TASK ) != ERROR)
+ {
+ retVal = true;
+ bCdrSimSet = true;
+ }
+ }
+ }
+ }
+
+ if (!retVal)
+ {
+ printf ("Unable to start CDR Client Simulator\n");
+ _CdrCleanTest ();
+ }
+
+ return (retVal);
+}
+
+
+void _CdrCleanTest ()
+{
+ // kill timer
+ if (pCdrSimTimer)
+ {
+ _CdrStopTest ();
+ delete pCdrSimTimer;
+ pCdrSimTimer = NULL;
+ }
+
+ // kill task
+ if (pCdrSimTask)
+ {
+ int tId = pCdrSimTask->GetTaskId();
+
+ taskSuspend (tId);
+ taskDelete (tId);
+ delete pCdrSimTask;
+ pCdrSimTask = NULL;
+ }
+
+ // kill queue
+ if (pCdrSimQueue)
+ {
+ delete pCdrSimQueue;
+ pCdrSimQueue = NULL;
+ }
+
+ bCdrSimSet = false;
+}
+
+// use resolution of 100 mSec
+// number of attempts = 0 ==> unlimited till stop is called
+bool _CdrStartTest (unsigned period, unsigned num)
+{
+ bool retVal = false;
+
+ if (bCdrSimSet || (retVal=_CdrInitTest()) )
+ {
+ if (!bCdrTestStart)
+ {
+ uTime = (period) ? period : CDR_DEFAULT_PERIOD;
+ iMaxTimes = (int)num;
+
+ pCdrSimTimer->setTimerMSec (period);
+ bCdrTestStart = true;
+ retVal = true;
+ printf ("CDR Client simulation begin\n");
+ }
+ else
+ printf ("CDR Client simulator is already started\n");
+ }
+
+ return (retVal);
+}
+
+
+void _CdrStopTest ()
+{
+ if (bCdrSimSet)
+ {
+ pCdrSimTimer->cancelTimer();
+
+ iMaxTimes = 0;
+ iCount = 0;
+ bCdrTestStart = false ;
+ uTime = CDR_DEFAULT_PERIOD;
+ }
+}
+
+
+void _CdrTestStatus ()
+{
+ if (bCdrSimSet)
+ {
+ printf ("CDR Client Simulator is %s\n", ((bCdrTestStart) ? "running" : "stoped") );
+ }
+ else
+ printf ("CDR Client Simulator is not initialized\n");
+}
+
+
+//===================================================================
+
+// simulator task handler
+bool _CdrSimHandle ()
+{
+ bool keepGoing = true;
+ CdrMessage_t msg ;
+ sbyte szHostName[MAX_PATH];
+ ubyte4 uHostIp = 0;
+ struct tm *currTime ;
+ time_t lTime ;
+
+ JCMsgQueue *pReplayQ ;
+ unsigned inMsgType ,
+ inMsgSize ,
+ inMsgBuf ;
+
+ MNET_MODULE_ID fromModId;
+
+ // Spin here forever waiting for simulator activations
+ while (keepGoing)
+ {
+ if (pCdrSimQueue->JCMsgQReceive (&pReplayQ ,
+ &inMsgType ,
+ &fromModId ,
+ (char *)&inMsgBuf,
+ &inMsgSize ,
+ WAIT_FOREVER ) != ERROR)
+ {
+ if (!uHostIp)
+ {
+ msg.msgType = CDR_GENERIC_MSG_TYPE;
+
+ // get a local host name
+ if (gethostname (szHostName, sizeof(szHostName)) != SOC_STATUS_ERROR)
+ {
+ uHostIp = htonl (cdrGetLocalIp());
+ }
+ else
+ *szHostName = '\0';
+ }
+
+ /* Obtain coordinated universal time: */
+ time (&lTime);
+ currTime = gmtime (&lTime);
+ sprintf ((char *)msg.record, "Test log number %u [ref. %u] from a virtual client on host %s [%s], %s",
+ iCount, cdrAllocateRef(), szHostName, GenSocket::getIp(uHostIp), asctime(currTime) );
+
+ cdrSendLog (&msg);
+ }
+ }
+
+ return (true);
+}
+
+
+// timer ISR call back
+void _CdrSimCallback ()
+{
+ static CdrMessage_t msg ;
+ static sbyte szHostName[MAX_PATH];
+ static ubyte4 uHostIp = 0;
+
+ struct tm *currTime;
+ time_t lTime ;
+
+ if (!iMaxTimes || iCount < iMaxTimes)
+ {
+ ++iCount;
+
+ pCdrSimQueue->JCMsgQSend (pCdrSimQueue, 0, CDR_MODULE_ID, (char *)&iCount, sizeof iCount,
+ JC_NO_WAIT, JC_MSG_PRI_NORMAL);
+
+ pCdrSimTimer->setTimerMSec (uTime, iCount);
+ }
+ else
+ {
+ _CdrStopTest ();
+ }
+
+}