2G ems initial

This commit is contained in:
2024-03-13 09:30:40 +08:00
commit eed6460ad2
1234 changed files with 419571 additions and 0 deletions

29
omc/plat/.copyarea.db Normal file
View File

@@ -0,0 +1,29 @@
ClearCase CopyAreaDB|4
vobs\r9\plat
2
19
4:smpp|2|0|0|0|fc296eabbfa511dc866b001c23e19543|0
4:isup|2|0|0|0|e6696767bfa411dc852a001c23e19543|0
7:iptrans|2|0|0|0|d51966f0bfa411dc851a001c23e19543|0
a:lost+found|2|0|0|0|63d949bbbfa011dc819a001c23e19543|0
4:mtp3|2|0|0|0|49e96a03bfa511dc85a0001c23e19543|0
4:xapp|2|0|0|0|3859703cbfa611dc86a4001c23e19543|0
6:public|2|0|0|0|59696a6bbfa511dc85ad001c23e19543|0
4:snmp|2|0|0|0|1e196f91bfa611dc868f001c23e19543|0
4:isdn|2|0|0|0|fe87fa67808c11dd88a4001c23e19543|0
6:haepub|2|0|0|0|ce8966c5bfa411dc8515001c23e19543|0
3:sip|2|0|0|0|d437f94b808c11dd889f001c23e19543|0
6:mgc_v2|2|0|0|0|7730c1eca0da11dd9cdb001c23e19543|0
4:bicc|2|0|0|0|952644599a8511dd8b36001c23e19543|0
4:mgcp|2|0|0|0|3cc969a9bfa511dc8595001c23e19543|0
4:sccp|2|0|0|0|5e18819ac44711dc962e001c23e19543|0
5:debug|2|0|0|0|c899669dbfa411dc8511001c23e19543|0
4:tcap|2|0|0|0|2bd96fecbfa611dc869a001c23e19543|0
3:mgc|2|0|0|0|30496955bfa511dc8589001c23e19543|0
4:8ecp|2|0|0|0|a4d965b7bfa411dc84ed001c23e19543|0
3:pal|2|0|0|0|731472cf6cf311dd91c7001c23e19543|0
5:mgcv2|2|0|0|0|da0645189a8a11dd8b34001c23e19543|0
4:m2ua|2|0|0|0|fb3967f0bfa411dc8544001c23e19543|0
3:rtp|2|0|0|0|89b96bacbfa511dc85d9001c23e19543|0
3:scf|2|0|0|0|f2996e6fbfa511dc8664001c23e19543|0
3:aif|2|0|0|0|840d286ec9bd11dc8b49001c23e19543|0

View File

@@ -0,0 +1,9 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\8ecp
2
5
3:doc|2|0|0|0|a56965d3bfa411dc84ed001c23e19543|0
2:ut|2|0|0|0|a99966cfbfa411dc84ed001c23e19543|0
3:src|2|0|0|0|a6996627bfa411dc84ed001c23e19543|0
8:Makefile|1|11d70a3d83e|b3e|1818c81f|a609660bbfa411dc84ed001c23e19543|0
3:lib|2|0|0|0|a56965efbfa411dc84ed001c23e19543|0

96
omc/plat/8ecp/Makefile Normal file
View File

@@ -0,0 +1,96 @@
##----------------------------------------------------------##
## ##
## Universal Makefile for module Version : V1.4 ##
## ##
## Created : Wei Liu 07/04/11 ##
## Revision: [Last]Wei Liu 07/06/18 ##
## ##
##----------------------------------------------------------##
##---------------------------------------------------------------------##
##--------------------------------------
##
## Project correlation(Customer define)
##
##--------------------------------------
## MODULE= [Module Name]
## TYPE = app/plat => Module Type
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Debug ]
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Release]
## BUILD = lib/exef => Output file format
## CFG = debug/release => Build Configuration
## SRC_PATH = [Source file path]
## INC_PATH = [Include file path]
## APP_PATH = [App Module path]
## PLT_PATH = [Plat Module path]
## PLT_LIB = [Needed plat lib for Link] => just for test or wxc2main
## APP_LIB = [Needed app lib for Link] => just for test or wxc2main
## LIB_ADD = [Needed Extend lib for Link] => just for test or wxc2main
## PLT_LIB e.g. = haepub fsm mng proto kernel aif mgc mgcp sip rtp \
## 8ecp bicc smpp xapp tcap mtp3 m2ua \
## snmp iptrans debug sccp public
##
## APP_LIB e.g. = msc vlr ssf hlr ae pps mnp smsc vms aas
## LIB_ADD e.g. = -liba3a8 -lm
## OBJ_ADD = [Extend third party object files needed]
## TEST_OBJ_PATH = [module object files Path for test ] => just for test
##---------------------------------------------------------------------##
MODULE = 8ecp
TYPE = plat
DBUG_FLAGS_ADD =
RELS_FLAGS_ADD =
##Default commonly as below
BUILD = lib
CFG = debug
PLT_LIB = public debug iptrans snmp mtp3
APP_LIB =
LIB_ADD =
SRC_PATH = ./src
INC_PATH = ./src/include
PLT_PATH = ../../plat
APP_PATH = ../../mss
OBJ_ADD =
TEST_OBJ_PATH = ../../obj
##---------------------------------------------------------------------##
##--------------------------------------
##
## Make configuration(Customer define)
##
##--------------------------------------
## CCFLAG_SWITCH = on/off => gcc flag show on/off
## COVER_NEED = yes/no => PTF cover report needed
## COVER_REPORT_PATH = [path ] => PTF cover report path
CCFLAG_SWITCH = off
COVER_NEED = no
COVER_REPORT_PATH = ./ut/ut_doc/output
##---------------------------------------------------------------------##
##--------------------------------------
##
## include makefile.rules (Do not change)
##
##--------------------------------------
include Makefile.rules

BIN
omc/plat/8ecp/lib/lib8ecp.a Normal file

Binary file not shown.

BIN
omc/plat/8ecp/obj/8ecp.o Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\8ecp\src
2
3
c:8ecp_debug.c|1|11d70a3d909|1e8c|adf63b13|a8696697bfa411dc84ed001c23e19543|0
6:8ecp.c|1|11d70a3d957|201f|3c43c25e|a8f966b3bfa411dc84ed001c23e19543|0
7:include|2|0|0|0|a6996643bfa411dc84ed001c23e19543|0

288
omc/plat/8ecp/src/8ecp.c Normal file
View File

@@ -0,0 +1,288 @@
#include "./include/8ecp.h"
#include <stdlib.h>
#include <stdio.h>
#include "./include/8ecp_debug.h"
SAP_In_8ECP SAPIn8ECP;
//time_t t[_8KE1_NUM]; //save the time when the heartbeat message of a 8KE1 was received.
BYTE s_msg[128];
Card_Struct card_struct[_8KE1_NUM];
int _8ecp_bind (_8ECP_SAP * sap)
{
if (SAPIn8ECP.inUse == InUse)
{
perror ("unable to bind a SAP, because the SAP is in use.");
return -1;
}
else //If bind successful, save the user name and the functions
{
SAPIn8ECP.inUse = InUse;
strcpy (SAPIn8ECP._8ecp_sap.name, (*sap).name);
SAPIn8ECP._8ecp_sap.update_mg_status = sap->update_mg_status;
SAPIn8ECP._8ecp_sap.update_trk_status = sap->update_trk_status;
return 0;
}
}
int _8ecp_unbind (BYTE sapIndex)
{
if (sapIndex != 0)
{
perror ("unable to unbind the SAP, because the SAP is not in use");
return -1;
}
else //If unbind successful, set the default value of SAPIn8ECP
{
SAPIn8ECP.inUse = NotInUse;
memset (SAPIn8ECP._8ecp_sap.name, 0,
strlen (SAPIn8ECP._8ecp_sap.name));
SAPIn8ECP._8ecp_sap.update_mg_status = NULL;
SAPIn8ECP._8ecp_sap.update_trk_status = NULL;
return 0;
}
}
int _8ecp_createMG(WORD mgNo, DWORD ip, BYTE cardNo)
{
card_struct[cardNo].mgNo = mgNo;
card_struct[cardNo].ip = ip;
return 1;
}
int _8ecp_deleteMG(WORD mgNo, DWORD ip, BYTE cardNo)
{
if(card_struct[cardNo].ip != ip)
{
printf("the ip is not correct, in 8ecp the ip of card %d is: %ld\n", cardNo, card_struct[cardNo].ip);
return 0;
}
if(card_struct[cardNo].mgNo != mgNo)
{
printf("the mgNo is not correct, in 8ecp the mgNo of card %d is: %d\n", cardNo, card_struct[cardNo].mgNo);
return 0;
}
card_struct[cardNo].ip = 0;;
card_struct[cardNo].mgNo = 0;
return 1;
}
/*
calcurate the IP address where the 8ECP PDU will be sent to
*/
struct sockaddr_in getIP (WORD orgChnl)
{
//char ip3, ip[16];
//WORD mgNo;
BYTE cardNo;
struct sockaddr_in s;
/* ip3 = orgChnl / 256; //the ID of the 8KE1
sprintf (ip, "172.18.%d.1", ip3);
*/
cardNo = orgChnl / 256;
memset (&s, 0, sizeof (struct sockaddr));
s.sin_family = AF_INET;
s.sin_port = htons (PORT);
s.sin_addr.s_addr = card_struct[cardNo].ip;
bzero (&(s.sin_zero), 8);
return s;
}
void _8ecp_connect_chnl (WORD orgChnl, WORD dstChnl, BYTE ecDisable)
{
//int i;
DWORD tempip;
_8ECP_PDU _8ecp_pdu;
message_list msg_list;
struct sockaddr_in sin_addr;
BYTE temstr[15];
if (!SAPIn8ECP.inUse)
{
perror ("SAP is not bind!");
return;
}
sin_addr = getIP (orgChnl);
memset (&_8ecp_pdu, 0, sizeof (struct _8ECP_PDU));
_8ecp_pdu.CPC_IFA_Inf = 0x87;
if (ecDisable == 0)
_8ecp_pdu.type = 0;
else if (ecDisable == 1)
_8ecp_pdu.type = 06;
else
{
perror ("the value of ecDisable is error!");
return;
}
_8ecp_pdu.sourceTimeSlotNo = orgChnl % 256; //the ID of the timeslot on the 8KE1
_8ecp_pdu.dstModuleID = dstChnl / 256;
_8ecp_pdu.dstTimeSlotNo = dstChnl % 256;
msg_list.msgSrcPort = PORT;
msg_list.msgDstIP = sin_addr.sin_addr.s_addr;
tempip = ntohl(msg_list.msgDstIP);
msg_list.msgDstPort = PORT;
msg_list.msgLength = sizeof (_8ecp_pdu);
memcpy (msg_list.msgContent, &_8ecp_pdu, msg_list.msgLength);
memcpy(&temstr,&_8ecp_pdu, msg_list.msgLength);
log_procedure(0, temstr); //0:Send msg 1:recv msg
iptrPutMessage (msg_list);
}
void _8ecp_connect_dtmf (WORD orgChnl, WORD dstChnl, BYTE dtmfNo)
{
struct sockaddr_in sin_addr;
//int i;
BYTE temstr[15];
_8ECP_PDU _8ecp_pdu;
message_list msg_list;
if (!SAPIn8ECP.inUse)
{
perror ("SAP is not bind!");
return;
}
sin_addr = getIP (orgChnl);
memset (&_8ecp_pdu, 0, sizeof (struct _8ECP_PDU));
_8ecp_pdu.CPC_IFA_Inf = 0x87;
_8ecp_pdu.type = 03;
_8ecp_pdu.sourceTimeSlotNo = orgChnl % 256; //the ID of the timeslot on the 8KE1
_8ecp_pdu.dstModuleID = dstChnl / 256;
_8ecp_pdu.dstTimeSlotNo = dstChnl % 256;
_8ecp_pdu.Value = dtmfNo;
msg_list.msgSrcPort = PORT;
msg_list.msgDstIP = sin_addr.sin_addr.s_addr;
msg_list.msgDstPort = PORT;
msg_list.msgLength = sizeof (_8ecp_pdu);
memcpy (msg_list.msgContent, &_8ecp_pdu, msg_list.msgLength);
memcpy(&temstr, &_8ecp_pdu, msg_list.msgLength);
log_procedure(0, temstr);
iptrPutMessage (msg_list);
}
void _8ecp_connect_tone (WORD orgChnl, WORD dstChnl, BYTE toneNo, WORD duration)
{
struct sockaddr_in sin_addr;
//int i;
BYTE temstr[15];
_8ECP_PDU _8ecp_pdu;
message_list msg_list;
sin_addr = getIP (orgChnl);
if (!SAPIn8ECP.inUse)
{
perror ("SAP is not bind!");
return;
}
sin_addr = getIP (orgChnl);
memset (&_8ecp_pdu, 0, sizeof (struct _8ECP_PDU));
_8ecp_pdu.CPC_IFA_Inf = 0x87;
_8ecp_pdu.type = 2;
_8ecp_pdu.sourceTimeSlotNo = orgChnl % 256; //the ID of the timeslot on the 8KE1
_8ecp_pdu.dstModuleID = dstChnl / 256;
_8ecp_pdu.dstTimeSlotNo = dstChnl % 256;
_8ecp_pdu.Value = toneNo;
_8ecp_pdu.duration = duration;
msg_list.msgSrcPort = PORT;
msg_list.msgDstIP = sin_addr.sin_addr.s_addr;
msg_list.msgDstPort = PORT;
msg_list.msgLength = sizeof (_8ecp_pdu);
memcpy (msg_list.msgContent, &_8ecp_pdu, msg_list.msgLength);
memcpy(&temstr, &_8ecp_pdu, msg_list.msgLength);
log_procedure(0, temstr);
iptrPutMessage (msg_list);
}
void _8ecp_timer ()
{
_8ecp_mon ();
}
int trap_proc (BYTE oid_len, DWORD * oid_ptr, BYTE * pdata, BYTE msg_len,
snmp_addr * addr)
{
DWORD * oid_in;
WORD mgNo;
BYTE cardNo;
BYTE temstr[128];
//int i, index;
//time_t now;
if(oid_ptr[10] != 1)
return 0;
if(oid_ptr[11] != 1)
return 0;
if(oid_ptr[12] != 4)
return 0;
log_procedure(1, pdata);
memset(&temstr, 0, sizeof(temstr));
oid_in = oid_ptr + OID_Prefix;
cardNo = E1NumOnCSU * pdata[0] + pdata[1];
mgNo = card_struct[cardNo].mgNo;
if ((SAPIn8ECP._8ecp_sap.update_mg_status == NULL)||(mgNo == 0))
return 0;
else
SAPIn8ECP._8ecp_sap.update_mg_status (mgNo, 1);
if ((SAPIn8ECP._8ecp_sap.update_trk_status == NULL) || (mgNo ==0))
return 0;
else
{
{
if(pdata[25]&0x01)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 0, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 0, 0); //trk on MG is nok
}
{
if(pdata[25]&0x02)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 1, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 1, 0); //trk on MG is nok
}
{
if(pdata[25]&0x04)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 2, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 2, 0); //trk on MG is nok
}
{
if(pdata[25]&0x08)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 3, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 3, 0); //trk on MG is nok
}
{
if(pdata[25]&0x10)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 4, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 4, 0); //trk on MG is nok
}
{
if(pdata[25]&0x20)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 5, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 5, 0); //trk on MG is nok
}
{
if(pdata[25]&0x40)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 6, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 6, 0); //trk on MG is nok
}
{
if(pdata[25]&0x80)
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 7, 1); //trk on MG is nok
else
SAPIn8ECP._8ecp_sap.update_trk_status (mgNo, 7, 0); //trk on MG is nok
}
}
return 0;
}
void _8ecp_init ()
{
printf ("8ECP init start!\n");
SAPIn8ECP.inUse = NotInUse;
memset (SAPIn8ECP._8ecp_sap.name, 0, sizeof (SAPIn8ECP._8ecp_sap.name));
SAPIn8ECP._8ecp_sap.update_mg_status = NULL;
SAPIn8ECP._8ecp_sap.update_trk_status = NULL;
//memset (&t, 0, sizeof (t));
memset(&card_struct, 0, sizeof(Card_Struct));
_8ecp_debug_set ();
inquire_trapmsg ((void *) trap_proc); //register, get heartbeat msg
printf ("8ECP init complete!\n");
}

View File

@@ -0,0 +1,352 @@
#include "./include/8ecp.h"
#define _8ECP_DEBUG_ID 20
#define _8ECP_VER_DEBUG "R9V0_01p1"
BYTE _8ecp_asciin_buf[MAX_ASCIIIN_LEN];
BYTE _8ecp_asciout_buf[MAX_ASCIIOUT_LEN];
WORD monitor_flag;
BYTE _8ecp_sg_mon_flag[MAX_MG_NO];
BYTE _8ecp_trk_mon_flag[MAX_TRK_NO];
BYTE _8ecp_chl_mon_flag[MAX_CHL_NO];
BYTE tempstr[128];
BYTE tempstr1[256];
static BYTE log_help[] = {"8ECP Debug Monitor Help:\n\r\
1.[help]\n\r\
2.[log all/none]\n\r\
3.[log error on/off]\n\r\
4.[log mg -mg_no on/off]\n\r\
5.[log trk -mg_no -trk_no on/off]\n\r\
6.[log chl -mg_no -trk_no -chnl_no on/off]\n\r\n\r"};
static WORD disp_page[128];
static BYTE *disp_ptr = (BYTE *) disp_page;
static DWORD debug_status_id[20] =
{1,3,6,1,4,1,1373,1,1,2,3,1,2, _8ECP_DEBUG_ID + 2, 1};
static BYTE debug_status = 1;
static DWORD debug_name_id[20] =
{1,3,6,1,4,1,1373,1,1,2,3,1,2,_8ECP_DEBUG_ID + 2,2};
static DWORD debug_ascin_id[20] =
{1, 3, 6, 1, 4, 1, 1373, 1, 1, 2, 3, 1, 2, _8ECP_DEBUG_ID + 2, 3};
static DWORD debug_ascout_id[20] =
{1, 3, 6, 1, 4, 1, 1373, 1, 1, 2, 3, 1, 2, _8ECP_DEBUG_ID + 2, 4};
static DWORD debug_page_title[20] =
{1,3,6,1,4,1,1373,1,1,2,3,1,2,_8ECP_DEBUG_ID + 2,1,1};
static DWORD debug_page_line[20] =
{1,3,6,1,4,1,1373,1,1,2,3,1,2,_8ECP_DEBUG_ID + 2, 1,2,1};
static BYTE title1_p[] =
{
" 8ECP Page\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Message Info\n\r\
"};
BYTE _8ecp_disp_line(BYTE page, BYTE line)
{
BYTE disp_length;
disp_length = 16;
disp_ptr = (BYTE *) disp_page;
switch (page)
{
case 1:
if (line == 0)
{
disp_ptr = (BYTE *) &disp_page[page];
disp_length = 2;
}
else
{
if(tempstr != NULL)
disp_ptr = (BYTE *)tempstr;
}
break;
default:
disp_length = 0;
break;
}
return disp_length;
}
void _8ecp_disp_page(BYTE page)
{
BYTE disp_line;
BYTE disp_length;
debug_page_line[PAGE_POINT] = page + 5;
for (disp_line = 0; disp_line < 22; disp_line++)
{
disp_length = _8ecp_disp_line(page, disp_line);
debug_page_line[LINE_POINT] = disp_line + 2;
debug_page_line[LINE_POINT + 1] = 2; // Data Pointer
debug_set_response(BASE_ID_LEN + 2, debug_page_line, disp_ptr, disp_length);
}
}
int _8ecp_asciout_proc (BYTE * out_ptr)
{
int out_len;
out_len = strlen (out_ptr);
if (out_len + strlen (_8ecp_asciout_buf) > MAX_ASCIIOUT_LEN - 2)
{
strcpy (_8ecp_asciout_buf, out_ptr);
}
else
{
strcat (_8ecp_asciout_buf, out_ptr);
}
return 1;
}
int _8ecp_debug_set (void)
{
BYTE page;
BYTE data[10];
BYTE *ptr;
bzero(disp_page,128);
ptr = data;
bzero(_8ecp_sg_mon_flag,MAX_MG_NO);
bzero(_8ecp_trk_mon_flag,MAX_TRK_NO);
bzero(_8ecp_chl_mon_flag,MAX_CHL_NO);
bzero(tempstr, 40);
debug_set_response(BASE_ID_LEN, debug_status_id, &debug_status, 1);
debug_set_response(BASE_ID_LEN, debug_name_id, _8ECP_VER_DEBUG, 10);
debug_set_response (BASE_ID_LEN, debug_ascin_id, _8ecp_asciin_buf, 4096);
debug_set_response (BASE_ID_LEN, debug_ascout_id, _8ecp_asciout_buf, 4096);
for (page = 1; page < 2; page++)
{
switch (page)
{
case 1: //page 1
ptr = title1_p;
break;
default:
break;
}
debug_page_title[PAGE_POINT] = 5 + page;
debug_set_response(BASE_ID_LEN + 1, debug_page_title, ptr, strlen(ptr));
_8ecp_disp_page(page);
}
return 1;
}
void log_procedure(BYTE flag, BYTE* tempstr)
{
int i;
if(flag == 0)
{
for(i = 0; i < 15; i ++)
sprintf(&tempstr1[3*i], " %02x",tempstr[i]);
}
else if(flag == 1)
{
for(i = 0; i < 41; i ++)
sprintf(&tempstr1[3*i], " %02x",tempstr[i]);
}
if(monitor_flag == MONITOR_ALL)
{
if(flag == 0)
{
_8ecp_asciout_proc("\33[32mSend:\33[0m");
_8ecp_asciout_proc(tempstr1);
_8ecp_asciout_proc("\n");
}
else if(flag == 1)
{
_8ecp_asciout_proc("\33[33mReceive:\33[0m");
_8ecp_asciout_proc(tempstr1);
_8ecp_asciout_proc("\n");
}
}
else
{
if(flag == 1)
{
for(i = 0; i < MAX_MG_NO; i ++)
{
if(_8ecp_sg_mon_flag[i] == 1)
{
if(tempstr[11] == i)
_8ecp_asciout_proc(tempstr);
}
}
for(i = 0; i < MAX_TRK_NO; i++)
{
if(_8ecp_trk_mon_flag[i] == 1)
if(tempstr[12] / 32 == i)
_8ecp_asciout_proc(tempstr);
}
for(i = 0; i < MAX_CHL_NO; i++)
{
if(_8ecp_chl_mon_flag[i] == 1)
if(tempstr[12] == i)
_8ecp_asciout_proc(tempstr);
}
}
}
}
void _8ecp_mon (void)
{
WORD str_len;
BYTE * ascii_in_ptr = NULL;
BYTE * tmpStr;
DWORD mgNo = 0, trkNo = 0, chlNo = 0;
BYTE error_flag = 0;
if ((str_len = strlen (_8ecp_asciin_buf)) > 0)
{
ascii_in_ptr = _8ecp_asciin_buf + 1;
if (strcmp (ascii_in_ptr, "log all") == 0)
{
monitor_flag = MONITOR_ALL;
}
else if (strcmp (ascii_in_ptr, "log none") == 0)
{
monitor_flag = MONITOR_NONE;
}
else if (strcmp (ascii_in_ptr, "help") == 0)
{
_8ecp_asciout_proc (log_help);
}
else if (strcmp (ascii_in_ptr, "log error on") == 0)
{
monitor_flag = MONITOR_ERROR_ON;
}
else if (strcmp (ascii_in_ptr, "log error off") == 0)
{
monitor_flag = MONITOR_ERROR_OFF;
}
else if ((strstr (ascii_in_ptr, "log mg")) != NULL)
{
if ((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
mgNo = strtoul (tmpStr + 1, NULL, 10);
if (mgNo >= 0 && mgNo <= 31)
{
if (strstr (ascii_in_ptr, "on") != NULL)
{
_8ecp_sg_mon_flag[mgNo] = 1;
}
else if (strstr (ascii_in_ptr, "off") != NULL)
{
_8ecp_sg_mon_flag[mgNo] = 0;
}
}
else
error_flag = 1; //the format of command is error
}
else
error_flag = 1;
}
else if (strstr (ascii_in_ptr, "log trk"))
{
if ((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
mgNo = strtoul (tmpStr + 1, NULL, 10);
if (mgNo >= 0 && mgNo <= 31)
{
while (*++tmpStr != '\0') //get the next char '-'
{
if (*tmpStr == '-')
{
trkNo = strtoul (tmpStr + 1, NULL, 10);
if (trkNo >= 0 && trkNo <= 7)
{
if (strstr (tmpStr, "on") != NULL)
{
_8ecp_trk_mon_flag[mgNo * 8 + trkNo] = 1;
}
else if (strstr (tmpStr, "off") != NULL)
{
_8ecp_trk_mon_flag[mgNo * 8 + trkNo] = 0;
}
}
else
error_flag = 1;
break;
}
}
}
else
error_flag = 1;
}
else
error_flag = 1;
}
else if (strstr (ascii_in_ptr, "log chl"))
{
if ((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
mgNo = strtoul (tmpStr + 1, NULL, 10);
if (mgNo >= 0 && mgNo <= 31)
{
while (*++tmpStr != '\0') //get the next char '-'
{
if (*tmpStr == '-')
{
trkNo = strtoul (tmpStr + 1, NULL, 10);
if (trkNo >= 0 && trkNo <= 7)
{
while (*++tmpStr != '\0') //get the next char '-'
{
if (*tmpStr == '-')
{
chlNo = strtoul (tmpStr + 1, NULL, 10);
if (chlNo >= 0 && chlNo <= 31)
{
if (strstr (tmpStr, "on") != NULL)
{
_8ecp_chl_mon_flag[mgNo * 8 * 32 + chlNo] = 1;
}
else if (strstr (tmpStr, "off") != NULL)
{
_8ecp_chl_mon_flag[mgNo * 8 * 32 + chlNo] = 0;
}
}
else
error_flag = 1;
break;
}
}
break;
}
else
error_flag = 1;
}
}
}
else
error_flag = 1;
}
else
{
error_flag = 1;
}
}
else
error_flag = 1;
if (error_flag == 0)
_8ecp_asciout_proc("Command OK!\n\r");
else
_8ecp_asciout_proc("Command Error!\n\r");
strcpy (_8ecp_asciin_buf, "\0");
}
}

View File

@@ -0,0 +1,6 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\8ecp\src\include
2
2
c:8ecp_debug.h|1|11d70a3da32|29d|7b16c4f9|a7c9667bbfa411dc84ed001c23e19543|0
6:8ecp.h|1|11d70a3d9f3|db8|3029f304|a739665fbfa411dc84ed001c23e19543|0

View File

@@ -0,0 +1,149 @@
#ifndef _8ECP__H
#define _8ECP__H
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <time.h>
#include "../../../public/src/include/includes.h"
#include "../../../public/src/include/public.h"
#include "../../../iptrans/src/include/iptrans.h"
#include "../../../snmp/src/include/snmp.h"
#include "../../../debug/src/include/debug.h"
#include "./8ecp_debug.h"
extern BYTE s_msg[128];
#ifndef _8ECP_MAX_USER_NAME_LEN
#define _8ECP_MAX_USER_NAME_LEN 100
#endif
#ifndef _8KE1_NUM
#define _8KE1_NUM 32
#endif
#ifndef MAX_DELAY
#define MAX_DELAY 1 //the max delay time of heartbeat message
#endif
#ifndef PORT
#define PORT 4950
#endif
#ifndef OID_Prefix
#define OID_Prefix 8
#endif
#ifndef InUSE
#define InUse 1
#endif
#ifndef NotInUse
#define NotInUse 0
#endif
#ifndef TrkStartIndex
#define TrkStartIndex 8 //the first index of trkno in the heartbeat msg
#endif
#ifndef E1NumOnCSU
#define E1NumOnCSU 16
#endif
#ifndef _T_BYTE
#define _T_BYTE
typedef unsigned char BYTE;
#endif
#ifndef _T_WORD
#define _T_WORD
typedef unsigned short WORD;
#endif
#ifndef _T_DWORD
#define _T_DWORD
typedef unsigned int DWORD;
#endif
typedef struct _8ECP_SAP
{
char name[_8ECP_MAX_USER_NAME_LEN];
//8ECP module will use these callback functions to update 8E1 MG and trunk status
//Return 0 if success, return -1 if failure
int (*update_mg_status)(BYTE mgNo, BYTE status);
int (*update_trk_status)(BYTE mgNo, BYTE trkNo, BYTE status);
}_8ECP_SAP;
typedef struct _8ECP_PDU //the message send to IPTRANS
{
BYTE reserved;
BYTE lenInd;
BYTE CPC_IFA_Inf; //fixed value 0x87
BYTE dstRef[2];
BYTE reserved1;
BYTE sourceRef[2];
BYTE reserved2;
BYTE type; //00=connect time slot with echo
//01=connect ack
//02=connect tone
//03=connect DTMF
//04=connect group
//05=disconnect group
//06=connect time slot without echo
BYTE sourceTimeSlotNo;
BYTE dstModuleID;
BYTE dstTimeSlotNo;
BYTE Value; /*when type=02,
0=tone#0, 1=tone#1, 2=tone#2, 3=tone#3,
4=tone#4, 5=tone#5/,6=tone#6, 7=tone#7
when type=03
0=DTMF1, 1=DTMF2, 2=DTMF3, 3=DTMF4,
4=DTMF5, 5=DTMF6, 6=DTMF7, 7=DTMF8,
8=DTMF9, 9=DTMF0, 10=DTMF*, 11=DTMF#
*/
BYTE duration;
}_8ECP_PDU;
// the struct of SAP in 8ecp
typedef struct _SAP_In_8ECP
{
BYTE inUse;
_8ECP_SAP _8ecp_sap;
}SAP_In_8ECP;
// the struct of MG in 8ecp
typedef struct Card_Struct
{
// WORD mgNo;
DWORD ip;
BYTE mgNo;
}Card_Struct;
//8ecp interface
int _8ecp_bind(_8ECP_SAP *sap);
int _8ecp_unbind(BYTE sapIndex);
int _8ecp_createMG(WORD mgNo, DWORD ip, BYTE cardNo); //create or update MG
int _8ecp_deleteMG(WORD mgNo, DWORD ip, BYTE cardNo); //delete MG
void _8ecp_connect_chnl(WORD orgChnl, WORD dstChnl, BYTE ecDisable); //ecDisable:0/1=enable/disable echo canceller
void _8ecp_connect_dtmf(WORD orgChnl, WORD dstChnl, BYTE dtmfNo);
void _8ecp_connect_tone(WORD orgChnl, WORD dstChnl, BYTE toneNo, WORD duration);
void _8ecp_init(); //called in the main program during initialization stage
void _8ecp_timer(); //called every 10ms in the main program
#endif

View File

@@ -0,0 +1,33 @@
#ifndef _8ECP_DEBUG_H
#define _8ECP_DEBUG_H
#define BASE_ID_LEN 15
#define PAGE_POINT 14
#define LINE_POINT 15
#define MAX_ASCIIIN_LEN 4096
#define MAX_ASCIIOUT_LEN 4096
#define MONITOR_ERROR_OFF 3
#define MONITOR_ERROR_ON 2
#define MONITOR_ALL 1
#define MONITOR_NONE 0
#define MAX_MG_NO 32
#define MAX_TRK_NO MAX_MG_NO * 8
#define MAX_CHL_NO MAX_TRK_NO * 32
#ifndef _T_BYTE
#define _T_BYTE
typedef unsigned char BYTE;
#endif
#ifndef _T_WORD
#define _T_WORD
typedef unsigned short WORD;
#endif
int _8ecp_debug_set(void);
int _8ecp_asciout_proc(BYTE* out_ptr);
void _8ecp_mon(void);
void log_procedure(BYTE flag, BYTE* tempstr);
#endif

View File

@@ -0,0 +1,9 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\aif
2
5
3:doc|2|0|0|0|5eb881a3c44711dc962f001c23e19543|0
2:ut|2|0|0|0|624881bac44711dc9633001c23e19543|0
3:src|2|0|0|0|598baa37051f11dd8b58001c23e19543|0
8:Makefile|1|11d70a3daed|b57|6a82d06f|ab596627bfa411dc84f1001c23e19543|0
3:lib|2|0|0|0|ab59660bbfa411dc84f1001c23e19543|0

95
omc/plat/aif/Makefile Normal file
View File

@@ -0,0 +1,95 @@
##----------------------------------------------------------##
## ##
## Universal Makefile for module Version : V1.4 ##
## ##
## Created : Wei Liu 07/04/11 ##
## Revision: [Last]Wei Liu 07/06/18 ##
## ##
##----------------------------------------------------------##
##---------------------------------------------------------------------##
##--------------------------------------
##
## Project correlation(Customer define)
##
##--------------------------------------
## MODULE= [Module Name]
## TYPE = app/plat => Module Type
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Debug ]
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Release]
## BUILD = lib/exef => Output file format
## CFG = debug/release => Build Configuration
## SRC_PATH = [Source file path]
## INC_PATH = [Include file path]
## APP_PATH = [App Module path]
## PLT_PATH = [Plat Module path]
## PLT_LIB = [Needed plat lib for Link] => just for test or wxc2main
## APP_LIB = [Needed app lib for Link] => just for test or wxc2main
## LIB_ADD = [Needed Extend lib for Link] => just for test or wxc2main
## PLT_LIB e.g. = haepub fsm mng proto kernel aif mgc mgcp sip rtp \
## 8ecp bicc smpp xapp tcap mtp3 m2ua \
## snmp iptrans debug sccp public
##
## APP_LIB e.g. = msc vlr ssf hlr ae pps mnp smsc vms aas
## LIB_ADD e.g. = -liba3a8 -lm
## OBJ_ADD = [Extend third party object files needed]
## TEST_OBJ_PATH = [module object files Path for test ] => just for test
##---------------------------------------------------------------------##
MODULE = aif
TYPE = plat
DBUG_FLAGS_ADD = -D_AIFG_DEBUG_
RELS_FLAGS_ADD =
##Default commonly as below
BUILD = lib
CFG = debug
PLT_LIB = cunit public debug iptrans snmp mtp3 sccp
APP_LIB =
LIB_ADD =
SRC_PATH = ./src
INC_PATH = ./src/include
PLT_PATH = ../../plat
APP_PATH = ../../app
OBJ_ADD =
TEST_OBJ_PATH = ../../obj
##---------------------------------------------------------------------##
##--------------------------------------
##
## Make configuration(Customer define)
##
##--------------------------------------
## CCFLAG_SWITCH = on/off => gcc flag show on/off
## COVER_NEED = yes/no => PTF cover report needed
## COVER_REPORT_PATH = [path ] => PTF cover report path
CCFLAG_SWITCH = off
COVER_NEED = yes
COVER_REPORT_PATH = ./ut/ut_doc/output
##---------------------------------------------------------------------##
##--------------------------------------
##
## include makefile.rules (Do not change)
##
##--------------------------------------
include Makefile.rules

View File

@@ -0,0 +1,5 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\aif\doc
2
1
10:release_note.txt|1|11d70a3dbb8|15b|92ef5818|6d988209c44711dc963f001c23e19543|0

View File

@@ -0,0 +1,21 @@
ACRD Software Module Release Notes
Module Name: AIFG
#----------------------------------------------
[Version]
R9V0_05P2
[Release Date]
2008-1-8
[Author]
Roy Jiang
[Changes]
Bug fixed:
1.NA
Improvements:
1.NA
New features:
1.NA
[Remark]
1.Initial Clearcase release
#----------------------------------------------

BIN
omc/plat/aif/lib/libaif.a Normal file

Binary file not shown.

BIN
omc/plat/aif/obj/aifg.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
omc/plat/aif/obj/aifg_ie.o Normal file

Binary file not shown.

BIN
omc/plat/aif/obj/aifg_m.o Normal file

Binary file not shown.

BIN
omc/plat/aif/obj/aifg_mpp.o Normal file

Binary file not shown.

View File

@@ -0,0 +1,11 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\aif\src
2
7
6:aifg.c|1|11d70a3dc93|1c81|3b10db20|adc96697bfa411dc84f1001c23e19543|0
8:aifg_m.c|1|11d70a3dcd1|b6fe|6671c6c5|e0c481066cf311dd91a5001c23e19543|0
b:aifg_csta.c|1|11d70a3dd8d|1bba|a93e11f0|6e8b63f2a4d211dd91b5001c23e19543|0
9:aifg_ie.c|1|11d70a3dc54|13c03|30223d39|ad29667bbfa411dc84f1001c23e19543|0
7:include|2|0|0|0|611881b1c44711dc9632001c23e19543|0
c:aifg_debug.c|1|11d70a3dd1f|78cb|50dddc48|b45967cbbfa411dc84f1001c23e19543|0
a:aifg_mpp.c|1|11d70a3dd4e|340f6|c3aecf7f|e154811e6cf311dd91a5001c23e19543|0

265
omc/plat/aif/src/aifg.c Normal file
View File

@@ -0,0 +1,265 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg_if.c
Description: Interface of AIFG
Version: v9.0.0
Author: Roy Jiang
Create Date: 2007-3-12
History:
2007-3-6 v9.0.1 Create
*********************************************************************/
#include "./include/aifg_var_ext.h"
#include "../../public/src/include/license_id.h"
/*
Name: aifg_bind
Purpose: Request to create a SAP in AIFG module.
Input: aifg_sap_type type: type of upper layer entity
int (*callback)(): pointer to call back function
Output: SAP id
*/
int aifg_bind(aifg_sap_type type, int (*callback)(aifg_indication, aifg_msg_pre_decoded *))
{
//checking parameters
assert(type == AIFG_SAP_MSC || type == AIFG_SAP_BSC);
assert(callback != NULL);
assert(sap[type].enable == 0);
if (wxc2_get_license(LIC_AIF) != 1)
return -1;
sap[type].enable = 1;
sap[type].callback_func = callback;
return (int)type;
}
/*
Name: aifg_modify
Purpose: Request to modify the SAP parameter in AIFG module.
Input: aifg_sap_type type: type of upper layer entity
aifg_callback_func *callback: new callback functions, null if no need to modify
Output: None
*/
void aifg_modify(int sapid, int (*callback)(aifg_indication, aifg_msg_pre_decoded*))
{
//checking parameters
assert(sapid == AIFG_SAP_MSC || sapid == AIFG_SAP_BSC);
assert(sap[sapid].enable == 1);
sap[sapid].enable = 1;
if(callback != NULL)
sap[sapid].callback_func = callback;
return;
}
/*
Name: aifg_set_running_mode
Purpose: Set the running mode of AIFG module.
Input: enum aifg_run_mode mode: running mode, 0 - single, 1 - dual
int alter_ip:IP address of the alternative server, hex format
Output: None
*/
void aifg_set_running_mode(aifg_run_mode mode)
{
assert(mode == AIFG_RUN_MODE_SINGLE || mode == AIFG_RUN_MODE_DUAL);
dual_server.mode = mode;
return;
}
/*
Name: aifg_createCircuitGroup
Purpose: Request to create a circuit group in AIFG module.
Input: int sapid: SAP ID of upper layer entity
int dpc: DPC of the circuit group.
aifg_ni ni: NI of the circuit group.
Output: Circuit Group ID - Upper layer entity should record this ID and pass it to AIFG module
whenever it request to send a message through this circuit group
AIFG_ERR_NO_RESOURCE: Create failed
*/
int aifg_createCircuitGroup(int sapid, int dpc, aifg_ni ni, int tgid)
{
int i;
assert(sapid == AIFG_SAP_MSC || sapid == AIFG_SAP_BSC);
assert(ni >= 0 && ni <= 3);
assert(dpc >= 0);
if (sap[sapid].enable == 0)
goto ERR_PROC;
//check if there is a existing CG with the same dpc and ni
for(i=0; i < AIFG_MAX_CG; i++){
if(cg[i].enable == 1 && cg[i].dpc == dpc && cg[i].ni == ni)
return i;
}
//create a new circuit group
i = 0;
while(cg[i].enable == 1)
i++;
if(i >= AIFG_MAX_CG){
aifg_event = AIFG_ERR_OUT_OF_RESOURCE;
goto ERR_PROC;
}
cg[i].enable = 1;
cg[i].dpc = dpc;
cg[i].ni = ni;
cg[i].sapid = sapid;
cg[i].tgid = tgid;
return i;
ERR_PROC:
return -1;
}
/*
Name: aifg_delCircuitGroup
Purpose: Request to delete a circuit group in AIFG module.
Input: int sapid: SAP ID of upper layer entity
int cgid: Circuit Group ID
Output: None
*/
void aifg_delCircuitGroup(int sapid, int cgid)
{
assert(sapid == AIFG_SAP_MSC || sapid == AIFG_SAP_BSC);
assert(cgid >= 0 && cgid < AIFG_MAX_CG);
cg[cgid].enable = 0;
cg[cgid].dpc = 0;
cg[cgid].ni = 0;
cg[cgid].sapid = 0;
cg[cgid].tgid = 0;
return;
}
/*
Name: aifg_modCircuitGroup
Purpose: Request to modify the parameter of a circuit group in AIFG module.
Input: int sapid: SAP ID of upper layer entity
int cgid: Circuit Group ID
int dpc: new DPC of the circuit group, -1 if no need to change.
enum aifg_ni: new NI of the circuit group, -1 if no need to change.
Output: Circuit Group ID - Upper layer entity should record this ID and pass it to AIFG module
whenever it request to send a message through this circuit group
*/
int aifg_modCircuitGroup(int sapid, int cgid, int dpc, int ni)
{
assert(sapid == AIFG_SAP_MSC || sapid == AIFG_SAP_BSC);
assert(cg[cgid].sapid == sapid);
assert(ni >= 0 && ni <= 3);
assert(dpc >= 0);
assert(cgid >= 0 && cgid < AIFG_MAX_CG);
cg[cgid].enable = 1;
cg[cgid].dpc = dpc;
cg[cgid].ni = ni;
return cgid;
}
/*
Name: aifg_send
Purpose: Request to send a message through A-interface.
Input: int sapid: SAP ID of upper layer entity.
int cgid: Circuit Group ID
int u_port: process port of upper layer entity
aifg_msg *msg: content of assign request message
Output: 0 - succeed
-1 - failed, no free port available
-2 - failed, circuit group not ready
*/
int aifg_send(int sapid, int cgid, int u_port, aifg_msg_t *msg)
{
int protocol;
assert(sapid == AIFG_SAP_MSC || sapid == AIFG_SAP_BSC);
assert(cgid >= 0 && cgid < AIFG_MAX_CG);
assert(msg != NULL);
if (sap[sapid].enable == 0){
aifg_event = AIFG_ERR_SAP_NOT_CREATED;
goto ERR_PROC;
}
//check message protocol and pd
msg->app_port = u_port;
if(msg->id <= AIFG_MSG_ID_RP_SMMA){
if(msg->id <= AIFG_MSG_ID_MM_INFO)
msg->pd = AIFG_PD_DTAP_MM;
else if(msg->id <= AIFG_MSG_ID_FACILITY)
msg->pd = AIFG_PD_DTAP_CC;
else if(msg->id <= AIFG_MSG_ID_RELEASE_CMP_SS)
msg->pd = AIFG_PD_DTAP_SS;
else if(msg->id <= AIFG_MSG_ID_RP_SMMA)
msg->pd = AIFG_PD_DTAP_SMS;
else
assert(0);
protocol = AIFG_MSG_DTAP;
}
else{
if(msg->id <= AIFG_MSG_ID_HO_CAN_RESP)
msg->pd = AIFG_PD_BSSMAP_GLOBAL;
else if(msg->id <= AIFG_MSG_ID_LSA_INFO)
msg->pd = AIFG_PD_BSSMAP_DEDICATED;
else
assert(0);
protocol = AIFG_MSG_BSSMAP;
}
if(msg->aif_port == -1 || msg->pd == AIFG_PD_BSSMAP_GLOBAL){
if(msg->pd != AIFG_PD_BSSMAP_GLOBAL || msg->id == AIFG_MSG_ID_PAGING){
if((msg->aif_port = aifg_port_assign(sapid, cgid, -1)) < 0){
aifg_event = AIFG_ERR_ASSIGN_PORT_FAIL;
goto ERR_PROC;
}
aifg_pcb[msg->aif_port].upper_port = u_port;
aifg_pcb[msg->aif_port].trace_flag = msg->trace_flag;
}
else{
msg->aif_port = -1; //no port need
aifg_send_udt(cgid, msg, NULL); //global BSSMAP message needs no aifg port, except paging
}
}
else if (aifg_pcb[msg->aif_port].stat == AIFG_PORT_TRANSACTION && aifg_pcb[msg->aif_port].ti_type != AIFG_TRANS_UNKNOW){
if((msg->id == AIFG_MSG_ID_SETUP
&& (aifg_pcb[msg->aif_port].ti_stat > 0 || aifg_pcb[msg->aif_port].ti_type != AIFG_TRANS_CC))
|| (msg->id == AIFG_MSG_ID_RP_DATA
&& aifg_pcb[msg->aif_port].ti_type != AIFG_TRANS_SMS))
{
//new transaction
int new_port = aifg_port_assign(sapid, cgid, -1);
if (new_port < 0){
aifg_event = AIFG_ERR_ASSIGN_PORT_FAIL;
goto ERR_PROC;
}
aifg_pcb[new_port].upper_port = u_port;
aifg_pcb[new_port].link_id = aifg_pcb[msg->aif_port].link_id;
aifg_pcb[new_port].trace_flag = msg->trace_flag;
msg->aif_port = new_port;
}
}
if(msg->aif_port != -1){
if (aifg_pcb[msg->aif_port].stat == AIFG_PORT_IDLE){
aifg_event = AIFG_ERR_MSG_SD_TO_IDLE_PORT;
goto ERR_PROC;
}
aifg_pcb[msg->aif_port].cgid = cgid;
aifg_port_proc(&aifg_pcb[msg->aif_port], msg, NULL);
}
aifg_debug_print(msg->aif_port, AIFG_EVENT_RV_REQ, msg, 0);
return AIFG_SUCCEED;
ERR_PROC:
aifg_debug_print(msg->aif_port, aifg_event, msg, u_port);
return AIFG_ERROR;
}

View File

@@ -0,0 +1,310 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg_csta.c
Description: CSTA of AIFG
Version: v9.0.0
Author: XH Chen
Create Date: 2008-3-12
History:
2007-3-6 v9.0.1 Create
*********************************************************************/
#include "../../../plat/public/src/include/includes.h"
#include "../../../plat/snmp/src/include/snmp.h"
#include "./include/aifg_type_def.h"
#define NO_EXIST 0
#define EXIST 1
#define OID_OFFSET 14
#define AIF_10SEC 1000
struct obj_view {
int entry_oidlen;
int column_oidlen;
int full_oidlen;
DWORD *entry;
DWORD *column;
DWORD *iid; /* Instance ID */
BYTE csta_pos;
BYTE csta_len;
};
typedef void *(*lookup_level_1)(u32 *oid_1);
typedef void *(*lookup_level_2)(u32 oid_1, u32 *oid_2);
typedef int (*get_csta)(struct obj_view *view, u8 *pdata, u8 *vartype);
struct tab_view{
BYTE exist_flag;
BYTE entry_id;
BYTE level; /* Three level: 1, 2*/
lookup_level_1 lookup_1;
lookup_level_2 lookup_2;
get_csta get_aif_csta;
u8 next_column[16];
struct obj_view view;
};
#define AIF_OID {1,3,6,1,4,1,1373,2,3,2,6}
#define AIF_OIDLEN 11
typedef struct{
unsigned long timestamp;
int msg_stat[AIFG_MAX_MESSAGE*2];
}aifg_csta;
BYTE aifCSTAInd;
aifg_csta aifCSTA[96];
//DTAP:RR MM CC SS SMS; BSSMAP:Global Dedicated
const BYTE cstaLen[8] = {0, 2, 21, 31, 3, 4, 18, 36};
const BYTE postion[8] = {0, 0, 4, 46, 108, 114, 122, 158};
extern int msg_statistics[AIFG_MAX_MESSAGE][2];
u32 *findnext_quater(u32 *id);
int get_aif_csta(struct obj_view *view, BYTE *pdata, BYTE *vartype);
int aifg_get_resp(BYTE oidlen, DWORD *oid, BYTE *pdata, BYTE *vartype);
int aif_getnext_resp(u8 prev_oidlen, u32 *prev_oid, u8 *oidlen, u32 *oid, u8 *pdata, u8 *vartype);
static struct tab_view aif_csta_table[8]={
{NO_EXIST},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
{
EXIST, OID_OFFSET, 1,
(void *)findnext_quater, NULL,
get_aif_csta,
{1, 2, 0}
},
};
void aifg_csta_init(void)
{
DWORD aif_oid_prefix[20] = AIF_OID;
inquire_getmsg(AIF_OIDLEN, aif_oid_prefix, aifg_get_resp);
inquire_getnextmsg(AIF_OIDLEN, aif_oid_prefix, aif_getnext_resp);
memset(aifCSTA, 0, sizeof(aifCSTA));
}
void aifg_csta_proc(void)
{
static int counter = 0;
static BYTE flag = 0;
struct tm *t;
unsigned long l_time;
if(counter ++ >= AIF_10SEC)
{
l_time = time(NULL);
t = localtime(&l_time);
counter = 0;
if(t->tm_min % 15 < 2) //per 15 min
{
if(flag == 0)
{
/* get csta index */
aifCSTAInd = t->tm_hour * 4 + t->tm_min / 15;
/* copy the msg statistic to the csta buffer */
memcpy(aifCSTA[aifCSTAInd].msg_stat, msg_statistics, sizeof(msg_statistics));
aifCSTA[aifCSTAInd].timestamp = l_time;
/* clear msg statistic */
memset(msg_statistics, 0, sizeof(msg_statistics));
flag = 1;
}
}
else
flag = 0;
}
}
u32 *findnext_quater(u32 *id)
{
int csta_inst = aifCSTAInd;
//CHECKME: to make sure it can run across 24 hours
if(csta_inst > 0)
csta_inst -= 1;
if(*id != csta_inst)
{
*id = csta_inst;
return id;
}
*id = 0;
return NULL;
}
struct obj_view *gen_obj_view(struct tab_view *table, u32 *oid)
{
struct obj_view *view = &table->view;
view->entry = oid + table->entry_id;
view->entry_oidlen = table->entry_id + 1;
view->column =view->entry + 1;
view->column_oidlen = view->entry_oidlen + 1;
view->iid = view->column + 1;
view->full_oidlen = view->column_oidlen + table->level;
view->csta_pos = postion[oid[table->entry_id-1]];
view->csta_len = cstaLen[oid[table->entry_id-1]];
return view;
}
struct tab_view *lookup_csta_table(BYTE oidlen, DWORD *oid)
{
int index;
if(oidlen < AIF_OIDLEN +2)
return NULL;
index = oid[AIF_OIDLEN];
if(index >= 8)
return NULL;
else if(aif_csta_table[index].exist_flag == 0)
return NULL;
else
return &aif_csta_table[index];
}
void aifg_encode_csta(BYTE *pData, BYTE pos, BYTE Len, aifg_csta *pCsta)
{
unsigned long *pDW = (unsigned long *)pData;
int *pSrc = (int *)&pCsta->msg_stat[2];
int *pDst = (int *)(pData + 4);
int i;
pDW[0] = htonl(pCsta->timestamp);
for(i = 0; i < Len*2; i++)
pDst[i] = htonl(pSrc[pos + i]);
}
int get_aif_csta(struct obj_view *view, BYTE *pdata, BYTE *vartype)
{
int dataLen = 0;
int csta_inst;
if((csta_inst = view->iid[0]) >= 96)
return -1;
switch(*(view->column))
{
case 1:
*((int *)pdata) = htonl(csta_inst);
*vartype = 0x02;
dataLen = 4;
break;
case 2:
if(aifCSTA[csta_inst].timestamp == 0)
return 0;
*vartype = 0x04;
aifg_encode_csta(pdata,view->csta_pos, view->csta_len, &aifCSTA[csta_inst]);
dataLen = (view->csta_len*sizeof(int)*2+4);
break;
}
return dataLen;
}
int aifg_get_resp(BYTE oidlen, DWORD *oid, BYTE *pdata, BYTE *vartype)
{
struct tab_view *table;
struct obj_view *view;
if((table = lookup_csta_table(oidlen, oid)) == NULL)
return -1;
view = gen_obj_view(table, oid);
if(oidlen != view->full_oidlen)
return -1;
if(*(view->entry) != 1)
return -1;
if(table->get_aif_csta == NULL)
return -1;
else
return table->get_aif_csta(view, pdata, vartype);
}
static int get_nextOid(u8 *oidlen, u32 *oid)
{
struct tab_view *table;
struct obj_view *view;
if((table = lookup_csta_table(*oidlen, oid)) == NULL)
return 0;
view = gen_obj_view(table, oid);
if(*oidlen < view->full_oidlen)
{
memset(&oid[*oidlen], 0, view->full_oidlen-*oidlen);
if(*oidlen < view->entry_oidlen)
*view->entry = 1;
if(*oidlen < view->column_oidlen)
*view->column = table->next_column[0];
if(*oidlen == view->full_oidlen-1)
{
*oidlen = view->full_oidlen;
}
*oidlen = view->full_oidlen;
}
for(; *(view->column) != 0; *(view->column) = table->next_column[*(view->column)])
{
switch(table->level)
{
case 1:
if(table->lookup_1(view->iid) != NULL)
return 1;
break;
case 2:
break;
case 3:
break;
}
}
return 0;
}
int aif_getnext_resp(u8 prev_oidlen, u32 *prev_oid, u8 *oidlen, u32 *oid, u8 *pdata, u8 *vartype)
{
memcpy(oid, prev_oid, prev_oidlen*sizeof(u32));
*oidlen = prev_oidlen;
if(get_nextOid(oidlen, oid))
{
return aifg_get_resp(*oidlen, oid, pdata, vartype);
}
else
return -1;
}

File diff suppressed because it is too large Load Diff

2227
omc/plat/aif/src/aifg_ie.c Normal file

File diff suppressed because it is too large Load Diff

1689
omc/plat/aif/src/aifg_m.c Normal file

File diff suppressed because it is too large Load Diff

7614
omc/plat/aif/src/aifg_mpp.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\aif\src\include
2
7
6:aifg.h|1|11d70a3de67|fe7|8b5f2301|b0296707bfa411dc84f1001c23e19543|0
d:aifg_public.h|1|11d70a3dee4|39d|33cc0d9f|b159673fbfa411dc84f1001c23e19543|0
9:aifg_ie.h|1|11d70a3df90|78f0|98f81cdb|b3196793bfa411dc84f1001c23e19543|0
9:aifg_if.h|1|11d70a3df23|26a|5af7abd0|b1e9675bbfa411dc84f1001c23e19543|0
a:aifg_msg.h|1|11d70a3deb5|aaac|6675a37b|853d2877c9bd11dc8b4a001c23e19543|0
e:aifg_var_ext.h|1|11d70a3de29|93a|8f4d21bb|aef966ebbfa411dc84f1001c23e19543|0
f:aifg_type_def.h|1|11d70a3df52|4492|b9916b|866d2878c9bd11dc8b4b001c23e19543|0

View File

@@ -0,0 +1,118 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg.h
Description: API Definition of AIFG module
Version: v9.0.0
Author: Roy Jiang
Create Date: 2007-3-6
History:
2007-3-6 v9.0.0 Create
2007-7-7 v9.0.1 Remove Block/Unblock/Reset/Reset CC/Overload/HO Can. Enq. API,
replace with aifg_send
*********************************************************************/
#ifndef _WXC2_AIFG_H
#define _WXC2_AIFG_H
#include "aifg_msg.h"
/*******************************SAP Management**********************************/
/*
Name: aifg_bind
Purpose: Request to create a SAP in AIFG module.
Input: aifg_sap_type type: type of upper layer entity
int opc:OPC of upper layer entity.
aifg_ni ni: NI of upper layer entity.
Output: SAP id
*/
int aifg_bind(aifg_sap_type type, int (*callback)(aifg_indication, aifg_msg_pre_decoded *));
/*
Name: aifg_modify
Purpose: Request to modify the SAP parameter in AIFG module.
Input: aifg_sap_type type: type of upper layer entity
int opc: new OPC, -1 if no need to modify
aifg_ni ni:new NI, -1 if no need to modify
aifg_callback_func *callback: new callback functions, null if no need to modify
Output: none
*/
void aifg_modify(aifg_sap_type type, int (*callback)(aifg_indication, aifg_msg_pre_decoded *));
/*
Name: aifg_set_running_mode
Purpose: Set the running mode of AIFG module.
Input: enum aifg_run_mode mode: running mode, 0 - single, 1 - dual
int alter_ip:IP address of the alternative server, hex format
Output: None
*/
void aifg_set_running_mode(aifg_run_mode mode);
/*
Name: aifg_createCircuitGroup
Purpose: Request to create a circuit group in AIFG module.
Input: int sapid: SAP ID of upper layer entity
int dpc: DPC of the circuit group.
aifg_ni ni: NI of the circuit group.
Output: Circuit Group ID - Upper layer entity should record this ID and pass it to AIFG module
whenever it request to send a message through this circuit group
-1: Create failed
*/
int aifg_createCircuitGroup(int sapid, int dpc, aifg_ni ni, int tgid);
/*
Name: aifg_modCircuitGroup
Purpose: Request to modify the parameter of a circuit group in AIFG module.
Input: int sapid: SAP ID of upper layer entity
int cgid: Circuit Group ID
int dpc: new DPC of the circuit group, -1 if no need to change.
enum aifg_ni: new NI of the circuit group, -1 if no need to change.
Output: Circuit Group ID - Upper layer entity should record this ID and pass it to AIFG module
whenever it request to send a message through this circuit group
*/
int aifg_modCircuitGroup(int sapid, int cgid, int dpc, int ni);
/*
Name: aifg_delCircuitGroup
Purpose: Request to delete a circuit group in AIFG module.
Input: int sapid: SAP ID of upper layer entity
int cgid: Circuit Group ID
Output: None
*/
void aifg_delCircuitGroup(int sapid, int cgid);
/*
Name: aifg_send
Purpose: Request to send a message through A-interface.
Input: int sapid: SAP ID of upper layer entity.
int cgid: Circuit Group ID
int u_port: process port of upper layer entity
aifg_msg *msg: content of assign request message
Output: 0 - succeed
-1 - failed
-2 - failed, circuit group not ready
*/
int aifg_send(int sapid, int cgid, int u_port, aifg_msg_t *msg);
/*
Name: aifg_paging
Purpose: Request to paging.
Input: int sapid: SAP ID of upper layer entity
int cgid: Circuit Group ID
int u_port: process port of upper layer entity
aifg_msg_bm_paging *msg: paging message
Output: 0 - succeed
-1 - failed
-2 - failed, circuit group not ready
*/
int aifg_paging(int sapid, int cgid, int u_port, aifg_msg_t *msg);
/*
Name: aifg_ie_decode
Purpose: Information element decode function
Input: aifg_msg_protocol protocol: BSSMAP or DTAP
aifg_pre_decoded_ie *pre_decoded: pre-decoded IE structure
aifg_ie *dst: pointer to a aifg_ie structure object in which the decoded message will be stored.
Output: Total length of decoded IE
*/
int aifg_ie_decode(aifg_ie_ptr *pre_decoded, aifg_ie *dst);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg_if.h
Description: Interface declearation for wxc2main
Version: v9.0.0
Author: Roy Jiang
Create Date: 2007-3-14
History:
2007-3-14 v9.0.0 Create
*********************************************************************/
#ifndef _WXC2_AIFG_IF_H
#define _WXC2_AIFG_IF_H
/*
Name: aifg_init
Purpose: Init AIFG module.
Input: None
Output: None
*/
void aifg_init();
/*
Name: aifg_init
Purpose: 10ms routing of AIFG module.
Input: None
Output: None
*/
void aifg_proc();
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg_public.h
Description: Public definition of AIFG module
Version: v9.0.0
Author: Roy Jiang
Create Date: 2007-3-6
History:
2007-3-6 v9.0.0 Create
*********************************************************************/
#ifndef _WXC2_AIFG_PUBLIC_H
#define _WXC2_AIFG_PUBLIC_H
//Common include
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../../../public/src/include/public.h"
typedef enum _aifg_sap_type{
AIFG_SAP_MSC,
AIFG_SAP_BSC
}aifg_sap_type;
typedef enum _aifg_ni{
AIFG_NI_INTERNATIONAL,
AIFG_NI_INTERNATIONAL_SPARE,
AIFG_NI_NATIONAL,
AIFG_NI_NATIONAL_SPARE,
}aifg_ni;
typedef enum _aifg_run_mode{
AIFG_RUN_MODE_SINGLE = 0,
AIFG_RUN_MODE_DUAL,
}aifg_run_mode;
typedef enum _aifg_indication{
AIFG_IND_RV_MSG,
}aifg_indication;
#endif

View File

@@ -0,0 +1,445 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg_type_def.h
Description: Data structure definition of AIFG module
Version: v9.0.0
Author: Roy Jiang
Create Date: 2007-3-12
History:
2007-3-6 v9.0.12 Create
*********************************************************************/
#ifndef _WXC2_AIFG_TYPE_DEF_H
#define _WXC2_AIFG_TYPE_DEF_H
#include "aifg_public.h"
#include "aifg_msg.h"
#include "../../../sccp/src/include/scoc_if.h"
#ifndef NULL
#define NULL 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define SCCP_SAP_AIFG 3
#define AIFG_PROC_FINISH 1
#define AIFG_PROC_CONTINUE 0
#define AIFG_MAX_CG 256
#define AIFG_MAX_SAP 2
#define MSG_PROC_EACH_TIME 64
#define AIFG_MAX_PORT 8192
#define AIFG_MAX_MSG_LENGTH 256
#define AIFG_MAX_TI_PER_LINK 16
#define AIFG_MAX_MESSAGE 128
#define SCCP_MAX_LINK 8192
typedef struct{
int port;
BYTE *data_ptr;
}aifg_raw_msg;
enum {AIFG_CG_AVAILABLE, AIFG_CG_UNAVAILABLE};
typedef struct{
BYTE enable;
int (*callback_func)(aifg_indication, aifg_msg_pre_decoded *);
}aifg_sap;
typedef struct{
BYTE mode;
}aifg_dual_server;
typedef enum{
AIFG_CG_STATE_DOWN,
AIFG_CG_STATE_UP,
}aifg_cg_state;
//port status definition
typedef enum {
AIFG_PORT_IDLE,
AIFG_PORT_INIT,
AIFG_PORT_PAGING,
AIFG_PORT_RESET,
AIFG_PORT_TRANSACTION,
AIFG_PORT_TRANSPARENT,
AIFG_PORT_RELEASE,
AIFG_PORT_FINISH,
}AIFG_PORT_STATE;
typedef enum{
AIFG_TRANS_UNKNOW = -1,
AIFG_TRANS_LU = 1,
AIFG_TRANS_CC = AIFG_PD_DTAP_CC, //3
AIFG_TRANS_SMS = AIFG_PD_DTAP_SMS, //9
AIFG_TRANS_SS = AIFG_PD_DTAP_SS, //11
}AIFG_TRANS_TYPE;
typedef struct aifg_port_t{
aifg_sap_type sapid; //SAP id
BYTE cgid; //circuit group id
int link_id; //link id
int new_link; //for handover, new link id to which the call will be handover to
int upper_port; //process port of upper layer
AIFG_PORT_STATE stat; //port status
int timer; //process timer
struct aifg_port_t *pNextOpenPort; //pointer to the next port in the opened port list
struct aifg_port_t *pPrevOpenPort; //pointer to the previous port in the opened port list
struct aifg_port_t *pNextPort; //pointer to the next port of the same BSSMAP transaction, such as paging/block
struct aifg_port_t *pPrevPort; //pointer to the previous port of the same BSSMAP transaction, such as paging/block
char ti; //TI value, including the TI flag
AIFG_TRANS_TYPE ti_type; //Transaction type of this port (CC/SS/SMS)
BYTE ti_stat; //Transaction status
BYTE rel_cause; //release cause
BYTE diagnostic[32]; //diagnostic for release
BYTE diag_len; //diagnostic length
BYTE imsi[16]; //associated mobile IMSI
BYTE imsi_len; //associated mobile IMSI length
BYTE ho_stat; //handover status
int app_ho_port; //application handover process port
SP_UiPriPara sd_buffer; //send message buffer, used in case when message re-send is needed
BYTE app_rel_flag; //flag to indicate whether app is released
BYTE trace_flag; //for debug trace
#ifdef _AIFG_DEBUG_
unsigned int dead_timer; //for resource leak checking
#endif
}aifg_port;
//timer definition, second
#define T1S_MULTIPLIER 100
enum{
AIFG_TIMER_T2 = 3 * T1S_MULTIPLIER, //Reset guard period at the MSC
AIFG_TIMER_T13 = 3 * T1S_MULTIPLIER, //Reset guard period at the BSS
AIFG_TIMER_T14 = 60 * T1S_MULTIPLIER, //Time to receive RESET ACKNOWLEDGE at the BSS
AIFG_TIMER_T16 = 60 * T1S_MULTIPLIER, //Time to receive RESET ACKNOWLEDGE at the MSC
AIFG_TIMER_T3113 = 15 * T1S_MULTIPLIER, //Time to receive PAGING RESPONSE at MSC
AIFG_TIMER_REPAGE = 8 * T1S_MULTIPLIER, //Time to resend PAGING REQUEST at MSC
AIFG_TIMER_TRANS_TIMEOUT = 120 * T1S_MULTIPLIER, //120s
AIFG_TIMER_CLEAR_TIMEOUT = 10 * T1S_MULTIPLIER, //10s
AIFG_TIMER_RELEASE_TIMEOUT = 10 * T1S_MULTIPLIER, //10s
AIFG_TIMER_WAIT_RELEASE_CMP = 50 //500ms
};
typedef struct{
BYTE enable;
int dpc;
aifg_ni ni;
BYTE sapid; //SAP which owns this CG
int tgid; //MSC trunk group id
}aifg_circuit_group;
typedef struct{
BYTE en_flag;
BYTE cleared; //if the link was cleared, all the ports belongs to it will be released
aifg_sap_type sapid; //SAP which owns this link
int cur_port; //in MSC:current activated local port
//in BSC:current activated upper port, for no AIFG local port need at BSC side
BYTE ti_number; //number of current activated ti, used at MSC side
BYTE next_ti; //TI value for next network initiate transaction
struct{
BYTE en_flag;
BYTE tio;
int port; //corresponding port number
}ti[3][AIFG_MAX_TI_PER_LINK]; //0-7 is assigned by network, 8-15 is assigned by mobile, used at MSC side
//totally 3 types of TI according to different SAP: CC, SMS or SS
}aifg_link_info;
enum TI_TYPE{
TI_FOR_CC,
TI_FOR_SMS,
TI_FOR_SS,
};
typedef enum{
AIFG_SUCCEED = 0,
AIFG_ERROR = -1,
//Error definition 1 ~ 1023
AIFG_ERR_OUT_OF_RESOURCE = 1,
AIFG_ERR_UNKNOW_MSG,
AIFG_ERR_UNKNOW_IE,
AIFG_ERR_ERROR_MSG,
AIFG_ERR_ERROR_IE,
AIFG_ERR_UP_NOT_EXIST,
AIFG_ERR_NO_UD_IN_CR,
AIFG_ERR_UNEXPECTED_DT1,
AIFG_ERR_UNEXPECTED_UDT,
AIFG_ERR_UNEXPECTED_CC,
AIFG_ERR_OVERLOAD,
AIFG_ERR_CG_NOT_READY,
AIFG_ERR_UNEXPECTED_PAGING_RESP,
AIFG_ERR_INVALID_TI,
AIFG_ERR_MISS_MANDATORY,
AIFG_ERR_MSG_RV_TO_IDLE_PORT,
AIFG_ERR_MSG_SD_TO_IDLE_PORT,
AIFG_ERR_ASSIGN_PORT_FAIL,
AIFG_ERR_SAP_NOT_CREATED,
AIFG_ERR_PORT_TIMER_OUT,
AIFG_ERR_CAN_NOT_FIND_TI,
AIFG_ERR_PAGING_NOT_RESP,
AIFG_ERR_PORT_RELEASED,
//event definition 1024 ~ 2048
AIFG_EVENT_SD_MSG = 1024, //Message sent to sccp
AIFG_EVENT_RV_MSG, //Message received from sccp
AIFG_EVENT_SD_IND, //Indication sent to upper app
AIFG_EVENT_RV_REQ, //Request received from upper app
AIFG_EVENT_REDIR_MSG, //Message redirected
AIFG_EVENT_CG_UP, //Circuit come up
AIFG_EVENT_LINK_RELEASE, //Link release
AIFG_EVENT_PORT_RELEASE,
}aifg_event_code;
typedef enum{
//DTAP
//RR
AIFG_MSG_T_PAGING_RESP = 0x27, //Paging response
AIFG_MSG_T_RR_HO_CMD = 0x2B, //RR Handover command
//MM
AIFG_MSG_T_IMSI_DETACH_IND = 0x01, //IMSI detach indication
AIFG_MSG_T_LU_ACCEPT = 0x02, //Location updating accept
AIFG_MSG_T_LU_REJECT = 0x04, //Location updating reject
AIFG_MSG_T_LU_REQUEST = 0x08, //Location updating request
AIFG_MSG_T_AUTH_REJECT = 0x11, //Authentication reject
AIFG_MSG_T_AUTH_REQUEST = 0x12, //Authentication request
AIFG_MSG_T_AUTH_RESPONSE = 0x14, //Authentication response
AIFG_MSG_T_ID_REQUEST = 0x18, //Identity request
AIFG_MSG_T_ID_RESPONSE = 0x19, //Identity response
AIFG_MSG_T_TMSI_REALLOC_CMD = 0x1A, //TMSI reallocation command
AIFG_MSG_T_TMSI_REALLOC_CMP = 0x1B, //TMSI reallocation complete
AIFG_MSG_T_CM_ACCEPT = 0x21, //CM service accept
AIFG_MSG_T_CM_REJECT = 0x22, //CM service reject
AIFG_MSG_T_CM_ABORT = 0x23, //CM service abort
AIFG_MSG_T_CM_REQUEST = 0x24, //CM service request
AIFG_MSG_T_CM_PROMPT = 0x25, //CM service prompt
AIFG_MSG_T_CM_REEST_REQUEST = 0x28, //CM re-establishment request
AIFG_MSG_T_ABORT = 0x29, //Abort
AIFG_MSG_T_MM_NULL = 0x30, //MM NULL
AIFG_MSG_T_MM_STATUS = 0x31, //MM status
AIFG_MSG_T_MM_INFO = 0x32, //MM information
//CC
AIFG_MSG_T_ALERTING = 0x01, //Alerting
AIFG_MSG_T_CALL_CONFIRMED = 0x08, //Call confirmed
AIFG_MSG_T_CALL_PROCEEDING = 0x02, //Call proceeding
AIFG_MSG_T_CONNECT = 0x07, //Connect
AIFG_MSG_T_CONNECT_ACK = 0x0F, //Connect ack
AIFG_MSG_T_EMERGENCY_SETUP = 0x0E, //Emergency setup
AIFG_MSG_T_PROGRESS = 0x03, //Progress
AIFG_MSG_T_SETUP = 0x05, //Setup
AIFG_MSG_T_MODIFY = 0x17, //Modify
AIFG_MSG_T_MODIFY_CMP = 0x1F, //Modify complete
AIFG_MSG_T_MODIFY_REJECT = 0x13, //Modify reject
AIFG_MSG_T_USER_INFO = 0x10, //User information
AIFG_MSG_T_HOLD = 0x18, //Hold
AIFG_MSG_T_HOLD_ACK = 0x19, //Hold ack
AIFG_MSG_T_HOLD_REJECT = 0x1A, //Hold reject
AIFG_MSG_T_RETRIEVE = 0x1C, //Retrieve
AIFG_MSG_T_RETRIEVE_ACK = 0x1D, //Retrieve ack
AIFG_MSG_T_RETRIEVE_REJECT = 0x1E, //Retrieve reject
AIFG_MSG_T_DISCONNECT = 0x25, //Disconnect
AIFG_MSG_T_RELEASE = 0x2D, //Release
AIFG_MSG_T_RELEASE_CMP = 0x2A, //Release complete
AIFG_MSG_T_CONGESTION_CTRL = 0x39, //Congestion control
AIFG_MSG_T_NOTIFY = 0x3E, //Notify
AIFG_MSG_T_STATUS = 0x3D, //Status
AIFG_MSG_T_STATUS_ENQ = 0x34, //Status enquiry
AIFG_MSG_T_START_DTMF = 0x35, //Start DTMF
AIFG_MSG_T_STOP_DTMF = 0x31, //Stop DTMF
AIFG_MSG_T_STOP_DTMF_ACK = 0x32, //Stop DTMF ack
AIFG_MSG_T_START_DTMF_ACK = 0x36, //Start DTMF ack
AIFG_MSG_T_START_DTMF_REJECT = 0x37, //Start DTMF reject
AIFG_MSG_T_FACILITY = 0x3A, //Facility
//SMS
AIFG_MSG_T_CP_DATA = 0x01, //CP-DATA
AIFG_MSG_T_CP_ACK = 0x04, //CP-ACK
AIFG_MSG_T_CP_ERROR = 0x10, //CP-ERRPR
AIFG_MSG_T_RP_DATA_MS = 0x00, //RP-DATA MS side
AIFG_MSG_T_RP_ACK_MS = 0x02, //RP-ACK MS side
AIFG_MSG_T_RP_ERROR_MS = 0x04, //RP-ERRPR MS side
AIFG_MSG_T_RP_SMMA = 0x06, //RP-SMMA MS side
AIFG_MSG_T_RP_DATA_NW = 0x01, //RP-DATA network side
AIFG_MSG_T_RP_ACK_NW = 0x03, //RP-ACK network side
AIFG_MSG_T_RP_ERROR_NW = 0x05, //RP-ERRPR network side
//SS
AIFG_MSG_T_FACILITY_SS = 0x3A, //Facility SS
AIFG_MSG_T_REGISTER = 0x3B, //Register
AIFG_MSG_T_RELEASE_CMP_SS = 0x2A, //Release complete SS
//BSSMAP
AIFG_MSG_T_ASSIGN_REQ = 0x01, //Assign request
AIFG_MSG_T_ASSIGN_CMP = 0x02, //Assign complete
AIFG_MSG_T_ASSIGN_FAIL = 0x03, //Assign failure
AIFG_MSG_T_HO_REQUEST = 0x10, //Handover request
AIFG_MSG_T_HO_REQUIRED = 0x11, //Handover required
AIFG_MSG_T_HO_REQ_ACK = 0x12, //Handover request ack
AIFG_MSG_T_HO_CMD = 0x13, //Handover command
AIFG_MSG_T_HO_CMP = 0x14, //Handover complete
AIFG_MSG_T_HO_SUC = 0x15, //Handover succeeded
AIFG_MSG_T_HO_FAIL = 0x16, //Handover failure
AIFG_MSG_T_HO_PERFORMED = 0x17, //Handover performed
AIFG_MSG_T_HO_CAN_ENQ = 0x18, //Handover candidate enquire
AIFG_MSG_T_HO_CAN_RESP = 0x19, //Handover candidate response
AIFG_MSG_T_HO_REQ_REJ = 0x1A, //Handover required reject
AIFG_MSG_T_HO_DETECT = 0x1B, //Handover detect
AIFG_MSG_T_CLR_CMD = 0x20, //Clear command
AIFG_MSG_T_CLR_CMP = 0x21, //Clear complete
AIFG_MSG_T_CLR_REQ = 0x22, //Clear request
AIFG_MSG_T_SAPI_REJ = 0x25, //SAPI 'n' reject
AIFG_MSG_T_CONFUSION = 0x26, //Confusion
AIFG_MSG_T_SUSPEND = 0x28, //Suspend
AIFG_MSG_T_RESUME = 0x29, //Resume
AIFG_MSG_T_LOC_INFO_CMD = 0x2A, //Location information command
AIFG_MSG_T_LOC_INFO_RPT = 0x2B, //Location information report
AIFG_MSG_T_RESET = 0x30, //Reset
AIFG_MSG_T_RESET_ACK = 0x31, //Reset ack
AIFG_MSG_T_OVERLOAD = 0x32, //Overload
AIFG_MSG_T_RESET_CC = 0x34, //Reset circuit
AIFG_MSG_T_RESET_CC_ACK = 0x35, //Reset circuit ack
AIFG_MSG_T_MSC_INVK_TRACE = 0x36, //MSC invoke trace
AIFG_MSG_T_BSC_INVK_TRACE = 0x37, //BSC invoke trace
AIFG_MSG_T_BLOCK = 0x40, //Block
AIFG_MSG_T_BLOCK_ACK = 0x41, //Blocking ack
AIFG_MSG_T_UNBLOCK = 0x42, //Unblock
AIFG_MSG_T_UNBLOCK_ACK = 0x43, //Unblocking ack
AIFG_MSG_T_CC_GROUP_BLK = 0x44, //Circuit group block
AIFG_MSG_T_CC_GROUP_BLK_ACK = 0x45, //Circuit group block ack
AIFG_MSG_T_CC_GROUP_UNBLK = 0x46, //Circuit group unblock
AIFG_MSG_T_CC_GROUP_UNBLK_ACK = 0x47, //Circuit group unblock ack
AIFG_MSG_T_UNEQUIP_CC = 0x48, //Unequipped circuit
AIFG_MSG_T_CHANGE_CC = 0x4E, //Change circuit
AIFG_MSG_T_CHANGE_CC_ACK = 0x4F, //Change circuit ack
AIFG_MSG_T_RESRC_REQ = 0x50, //Resource request
AIFG_MSG_T_RESRC_IND = 0x51, //Resource indication
AIFG_MSG_T_PAGING = 0x52, //Paging
AIFG_MSG_T_CIPHER_MODE_CMD = 0x53, //Cipher mode command
AIFG_MSG_T_CM_UPDATE = 0x54, //Classmark update
AIFG_MSG_T_CIPHER_MODE_CMP = 0x55, //Cipher mode complete
AIFG_MSG_T_QUEUE_IND = 0x56, //Queuing indication
AIFG_MSG_T_L3_INFO = 0x57, //Complete layer 3 information
AIFG_MSG_T_CLASSMARK_REQ = 0x58, //Classmark request
AIFG_MSG_T_CIPHER_MODE_REJ = 0x59, //Cipher mode reject
AIFG_MSG_T_LOAD_IND = 0x5A, //Load indication
}aifg_msg_type;
typedef enum _aifg_iei_coding{
//For BSSMAP
AIFG_IEI_BM_CIC = 0x01, //CIC
AIFG_IEI_BM_RESOURCEAVAIL = 0x03, //Resource available
AIFG_IEI_BM_CAUSE = 0x04, //Cause
AIFG_IEI_BM_CELLID = 0x05, //Cell identifier
AIFG_IEI_BM_PRIORITY = 0x06, //Priority
AIFG_IEI_BM_L3HEADERINFO = 0x07, //Layer 3 header information
AIFG_IEI_BM_IMSI = 0x08, //IMSI
AIFG_IEI_BM_TMSI = 0x09, //TMSI
AIFG_IEI_BM_ENCRYPTINFO = 0x0A, //Encrypt information
AIFG_IEI_BM_CHANNELTYPE = 0x0B, //Channel type
AIFG_IEI_BM_PERIODICITY = 0x0C, //Periodicity
AIFG_IEI_BM_EXTRESOURCEIND = 0x0D, //Extended resource indicator
AIFG_IEI_BM_MSNUM = 0x0E, //Number of MSs
AIFG_IEI_BM_CLASSMARKINFO2 = 0x12, //Classmark information type 2
AIFG_IEI_BM_CLASSMARKINFO3 = 0x13, //Classmark information type 3
AIFG_IEI_BM_BANDUSED = 0x14, //Band to be used
AIFG_IEI_BM_RRCAUSE = 0x15, //RR cause
AIFG_IEI_BM_L3INFO = 0x17, //Layer 3 information
AIFG_IEI_BM_DLCI = 0x18, //DLCI
AIFG_IEI_BM_DTXFLAG = 0x19, //DTC flag
AIFG_IEI_BM_CELLIDLIST = 0x1A, //Cell identity list
AIFG_IEI_BM_RESPREQ = 0x1B, //Response request
AIFG_IEI_BM_RESOURCEINDMEHTOD = 0x1C, //Resource indication method
AIFG_IEI_BM_CLASSMARKINFO1 = 0x1D, //Classmark information type 1
AIFG_IEI_BM_CICLIST = 0x1E, //CIC list
AIFG_IEI_BM_DIGNOSTIC = 0x1F, //Dignostic
AIFG_IEI_BM_L3MSGCONTENT = 0x20, //Layer 3 message content
AIFG_IEI_BM_CHOSENCHANNEL = 0x21, //Chosen channel
AIFG_IEI_BM_TOTALRESOURCE = 0x22, //Total resource accessible
AIFG_IEI_BM_CIPHERRESPMODE = 0x23, //Cipher response mode
AIFG_IEI_BM_CHANNELNEEDED = 0x24, //Channel needed
AIFG_IEI_BM_TRACETYPE = 0x25, //Trace type
AIFG_IEI_BM_TRIGGERID = 0x26, //Trigger ID
AIFG_IEI_BM_TRACEREF = 0x27, //Trace reference
AIFG_IEI_BM_TRANSACTIONID = 0x28, //Transaction ID
AIFG_IEI_BM_MOBILEID = 0x29, //Mobile identity
AIFG_IEI_BM_OMCID = 0x2A, //OMC ID
AIFG_IEI_BM_FORWARDIND = 0x2B, //Forward indication
AIFG_IEI_BM_CHOSENENCRYPT = 0x2C, //Chosen encrypt algorithm
AIFG_IEI_BM_CIRCUITPOOL = 0x2D, //Circuit pool
AIFG_IEI_BM_CIRCUITPOOLLIST = 0x2E, //Circuit pool list
AIFG_IEI_BM_TIMEIND = 0x2F, //Time indicator
AIFG_IEI_BM_RESOURCESITUATION = 0x30, //Resource situation
AIFG_IEI_BM_CURCHANNELTYPE1 = 0x31, //Current channel type 1
AIFG_IEI_BM_QUEUEIND = 0x32, //Queuing indicator
AIFG_IEI_BM_ASSIGNREQUIREMENT = 0x33, //Assignment requirement
AIFG_IEI_BM_TALKERFLAG = 0x34, //Talker flag
AIFG_IEI_BM_CONNRELREQ = 0x35, //Connection release request
AIFG_IEI_BM_GROUPCALLREF = 0x36, //Group call reference
AIFG_IEI_BM_EMLPP = 0x37, //eMLPP
AIFG_IEI_BM_CFGEVOIND = 0x38, //Configuration evolution indication
AIFG_IEI_BM_BSSOLDTONEW = 0x39, //Old BSS to new BSS
AIFG_IEI_BM_LSAID = 0x3A, //LSA identity
AIFG_IEI_BM_LSAIDLIST = 0x3B, //LSA identity list
AIFG_IEI_BM_LSAINFO = 0x3C, //LSA information
AIFG_IEI_BM_LOCATIONINFO = 0x3D, //Location information
AIFG_IEI_BM_SPEECHVER = 0x40, //Speech version
//For DTAP
//common
AIFG_IEI_DT_LAI = 0x13, //location area identification
AIFG_IEI_DT_MOBILEID = 0x17, //mobile identity
AIFG_IEI_DT_MSCM3 = 0x20, //mobile station classmark 3
//MM
AIFG_IEI_DT_FLONPROCEED = 0xa1, //Follow on proceed
AIFG_IEI_DT_CTS = 0xa2, //CTS permission
AIFG_IEI_DT_FULL_NWNAME = 0x43, //Full name for network
AIFG_IEI_DT_SHORT_NWNAME = 0x45, //Short name for network
AIFG_IEI_DT_TIMEZONE = 0x46, //Network time zone
AIFG_IEI_DT_TZTIME = 0x47, //Universal time and time zone
AIFG_IEI_DT_LSAID = 0x48, //LSA Identity
//CC
AIFG_IEI_DT_PRIORITYLEVEL = 0x80, //Priority Level
AIFG_IEI_DT_SHIFT = 0x90, //Locking and non-locking shift procedure
AIFG_IEI_DT_REPEATIND = 0xD0, //Repease indicator
AIFG_IEI_DT_MOREDATA = 0xA0, //More data
AIFG_IEI_DT_CLIRSUP = 0xA1, //CLIR Suppression
AIFG_IEI_DT_CLIRIVO = 0xA2, //CLIR Invocation
AIFG_IEI_DT_REVCALLDIR = 0xA3, //Reverse call setup direction
AIFG_IEI_DT_BEARERCAP = 0x04, //Bearer capability
AIFG_IEI_DT_CAUSE = 0x08, //Cause
AIFG_IEI_DT_CCCAP = 0x15, //Call Control Capabilities
AIFG_IEI_DT_FACILITY = 0x1C, //Facility
AIFG_IEI_DT_PROGIND = 0x1E, //Progress indicator
AIFG_IEI_DT_AUXSTAT = 0x24, //Auxiliary states
AIFG_IEI_DT_CALLEDBCD = 0x5E, //Called party BCD
AIFG_IEI_DT_CALLEDSUBADDR = 0x6D, //Called party subaddress
AIFG_IEI_DT_CALLERBCD = 0x5C, //Calling party BCD
AIFG_IEI_DT_CALLERSUBADDR = 0x5D, //Calling party subaddress
AIFG_IEI_DT_CONNNUM = 0x4C, //Connected number
AIFG_IEI_DT_CONNSUBADDR = 0x4D, //Connected subaddress
AIFG_IEI_DT_HIGHCOM = 0x7D, //Higher layer compatibility
AIFG_IEI_DT_KEYPAD = 0x2C, //Keypad facility
AIFG_IEI_DT_LOWCOM = 0x7C, //Lower layer compatibility
AIFG_IEI_DT_REDIRBCD = 0x74, //Redirecting party BCD
AIFG_IEI_DT_REDIRSUBADDR = 0x75, //Redirecting party subaddress
AIFG_IEI_DT_SIGNAL = 0x34, //Signal
AIFG_IEI_DT_SSVER = 0x7F, //SS version indicator
AIFG_IEI_DT_USERUSER = 0x7E, //User-user
AIFG_IEI_DT_ALERTPATTERN = 0x19, //Alert pattern
//SMS
AIFG_IEI_DT_RP_UD = 0x41, //RP User data
AIFG_IEI_DT_RP_CAUSE = 0x42, //RP Cause
}aifg_iei;
#endif

View File

@@ -0,0 +1,68 @@
/********************************************************************
Copyright ?2007 LGC Wireless, Inc. All rights reserved
File Name: aifg_var_ext.h
Description: Public variant definition of AIFG module
Version: v9.0.0
Author: Roy Jiang
Create Date: 2007-3-12
History:
2007-3-6 v9.0.12 Create
*********************************************************************/
#ifndef _WXC2_AIFG_VAR_EXT_H
#define _WXC2_AIFG_VAR_EXT_H
#include <assert.h>
#include "aifg_type_def.h"
//Variant declaration
extern aifg_circuit_group cg[AIFG_MAX_CG];
extern aifg_sap sap[AIFG_MAX_SAP];
extern aifg_dual_server dual_server;
extern aifg_port aifg_pcb[AIFG_MAX_PORT];
extern aifg_event_code aifg_event;
extern aifg_msg_t sd_msg;
aifg_msg_pre_decoded rv_msg;
extern int cur_port; //current processing port
extern aifg_link_info link_info[SCCP_MAX_LINK];
extern int msg_statistics[AIFG_MAX_MESSAGE][2];
int aifg_ie_encode(aifg_msg_protocol protocol, int ie_id, ie_u *src, BYTE *dst, int m_o_flag);
int aifg_ie_decode(aifg_ie_ptr *src, aifg_ie *dst);
int aifg_msgtype_to_localid(aifg_pd pd, int msg_type);
int aifg_send_cr(int sapid, int cgid, aifg_msg_t *msg);
void aifg_send_dt1(int linkid, aifg_msg_t *msg, int ti);
void aifg_send_udt(int cgid, aifg_msg_t *msg, SP_UiPriPara *buf_ptr);
void aifg_mpp_init();
int aifg_mpp_proc();
void aifg_port_proc(aifg_port *pPort, aifg_msg_t *upper_msg, aifg_msg_pre_decoded *peer_msg);
inline int aifg_port_assign(int sapid, int cgid, int linkid);
inline void aifg_port_release(aifg_port *pPort);
inline int aifg_get_local_port(int u_port);
inline int aifg_get_paging_port(int cgid, BYTE *imsi_ptr, int imsi_len);
inline int aifg_ti2lport(int ti, int link_id, int pd);
inline int aifg_get_link(int u_port);
inline int aifg_add_link(int linkid, int sapid);
inline int aifg_del_link(int sccp_link_id);
inline void aifg_link_release(int link_id);
inline aifg_link_info *aifg_get_link_info(int link_id);
inline int aifg_get_cg(int dpc, int ni);
inline void aifg_add_ti(int link_id, int ti, int ti_type, int port);
inline int aifg_get_ti(int link_id, int port, int ti_type);
inline int aifg_del_ti(int link_id, int ti, int ti_type);
void aifg_send_rlsd(int linkid);
void aifg_debug_init();
void aifg_debug_timer();
void aifg_debug_print(int port, aifg_event_code event, void *msg, int o_info);
void aifg_log(char *info);
#endif

View File

@@ -0,0 +1,7 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\aif\ut
2
3
8:makefile|1|11d70a3e0a9|2f4|19f1d7f0|b9a968abbfa411dc84f1001c23e19543|0
b:aifg_test.c|1|11d70a3e07a|3d275|fa91da6e|b7e96873bfa411dc84f1001c23e19543|0
b:aifg_main.c|1|11d70a3e02c|103|bf8d4d3c|b7496857bfa411dc84f1001c23e19543|0

View File

@@ -0,0 +1,23 @@
/*
*Test program of AIFG module --by Roy Jiang
*/
#include "../src/include/aifg.h"
#include "../src/include/aifg_if.h"
void aifg_test();
int main()
{
printf("Test of AIFG\n");
aifg_test();
#ifdef _WINDOWS_
system("PAUSE");
#endif
return 0;
}

7083
omc/plat/aif/ut/aifg_test.c Normal file

File diff suppressed because it is too large Load Diff

40
omc/plat/aif/ut/makefile Normal file
View File

@@ -0,0 +1,40 @@
#WXC2 R9.0 AIFG makefile
#Create by Roy Jiang
#2007-3-12
CC = gcc
CFLAG = -g -Wall -c #-fprofile-arcs -ftest-coverage
AIFG_LIB_OBJ = aifg_m.o aifg.o aifg_mpp.o aifg_debug.o aifg_ie.o
AIFG_TST_OBJ = aifg_main.o aifg_test.o
AIFG_LIB = -L../lib -laif
TEST_LIB = -L/usr/local/lib/CUnit -lcunit -lgcov
aifg_main: $(AIFG_TST_OBJ)
$(CC) $(AIFG_TST_OBJ) -o test_main $(AIFG_LIB) $(TEST_LIB)
aifg_main.o: aifg_main.c
$(CC) $(CFLAG) $<
aifg_test.o: aifg_test.c
$(CC) $(CFLAG) $<
aifg.o: aifg.c
$(CC) $(CFLAG) $<
aifg_m.o: aifg_m.c
$(CC) $(CFLAG) $<
aifg_mpp.o: aifg_mpp.c
$(CC) $(CFLAG) $<
aifg_debug.o: aifg_debug.c
$(CC) $(CFLAG) $<
aifg_ie.o: aifg_ie.c
$(CC) $(CFLAG) $<
clean:
rm -f main *.o *.a *.xml *.gcov *.gcda *.gcno core test_main

View File

@@ -0,0 +1,10 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\bicc
2
6
3:doc|2|0|0|0|bb796660bfa411dc8505001c23e19543|0
2:ut|2|0|0|0|c7696890bfa411dc8505001c23e19543|0
3:src|2|0|0|0|96f644919a8511dd8b36001c23e19543|0
7:src.old|2|0|0|0|95c644659a8511dd8b36001c23e19543|0
8:Makefile|1|11d70a3e184|b31|3d53c002|bca96698bfa411dc8505001c23e19543|0
3:lib|2|0|0|0|bc09667cbfa411dc8505001c23e19543|0

98
omc/plat/bicc/Makefile Normal file
View File

@@ -0,0 +1,98 @@
##----------------------------------------------------------##
## ##
## Universal Makefile for module template : V1.6.3 ##
## ##
## Created : Wei Liu 07/04/11 ##
## Revision: [Last]Wei Liu 07/07/07 ##
## ##
##----------------------------------------------------------##
##---------------------------------------------------------------------##
##--------------------------------------
##
## Project correlation(Customer define)
##
##--------------------------------------
## MODULE= [Module Name]
## TYPE = app/plat => Module Type
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Debug ]
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Release]
## BUILD = lib/exef => Output file format
## CFG = debug/release => Build Configuration
## SRC_PATH = [Source file path]
## INC_PATH = [Include file path]
## APP_PATH = [App Module path]
## PLT_PATH = [Plat Module path]
## PLT_LIB = [Needed plat lib for Link] => just for test or wxc2main
## APP_LIB = [Needed app lib for Link] => just for test or wxc2main
## LIB_ADD = [Needed Extend lib for Link] => just for test or wxc2main
## PLT_LIB e.g. = haepub fsm mng proto kernel aif mgc mgcp sip rtp \
## 8ecp bicc smpp xapp tcap mtp3 m2ua \
## snmp iptrans debug sccp public
##
## APP_LIB e.g. = msc vlr ssf hlr ae pps mnp smsc vms aas
## LIB_ADD e.g. = -liba3a8 -lm
## OBJ_ADD = [Extend third party object files needed]
## TEST_OBJ_PATH = [module object files Path for test ] => just for test
##---------------------------------------------------------------------##
MODULE = bicc
TYPE = plat
DBUG_FLAGS_ADD =
RELS_FLAGS_ADD =
##Default commonly as below
BUILD = lib
CFG = debug
PLT_LIB =
APP_LIB =
LIB_ADD =
SRC_PATH = ./src
INC_PATH = ./src/include
PLT_PATH = ../../plat
APP_PATH = ../../mss
OBJ_ADD =
TEST_OBJ_PATH =
PREPROC_CMD =
POSTPROC_CMD =
##---------------------------------------------------------------------##
##--------------------------------------
##
## Make configuration(Customer define)
##
##--------------------------------------
## CCFLAG_SWITCH = on/off => gcc flag show on/off
## COVER_NEED = yes/no => PTF cover report needed
## COVER_REPORT_PATH = [path ] => PTF cover report path
CCFLAG_SWITCH = off
COVER_NEED = no
COVER_REPORT_PATH = ./output
##---------------------------------------------------------------------##
##--------------------------------------
##
## include makefile.rules (Do not change)
##
##--------------------------------------
include Makefile.rules

BIN
omc/plat/bicc/lib/libbicc.a Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
omc/plat/bicc/obj/biccif.o Normal file

Binary file not shown.

View File

@@ -0,0 +1,13 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\bicc\src.old
2
9
a:bicc_prm.c|1|11d70a3e27e|33ed|1c8d9a4|e15481366cf311dd91a5001c23e19543|0
a:bicc_fsm.c|1|11d70a3e433|f45c|d7758e91|5c364a229a8611dd8b36001c23e19543|0
e:bicc_fsm.c.old|1|11d70a3e3f5|f45c|d7758e91|5b0649aa9a8611dd8b36001c23e19543|0
a:bicc_msg.c|1|11d70a3e2fb|8563|a0fc75de|e1f481666cf311dd91a5001c23e19543|0
a:bicc_apm.c|1|11d70a3e2ad|1363|b56b34ff|e1f4814e6cf311dd91a5001c23e19543|0
7:include|2|0|0|0|c1696778bfa411dc8505001c23e19543|0
c:bicc_debug.c|1|11d70a3e32a|54e6|55931a29|e294817e6cf311dd91a5001c23e19543|0
8:biccif.c|1|11d70a3e3b6|800d|713cda1f|56e6486a9a8611dd8b36001c23e19543|0
c:bicc_ipbcp.c|1|11d70a3e368|1e3d|81f3ff1f|e32481ae6cf311dd91a5001c23e19543|0

View File

@@ -0,0 +1,206 @@
#include <stdio.h>
#include <string.h>
#include "./include/q765_5e.h"
void apm_decode_action(ActionInd_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_action(u8 *flw_ptr, const ActionInd_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_bncid(BncId_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->len = length - 1;
memcpy(ptr->val, flw_ptr+1, ptr->len);
}
u32 apm_encode_bncid(u8 *flw_ptr, const BncId_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
memcpy(flw_ptr+1, ptr->val, ptr->len);
return ptr->len + 1;
}
void apm_decode_bncchr(BncChr_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_bncchr(u8 *flw_ptr, const BncChr_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_bcinfo(BcInfo_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->bctp.bvei = (flw_ptr[1] >> 6) & 0x01;
ptr->bctp.btcp_version = flw_ptr[1] & 0x1f;
ptr->bctp.tpei = (flw_ptr[2] >> 6) & 0x01;
ptr->bctp.tunnel_protocol = flw_ptr[2] & 0x3f;
ptr->bctp.ipbcp_len = length - 3;
memcpy(ptr->bctp.ipbcp_content, flw_ptr+3, ptr->bctp.ipbcp_len);
}
u32 apm_encode_bcinfo(u8 *flw_ptr, const BcInfo_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = (ptr->bctp.bvei << 6) + (1 << 5) + ptr->bctp.btcp_version;
flw_ptr[2] = (ptr->bctp.tpei << 6) + ptr->bctp.tunnel_protocol;
memcpy(flw_ptr+3, ptr->bctp.ipbcp_content, ptr->bctp.ipbcp_len);
return ptr->bctp.ipbcp_len + 3;
}
void apm_decode_bctunnel(BcTunnel_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_bctunnel(u8 *flw_ptr, const BcTunnel_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_signaltype(SignalType_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_signaltype(u8 *flw_ptr, const SignalType_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_duration(Duration_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = (flw_ptr[1] << 8) + flw_ptr[2];
}
u32 apm_encode_duration(u8 *flw_ptr, const Duration_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val >> 8;
flw_ptr[2] = ptr->val & 0xff;
return 3;
}
void apm_decode(ApmUser_struct *ptr, const u8 *flw_ptr, u8 length)
{
const u8 *old_ptr = flw_ptr;
while(flw_ptr+flw_ptr[1]+2-old_ptr <= length)
{
if(*flw_ptr == 0)
break;
switch(*flw_ptr)
{
case AP_ACTION:
apm_decode_action(&ptr->action, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BNCID:
apm_decode_bncid(&ptr->bnc_id, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BNCCHR:
apm_decode_bncchr(&ptr->bnc_chr, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BCINFO:
apm_decode_bcinfo(&ptr->bc_info, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BCTUNNEL:
apm_decode_bctunnel(&ptr->bc_tunnel, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_SIGNALTYPE:
apm_decode_signaltype(&ptr->signal_type, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_DURATION:
apm_decode_duration(&ptr->duration, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
default:
flw_ptr += flw_ptr[1] + 2;
break;
}
}
}
u32 apm_encode(u8 *flw_ptr, const ApmUser_struct *ptr)
{
u8 *old_ptr = flw_ptr;
if(ptr->action.pres == 1)
{
flw_ptr[0] = AP_ACTION;
flw_ptr[1] = apm_encode_action(flw_ptr+2, &ptr->action);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bnc_id.pres == 1)
{
flw_ptr[0] = AP_BNCID;
flw_ptr[1] = apm_encode_bncid(flw_ptr+2, &ptr->bnc_id);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bnc_chr.pres == 1)
{
flw_ptr[0] = AP_BNCCHR;
flw_ptr[1] = apm_encode_bncchr(flw_ptr+2, &ptr->bnc_chr);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bc_info.pres == 1)
{
flw_ptr[0] = AP_BCINFO;
flw_ptr[1] = apm_encode_bcinfo(flw_ptr+2, &ptr->bc_info);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bc_tunnel.pres == 1)
{
flw_ptr[0] = AP_BCTUNNEL;
flw_ptr[1] = apm_encode_bctunnel(flw_ptr+2, &ptr->bc_tunnel);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->signal_type.pres == 1)
{
flw_ptr[0] = AP_SIGNALTYPE;
flw_ptr[1] = apm_encode_signaltype(flw_ptr+2, &ptr->signal_type);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->duration.pres == 1)
{
flw_ptr[0] = AP_DURATION;
flw_ptr[1] = apm_encode_duration(flw_ptr+2, &ptr->duration);
flw_ptr += flw_ptr[1] + 2;
}
return flw_ptr - old_ptr;
}

View File

@@ -0,0 +1,882 @@
#include "./include/var_ext.h"
//static u32 bicc_object_id[BICC_PREOID_LEN] = {1,3,6,1,4,1,1373,1,3,2,2,6};
//static u16 bicc_sub_page[BICC_DEBUG_PAGE] = {0};
//static u8 bicc_ascii_in[BICC_ASCIN_LEN] = {0};
//static u8 bicc_ascii_out[BICC_ASCOUT_LEN] = {0};
#define BICC_DEBUG_ID 17
#define BICC_VER_DEBUG "R91V0_01"
#define MONITOR_NONE 0x0000
#define MONITOR_ERROR 0x0010
#define MONITOR_ALL 0xffff
#define TRACE_FLAG_ON 1
#define TRACE_FLAG_OFF 0
u8 AsciInBuf[4096];
u8 AsciOutBuf[4096];
u8 AsciTempBuf[4096];
WORD MonitorFg;
u8 info[1024];
static u8 log_help[] = {
"BICC debug Help:\n\r\
\n\r\
1.help\n\r\
2.log all/none\n\r\
3.log error on/off\n\r\
4.list cg[-cgNo] \n\r\
5.list circuit[-circuitNo]\n\r\
6.list port[-portNo]\n\r\
7.list dmp\n\r\
8.trace on-portNo\n\r\
9.trace off[-portNo]\n\r\n\r\
"
};
static WORD disp_page[10];
static u8 *disp_ptr = (u8 *) disp_page;
static DWORD debug_status_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,1
};
static BYTE debug_status = 1;
static DWORD debug_name_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,2
};
static DWORD debug_ascin_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,3
};
static DWORD debug_ascout_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,4
};
static DWORD debug_page_title[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,1,1
};
static DWORD debug_page_line[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,1,2,1
};
const static u8 BASE_ID_LEN = 15;
const static u8 PAGE_POINT = 14;
const static u8 LINE_POINT = 15;
static u8 title1_p[] =
{
" BICC Page 01 SAP Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
Enable\n\r\
CG num\n\r"
};
static u8 title2_p[] =
{
" BICC Page 02 CG Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
Enable\n\r\
SAP id\n\r\
NI\n\r\
DPC\n\r"
};
static u8 title3_p[] =
{
" BICC Page 03 CIrcuit Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
CG id\n\r\
CIC range\n\r\
HEAD CIC\n\r"
};
static u8 title4_p[] =
{
" BICC Page 04 Port Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
Enable\n\r\
FSM State\n\r\
CIC State\n\r"
};
static u8 debug_disp_line(u8 page, u8 line)
{
u8 disp_length;
disp_length = 0;
disp_ptr = (u8 *) disp_page;
switch (page)
{
/*
case 1: // Page 1: sap Info
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page];
disp_length = 2;
break;
case 1:
disp_ptr = (BYTE *) &Bicc_Data.debug_data.sap_enable;
disp_length = 16;
break;
case 2:
disp_ptr = (BYTE *) &Bicc_Data.debug_data.sap_cg_num;
disp_length = 16;
break;
default:
break;
}
break;
case 2: // Page 2: cg Info
//disp_page[page] = (disp_page[page]+1)%BICC_MAX_CG;
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page]; //Subpage
disp_length = 2;
break;
case 1: //enable
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].used_flag);
disp_length = 16;
break;
case 2: //sap_id
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].sap_id);
disp_length = 16;
break;
case 3: //network_id
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].attrib.network_id);
disp_length = 16;
break;
case 4: //dpc
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].attrib.dpc);
disp_length = 16;
break;
default:
break;
}
break;
case 3: // Page 3: circuit Info
//disp_page[page] = (disp_page[page]+1)%BICC_MAX_CIRCUIT;
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page]; //Subpage
disp_length = 16;
break;
case 1: //cg_id
disp_ptr = (BYTE *) &(BiccResource.circuit_pond[disp_page[page]].cg_id);
disp_length = 16;
break;
case 2: //cic_range
disp_ptr = (BYTE *) &(BiccResource.circuit_pond[disp_page[page]].attrib.cic_range);
disp_length = 16;
break;
case 3: //head_cic
disp_ptr = (BYTE *) &(BiccResource.circuit_pond[disp_page[page]].attrib.head_cic);
disp_length = 16;
break;
default:
break;
}
break;
case 4: // Page 4: port Info
//disp_page[page] = (disp_page[page]+32)%BICC_MAX_PORT;
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page]; //Subpage
disp_length = 16;
break;
case 1: //enable
disp_ptr = (BYTE *) &(BiccResource.port_pond[disp_page[page]].used_flag);
disp_length = 16;
break;
case 2: //fsm_state
disp_ptr = (BYTE *) &(BiccResource.port_pond[disp_page[page]].fsm_state);
disp_length = 16;
break;
case 3: //cic_state
disp_ptr = (BYTE *) &(BiccResource.port_pond[disp_page[page]].cic_state);
disp_length = 16;
break;
default:
break;
}
break;
*/
default:
disp_length = 0;
break;
}
return disp_length;
}
static void debug_disp_page(u8 page)
{
u8 disp_line;
u8 disp_length;
debug_page_line[PAGE_POINT] = page + 5;
for (disp_line = 0; disp_line < 22; disp_line++)
{
disp_length = debug_disp_line(page, disp_line);
debug_page_line[LINE_POINT] = disp_line + 2;
debug_page_line[LINE_POINT + 1] = 2; // Data Pointer
debug_set_response(BASE_ID_LEN + 2, debug_page_line, disp_ptr, disp_length);
}
}
int bicc_debug_init(void)
{
BYTE page;
BYTE data[10];
BYTE *ptr;
strcpy(AsciInBuf, "\0");
strcpy(AsciOutBuf, "\0");
MonitorFg = MONITOR_NONE;
bzero(disp_page, 20);
ptr = data;
debug_set_response(BASE_ID_LEN, debug_status_id, &debug_status, 1);
debug_set_response(BASE_ID_LEN, debug_name_id, BICC_VER_DEBUG, 10);
debug_set_response(BASE_ID_LEN, debug_ascin_id, AsciInBuf, 4096);
debug_set_response(BASE_ID_LEN, debug_ascout_id, AsciOutBuf, 4096);
for (page = 1; page < 5; page++)
{
switch (page)
{
case 1: //page 1
ptr = title1_p;
break;
case 2: //page 2
ptr = title2_p;
break;
case 3: //page 3
ptr = title3_p;
break;
case 4: //page 4
ptr = title4_p;
break;
default:
break;
}
debug_page_title[PAGE_POINT] = 5 + page;
debug_set_response(BASE_ID_LEN + 1, debug_page_title, ptr, strlen(ptr));
debug_disp_page(page);
}
return 1;
}
void bicc_asciout_proc(const char *fmt, ...)
{
va_list ap;
char buf[1024];
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
if((strlen(AsciOutBuf) + strlen(buf)) < 4096)
strcat(AsciOutBuf, buf);
else
strcpy(AsciOutBuf, buf);
va_end(ap);
}
void bicc_debug_refresh(void)
{
// int i;
#if 0
for(i=0;i<16;i++)
{
Bicc_Data.debug_data.sap_enable[i] = BiccResource.sap_pond[i].used_flag;
Bicc_Data.debug_data.sap_cg_num[i] = BiccResource.sap_pond[i].cg_num;
}
#endif
}
#if 0
void list_sap(WORD sapNo)
{
//u8 sapinfo[1024];
if(sapNo >= BICC_MAX_SAP)
return;
sprintf(info,"\
Enable:%d\n\r\
cg num:%d\n\r",
BiccResource.sap_pond[sapNo].used_flag,BiccResource.sap_pond[sapNo].cg_num);
bicc_asciout_proc(info);
}
void list_all_sap()
{
int i;
sprintf(info, "Index CG(s)\n\r");
bicc_asciout_proc(info);
for(i=0; i<BICC_MAX_SAP; i++)
{
if(BiccResource.sap_pond[i].used_flag == 1)
{
sprintf(info, " %d %d\n\r", i, BiccResource.sap_pond[i].cg_num);
bicc_asciout_proc(info);
}
}
}
#endif
void list_cg(WORD cgNo)
{
const pal_cg_struct *pcg;
if(cgNo >= PAL_MAX_CG)
return;
pcg = pal_cg_ptr(cgNo);
if(pcg == NULL)
return;
sprintf(info, "\
Enable:%d\n\r\
sap id:%d\n\r\
circuit num:%d\n\r\
variant_type:%d\n\r\
priority:%d\n\r\
network id:%d\n\r\
opc:%ld\n\r\
dpc:%ld\n\r\
tg_id:%ld\n\r",
pcg->enable,pcg->sap_id,pcg->circuit_num,pcg->attrib.variant,pcg->attrib.priority,pcg->attrib.network_id,pcg->attrib.opc,pcg->attrib.dpc,pcg->attrib.tg_id);
bicc_asciout_proc(info);
}
void list_all_cg()
{
int i = 0;
const pal_cg_struct *pcg;
sprintf(info, "Index SAP Circuit(s) NetInd DPC OPC TG\n\r");
bicc_asciout_proc(info);
for(i=0; i<PAL_MAX_CG; i++)
{
pcg = pal_cg_ptr(i);
if(pcg == NULL)
continue;
if(pcg->enable==0)
continue;
if(pcg->attrib.protocol != PROTO_BICC)
continue;
sprintf(info, " %d %d %d %d %ld %ld %ld\n\r", i, pcg->sap_id, pcg->circuit_num, pcg->attrib.network_id, pcg->attrib.dpc, pcg->attrib.opc, pcg->attrib.tg_id);
bicc_asciout_proc(info);
}
}
void list_circuit(WORD circuitNo)
{
const pal_circuit_struct *pcircuit;
if(circuitNo >= PAL_MAX_CIRCUIT)
return;
pcircuit = pal_circuit_ptr(circuitNo);
if(pcircuit == NULL)
return ;
sprintf(info,"\
Enable:%d\n\r\
cg id:%d\n\r\
head cic:%ld\n\r\
cic range:%d\n\r\
plat id:%d\n\r",
pcircuit->enable,pcircuit->cg_id,pcircuit->attrib.head_cic,pcircuit->attrib.cic_range,pcircuit->attrib.plat_id);
bicc_asciout_proc(info);
}
void list_all_circuit()
{
int i = 0, j = 0;
const pal_circuit_struct *pcircuit;
const pal_cg_struct *pcg;
// for(i = 0; i < BICC_MAX_SAP; i ++)
//{
sprintf(info, "Index CG PLAT CIC(s)\n\r");
bicc_asciout_proc(info);
for(i=0; i<PAL_MAX_CG; i++)
{
pcg = pal_cg_ptr(i);
if(pcg == NULL)
continue;
if(pcg->enable == 0)
continue;
if(pcg->attrib.protocol != PROTO_BICC)
continue;
for(j = 0; j<PAL_MAX_CIRCUIT; j++)
{
pcircuit = pal_circuit_ptr(j);
if(pcircuit == NULL)
continue;
if(pcircuit->enable == 0 || pcircuit->cg_id != pcg->id)
continue;
sprintf(info, " %d %d %d %d (%ld~~%ld)\n\r", i, pcircuit->cg_id, pcircuit->attrib.plat_id, pcircuit->attrib.cic_range, pcircuit->attrib.head_cic, pcircuit->attrib.head_cic+pcircuit->attrib.cic_range);
bicc_asciout_proc(info);
}
}
}
void list_port(WORD portNo)
{
if(portNo>=BICC_MAX_PORT)
return;
sprintf(info,"\
upper port:%ld\n\r\
sprc_cmd:%x\n\r\
primitive_cmd:%x\n\r\
internal_cmd:%x\n\r\
cic state{\n\r\
call state:%d\n\r\
suspend state:%d\n\r\
block state:%d\n\r\
}\n\r\
fsm state{\n\r\
cpc_state:%d\n\r\
mgbs_state:%d\n\r\
mgbr_state:%d\n\r\
crs_state:%d\n\r\
crr_state:%d\n\r\
cgrs_state:%d\n\r\
cgrr_state:%d\n\r\
}\n\r",
Bicc_Data.port_data[portNo].su_proc_id,Bicc_Data.port_data[portNo].sprc_cmd,
Bicc_Data.port_data[portNo].primitive_cmd,Bicc_Data.port_data[portNo].internal_cmd,
Bicc_Data.port_data[portNo].cic_state.call_state,Bicc_Data.port_data[portNo].cic_state.sus_state,
Bicc_Data.port_data[portNo].cic_state.blo_state,Bicc_Data.port_data[portNo].fsm_state.cpc_state,
Bicc_Data.port_data[portNo].fsm_state.mgbs_state,Bicc_Data.port_data[portNo].fsm_state.mgbr_state,
Bicc_Data.port_data[portNo].fsm_state.crs_state,Bicc_Data.port_data[portNo].fsm_state.crr_state,
Bicc_Data.port_data[portNo].fsm_state.cgrs_state,Bicc_Data.port_data[portNo].fsm_state.cgrr_state);
bicc_asciout_proc(info);
}
void list_busy_port()
{
int i,j=0;
sprintf(info, "Index PortNo CallState\n\r");
bicc_asciout_proc(info);
for(i=0;i<BICC_MAX_PORT;i++)
{
if(Bicc_Data.port_data[i].used_flag == 1)
{
sprintf(info,"%d %d %s\n\r",j++,i,(Bicc_Data.port_data[i].cic_state.call_state==1)?"INCOMING":"OUTGOING");
bicc_asciout_proc(info);
}
}
}
void list_dmp()
{
sprintf(info, "\
dmp active: %d\n\r\
local plat id: %d\n\r\
remote ip: %lx\n\r", Bicc_Data.dmp_data.active,Bicc_Data.dmp_data.processor_id,Bicc_Data.dmp_data.remote_ip);
bicc_asciout_proc(info);
}
void bicc_debug_timer(void)
{
BYTE in_page, err_fg = 0;
BYTE *ascii_in_ptr = NULL;
BYTE *str_start = NULL, * tmpStr;
WORD str_len, portNo=0;
WORD num, cgNo, circuitNo;
if ((str_len = strlen(AsciInBuf)) > 0)
{
in_page = AsciInBuf[0] - 1;
ascii_in_ptr = AsciInBuf + 1;
if (in_page > 4)
err_fg = 1;
else if (strcmp(ascii_in_ptr,"log error on") == 0)
{
MonitorFg = MonitorFg | MONITOR_ERROR;
}
else if (strcmp(ascii_in_ptr,"log error off") == 0)
{
MonitorFg = MonitorFg & (~MONITOR_ERROR);
}
else if (strcmp(ascii_in_ptr,"log all") == 0)
{
MonitorFg = MONITOR_ALL;
}
else if (strcmp(ascii_in_ptr,"log none") == 0)
{
MonitorFg = MONITOR_NONE;
}
else if (strcmp(ascii_in_ptr,"help") == 0)
{
bicc_asciout_proc(log_help);
}
else if (isdigit(ascii_in_ptr[0]))
{
num = strtoul(ascii_in_ptr, NULL, 10);
disp_page[in_page] = num;
debug_disp_page(in_page);
}
else if ((str_start = strstr(ascii_in_ptr, ">")) != NULL)
{
num = strtoul(str_start + 1, NULL, 10);
disp_page[in_page] += num;
debug_disp_page(in_page);
}
else if ((str_start = strstr(ascii_in_ptr, "<"))!= NULL)
{
num = strtoul(str_start + 1, NULL, 10);
disp_page[in_page] -= num;
debug_disp_page(in_page);
}
#if 0
else if ((strstr (ascii_in_ptr, "list sap")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
sapNo = strtoul (tmpStr + 1, NULL, 10);
list_sap(sapNo);
}
else
{
list_all_sap();
}
}
#endif
else if ((strstr (ascii_in_ptr,"list cg")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
// if((tmpStr = strsep(&&ascii_in_ptr, " \t")) != NULL)
{
cgNo = strtoul (tmpStr+1, NULL, 10);
// strsep(, " \t");
list_cg(cgNo);
}
else
{
list_all_cg();
}
}
else if ((strstr (ascii_in_ptr, "list circuit")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
circuitNo = strtoul (tmpStr + 1, NULL, 10);
list_circuit(circuitNo);
}
else
{
list_all_circuit();
}
}
else if ((strstr (ascii_in_ptr, "list port")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
portNo = strtoul (tmpStr + 1, NULL, 10);
list_port(portNo);
}
else
{
list_busy_port();
}
}
else if((strstr (ascii_in_ptr, "list dmp")) != NULL)
{
list_dmp();
}
else if((strstr(ascii_in_ptr, "trace on")) != NULL)
{
if((tmpStr = strstr(ascii_in_ptr, "-")) != NULL)
{
portNo = strtoul(tmpStr + 1, NULL, 10);
//trace_port(portNo);
Bicc_Data.port_data[portNo].trace_flag = 1;
}
else
{}
}
else if ((strstr (ascii_in_ptr, "trace off")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
portNo = strtoul (tmpStr + 1, NULL, 10);
Bicc_Data.port_data[portNo].trace_flag = 0;
}
else
{
int i;
for(i=0; i<BICC_MAX_PORT; i++)
Bicc_Data.port_data[i].trace_flag = 0;
}
}
else
err_fg = 1;
if (err_fg == 0)
bicc_asciout_proc("Command OK!\n\r");
else
bicc_asciout_proc("Command Error!\n\r");
strcpy(AsciInBuf, "\0");
}
bicc_debug_refresh();
}
void bicc_log_err(const char *fmt, ...)
{
if ((MonitorFg & MONITOR_ERROR) == MONITOR_ERROR)
{
va_list ap;
char buf[1024];
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
if((strlen(AsciOutBuf) + strlen(buf)) < 4096-15)
{
strcat(AsciOutBuf, "\33[31m");
strcat(AsciOutBuf, buf);
strcat(AsciOutBuf, "\33[37m");
}
else
{
strcpy(AsciOutBuf, "\33[31m");
strcat(AsciOutBuf, buf);
strcat(AsciOutBuf, "\33[37m");
}
va_end(ap);
}
}
int bicc_log_procedure(WORD mgNo, WORD portIndex, WORD chnlIndex, char *msg)
{
u8 monFlag = 0;
monFlag = 1;
if (monFlag == 1)
{
if (strlen(msg) >= 4096)
sprintf(AsciTempBuf, "log msg is too long!\n\r");
else
sprintf(AsciTempBuf, "%s\n\r", msg);
bicc_asciout_proc(AsciTempBuf);
return 0;
}
return -1;
}
void display_bicc_msgtype(u8 msgtype, u32 cic)
{
switch(msgtype)
{
case M_ACM:
bicc_asciout_proc("ACM:Address complete");
break;
case M_ANM:
bicc_asciout_proc("ANM:Answer");
break;
case M_BLO:
bicc_asciout_proc("BLO:Blocking");
break;
case M_BLA:
bicc_asciout_proc("BLA:Blocking acknowledgement");
break;
case M_CPG:
bicc_asciout_proc("CPG:Call progress");
break;
case M_CGB:
bicc_asciout_proc("CGB:Circuit/CIC group blocking");
break;
case M_CGBA:
bicc_asciout_proc("CGBA:Circuit/CIC group blocking acknowledgement");
break;
case M_CQM:
bicc_asciout_proc("CQM:Circuit/CIC group query (national use)");
break;
case M_CQR:
bicc_asciout_proc("CQR:Circuit/CIC group query response (national use)");
break;
case M_GRS:
bicc_asciout_proc("GRS:Circuit/CIC group reset");
break;
case M_GRA:
bicc_asciout_proc("GRA:Circuit/CIC group reset acknowledgement");
break;
case M_CGU:
bicc_asciout_proc("CGU:Circuit/CIC group unblocking");
break;
case M_CGUA:
bicc_asciout_proc("CGUA:Circuit/CIC group unblocking acknowledgement");
break;
case M_CRG:
bicc_asciout_proc("CRG:Charge information (national use)");
break;
case M_CFN:
bicc_asciout_proc("CFN:Confusion");
break;
case M_CON:
bicc_asciout_proc("CON:Connect");
break;
case M_COT:
bicc_asciout_proc("COT:Continuity");
break;
case M_FAC:
bicc_asciout_proc("FAC:Facility ");
break;
case M_FAA:
bicc_asciout_proc("FAA:Facility accepted");
break;
case M_FRJ:
bicc_asciout_proc("FRJ:Facility reject");
break;
case M_FAR:
bicc_asciout_proc("FAR:Facility request");
break;
case M_FOT:
bicc_asciout_proc("FOT:Forward transfer");
break;
case M_IDR:
bicc_asciout_proc("IDR:Identification request");
break;
case M_IRS:
bicc_asciout_proc("IRS:Identification response");
break;
case M_INF:
bicc_asciout_proc("INF:Information (national use)");
break;
case M_INR:
bicc_asciout_proc("INR:Information request (national use)");
break;
case M_IAM:
bicc_asciout_proc("IAM:Initial address");
break;
case M_NRM:
bicc_asciout_proc("NRM:Network resource management");
break;
case M_REL:
bicc_asciout_proc("REL:Release");
break;
case M_RLC:
bicc_asciout_proc("RLC:Release complete");
break;
case M_RSC:
bicc_asciout_proc("RSC:Reset circuit/CIC");
break;
case M_RES:
bicc_asciout_proc("RES:Resume");
break;
case M_SGM:
bicc_asciout_proc("SGM:Segmentation");
break;
case M_SAM:
bicc_asciout_proc("SAM:Subsequent address");
break;
case M_SUS:
bicc_asciout_proc("SUS:Suspend");
break;
case M_UBL:
bicc_asciout_proc("UBL:Unblocking");
break;
case M_UBA:
bicc_asciout_proc("UBA:Unblocking acknowledgement");
break;
case M_UCIC:
bicc_asciout_proc("UCIC:Unequipped CIC (national use)");
break;
case M_APM:
bicc_asciout_proc("APM:Application Transport");
break;
case M_USR:
bicc_asciout_proc("USR:User-to-user information");
break;
default:
bicc_asciout_proc("Unknown message");
}
bicc_asciout_proc("(message type=0x%x cic=%d)\r\n",msgtype,cic);
}
void monitor_bicc_msg(BYTE *msg,BYTE buf_len, BYTE flag, u32 cic, u32 portNo)
{
BYTE i,temp_buf[1024];
if(MonitorFg == MONITOR_ALL)
{
if(flag == 0)
bicc_asciout_proc("\33[33mReceive:\33[0m");
else if(flag == 1)
bicc_asciout_proc("\33[32mSend:\33[0m");
else if(flag == 2)
bicc_asciout_proc("\33[34mRedirect:\33[0m");
display_bicc_msgtype(msg[0], cic);
if(flag != 2)
{
for (i = 0; i < buf_len; i ++)
{
sprintf(&temp_buf[3*i]," %02x", msg[i]);
}
sprintf(&temp_buf[3*i],"\n\r");
bicc_asciout_proc(temp_buf);
}
}
if(MonitorFg == MONITOR_NONE)
{}
if(Bicc_Data.port_data[portNo].trace_flag == 1)
{
if(flag == 0)
bicc_asciout_proc("\33[33mReceive:\33[0m");
else if(flag == 1)
bicc_asciout_proc("\33[32mSend:\33[0m");
else if(flag == 2)
bicc_asciout_proc("\33[34mRedirect:\33[0m");
display_bicc_msgtype(msg[0], cic);
if(flag != 2)
{
for (i = 0; i < buf_len; i ++)
{
sprintf(&temp_buf[3*i]," %02x", msg[i]);
}
sprintf(&temp_buf[3*i],"\n\r");
bicc_asciout_proc(temp_buf);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,362 @@
#include <stdio.h>
#include <string.h>
#include "./include/ipbcp.h"
int sdp_decode_orig(SdpOrig_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->username, token);
strcat(dst_ptr->username, "\0");
break;
case 2:
sprintf(dst_ptr->session_id, token);
strcat(dst_ptr->session_id, "\0");
break;
case 3:
sprintf(dst_ptr->version, token);
strcat(dst_ptr->version, "\0");
break;
case 4:
sprintf(dst_ptr->network_type, token);
strcat(dst_ptr->network_type, "\0");
break;
case 5:
sprintf(dst_ptr->address_type, token);
strcat(dst_ptr->address_type, "\0");
break;
case 6:
sprintf(dst_ptr->address, token);
strcat(dst_ptr->address, "\0");
break;
default:
return 0;
}
}
if(field_id != 6)
return 0;
else
return 1;
}
int sdp_decode_conn(SdpConn_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->network_type, token);
strcat(dst_ptr->network_type, "\0");
break;
case 2:
sprintf(dst_ptr->address_type, token);
strcat(dst_ptr->address_type, "\0");
break;
case 3:
sprintf(dst_ptr->address, token);
strcat(dst_ptr->address, "\0");
break;
default:
return 0;
}
}
if(field_id != 3)
return 0;
else
return 1;
}
int sdp_decode_time(SdpTime_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->start, token);
strcat(dst_ptr->start, "\0");
break;
case 2:
sprintf(dst_ptr->stop, token);
strcat(dst_ptr->stop, "\0");
break;
default:
return 0;
}
}
if(field_id != 2)
return 0;
else
return 1;
}
int sdp_decode_attrib(SdpAttrib_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
if(strstr(src_ptr, "ipbcp:") != src_ptr)
return 0;
src_ptr += strlen("ipbcp:");
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->version, token);
strcat(dst_ptr->version, "\0");
break;
case 2:
sprintf(dst_ptr->type, token);
strcat(dst_ptr->type, "\0");
break;
default:
return 0;
}
}
if(field_id != 2)
return 0;
else
return 1;
}
int sdp_decode_mediaAnn(SdpMediaAnn_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->media, token);
strcat(dst_ptr->media, "\0");
break;
case 2:
sprintf(dst_ptr->port, token);
strcat(dst_ptr->port, "\0");
break;
case 3:
sprintf(dst_ptr->transport, token);
strcat(dst_ptr->transport, "\0");
strcpy(dst_ptr->fmt_list, src_ptr);
strcat(dst_ptr->fmt_list, "\0");
break;
case 4:
// sprintf(dst_ptr->fmt_list, token);
break;
default:
break;
}
}
if(field_id < 4)
return 0;
else
return 1;
}
int sdp_decode_mediaAtt(SdpMediaAtt_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
if(strstr(src_ptr, "rtpmap:") != src_ptr)
return 0;
src_ptr += strlen("rtpmap:");
while((token = strsep(&src_ptr, " /")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->payload, token);
strcat(dst_ptr->payload, "\0");
break;
case 2:
sprintf(dst_ptr->encoding_name, token);
strcat(dst_ptr->encoding_name, "\0");
break;
case 3:
sprintf(dst_ptr->clock_rate, token);
strcat(dst_ptr->clock_rate, "\0");
break;
case 4:
// sprintf(dst_ptr->p_time, token);
field_id --;//to avoid 4 fields
break;
default:
return 0;
}
}
if(field_id != 3)
return 0;
else
return 1;
}
int sdp_decode_ptime(char* p_time, char *src_ptr)
{
char *token;
if((token = strstr(src_ptr, "ptime:")) == NULL)
return 0;
token = strtok(token, ":");
token = strtok(NULL, ":");
// p_time = token;
// if(strlen(token)<8)
if(token)
{
sprintf(p_time, token);
strcat(p_time, "\0");
}
return 1;
}
int ipbcp_decode(IPBCP_struct *ipbcp_ptr, const char *ptr)
{
char *token;
unsigned char field_id = 0;
char temp_ipbcp[200];
char *temp_ptr;
strncpy(temp_ipbcp, ptr, 200);
temp_ptr = temp_ipbcp;
memset(ipbcp_ptr, 0, sizeof(IPBCP_struct));
while((token = strsep(&temp_ptr, "\r\n")) != NULL)
{
if(strlen(token) == 0)
continue;
switch(++field_id)
{
case 1:
if((token[0] != 'v') || (token[1] != '='))
return 0;
sprintf(ipbcp_ptr->proto_ver, token+2);
strcat(ipbcp_ptr->proto_ver, "\0");
break;
case 2:
if((token[0] != 'o') || (token[1] != '='))
return 0;
if(!sdp_decode_orig(&ipbcp_ptr->orig, token+2))
return 0;
break;
case 3:
if((token[0] != 's') || (token[1] != '='))
return 0;
sprintf(ipbcp_ptr->session_name, token+2);
strcat(ipbcp_ptr->session_name, "\0");
break;
case 4:
if((token[0] != 'c') || (token[1] != '='))
return 0;
if(!sdp_decode_conn(&ipbcp_ptr->conn_data, token+2))
return 0;
break;
case 5:
if((token[0] != 't') || (token[1] != '='))
return 0;
if(!sdp_decode_time(&ipbcp_ptr->time, token+2))
return 0;
break;
case 6:
if((token[0] != 'a') || (token[1] != '='))
return 0;
if(!sdp_decode_attrib(&ipbcp_ptr->attrib, token+2))
return 0;
break;
case 7:
if((token[0] != 'm') || (token[1] != '='))
return 0;
if(!sdp_decode_mediaAnn(&ipbcp_ptr->m_ann, token+2))
return 0;
break;
case 8:
if((token[0] != 'a') || (token[1] != '='))
return 0;
if(sdp_decode_mediaAtt(&ipbcp_ptr->m_att, token+2))
// return 0;
;
else if(!sdp_decode_ptime(ipbcp_ptr->ptime, token+2))
return 0;
break;
case 9:
if((token[0] != 'a') || (token[1] != '='))
return 0;
if(!sdp_decode_ptime(ipbcp_ptr->ptime, token+2))
return 0;
default:
break;
}
}
return 1;
}
int ipbcp_encode(char *ptr, const IPBCP_struct *ipbcp_ptr)
{
char tmp_buf[128];
sprintf(ptr, "v=%s\r\n", ipbcp_ptr->proto_ver);
sprintf(tmp_buf, "o=%s %s %s %s %s %s\r\n",
ipbcp_ptr->orig.username,
ipbcp_ptr->orig.session_id,
ipbcp_ptr->orig.version,
ipbcp_ptr->orig.network_type,
ipbcp_ptr->orig.address_type,
ipbcp_ptr->orig.address);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "s=%s\r\n", ipbcp_ptr->session_name);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "c=%s %s %s\r\n",
ipbcp_ptr->conn_data.network_type,
ipbcp_ptr->conn_data.address_type,
ipbcp_ptr->conn_data.address);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "t=%s %s\r\n", ipbcp_ptr->time.start, ipbcp_ptr->time.stop);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "a=ipbcp:%s %s\r\n", ipbcp_ptr->attrib.version, ipbcp_ptr->attrib.type);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "m=%s %s %s %s\r\n",
ipbcp_ptr->m_ann.media,
ipbcp_ptr->m_ann.port,
ipbcp_ptr->m_ann.transport,
ipbcp_ptr->m_ann.fmt_list);
strcat(ptr, tmp_buf);
if(strlen(ipbcp_ptr->m_att.payload) != 0)
{
sprintf(tmp_buf, "a=rtpmap:%s %s/%s\r\n",
ipbcp_ptr->m_att.payload,
ipbcp_ptr->m_att.encoding_name,
ipbcp_ptr->m_att.clock_rate);
strcat(ptr, tmp_buf);
}
//ipbcp_ptr->ptime[7]='\0';
if((ipbcp_ptr->ptime[0] != '\0') && (strlen(ipbcp_ptr->ptime)<8))
{
sprintf(tmp_buf, "a=ptime:%s\r\n", ipbcp_ptr->ptime);
strcat(ptr, tmp_buf);
}
return strlen(ptr);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,244 @@
#include "./include/inc.h"
#include "./include/var_ext.h"
#include "./include/q1902_3e.h"
/**********************************************/
/******* BICC Message&Primitive Mapping *******/
/**********************************************/
void app_msg2prm(AppTransM_struct *dst_ptr, AppTrans_struct *src_ptr)
{
dst_ptr->pres = src_ptr->pres;
if(src_ptr->pres == 1)
{
memcpy(&dst_ptr->apm_info, &src_ptr->apm_info, sizeof(ApmUser_struct));
dst_ptr->apm_info.sni = src_ptr->sni;
dst_ptr->apm_info.rci = src_ptr->rci;
}
}
void app_prm2msg(AppTrans_struct *dst_ptr, AppTransM_struct *src_ptr)
{
dst_ptr->pres = src_ptr->pres;
if(src_ptr->pres == 1)
{
dst_ptr->aci[0] = 0x00;
dst_ptr->aci[1] = 0x00;
dst_ptr->sni = src_ptr->apm_info.sni;
dst_ptr->rci = src_ptr->apm_info.rci;
dst_ptr->si = 0; //subsequent segment to first segment
dst_ptr->segment = 0; //final segment
dst_ptr->slr = 0;
memcpy(&dst_ptr->apm_info, &src_ptr->apm_info, sizeof(ApmUser_struct));
}
}
void bicc_msg2prm(BiccReadPrim_union *prm_ptr, BiccMsg_union *msg_ptr, u8 msg_type)
{
memset(prm_ptr, 0, sizeof(BiccReadPrim_union));
switch(msg_type)
{
case M_ACM:
memcpy(&prm_ptr->alert_ind.backCall, &msg_ptr->acm.backCall, sizeof(BackCallInd_struct));
app_msg2prm(&prm_ptr->alert_ind.app, &msg_ptr->acm.app);
memcpy(&prm_ptr->alert_ind.cause, &msg_ptr->acm.cause, sizeof(CauseInd_struct));
memcpy(&prm_ptr->alert_ind.confTreat, &msg_ptr->acm.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->alert_ind.optBackCall, &msg_ptr->acm.optBackCall, sizeof(OptBackCallInd_struct));
memcpy(&prm_ptr->alert_ind.utuInd, &msg_ptr->acm.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->alert_ind.utuInfo, &msg_ptr->acm.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_ANM:
app_msg2prm(&prm_ptr->setup_cnf.app, &msg_ptr->anm.app);
memcpy(&prm_ptr->setup_cnf.backCall, &msg_ptr->anm.backCall, sizeof(BackCallInd_struct));
memcpy(&prm_ptr->setup_cnf.confTreat, &msg_ptr->anm.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->setup_cnf.connNum, &msg_ptr->anm.connNum, sizeof(ConnNum_struct));
memcpy(&prm_ptr->setup_cnf.utuInd, &msg_ptr->anm.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->setup_cnf.utuInfo, &msg_ptr->anm.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_APM:
app_msg2prm(&prm_ptr->apm_ind.app, &msg_ptr->apm.app);
break;
case M_CPG:
memcpy(&prm_ptr->cpg_ind.eventInfo, &msg_ptr->cpg.eventInfo, sizeof(EventInfo_struct));
app_msg2prm(&prm_ptr->cpg_ind.app, &msg_ptr->cpg.app);
memcpy(&prm_ptr->cpg_ind.backCall, &msg_ptr->cpg.backCall, sizeof(BackCallInd_struct));
memcpy(&prm_ptr->cpg_ind.calldiver,&msg_ptr->cpg.calldiver, sizeof(BiccCpg_struct));
memcpy(&prm_ptr->cpg_ind.cause, &msg_ptr->cpg.cause, sizeof(CauseInd_struct));
memcpy(&prm_ptr->cpg_ind.confTreat, &msg_ptr->cpg.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->cpg_ind.connNum, &msg_ptr->cpg.connNum, sizeof(ConnNum_struct));
memcpy(&prm_ptr->cpg_ind.utuInd, &msg_ptr->cpg.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->cpg_ind.utuInfo, &msg_ptr->cpg.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_CGB:
memcpy(&prm_ptr->cgb_ind.cicGrpSpv, &msg_ptr->cgb.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgb_ind.rangeStatus, &msg_ptr->cgb.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGBA:
memcpy(&prm_ptr->cgb_cnf.cicGrpSpv, &msg_ptr->cgb.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgb_cnf.rangeStatus, &msg_ptr->cgb.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGU:
memcpy(&prm_ptr->cgu_ind.cicGrpSpv, &msg_ptr->cgu.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgu_ind.rangeStatus, &msg_ptr->cgu.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGUA:
memcpy(&prm_ptr->cgu_cnf.cicGrpSpv, &msg_ptr->cgu.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgu_cnf.rangeStatus, &msg_ptr->cgu.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRS:
memcpy(&prm_ptr->grs_ind.rangeStatus, &msg_ptr->grs.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRA:
memcpy(&prm_ptr->grs_cnf.rangeStatus, &msg_ptr->grs.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CON:
app_msg2prm(&prm_ptr->setup_cnf.app, &msg_ptr->con.app);
memcpy(&prm_ptr->setup_cnf.backCall, &msg_ptr->con.backCall, sizeof(BackCallInd_struct));
memcpy(&prm_ptr->setup_cnf.confTreat, &msg_ptr->con.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->setup_cnf.connNum, &msg_ptr->con.connNum, sizeof(ConnNum_struct));
memcpy(&prm_ptr->setup_cnf.utuInd, &msg_ptr->con.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->setup_cnf.utuInfo, &msg_ptr->con.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_IAM:
memcpy(&prm_ptr->setup_ind.natConn, &msg_ptr->iam.natConn, sizeof(NatConnInd_struct));
memcpy(&prm_ptr->setup_ind.fwdCall, &msg_ptr->iam.fwdCall, sizeof(FwdCallInd_struct));
memcpy(&prm_ptr->setup_ind.callingPtyCat, &msg_ptr->iam.callingPtyCat, sizeof(CallingPtyCat_struct));
memcpy(&prm_ptr->setup_ind.transMedReq, &msg_ptr->iam.transMedReq, sizeof(TransMedReq_struct));
memcpy(&prm_ptr->setup_ind.calledPtyNum, &msg_ptr->iam.calledPtyNum, sizeof(CalledPtyNum_struct));
app_msg2prm(&prm_ptr->setup_ind.app, &msg_ptr->apm.app);
memcpy(&prm_ptr->setup_ind.callingPtyNum, &msg_ptr->iam.callingPtyNum, sizeof(CallingPtyNum_struct));
memcpy(&prm_ptr->setup_ind.collectCallReq, &msg_ptr->iam.collectCallReq, sizeof(CollectCallReq_struct));
memcpy(&prm_ptr->setup_ind.confTreat, &msg_ptr->iam.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->setup_ind.correlationId, &msg_ptr->iam.correlationId, sizeof(CorrelationId_struct));
memcpy(&prm_ptr->setup_ind.origCalledNum, &msg_ptr->iam.origCalledNum, sizeof(OrigCalledNum_struct));
memcpy(&prm_ptr->setup_ind.redirgNum, &msg_ptr->iam.redirgNum, sizeof(RedirgNum_struct));
memcpy(&prm_ptr->setup_ind.redirInfo, &msg_ptr->iam.redirInfo, sizeof(RedirInfo_struct));
memcpy(&prm_ptr->setup_ind.scfId, &msg_ptr->iam.scfId, sizeof(ScfId_struct));
memcpy(&prm_ptr->setup_ind.utuInd, &msg_ptr->iam.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->setup_ind.utuInfo, &msg_ptr->iam.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_REL:
memcpy(&prm_ptr->rel_ind.cause, &msg_ptr->rel.cause, sizeof(CauseInd_struct));
memcpy(&prm_ptr->rel_ind.utuInd, &msg_ptr->rel.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->rel_ind.utuInfo, &msg_ptr->rel.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_RLC:
memcpy(&prm_ptr->rel_cnf.cause, &msg_ptr->rlc.cause, sizeof(CauseInd_struct));
break;
case M_RES:
memcpy(&prm_ptr->res_ind.susRes, &msg_ptr->res.susRes, sizeof(SusResInd_struct));
break;
case M_SUS:
memcpy(&prm_ptr->sus_ind.susRes, &msg_ptr->sus.susRes, sizeof(SusResInd_struct));
break;
case M_SAM:
memcpy(&prm_ptr->info_ind.subseqNum, &msg_ptr->sam.subseqNum, sizeof(SubseqNum_struct));
break;
default:
break;
}
}
void bicc_prm2msg(BiccMsg_union *msg_ptr, BiccWritePrim_union *prm_ptr, u8 msg_type)
{
memset(msg_ptr, 0, sizeof(BiccMsg_union));
switch(msg_type)
{
case M_ACM:
memcpy(&msg_ptr->acm.backCall, &prm_ptr->alert_req.backCall, sizeof(BackCallInd_struct));
app_prm2msg(&msg_ptr->acm.app, &prm_ptr->alert_req.app);
memcpy(&msg_ptr->acm.cause, &prm_ptr->alert_req.cause, sizeof(CauseInd_struct));
memcpy(&msg_ptr->acm.confTreat, &prm_ptr->alert_req.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->acm.optBackCall, &prm_ptr->alert_req.optBackCall, sizeof(OptBackCallInd_struct));
memcpy(&msg_ptr->acm.utuInd, &prm_ptr->alert_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->acm.utuInfo, &prm_ptr->alert_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_ANM:
app_prm2msg(&msg_ptr->anm.app, &prm_ptr->setup_rsp.app);
memcpy(&msg_ptr->anm.backCall, &prm_ptr->setup_rsp.backCall, sizeof(BackCallInd_struct));
memcpy(&msg_ptr->anm.confTreat, &prm_ptr->setup_rsp.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->anm.connNum, &prm_ptr->setup_rsp.connNum, sizeof(ConnNum_struct));
memcpy(&msg_ptr->anm.utuInd, &prm_ptr->setup_rsp.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->anm.utuInfo, &prm_ptr->setup_rsp.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_APM:
app_prm2msg(&msg_ptr->apm.app, &prm_ptr->apm_req.app);
break;
case M_CPG:
memcpy(&msg_ptr->cpg.eventInfo, &prm_ptr->cpg_req.eventInfo, sizeof(EventInfo_struct));
app_prm2msg(&msg_ptr->cpg.app, &prm_ptr->cpg_req.app);
memcpy(&msg_ptr->cpg.backCall, &prm_ptr->cpg_req.backCall, sizeof(BackCallInd_struct));
memcpy(&msg_ptr->cpg.calldiver, &prm_ptr->cpg_req.calldiver, sizeof(BiccCpg_struct));
memcpy(&msg_ptr->cpg.cause, &prm_ptr->cpg_req.cause, sizeof(CauseInd_struct));
memcpy(&msg_ptr->cpg.confTreat, &prm_ptr->cpg_req.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->cpg.connNum, &prm_ptr->cpg_req.connNum, sizeof(ConnNum_struct));
memcpy(&msg_ptr->cpg.utuInd, &prm_ptr->cpg_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->cpg.utuInfo, &prm_ptr->cpg_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_CGB:
memcpy(&msg_ptr->cgb.cicGrpSpv, &prm_ptr->cgb_req.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgb.rangeStatus, &prm_ptr->cgb_req.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGBA:
memcpy(&msg_ptr->cgb.cicGrpSpv, &prm_ptr->cgb_rsp.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgb.rangeStatus, &prm_ptr->cgb_rsp.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGU:
memcpy(&msg_ptr->cgu.cicGrpSpv, &prm_ptr->cgu_req.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgu.rangeStatus, &prm_ptr->cgu_req.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGUA:
memcpy(&msg_ptr->cgu.cicGrpSpv, &prm_ptr->cgu_rsp.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgu.rangeStatus, &prm_ptr->cgu_rsp.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRS:
memcpy(&msg_ptr->grs.rangeStatus, &prm_ptr->grs_req.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRA:
memcpy(&msg_ptr->grs.rangeStatus, &prm_ptr->grs_rsp.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CON:
app_prm2msg(&msg_ptr->con.app, &prm_ptr->setup_rsp.app);
memcpy(&msg_ptr->con.backCall, &prm_ptr->setup_rsp.backCall, sizeof(BackCallInd_struct));
memcpy(&msg_ptr->con.confTreat, &prm_ptr->setup_rsp.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->con.connNum, &prm_ptr->setup_rsp.connNum, sizeof(ConnNum_struct));
memcpy(&msg_ptr->con.utuInd, &prm_ptr->setup_rsp.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->con.utuInfo, &prm_ptr->setup_rsp.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_IAM:
memcpy(&msg_ptr->iam.natConn, &prm_ptr->setup_req.natConn, sizeof(NatConnInd_struct));
memcpy(&msg_ptr->iam.fwdCall, &prm_ptr->setup_req.fwdCall, sizeof(FwdCallInd_struct));
memcpy(&msg_ptr->iam.callingPtyCat, &prm_ptr->setup_req.callingPtyCat, sizeof(CallingPtyCat_struct));
memcpy(&msg_ptr->iam.transMedReq, &prm_ptr->setup_req.transMedReq, sizeof(TransMedReq_struct));
memcpy(&msg_ptr->iam.calledPtyNum, &prm_ptr->setup_req.calledPtyNum, sizeof(CalledPtyNum_struct));
app_prm2msg(&msg_ptr->iam.app, &prm_ptr->setup_req.app);
memcpy(&msg_ptr->iam.callingPtyNum, &prm_ptr->setup_req.callingPtyNum, sizeof(CallingPtyNum_struct));
memcpy(&msg_ptr->iam.collectCallReq, &prm_ptr->setup_req.collectCallReq, sizeof(CollectCallReq_struct));
memcpy(&msg_ptr->iam.confTreat, &prm_ptr->setup_req.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->iam.correlationId, &prm_ptr->setup_req.correlationId, sizeof(CorrelationId_struct));
memcpy(&msg_ptr->iam.origCalledNum, &prm_ptr->setup_req.origCalledNum, sizeof(OrigCalledNum_struct));
memcpy(&msg_ptr->iam.redirgNum, &prm_ptr->setup_req.redirgNum, sizeof(RedirgNum_struct));
memcpy(&msg_ptr->iam.redirInfo, &prm_ptr->setup_req.redirInfo, sizeof(RedirInfo_struct));
memcpy(&msg_ptr->iam.scfId, &prm_ptr->setup_req.scfId, sizeof(ScfId_struct));
memcpy(&msg_ptr->iam.utuInd, &prm_ptr->setup_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->iam.utuInfo, &prm_ptr->setup_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_REL:
memcpy(&msg_ptr->rel.cause, &prm_ptr->rel_req.cause, sizeof(CauseInd_struct));
memcpy(&msg_ptr->rel.utuInd, &prm_ptr->rel_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->rel.utuInfo, &prm_ptr->rel_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_RLC:
memcpy(&msg_ptr->rlc.cause, &prm_ptr->rel_rsp.cause, sizeof(CauseInd_struct));
break;
case M_RES:
memcpy(&msg_ptr->res.susRes, &prm_ptr->res_req.susRes, sizeof(SusResInd_struct));
break;
case M_SUS:
memcpy(&msg_ptr->sus.susRes, &prm_ptr->sus_req.susRes, sizeof(SusResInd_struct));
break;
case M_SAM:
memcpy(&msg_ptr->sam.subseqNum, &prm_ptr->info_req.subseqNum, sizeof(SubseqNum_struct));
break;
default:
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\bicc\src.old\include
2
8
c:bicc_debug.h|1|11d70a3e55c|2d0|bc45c482|e454820e6cf311dd91a5001c23e19543|0
7:ipbcp.h|1|11d70a3e4ee|5ec|3918ea7e|e3c481de6cf311dd91a5001c23e19543|0
a:q1902_3e.h|1|11d70a3e4c0|2d50|c4a74e73|e32481c66cf311dd91a5001c23e19543|0
8:biccif.h|1|11d70a3e636|32e4|3f0cf7b4|e584826e6cf311dd91a5001c23e19543|0
5:inc.h|1|11d70a3e5ba|e57|566ed92f|e4f4823e6cf311dd91a5001c23e19543|0
9:q765_5e.h|1|11d70a3e59a|82e|ee80601c|e45482266cf311dd91a5001c23e19543|0
9:var_ext.h|1|11d70a3e5f8|15c|91ea711b|e4f482566cf311dd91a5001c23e19543|0
8:define.h|1|11d70a3e53d|1e9|94808f37|e3c481f66cf311dd91a5001c23e19543|0

View File

@@ -0,0 +1,25 @@
#include "define.h"
#include "../../../debug/src/include/debug.h"
#define LOG_ERR_FLAG 0x01
#define LOG_BICC_FLAG 0x02
#define LOG_MSG_FLAG 0x04
#define LOG_TIME_FLAG 0x08
#define LOG_DMP_FLAG 0x10
#define LOG_ALL_FLAG 0x1f
#define LOG_FILE_FLAG 0x20
/*******************************/
#define MAX_OPR_LEN 16
#define MAX_OBJ_LEN 32
#define MAX_VALUE_LEN 32
#define BICC_PREOID_LEN 12
#define BICC_DEBUG_OID 17
#define BICC_DEBUG_PAGE 10
#define BICC_ASCIN_LEN 128
#define BICC_ASCOUT_LEN 4096
int bicc_debug_init();
void bicc_debug_timer();
void monitor_bicc_msg(u8 *msg,u8 buf_len, BYTE flag, u32 cic, u32 portNo);
void bicc_asciout_proc(const char *fmt, ...);

View File

@@ -0,0 +1,417 @@
#ifndef _BICCIF_H_
#define _BICCIF_H_
#include "q765_5e.h"
#include "q1902_3e.h"
#include "../../../mtp3/src/include/mtp3.h"
#include "../../../snmp/src/include/snmp.h"
//#include "../../../public/src/include/proto_pub.h"
#include "bicc_debug.h"
#include "../../../pal/pal.h"
/*********************************/
/*** BICC Management Structure ***/
/*********************************/
#define BICC_CM_OK 1 //command request success
#define BICC_CM_FAILED -1 //command request failed
/*************************************
******BICC Resource Structure*********
*************************************/
#define BICC_MAX_PORT 8192
#define BICC_CG_CIRCUIT 32
#define BICC_CIRCUIT_CIC 32
/*** BICC Primitive Parameter Structure (different to q1902_3e) ***/
typedef struct AppTransM_struct { //Application Transport Mechanism
u8 pres;
ApmUser_struct apm_info;
} AppTransM_struct;
/*********************************/
/**** BICC Primitive Structure ***/
/*********************************/
typedef struct BiccSetup_Req {
NatConnInd_struct natConn;//F
FwdCallInd_struct fwdCall;//F
CallingPtyCat_struct callingPtyCat;//F
TransMedReq_struct transMedReq;//F
CalledPtyNum_struct calledPtyNum;//V
AppTransM_struct app;
CallingPtyNum_struct callingPtyNum;
CollectCallReq_struct collectCallReq;
ConfTreatInd_struct confTreat;
CorrelationId_struct correlationId;
OrigCalledNum_struct origCalledNum;
RedirgNum_struct redirgNum;
RedirInfo_struct redirInfo;
ScfId_struct scfId;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccSetup_Req, BiccSetup_Ind;
typedef struct BiccSetup_Rsp {
AppTransM_struct app;
BackCallInd_struct backCall;//C: use it if no alert req is sent before
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccSetup_Rsp, BiccSetup_Cnf;
typedef struct BiccAlert_Req {
BackCallInd_struct backCall;//F
AppTransM_struct app;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
OptBackCallInd_struct optBackCall;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccAlert_Req, BiccAlert_Ind;
typedef struct BiccInfo_Req {
SubseqNum_struct subseqNum;//V
} BiccInfo_Req, BiccInfo_Ind;
typedef struct BiccApm_Req {
AppTransM_struct app;
} BiccApm_Req, BiccApm_Ind;
typedef struct BiccCpg_Req {
EventInfo_struct eventInfo;//F
AppTransM_struct app;
BackCallInd_struct backCall;
CallDiverInfo_struct calldiver;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccCpg_Req, BiccCpg_Ind;
typedef struct BiccRel_Req {
CauseInd_struct cause;//V
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccRel_Req, BiccRel_Ind;
typedef struct BiccRel_Rsp {
CauseInd_struct cause;
} BiccRel_Rsp, BiccRel_Cnf;
typedef struct BiccRes_Req {
SusResInd_struct susRes;//F
} BiccRes_Req, BiccRes_Ind;
typedef struct BiccSus_Req {
SusResInd_struct susRes;//F
} BiccSus_Req, BiccSus_Ind;
typedef struct BiccCgb_Req {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgb_Req, BiccCgb_Ind;
typedef struct BiccCgb_Rsp {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgb_Rsp, BiccCgb_Cnf;
typedef struct BiccCgu_Req {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgu_Req, BiccCgu_Ind;
typedef struct BiccCgu_Rsp {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgu_Rsp, BiccCgu_Cnf;
typedef struct BiccGrs_Req {
RangeStatus_struct rangeStatus;//V
} BiccGrs_Req, BiccGrs_Ind;
typedef struct BiccGrs_Rsp {
RangeStatus_struct rangeStatus;//V
} BiccGrs_Rsp, BiccGrs_Cnf;
typedef struct BiccSta_Req
{
BiccMsg_struct biccMsg;
}BiccSta_Req;
typedef struct BiccFac_Req
{
FacInd_struct facInd;
}BiccFac_Req, BiccFac_Ind;
typedef struct BiccFac_Rsp
{
FacInd_struct facInd;
}BiccFac_Rsp, BiccFac_Cnf;
typedef union BiccWritePrim_union {
BiccSetup_Req setup_req;
BiccSetup_Rsp setup_rsp;
BiccAlert_Req alert_req;
BiccInfo_Req info_req;
BiccApm_Req apm_req;
BiccCpg_Req cpg_req;
BiccRel_Req rel_req;
BiccRel_Rsp rel_rsp;
BiccRes_Req res_req;
BiccSus_Req sus_req;
BiccCgb_Req cgb_req;//only used in BICC module
BiccCgb_Rsp cgb_rsp;//only used in BICC module
BiccCgu_Req cgu_req;//only used in BICC module
BiccCgu_Rsp cgu_rsp;//only used in BICC module
BiccGrs_Req grs_req;//only used in BICC module
BiccGrs_Rsp grs_rsp;//only used in BICC module
BiccFac_Req fac_req;
BiccFac_Rsp fac_rsp;
} BiccWritePrim_union;
typedef union BiccReadPrim_union {
BiccSetup_Ind setup_ind;
BiccSetup_Cnf setup_cnf;
BiccAlert_Ind alert_ind;
BiccInfo_Ind info_ind;
BiccApm_Ind apm_ind;
BiccCpg_Ind cpg_ind;
BiccRel_Ind rel_ind;
BiccRel_Cnf rel_cnf;
BiccRes_Ind res_ind;
BiccSus_Ind sus_ind;
BiccCgb_Ind cgb_ind;//only used in BICC module
BiccCgb_Cnf cgb_cnf;//only used in BICC module
BiccCgu_Ind cgu_ind;//only used in BICC module
BiccCgu_Cnf cgu_cnf;//only used in BICC module
BiccGrs_Ind grs_ind;//only used in BICC module
BiccGrs_Cnf grs_cnf;//only used in BICC module
BiccFac_Ind fac_ind;
BiccFac_Cnf fac_cnf;
} BiccReadPrim_union;
/********************************************/
/****** BICC Internal Command *************/
/********************************************/
#define BICC_CMD_UNBLO 0x01
#define BICC_CMD_BLO 0x02
#define BICC_CMD_RESET 0x03
#define BICC_CMD_RESET_COMP 0x04
#define BICC_SI_CPCI 0x10
#define BICC_SI_CPCO 0x20
#define BICC_SI_BLS 0x30
#define BICC_SI_BLR 0x40
#define BICC_SI_MGBR 0x50
#define BICC_SI_MGBS 0x60
#define BICC_SI_CRS 0x70
#define BICC_SI_CRR 0x80
#define BICC_SI_CGRS 0x90
#define BICC_SI_CGRR 0xA0
/********************************************/
/****** BICC Event/Primitive Definition *****/
/********************************************/
#define BICC_SETUP_REQ 0x01 //user-defined, first 4-digit:type of primitive second 4-digit:type of event
#define BICC_SETUP_IND 0x41
#define BICC_SETUP_RSP 0x81
#define BICC_SETUP_CNF 0xc1
#define BICC_ALERT_REQ 0x02
#define BICC_ALERT_IND 0x42
#define BICC_INFO_REQ 0x03
#define BICC_INFO_IND 0x43
#define BICC_APM_REQ 0x04
#define BICC_APM_IND 0x44
#define BICC_PROG_REQ 0x05
#define BICC_PROG_IND 0x45
#define BICC_RELEASE_REQ 0x06
#define BICC_RELEASE_IND 0x46
#define BICC_RELEASE_RSP 0x86
#define BICC_RELEASE_CNF 0xc6
#define BICC_RESET_REQ 0x07
#define BICC_RESET_IND 0x47
#define BICC_RESET_CNF 0xc7
#define BICC_RESET_RSP 0x87
#define BICC_GROUP_RESET_REQ 0x17
#define BICC_BLOCK_REQ 0x08
#define BICC_BLOCK_IND 0x48
#define BICC_BLOCK_RSP 0x88
#define BICC_BLOCK_CNF 0xc8
#define BICC_UNBLOCK_REQ 0x09
#define BICC_UNBLOCK_IND 0x49
#define BICC_UNBLOCK_RSP 0x89
#define BICC_UNBLOCK_CNF 0xc9
#define BICC_SUSPEND_REQ 0x0a
#define BICC_SUSPEND_IND 0x4a
#define BICC_RESUME_REQ 0x0b
#define BICC_RESUME_IND 0x4b
#define BICC_REATTEMPT_IND 0x4c
#define BICC_FAILURE_IND 0x4f
#define BICC_FAC_REQ 0x0d
#define BICC_FAC_RSP 0x8d
#define BICC_FAC_IND 0x4d
#define BICC_FAC_CNF 0xcd
#define BICC_STA_IND 0x4e
#define BICC_STA_REQ 0x0e
#define BICC_MAINTENANCE_IND 0x44 //
#define BICC_STOP_REQ 0xee
#define BICC_STOP_CNF 0xef
typedef int f_bicc_setup_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_setup_anm_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_setup_con_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_release_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_release_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_alert_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_info_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_prog_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_suspend_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_resume_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_reset_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_reset_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_apm_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_reattempt_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_failure_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_block_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_block_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_unblock_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_unblock_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef struct bicc_eventhandle_struct
{
f_bicc_setup_ind *h_bicc_setup_ind;
f_bicc_setup_anm_cnf *h_bicc_setup_anm_cnf;
f_bicc_setup_con_cnf *h_bicc_setup_con_cnf;
f_bicc_release_ind *h_bicc_release_ind;
f_bicc_release_cnf *h_bicc_release_cnf;
f_bicc_alert_ind *h_bicc_alert_ind;
f_bicc_info_ind *h_bicc_info_ind;
f_bicc_prog_ind *h_bicc_prog_ind;
f_bicc_suspend_ind *h_bicc_suspend_ind;
f_bicc_resume_ind *h_bicc_resume_ind;
f_bicc_block_ind *h_bicc_block_ind;
f_bicc_block_cnf *h_bicc_block_cnf;
f_bicc_unblock_ind *h_bicc_unblock_ind;
f_bicc_unblock_cnf *h_bicc_unblock_cnf;
f_bicc_reset_ind *h_bicc_reset_ind;
f_bicc_reset_cnf *h_bicc_reset_cnf;
f_bicc_apm_ind *h_bicc_apm_ind;
f_bicc_reattempt_ind *h_bicc_reattempt_ind;
f_bicc_failure_ind *h_bicc_failure_ind;
}BICC_EventHandle_struct;
typedef struct _bicc_sap_attrib_
{
BICC_EventHandle_struct event_handle;
}bicc_sap_sttrib_;
typedef enum _BICC_network_id
{
SI_INTERNATIONAL = 0,
SI_INTERNATIONAL_SPARE = 1,
SI_NATIONAL = 2,
SI_NATIONAL_SPARE = 3,
}SI_Netwrok_ID;
typedef struct bicc_cic_state
{
u8 call_state;
u8 sus_state; //suspend state, remote hold? local hold?
u8 blo_state; //block state, remote block? local hold?
}BICC_CIC_state;
typedef struct bicc_fsm_state
{
u8 cpc_state;
u8 mgbs_state;
u8 mgbr_state;
u8 crs_state;
u8 crr_state;
u8 cgrs_state;
u8 cgrr_state;
}BICC_Fsm_state;
typedef struct bicc_port_struct
{
u8 used_flag;
u8 trace_flag;
u32 w_time;
u32 su_proc_id;
u8 sprc_cmd;
u8 primitive_cmd;
u8 internal_cmd;
BICC_Fsm_state fsm_state;
BICC_CIC_state cic_state;
up_message_2 s_mtp_msg; //message send to mtp3
}BICC_Port_struct;
extern up_message_2 r_mtp_msg; //message receive from mtp3
typedef struct BiccDmp_struct {
// If DMP is active, circuit 0-127 is according to proccessor 0, circuit 128-255 is accroding to proccessor 1 //
u8 active;
u8 processor_id;
u32 remote_ip;
} BiccDmp_struct;
/**********************
***upper layer interface***
***********************
*/
extern int BICC_con_req(Pst *pst, BiccSetup_Req *ptr); //iam //Connection establishment request
extern int BICC_con_rsp(Pst *pst, BiccSetup_Rsp *ptr); //anm,con //Connection establishment response
extern int BICC_rel_req(Pst *pst, BiccRel_Req *ptr); //Release request
extern int BICC_rel_rsp(Pst *pst, BiccRel_Rsp *ptr); //Release response
extern int BICC_alert_req(Pst *pst, BiccAlert_Req *ptr); //alert
extern int BICC_info_req(Pst *pst, BiccInfo_Req *ptr); //sam
extern int BICC_prog_req(Pst *pst, BiccCpg_Req *ptr); //progress
extern int BICC_apm_req(Pst *pst, BiccApm_Req *ptr);
extern int BICC_sus_req(Pst *pst, BiccSus_Req *ptr); //Call suspend request
extern int BICC_resm_req(Pst *pst, BiccRes_Req *ptr); //Call resume request
extern int BICC_block_req(Pst *pst, BiccCgb_Req *ptr); //block req
extern int BICC_block_rsp(Pst *pst, BiccCgb_Req *ptr);
extern int BICC_unblock_req(Pst *pst, BiccCgb_Req *ptr); //unblock req
extern int BICC_unblock_rsp(Pst *pst, BiccCgb_Req *ptr);
extern int BICC_reset_req(Pst *pst, BiccGrs_Req *ptr);
extern int BICC_reset_rsp(Pst *pst, BiccGrs_Rsp *ptr); //reset response
extern void BICC_EMPTY_OPTPAR(void *ptr, u8 prim);
extern BOOL bicc_trunk_reachable(u32 cg_id);
/*****************************
*** layer management interface***
******************************
*/
int BICC_active_dmp(u8 plat_id, u32 alter_id );
int BICC_deactive_dmp();
/***********************
*** lower layer interface***
************************
*/
void BICC_msdc_proc(u32 pid, up_message_2 *upmsg_ptr);
int BICC_mdsc_proc();
/******************************
*** system service interface***
*******************************
*/
void BICC_init(int interval_ms, int local_id);
void BICC_timer();
#endif

View File

@@ -0,0 +1,34 @@
#ifndef _DEFINE_H_
#define _DEFINE_H_
//typedef int BOOL;
#ifndef _T_U8
#define _T_U8
typedef unsigned char u8;
#endif
#ifndef _T_U16
#define _T_U16
typedef unsigned short u16;
#endif
#ifndef _T_U32
#define _T_U32
typedef unsigned int u32;
#endif
#define BICC_TOLERANT
#define BICC_REATTEMPT
#define BICC_DEBUG
//Event
#define EN_NONE 0x00
#define EN_ANM 0x01
#define EN_CON 0x02
#define EN_GROUP 0x03
#define M_LOCAL_BLOCK 0x01
#define M_REMOTE_BLOCK 0x02
#endif

View File

@@ -0,0 +1,162 @@
#ifndef _INC_H
#define _INC_H
#include <string.h>
#include <stdio.h>
#include "../../../mtp3/src/include/mtp3.h"
#include "../../../snmp/src/include/snmp.h"
#include "biccif.h"
#define BICC_VERSION {9, 0, 10, 0}
#define BICC_SCREEN_SIZE 32
#define BICC_TIMER_STOP 0
#define BICC_TIMER_EXPIRED 1
#define BICC_T1 15
#define BICC_T5 300
#define BICC_T7 30
#define BICC_T8 10
#define BICC_T9 120
#define BICC_T12 15
#define BICC_T13 300
#define BICC_T14 15
#define BICC_T15 300
#define BICC_T16 15
#define BICC_T17 300
#define BICC_T18 15
#define BICC_T19 300
#define BICC_T20 15
#define BICC_T21 300
#define BICC_T22 15
#define BICC_T23 300
//#define BICC_T24 1
//#define BICC_T25 1
//#define BICC_T26 60
//#define BICC_T27 240
#define BICC_T28 10
#define BICC_T33 12
#define BICC_T34 2
#define BICC_T35 15
//#define BICC_T36 10
//#define BICC_T37 2
#define BICC_T40 10
#define BICC_T41 10
#define BICC_T42 5
#define BICC_T43 5
#define BICC_USER_T10 10//user defined timer,10s
#define BICC_CIC_IDLE 0
#define BICC_INCOMING 1
#define BICC_OUTGOING 2
#define BICC_RESET 3
#define BICC_TYPE_INCOMING 0
#define BICC_TYPE_OUTGOING 1
#define BICC_TYPE_BIDIRECT 2
#define BICC_ORIG_SUSPEND 0 //originating side suspend
#define BICC_TERM_SUSPEND 1 //terminating side suspend
typedef struct BiccTimer_struct
{
int t1;
int t5;
int t7;
int t8;
int t9;
int t12;
int t13;
int t14;
int t15;
int t16;
int t17;
int t18;
int t19;
int t20;
int t21;
int t22;
int t23;
int t28;
int t33;
int t34;
int t35;
int t40;
int t41;
int t42;
int t43;
int user_t10;
}BiccTimer_struct;
typedef struct BiccMng_struct {
u8 state;
u32 lnk_id;
RangeStatus_struct rangeStatus;
} BiccMng_struct;
typedef struct BiccDebug_struct {
u32 flag;
u8 sap_enable[BICC_SCREEN_SIZE];
u8 sap_cg_num[BICC_SCREEN_SIZE];
//u8 cg_enable[BICC_SCREEN_SIZE];
//u8 network_id[BICC_SCREEN_SIZE];
// page 1 //
u8 cic_enable[BICC_SCREEN_SIZE];
u8 cic_type[BICC_SCREEN_SIZE];
u8 l_block[BICC_SCREEN_SIZE];
u8 r_block[BICC_SCREEN_SIZE];
// page 2 //
u8 cic_status[BICC_SCREEN_SIZE];
u8 cpc_state[BICC_SCREEN_SIZE];
u8 mgbs_state[BICC_SCREEN_SIZE];
u8 mgbr_state[BICC_SCREEN_SIZE];
u8 crs_state[BICC_SCREEN_SIZE];
u8 crr_state[BICC_SCREEN_SIZE];
u8 cgrs_state[BICC_SCREEN_SIZE];
u8 cgrr_state[BICC_SCREEN_SIZE];
// page 3 //
u8 sprc_command[BICC_SCREEN_SIZE];
u8 mgbs_command[BICC_SCREEN_SIZE];
u8 mgbr_command[BICC_SCREEN_SIZE];
u8 crs_command[BICC_SCREEN_SIZE];
u8 crr_command[BICC_SCREEN_SIZE];
u8 cgrs_command[BICC_SCREEN_SIZE];
u8 cgrr_command[BICC_SCREEN_SIZE];
u8 prim_command[BICC_SCREEN_SIZE];
// page 4 //
u8 mng_state;
u8 mng_lnk_id;
} BiccDebug_struct;
typedef struct BiccData_struct
{
BiccDebug_struct debug_data;
BiccMng_struct mng_data;
BiccDmp_struct dmp_data;
BiccTimer_struct timer_data[BICC_MAX_PORT];
//BICC_Fsm_state fsm_data[BICC_MAX_PORT];
BICC_Port_struct port_data[BICC_MAX_PORT];
}BiccData_struct;
typedef struct stat_struct {
// u32 en_cic;
u32 lblo_cic;
u32 rblo_cic;
// u32 in_cic;
// u32 out_cic;
// u32 bi_cic;
u32 idle_call;
u32 in_call;
u32 out_call;
u32 lsus_cic;
u32 rsus_cic;
}stat_struct;
#endif

View File

@@ -0,0 +1,60 @@
// Q.1970E; RFC 2327 //
#ifndef _IPBCP_H_
#define _IPBCP_H_
typedef struct SdpOrig_struct {
char username[16];
char session_id[16];
char version[8];
char network_type[8];
char address_type[8];
char address[16];
} SdpOrig_struct;
typedef struct SdpConn_struct {
char network_type[8];
char address_type[8];
char address[16];
} SdpConn_struct;
typedef struct SdpTime_struct {
char start[16]; //0
char stop[16]; //0
} SdpTime_struct;
typedef struct SdpAttrib_struct {
char version[8]; //1
char type[16]; //"Request"/"Accepted"/"Confused"/"Rejected"
} SdpAttrib_struct;
typedef struct SdpMediaAnn_struct {
char media[16];
char port[8];
char transport[16];
char fmt_list[128];
} SdpMediaAnn_struct;
// specify RTP dynamic payload types //
typedef struct SdpMediaAtt_struct {
char payload[8];
char encoding_name[16];
char clock_rate[8];
// char p_time[8];
} SdpMediaAtt_struct;
typedef struct IPBCP_struct {
char proto_ver[8]; //Protocol version (M)
SdpOrig_struct orig; //Orign (M)
char session_name[16]; //Session name (M)
SdpConn_struct conn_data; //Connection data
SdpTime_struct time; //Time
SdpAttrib_struct attrib; //Session attribute
SdpMediaAnn_struct m_ann; //Media announcement (M)
SdpMediaAtt_struct m_att; //Media attributes
char ptime[8];
} IPBCP_struct;
extern int ipbcp_decode(IPBCP_struct *ipbcp_ptr, const char *ptr);
extern int ipbcp_encode(char *ptr, const IPBCP_struct *ipbcp_ptr);
#endif

View File

@@ -0,0 +1,456 @@
#ifndef _q1902_3E_H_
#define _q1902_3E_H_
#include "define.h"
#include "q765_5e.h"
/******************************************/
/******** BICC SIO (Q.1901E C.7.3) ********/
/******************************************/
#define BICC_SI 13
/******************************************/
/* Message Type Codes (Q.1902-3E, page 5) */
/******************************************/
#define M_ACM 0x06//Address complete
#define M_ANM 0x09//Answer
#define M_APM 0x41//Application transport
#define M_BLO 0x13//Blocking
#define M_BLA 0x15//Blocking acknowledgement
#define M_CPG 0x2c//Call progress
#define M_CGB 0x18//Circuit/CIC group blocking
#define M_CGBA 0x1a//Circuit/CIC group blocking acknowledgement
#define M_CQM 0x2a//Circuit/CIC group query (national use)
#define M_CQR 0x2b//Circuit/CIC group query response (national use)
#define M_GRS 0x17//Circuit/CIC group reset
#define M_GRA 0x29//Circuit/CIC group reset acknowledgement
#define M_CGU 0x19//Circuit/CIC group unblocking
#define M_CGUA 0x1b//Circuit/CIC group unblocking acknowledgement
#define M_CRG 0x31//Charge information (national use)
#define M_CFN 0x2f//Confusion
#define M_CON 0x07//Connect
#define M_COT 0x05//Continuity
#define M_FAC 0x33//Facility
#define M_FAA 0x20//Facility accepted
#define M_FRJ 0x21//Facility reject
#define M_FAR 0x1f//Facility request
#define M_FOT 0x08//Forward transfer
#define M_IDR 0x36//Identification request
#define M_IRS 0x37//Identification response
#define M_INF 0x04//Information (national use)
#define M_INR 0x03//Information request (national use)
#define M_IAM 0x01//Initial address
#define M_LOP 0x40//Loop prevention
#define M_NRM 0x32//Network resource management
#define M_PRI 0x42//Pre-release information
#define M_REL 0x0c//Release
#define M_RLC 0x10//Release complete
#define M_RSC 0x12//Reset circuit/CIC
#define M_RES 0x0e//Resume
#define M_SGM 0x38//Segmentation
#define M_SAM 0x02//Subsequent address
#define M_SDM 0x43//Subsequent Directory Number (national use)
#define M_SUS 0x0d//Suspend
#define M_UBL 0x14//Unblocking
#define M_UBA 0x16//Unblocking acknowledgement
#define M_UCIC 0x2e//Unequipped CIC (national use)
#define M_USR 0x2d//User-to-user information
/*********************************************/
/* Parameter Name Codes (Q.1902-3E, page 10) */
/*********************************************/
#define P_APPTRANS 0x78//Application transport
#define P_BACKCALLIND 0x11//Backward call indicators
#define P_CALLEDPTYNUM 0x04//Called party number
#define P_CALLINGPTYNUM 0x0a//Calling party number
#define P_CALLINGPTYCAT 0x09//Calling party's category
#define P_CAUSEIND 0x02//Cause indicators
#define P_CICGRPSPV 0x15//Circuit/CIC group supervision message type
#define P_COLLECTCALLREQ 0x79//Collect call request
#define P_CONFTREATIND 0x72//Conference treatment indicators
#define P_CONNNUM 0x21//Connected number
#define P_CORRELATIONID 0x65//Correlation id
#define P_EVENINFO 0x24//Event information
#define P_FACIND 0x18//Facility indicator
#define P_FWDCALLIND 0x07//Forward call indicators
#define P_NATCONNIND 0x06//Nature of connection indicators
#define P_ORIGCALLEDNUM 0x28//Original called number
#define P_RANGESTATUS 0x16//Range and status
#define P_REDIRGNUM 0x0b//Redirecting number
#define P_REDIRINFO 0x13//Redirection information
#define P_SCFID 0x66//SCF id
#define P_SUBSEQNUM 0x05//Subsequent number
#define P_SUSRESIND 0x22//Suspend/Resume indicators
#define P_TRANSMEDREQ 0x02//Transmission medium requirement
#define P_UTUIND 0x2a//User-to-user indicators
#define P_UTUINFO 0x20//User-to-user information
#define P_CALLDIVERINFO 0x36//Call diversion information
#define P_OPTBACKCALLIND 0x29//Optional backward call indicators
/**********************************************/
/* Parameter Structure (Q.1902-3E, section 6) */
/**********************************************/
#define MAX_BICC_DIGIT 32
#define BICC_STATUS_LEN 32
#define BICC_APP_LEN 200
#define MAX_DIAGNOSTIC_LEN 32
typedef struct AppTrans_struct {
u8 pres;
u8 aci[2]; //Application context identifier
u8 :6;
u8 sni:1; //Send notification indicator
u8 rci:1; //Release call indicator
u16 :1;
u16 si:1; //Sequence indicator
u16 segment:6; //APM segmentation indicator
u16 :1;
u16 slr:7; //Segmentation local reference
// APM-user information (For APM'98-user application only) //
ApmUser_struct apm_info;
} AppTrans_struct;
typedef struct BackCallInd_struct {
u8 pres;
u8 val[2];
} BackCallInd_struct;
typedef struct CalledPtyNum_struct {
u8 pres;
u8 nai;
u8 inn;
u8 npi;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} CalledPtyNum_struct;
typedef struct CallingPtyNum_struct {
u8 pres;
u8 nai;
u8 ni;
u8 npi;
u8 apri;
u8 si;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} CallingPtyNum_struct;
typedef struct CallingPtyCat_struct {
u8 pres;
u8 val;
} CallingPtyCat_struct;
/* defined in Q.850E */
typedef struct CauseInd_struct {
u8 pres;
u8 codingStd;
u8 location;
u8 causeVal;
//diagnostic
} CauseInd_struct;
typedef struct CicGrpSpv_struct {
u8 pres;
u8 val;
} CicGrpSpv_struct;
typedef struct CollectCallReq_struct {
u8 pres;
u8 val;
} CollectCallReq_struct;
typedef struct ConfTreatInd_struct {
u8 pres;
u8 val;
} ConfTreatInd_struct;
typedef struct ConnNum_struct {
u8 pres;
u8 nai;
u8 npi;
u8 apri;
u8 si;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} ConnNum_struct;
typedef struct EventInfo_struct {
u8 pres;
u8 val;
} EventInfo_struct;
typedef struct FacInd_struct {
u8 pres;
u8 val;
} FacInd_struct;
typedef struct FwdCallInd_struct {
u8 pres;
u8 val[2];
} FwdCallInd_struct;
typedef struct GenericNumber_struct {
u8 pres;
u8 nqi; //Number qualifier indicator
u8 nai;
u8 ni;
u8 npi;
u8 apri;
u8 si;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} GenericNumber_struct;
typedef struct GenericDigits_struct /* Generic Digits */
{
u8 pres;
u8 typeOfDigits;
u8 encodeScheme;
u8 numOfDigit;
u8* digits;
} GenericDigits_struct;
typedef GenericDigits_struct CorrelationId_struct; //R10
//typedef struct CorrelationId_struct { //R9
// u8 pres;
// u8 digit[4]; //4 bytes
//}CorrelationId_struct;
typedef struct NatConnInd_struct {
u8 pres;
u8 val;
} NatConnInd_struct;
typedef struct OrigCalledNum_struct {
u8 pres;
u8 nai;
u8 npi;
u8 apri;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} OrigCalledNum_struct;
typedef struct RangeStatus_struct {
u8 pres;
u8 range;
u8 status[BICC_STATUS_LEN];
} RangeStatus_struct;
typedef struct RedirgNum_struct {
u8 pres;
u8 nai;
u8 npi;
u8 apri;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} RedirgNum_struct;
typedef struct RedirInfo_struct{
u8 pres;
u8 redInd;
u8 origRedirReason;
u8 redirCounter;
u8 redirReason;
}RedirInfo_struct;
typedef GenericDigits_struct ScfId_struct;
/*typedef struct ScfId_struct {
u8 pres;
u8 nai;
u8 inn;
u8 npi;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
}ScfId_struct;
*/
typedef struct SubseqNum_struct {
u8 pres;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} SubseqNum_struct;
typedef struct SusResInd_struct {
u8 pres;
u8 val;
} SusResInd_struct;
typedef struct TransMedReq_struct {
u8 pres;
u8 val;
} TransMedReq_struct;
typedef struct UserToUserInd_struct {
u8 pres;
u8 val;
} UserToUserInd_struct;
typedef struct UserToUserInfo_struct {
u8 pres;
u8 len;
u8 val[129];
} UserToUserInfo_struct;
typedef struct CallDiverInfo_struct
{
u8 pres;
u8 notifSubsOption;
u8 redirReason;
}CallDiverInfo_struct;
typedef struct OptBackCallInd_struct
{
u8 pres;
u8 inbandInfoInd;
u8 callDiverOccurInd;
u8 simpSegmInd;
u8 mlppUserInd;
}OptBackCallInd_struct;
/********************************************/
/* Message structure (Q.1902-3E, section 7) */
/********************************************/
typedef struct BiccAcm_struct {
BackCallInd_struct backCall;//F
AppTrans_struct app;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
OptBackCallInd_struct optBackCall;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccAcm_struct;
typedef struct BiccAnm_struct {
AppTrans_struct app;
BackCallInd_struct backCall;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccAnm_struct;
typedef struct BiccApm_struct {
AppTrans_struct app;
} BiccApm_struct;
typedef struct BiccCpg_struct {
EventInfo_struct eventInfo;//F
AppTrans_struct app;
BackCallInd_struct backCall;
CallDiverInfo_struct calldiver;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccCpg_struct;
typedef struct BiccCgb_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgb_struct;
typedef struct BiccCgba_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgba_struct;
typedef struct BiccCgu_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgu_struct;
typedef struct BiccCgua_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgua_struct;
typedef struct BiccGrs_struct {
RangeStatus_struct rangeStatus;//V
} BiccGrs_struct;
typedef struct BiccGra_struct {
RangeStatus_struct rangeStatus;//V
} BiccGra_struct;
typedef struct BiccCon_struct {
BackCallInd_struct backCall;//F
AppTrans_struct app;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccCon_struct;
typedef struct BiccIam_struct {
NatConnInd_struct natConn;//F
FwdCallInd_struct fwdCall;//F
CallingPtyCat_struct callingPtyCat;//F
TransMedReq_struct transMedReq;//F
CalledPtyNum_struct calledPtyNum;//V
AppTrans_struct app;
CallingPtyNum_struct callingPtyNum;
CollectCallReq_struct collectCallReq;
ConfTreatInd_struct confTreat;
CorrelationId_struct correlationId;
OrigCalledNum_struct origCalledNum;
RedirgNum_struct redirgNum;
RedirInfo_struct redirInfo;
ScfId_struct scfId;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccIam_struct;
typedef struct BiccRel_struct {
CauseInd_struct cause;//V
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccRel_struct;
typedef struct BiccRlc_struct {
CauseInd_struct cause;
} BiccRlc_struct;
typedef struct BiccRes_struct {
SusResInd_struct susRes;//F
//Optional
} BiccRes_struct;
typedef struct BiccSus_struct {
SusResInd_struct susRes;//F
//Optional
} BiccSus_struct;
typedef struct BiccSam_struct {
SubseqNum_struct subseqNum;//V
//Optional
} BiccSam_struct;
typedef struct BiccMsg_struct
{
}BiccMsg_struct;
typedef union BiccMsg_union {
BiccAcm_struct acm;
BiccAnm_struct anm;
BiccApm_struct apm;
BiccCpg_struct cpg;
BiccCgb_struct cgb;
BiccCgba_struct cgba;
BiccCgu_struct cgu;
BiccCgua_struct cgua;
BiccGrs_struct grs;
BiccGra_struct gra;
BiccCon_struct con;
BiccIam_struct iam;
BiccRel_struct rel;
BiccRlc_struct rlc;
BiccRes_struct res;
BiccSus_struct sus;
BiccSam_struct sam;
} BiccMsg_union;
#endif

View File

@@ -0,0 +1,100 @@
#ifndef _q765_5E_H_
#define _q765_5E_H_
#include "define.h"
#define AP_ACTION 0x01
#define AP_BNCID 0x02
#define AP_IWFADDR 0x03
#define AP_CODECLIST 0x04
#define AP_SINGLECODEC 0x05
#define AP_BATCR 0x06
#define AP_BNCCHR 0x07
#define AP_BCINFO 0x08
#define AP_BCTUNNEL 0x09
#define AP_BCUI 0x0a
#define AP_SIGNAL 0x0b
#define AP_BRC 0x0c
#define AP_BRI 0x0d
#define AP_SIGNALTYPE 0x0e
#define AP_DURATION 0x0f
/************************************************/
/***** Encapsulated application information *****/
/************************************************/
typedef struct ActionInd_struct {
u8 pres;
u8 comp_info;
u8 val;
} ActionInd_struct;
typedef struct BncId_struct {
u8 pres;
u8 comp_info;
u8 len;
u8 val[4];
} BncId_struct;
typedef struct IwfAddr_struct {
u8 pres;
//...
} IwfAddr_struct;
typedef struct BncChr_struct {
u8 pres;
u8 comp_info;
u8 val;
} BncChr_struct;
typedef struct BCTP_struct {
// BTCP (Q.1990) //
u8 :1;
u8 bvei:1; //BCTP Version Error Indicator
u8 :1;
u8 btcp_version:5; //BCTP Version Indicator
u8 :1;
u8 tpei:1; //Tunnelled Protocol Error Indicator
u8 tunnel_protocol:6; //Tunnelled Protocol Indicator
// IPBCP (Q.1970) //
u8 ipbcp_len;
u8 ipbcp_content[200];
} BCTP_struct;
typedef struct BcInfo_struct {
u8 pres;
u8 comp_info;
BCTP_struct bctp;
} BcInfo_struct;
typedef struct BcTunnel_struct {
u8 pres;
u8 comp_info;
u8 val;
} BcTunnel_struct;
typedef struct SignalType_struct {
u8 pres;
u8 comp_info;
u8 val;
} SignalType_struct;
typedef struct Duration_struct {
u8 pres;
u8 comp_info;
u16 val;
} Duration_struct;
typedef struct ApmUser_struct {
u8 :6;
u8 sni:1; //Send notification indicator
u8 rci:1; //Release call indicator
ActionInd_struct action;
BncId_struct bnc_id;
BncChr_struct bnc_chr;
BcInfo_struct bc_info;
BcTunnel_struct bc_tunnel;
SignalType_struct signal_type;
Duration_struct duration;
} ApmUser_struct;
#endif

View File

@@ -0,0 +1,14 @@
#ifndef _VAR_EXT_H_
#define _VAR_EXT_H_
#include "define.h"
#include "biccif.h"
#include "inc.h"
extern u8 Bicc_Version[4];
extern BiccData_struct Bicc_Data;
extern BiccTimer_struct Timer_Data;
extern BiccReadPrim_union readPrim_union[BICC_MAX_PORT];
extern BiccWritePrim_union writePrim_union[BICC_MAX_PORT];
#endif

View File

@@ -0,0 +1,12 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\bicc\src
2
8
a:bicc_prm.c|1|11d70a3e7ec|33ed|1c8d9a4|5cd64a3a9a8611dd8b36001c23e19543|0
a:bicc_fsm.c|1|11d70a3e740|f45c|d7758e91|5e064a9a9a8611dd8b36001c23e19543|0
a:bicc_msg.c|1|11d70a3e7ad|8563|a0fc75de|5d764a6a9a8611dd8b36001c23e19543|0
a:bicc_apm.c|1|11d70a3e6d3|1363|b56b34ff|5cd64a529a8611dd8b36001c23e19543|0
7:include|2|0|0|0|b19bc6669b5711dd8e28001c23e19543|0
c:bicc_debug.c|1|11d70a3e702|54e6|55931a29|5d764a829a8611dd8b36001c23e19543|0
8:biccif.c|1|11d70a3e81b|800d|713cda1f|5ea64ae29a8611dd8b36001c23e19543|0
c:bicc_ipbcp.c|1|11d70a3e76f|1e3d|81f3ff1f|5ea64aca9a8611dd8b36001c23e19543|0

View File

@@ -0,0 +1,206 @@
#include <stdio.h>
#include <string.h>
#include "./include/q765_5e.h"
void apm_decode_action(ActionInd_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_action(u8 *flw_ptr, const ActionInd_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_bncid(BncId_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->len = length - 1;
memcpy(ptr->val, flw_ptr+1, ptr->len);
}
u32 apm_encode_bncid(u8 *flw_ptr, const BncId_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
memcpy(flw_ptr+1, ptr->val, ptr->len);
return ptr->len + 1;
}
void apm_decode_bncchr(BncChr_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_bncchr(u8 *flw_ptr, const BncChr_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_bcinfo(BcInfo_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->bctp.bvei = (flw_ptr[1] >> 6) & 0x01;
ptr->bctp.btcp_version = flw_ptr[1] & 0x1f;
ptr->bctp.tpei = (flw_ptr[2] >> 6) & 0x01;
ptr->bctp.tunnel_protocol = flw_ptr[2] & 0x3f;
ptr->bctp.ipbcp_len = length - 3;
memcpy(ptr->bctp.ipbcp_content, flw_ptr+3, ptr->bctp.ipbcp_len);
}
u32 apm_encode_bcinfo(u8 *flw_ptr, const BcInfo_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = (ptr->bctp.bvei << 6) + (1 << 5) + ptr->bctp.btcp_version;
flw_ptr[2] = (ptr->bctp.tpei << 6) + ptr->bctp.tunnel_protocol;
memcpy(flw_ptr+3, ptr->bctp.ipbcp_content, ptr->bctp.ipbcp_len);
return ptr->bctp.ipbcp_len + 3;
}
void apm_decode_bctunnel(BcTunnel_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_bctunnel(u8 *flw_ptr, const BcTunnel_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_signaltype(SignalType_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = flw_ptr[1];
}
u32 apm_encode_signaltype(u8 *flw_ptr, const SignalType_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val;
return 2;
}
void apm_decode_duration(Duration_struct *ptr, const u8 *flw_ptr, u8 length)
{
ptr->pres = 1;
ptr->comp_info = flw_ptr[0];
ptr->val = (flw_ptr[1] << 8) + flw_ptr[2];
}
u32 apm_encode_duration(u8 *flw_ptr, const Duration_struct *ptr)
{
flw_ptr[0] = ptr->comp_info;
flw_ptr[1] = ptr->val >> 8;
flw_ptr[2] = ptr->val & 0xff;
return 3;
}
void apm_decode(ApmUser_struct *ptr, const u8 *flw_ptr, u8 length)
{
const u8 *old_ptr = flw_ptr;
while(flw_ptr+flw_ptr[1]+2-old_ptr <= length)
{
if(*flw_ptr == 0)
break;
switch(*flw_ptr)
{
case AP_ACTION:
apm_decode_action(&ptr->action, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BNCID:
apm_decode_bncid(&ptr->bnc_id, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BNCCHR:
apm_decode_bncchr(&ptr->bnc_chr, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BCINFO:
apm_decode_bcinfo(&ptr->bc_info, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_BCTUNNEL:
apm_decode_bctunnel(&ptr->bc_tunnel, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_SIGNALTYPE:
apm_decode_signaltype(&ptr->signal_type, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
case AP_DURATION:
apm_decode_duration(&ptr->duration, flw_ptr+2, flw_ptr[1]);
flw_ptr += flw_ptr[1] + 2;
break;
default:
flw_ptr += flw_ptr[1] + 2;
break;
}
}
}
u32 apm_encode(u8 *flw_ptr, const ApmUser_struct *ptr)
{
u8 *old_ptr = flw_ptr;
if(ptr->action.pres == 1)
{
flw_ptr[0] = AP_ACTION;
flw_ptr[1] = apm_encode_action(flw_ptr+2, &ptr->action);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bnc_id.pres == 1)
{
flw_ptr[0] = AP_BNCID;
flw_ptr[1] = apm_encode_bncid(flw_ptr+2, &ptr->bnc_id);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bnc_chr.pres == 1)
{
flw_ptr[0] = AP_BNCCHR;
flw_ptr[1] = apm_encode_bncchr(flw_ptr+2, &ptr->bnc_chr);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bc_info.pres == 1)
{
flw_ptr[0] = AP_BCINFO;
flw_ptr[1] = apm_encode_bcinfo(flw_ptr+2, &ptr->bc_info);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->bc_tunnel.pres == 1)
{
flw_ptr[0] = AP_BCTUNNEL;
flw_ptr[1] = apm_encode_bctunnel(flw_ptr+2, &ptr->bc_tunnel);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->signal_type.pres == 1)
{
flw_ptr[0] = AP_SIGNALTYPE;
flw_ptr[1] = apm_encode_signaltype(flw_ptr+2, &ptr->signal_type);
flw_ptr += flw_ptr[1] + 2;
}
if(ptr->duration.pres == 1)
{
flw_ptr[0] = AP_DURATION;
flw_ptr[1] = apm_encode_duration(flw_ptr+2, &ptr->duration);
flw_ptr += flw_ptr[1] + 2;
}
return flw_ptr - old_ptr;
}

View File

@@ -0,0 +1,882 @@
#include "./include/var_ext.h"
//static u32 bicc_object_id[BICC_PREOID_LEN] = {1,3,6,1,4,1,1373,1,3,2,2,6};
//static u16 bicc_sub_page[BICC_DEBUG_PAGE] = {0};
//static u8 bicc_ascii_in[BICC_ASCIN_LEN] = {0};
//static u8 bicc_ascii_out[BICC_ASCOUT_LEN] = {0};
#define BICC_DEBUG_ID 17
#define BICC_VER_DEBUG "R91V0_01"
#define MONITOR_NONE 0x0000
#define MONITOR_ERROR 0x0010
#define MONITOR_ALL 0xffff
#define TRACE_FLAG_ON 1
#define TRACE_FLAG_OFF 0
u8 AsciInBuf[4096];
u8 AsciOutBuf[4096];
u8 AsciTempBuf[4096];
WORD MonitorFg;
u8 info[1024];
static u8 log_help[] = {
"BICC debug Help:\n\r\
\n\r\
1.help\n\r\
2.log all/none\n\r\
3.log error on/off\n\r\
4.list cg[-cgNo] \n\r\
5.list circuit[-circuitNo]\n\r\
6.list port[-portNo]\n\r\
7.list dmp\n\r\
8.trace on-portNo\n\r\
9.trace off[-portNo]\n\r\n\r\
"
};
static WORD disp_page[10];
static u8 *disp_ptr = (u8 *) disp_page;
static DWORD debug_status_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,1
};
static BYTE debug_status = 1;
static DWORD debug_name_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,2
};
static DWORD debug_ascin_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,3
};
static DWORD debug_ascout_id[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,4
};
static DWORD debug_page_title[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,1,1
};
static DWORD debug_page_line[20] =
{
1,3,6,1,4,1,1373,1,1,2,3,1,2,BICC_DEBUG_ID + 2,1,2,1
};
const static u8 BASE_ID_LEN = 15;
const static u8 PAGE_POINT = 14;
const static u8 LINE_POINT = 15;
static u8 title1_p[] =
{
" BICC Page 01 SAP Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
Enable\n\r\
CG num\n\r"
};
static u8 title2_p[] =
{
" BICC Page 02 CG Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
Enable\n\r\
SAP id\n\r\
NI\n\r\
DPC\n\r"
};
static u8 title3_p[] =
{
" BICC Page 03 CIrcuit Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
CG id\n\r\
CIC range\n\r\
HEAD CIC\n\r"
};
static u8 title4_p[] =
{
" BICC Page 04 Port Info\n\r\
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n\r\
Subpage\n\r\
Enable\n\r\
FSM State\n\r\
CIC State\n\r"
};
static u8 debug_disp_line(u8 page, u8 line)
{
u8 disp_length;
disp_length = 0;
disp_ptr = (u8 *) disp_page;
switch (page)
{
/*
case 1: // Page 1: sap Info
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page];
disp_length = 2;
break;
case 1:
disp_ptr = (BYTE *) &Bicc_Data.debug_data.sap_enable;
disp_length = 16;
break;
case 2:
disp_ptr = (BYTE *) &Bicc_Data.debug_data.sap_cg_num;
disp_length = 16;
break;
default:
break;
}
break;
case 2: // Page 2: cg Info
//disp_page[page] = (disp_page[page]+1)%BICC_MAX_CG;
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page]; //Subpage
disp_length = 2;
break;
case 1: //enable
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].used_flag);
disp_length = 16;
break;
case 2: //sap_id
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].sap_id);
disp_length = 16;
break;
case 3: //network_id
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].attrib.network_id);
disp_length = 16;
break;
case 4: //dpc
disp_ptr = (BYTE *) &(BiccResource.cg_pond[disp_page[page]].attrib.dpc);
disp_length = 16;
break;
default:
break;
}
break;
case 3: // Page 3: circuit Info
//disp_page[page] = (disp_page[page]+1)%BICC_MAX_CIRCUIT;
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page]; //Subpage
disp_length = 16;
break;
case 1: //cg_id
disp_ptr = (BYTE *) &(BiccResource.circuit_pond[disp_page[page]].cg_id);
disp_length = 16;
break;
case 2: //cic_range
disp_ptr = (BYTE *) &(BiccResource.circuit_pond[disp_page[page]].attrib.cic_range);
disp_length = 16;
break;
case 3: //head_cic
disp_ptr = (BYTE *) &(BiccResource.circuit_pond[disp_page[page]].attrib.head_cic);
disp_length = 16;
break;
default:
break;
}
break;
case 4: // Page 4: port Info
//disp_page[page] = (disp_page[page]+32)%BICC_MAX_PORT;
switch(line)
{
case 0:
disp_ptr = (BYTE *) &disp_page[page]; //Subpage
disp_length = 16;
break;
case 1: //enable
disp_ptr = (BYTE *) &(BiccResource.port_pond[disp_page[page]].used_flag);
disp_length = 16;
break;
case 2: //fsm_state
disp_ptr = (BYTE *) &(BiccResource.port_pond[disp_page[page]].fsm_state);
disp_length = 16;
break;
case 3: //cic_state
disp_ptr = (BYTE *) &(BiccResource.port_pond[disp_page[page]].cic_state);
disp_length = 16;
break;
default:
break;
}
break;
*/
default:
disp_length = 0;
break;
}
return disp_length;
}
static void debug_disp_page(u8 page)
{
u8 disp_line;
u8 disp_length;
debug_page_line[PAGE_POINT] = page + 5;
for (disp_line = 0; disp_line < 22; disp_line++)
{
disp_length = debug_disp_line(page, disp_line);
debug_page_line[LINE_POINT] = disp_line + 2;
debug_page_line[LINE_POINT + 1] = 2; // Data Pointer
debug_set_response(BASE_ID_LEN + 2, debug_page_line, disp_ptr, disp_length);
}
}
int bicc_debug_init(void)
{
BYTE page;
BYTE data[10];
BYTE *ptr;
strcpy(AsciInBuf, "\0");
strcpy(AsciOutBuf, "\0");
MonitorFg = MONITOR_NONE;
bzero(disp_page, 20);
ptr = data;
debug_set_response(BASE_ID_LEN, debug_status_id, &debug_status, 1);
debug_set_response(BASE_ID_LEN, debug_name_id, BICC_VER_DEBUG, 10);
debug_set_response(BASE_ID_LEN, debug_ascin_id, AsciInBuf, 4096);
debug_set_response(BASE_ID_LEN, debug_ascout_id, AsciOutBuf, 4096);
for (page = 1; page < 5; page++)
{
switch (page)
{
case 1: //page 1
ptr = title1_p;
break;
case 2: //page 2
ptr = title2_p;
break;
case 3: //page 3
ptr = title3_p;
break;
case 4: //page 4
ptr = title4_p;
break;
default:
break;
}
debug_page_title[PAGE_POINT] = 5 + page;
debug_set_response(BASE_ID_LEN + 1, debug_page_title, ptr, strlen(ptr));
debug_disp_page(page);
}
return 1;
}
void bicc_asciout_proc(const char *fmt, ...)
{
va_list ap;
char buf[1024];
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
if((strlen(AsciOutBuf) + strlen(buf)) < 4096)
strcat(AsciOutBuf, buf);
else
strcpy(AsciOutBuf, buf);
va_end(ap);
}
void bicc_debug_refresh(void)
{
// int i;
#if 0
for(i=0;i<16;i++)
{
Bicc_Data.debug_data.sap_enable[i] = BiccResource.sap_pond[i].used_flag;
Bicc_Data.debug_data.sap_cg_num[i] = BiccResource.sap_pond[i].cg_num;
}
#endif
}
#if 0
void list_sap(WORD sapNo)
{
//u8 sapinfo[1024];
if(sapNo >= BICC_MAX_SAP)
return;
sprintf(info,"\
Enable:%d\n\r\
cg num:%d\n\r",
BiccResource.sap_pond[sapNo].used_flag,BiccResource.sap_pond[sapNo].cg_num);
bicc_asciout_proc(info);
}
void list_all_sap()
{
int i;
sprintf(info, "Index CG(s)\n\r");
bicc_asciout_proc(info);
for(i=0; i<BICC_MAX_SAP; i++)
{
if(BiccResource.sap_pond[i].used_flag == 1)
{
sprintf(info, " %d %d\n\r", i, BiccResource.sap_pond[i].cg_num);
bicc_asciout_proc(info);
}
}
}
#endif
void list_cg(WORD cgNo)
{
const pal_cg_struct *pcg;
if(cgNo >= PAL_MAX_CG)
return;
pcg = pal_cg_ptr(cgNo);
if(pcg == NULL)
return;
sprintf(info, "\
Enable:%d\n\r\
sap id:%d\n\r\
circuit num:%d\n\r\
variant_type:%d\n\r\
priority:%d\n\r\
network id:%d\n\r\
opc:%ld\n\r\
dpc:%ld\n\r\
tg_id:%ld\n\r",
pcg->enable,pcg->sap_id,pcg->circuit_num,pcg->attrib.variant,pcg->attrib.priority,pcg->attrib.network_id,pcg->attrib.opc,pcg->attrib.dpc,pcg->attrib.tg_id);
bicc_asciout_proc(info);
}
void list_all_cg()
{
int i = 0;
const pal_cg_struct *pcg;
sprintf(info, "Index SAP Circuit(s) NetInd DPC OPC TG\n\r");
bicc_asciout_proc(info);
for(i=0; i<PAL_MAX_CG; i++)
{
pcg = pal_cg_ptr(i);
if(pcg == NULL)
continue;
if(pcg->enable==0)
continue;
if(pcg->attrib.protocol != PROTO_BICC)
continue;
sprintf(info, " %d %d %d %d %ld %ld %ld\n\r", i, pcg->sap_id, pcg->circuit_num, pcg->attrib.network_id, pcg->attrib.dpc, pcg->attrib.opc, pcg->attrib.tg_id);
bicc_asciout_proc(info);
}
}
void list_circuit(WORD circuitNo)
{
const pal_circuit_struct *pcircuit;
if(circuitNo >= PAL_MAX_CIRCUIT)
return;
pcircuit = pal_circuit_ptr(circuitNo);
if(pcircuit == NULL)
return ;
sprintf(info,"\
Enable:%d\n\r\
cg id:%d\n\r\
head cic:%ld\n\r\
cic range:%d\n\r\
plat id:%d\n\r",
pcircuit->enable,pcircuit->cg_id,pcircuit->attrib.head_cic,pcircuit->attrib.cic_range,pcircuit->attrib.plat_id);
bicc_asciout_proc(info);
}
void list_all_circuit()
{
int i = 0, j = 0;
const pal_circuit_struct *pcircuit;
const pal_cg_struct *pcg;
// for(i = 0; i < BICC_MAX_SAP; i ++)
//{
sprintf(info, "Index CG PLAT CIC(s)\n\r");
bicc_asciout_proc(info);
for(i=0; i<PAL_MAX_CG; i++)
{
pcg = pal_cg_ptr(i);
if(pcg == NULL)
continue;
if(pcg->enable == 0)
continue;
if(pcg->attrib.protocol != PROTO_BICC)
continue;
for(j = 0; j<PAL_MAX_CIRCUIT; j++)
{
pcircuit = pal_circuit_ptr(j);
if(pcircuit == NULL)
continue;
if(pcircuit->enable == 0 || pcircuit->cg_id != pcg->id)
continue;
sprintf(info, " %d %d %d %d (%ld~~%ld)\n\r", i, pcircuit->cg_id, pcircuit->attrib.plat_id, pcircuit->attrib.cic_range, pcircuit->attrib.head_cic, pcircuit->attrib.head_cic+pcircuit->attrib.cic_range);
bicc_asciout_proc(info);
}
}
}
void list_port(WORD portNo)
{
if(portNo>=BICC_MAX_PORT)
return;
sprintf(info,"\
upper port:%ld\n\r\
sprc_cmd:%x\n\r\
primitive_cmd:%x\n\r\
internal_cmd:%x\n\r\
cic state{\n\r\
call state:%d\n\r\
suspend state:%d\n\r\
block state:%d\n\r\
}\n\r\
fsm state{\n\r\
cpc_state:%d\n\r\
mgbs_state:%d\n\r\
mgbr_state:%d\n\r\
crs_state:%d\n\r\
crr_state:%d\n\r\
cgrs_state:%d\n\r\
cgrr_state:%d\n\r\
}\n\r",
Bicc_Data.port_data[portNo].su_proc_id,Bicc_Data.port_data[portNo].sprc_cmd,
Bicc_Data.port_data[portNo].primitive_cmd,Bicc_Data.port_data[portNo].internal_cmd,
Bicc_Data.port_data[portNo].cic_state.call_state,Bicc_Data.port_data[portNo].cic_state.sus_state,
Bicc_Data.port_data[portNo].cic_state.blo_state,Bicc_Data.port_data[portNo].fsm_state.cpc_state,
Bicc_Data.port_data[portNo].fsm_state.mgbs_state,Bicc_Data.port_data[portNo].fsm_state.mgbr_state,
Bicc_Data.port_data[portNo].fsm_state.crs_state,Bicc_Data.port_data[portNo].fsm_state.crr_state,
Bicc_Data.port_data[portNo].fsm_state.cgrs_state,Bicc_Data.port_data[portNo].fsm_state.cgrr_state);
bicc_asciout_proc(info);
}
void list_busy_port()
{
int i,j=0;
sprintf(info, "Index PortNo CallState\n\r");
bicc_asciout_proc(info);
for(i=0;i<BICC_MAX_PORT;i++)
{
if(Bicc_Data.port_data[i].used_flag == 1)
{
sprintf(info,"%d %d %s\n\r",j++,i,(Bicc_Data.port_data[i].cic_state.call_state==1)?"INCOMING":"OUTGOING");
bicc_asciout_proc(info);
}
}
}
void list_dmp()
{
sprintf(info, "\
dmp active: %d\n\r\
local plat id: %d\n\r\
remote ip: %lx\n\r", Bicc_Data.dmp_data.active,Bicc_Data.dmp_data.processor_id,Bicc_Data.dmp_data.remote_ip);
bicc_asciout_proc(info);
}
void bicc_debug_timer(void)
{
BYTE in_page, err_fg = 0;
BYTE *ascii_in_ptr = NULL;
BYTE *str_start = NULL, * tmpStr;
WORD str_len, portNo=0;
WORD num, cgNo, circuitNo;
if ((str_len = strlen(AsciInBuf)) > 0)
{
in_page = AsciInBuf[0] - 1;
ascii_in_ptr = AsciInBuf + 1;
if (in_page > 4)
err_fg = 1;
else if (strcmp(ascii_in_ptr,"log error on") == 0)
{
MonitorFg = MonitorFg | MONITOR_ERROR;
}
else if (strcmp(ascii_in_ptr,"log error off") == 0)
{
MonitorFg = MonitorFg & (~MONITOR_ERROR);
}
else if (strcmp(ascii_in_ptr,"log all") == 0)
{
MonitorFg = MONITOR_ALL;
}
else if (strcmp(ascii_in_ptr,"log none") == 0)
{
MonitorFg = MONITOR_NONE;
}
else if (strcmp(ascii_in_ptr,"help") == 0)
{
bicc_asciout_proc(log_help);
}
else if (isdigit(ascii_in_ptr[0]))
{
num = strtoul(ascii_in_ptr, NULL, 10);
disp_page[in_page] = num;
debug_disp_page(in_page);
}
else if ((str_start = strstr(ascii_in_ptr, ">")) != NULL)
{
num = strtoul(str_start + 1, NULL, 10);
disp_page[in_page] += num;
debug_disp_page(in_page);
}
else if ((str_start = strstr(ascii_in_ptr, "<"))!= NULL)
{
num = strtoul(str_start + 1, NULL, 10);
disp_page[in_page] -= num;
debug_disp_page(in_page);
}
#if 0
else if ((strstr (ascii_in_ptr, "list sap")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
sapNo = strtoul (tmpStr + 1, NULL, 10);
list_sap(sapNo);
}
else
{
list_all_sap();
}
}
#endif
else if ((strstr (ascii_in_ptr,"list cg")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
// if((tmpStr = strsep(&&ascii_in_ptr, " \t")) != NULL)
{
cgNo = strtoul (tmpStr+1, NULL, 10);
// strsep(, " \t");
list_cg(cgNo);
}
else
{
list_all_cg();
}
}
else if ((strstr (ascii_in_ptr, "list circuit")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
circuitNo = strtoul (tmpStr + 1, NULL, 10);
list_circuit(circuitNo);
}
else
{
list_all_circuit();
}
}
else if ((strstr (ascii_in_ptr, "list port")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
portNo = strtoul (tmpStr + 1, NULL, 10);
list_port(portNo);
}
else
{
list_busy_port();
}
}
else if((strstr (ascii_in_ptr, "list dmp")) != NULL)
{
list_dmp();
}
else if((strstr(ascii_in_ptr, "trace on")) != NULL)
{
if((tmpStr = strstr(ascii_in_ptr, "-")) != NULL)
{
portNo = strtoul(tmpStr + 1, NULL, 10);
//trace_port(portNo);
Bicc_Data.port_data[portNo].trace_flag = 1;
}
else
{}
}
else if ((strstr (ascii_in_ptr, "trace off")) != NULL)
{
if((tmpStr = strstr (ascii_in_ptr, "-")) != NULL)
{
portNo = strtoul (tmpStr + 1, NULL, 10);
Bicc_Data.port_data[portNo].trace_flag = 0;
}
else
{
int i;
for(i=0; i<BICC_MAX_PORT; i++)
Bicc_Data.port_data[i].trace_flag = 0;
}
}
else
err_fg = 1;
if (err_fg == 0)
bicc_asciout_proc("Command OK!\n\r");
else
bicc_asciout_proc("Command Error!\n\r");
strcpy(AsciInBuf, "\0");
}
bicc_debug_refresh();
}
void bicc_log_err(const char *fmt, ...)
{
if ((MonitorFg & MONITOR_ERROR) == MONITOR_ERROR)
{
va_list ap;
char buf[1024];
va_start(ap, fmt);
vsprintf(buf, fmt, ap);
if((strlen(AsciOutBuf) + strlen(buf)) < 4096-15)
{
strcat(AsciOutBuf, "\33[31m");
strcat(AsciOutBuf, buf);
strcat(AsciOutBuf, "\33[37m");
}
else
{
strcpy(AsciOutBuf, "\33[31m");
strcat(AsciOutBuf, buf);
strcat(AsciOutBuf, "\33[37m");
}
va_end(ap);
}
}
int bicc_log_procedure(WORD mgNo, WORD portIndex, WORD chnlIndex, char *msg)
{
u8 monFlag = 0;
monFlag = 1;
if (monFlag == 1)
{
if (strlen(msg) >= 4096)
sprintf(AsciTempBuf, "log msg is too long!\n\r");
else
sprintf(AsciTempBuf, "%s\n\r", msg);
bicc_asciout_proc(AsciTempBuf);
return 0;
}
return -1;
}
void display_bicc_msgtype(u8 msgtype, u32 cic)
{
switch(msgtype)
{
case M_ACM:
bicc_asciout_proc("ACM:Address complete");
break;
case M_ANM:
bicc_asciout_proc("ANM:Answer");
break;
case M_BLO:
bicc_asciout_proc("BLO:Blocking");
break;
case M_BLA:
bicc_asciout_proc("BLA:Blocking acknowledgement");
break;
case M_CPG:
bicc_asciout_proc("CPG:Call progress");
break;
case M_CGB:
bicc_asciout_proc("CGB:Circuit/CIC group blocking");
break;
case M_CGBA:
bicc_asciout_proc("CGBA:Circuit/CIC group blocking acknowledgement");
break;
case M_CQM:
bicc_asciout_proc("CQM:Circuit/CIC group query (national use)");
break;
case M_CQR:
bicc_asciout_proc("CQR:Circuit/CIC group query response (national use)");
break;
case M_GRS:
bicc_asciout_proc("GRS:Circuit/CIC group reset");
break;
case M_GRA:
bicc_asciout_proc("GRA:Circuit/CIC group reset acknowledgement");
break;
case M_CGU:
bicc_asciout_proc("CGU:Circuit/CIC group unblocking");
break;
case M_CGUA:
bicc_asciout_proc("CGUA:Circuit/CIC group unblocking acknowledgement");
break;
case M_CRG:
bicc_asciout_proc("CRG:Charge information (national use)");
break;
case M_CFN:
bicc_asciout_proc("CFN:Confusion");
break;
case M_CON:
bicc_asciout_proc("CON:Connect");
break;
case M_COT:
bicc_asciout_proc("COT:Continuity");
break;
case M_FAC:
bicc_asciout_proc("FAC:Facility ");
break;
case M_FAA:
bicc_asciout_proc("FAA:Facility accepted");
break;
case M_FRJ:
bicc_asciout_proc("FRJ:Facility reject");
break;
case M_FAR:
bicc_asciout_proc("FAR:Facility request");
break;
case M_FOT:
bicc_asciout_proc("FOT:Forward transfer");
break;
case M_IDR:
bicc_asciout_proc("IDR:Identification request");
break;
case M_IRS:
bicc_asciout_proc("IRS:Identification response");
break;
case M_INF:
bicc_asciout_proc("INF:Information (national use)");
break;
case M_INR:
bicc_asciout_proc("INR:Information request (national use)");
break;
case M_IAM:
bicc_asciout_proc("IAM:Initial address");
break;
case M_NRM:
bicc_asciout_proc("NRM:Network resource management");
break;
case M_REL:
bicc_asciout_proc("REL:Release");
break;
case M_RLC:
bicc_asciout_proc("RLC:Release complete");
break;
case M_RSC:
bicc_asciout_proc("RSC:Reset circuit/CIC");
break;
case M_RES:
bicc_asciout_proc("RES:Resume");
break;
case M_SGM:
bicc_asciout_proc("SGM:Segmentation");
break;
case M_SAM:
bicc_asciout_proc("SAM:Subsequent address");
break;
case M_SUS:
bicc_asciout_proc("SUS:Suspend");
break;
case M_UBL:
bicc_asciout_proc("UBL:Unblocking");
break;
case M_UBA:
bicc_asciout_proc("UBA:Unblocking acknowledgement");
break;
case M_UCIC:
bicc_asciout_proc("UCIC:Unequipped CIC (national use)");
break;
case M_APM:
bicc_asciout_proc("APM:Application Transport");
break;
case M_USR:
bicc_asciout_proc("USR:User-to-user information");
break;
default:
bicc_asciout_proc("Unknown message");
}
bicc_asciout_proc("(message type=0x%x cic=%d)\r\n",msgtype,cic);
}
void monitor_bicc_msg(BYTE *msg,BYTE buf_len, BYTE flag, u32 cic, u32 portNo)
{
BYTE i,temp_buf[1024];
if(MonitorFg == MONITOR_ALL)
{
if(flag == 0)
bicc_asciout_proc("\33[33mReceive:\33[0m");
else if(flag == 1)
bicc_asciout_proc("\33[32mSend:\33[0m");
else if(flag == 2)
bicc_asciout_proc("\33[34mRedirect:\33[0m");
display_bicc_msgtype(msg[0], cic);
if(flag != 2)
{
for (i = 0; i < buf_len; i ++)
{
sprintf(&temp_buf[3*i]," %02x", msg[i]);
}
sprintf(&temp_buf[3*i],"\n\r");
bicc_asciout_proc(temp_buf);
}
}
if(MonitorFg == MONITOR_NONE)
{}
if(Bicc_Data.port_data[portNo].trace_flag == 1)
{
if(flag == 0)
bicc_asciout_proc("\33[33mReceive:\33[0m");
else if(flag == 1)
bicc_asciout_proc("\33[32mSend:\33[0m");
else if(flag == 2)
bicc_asciout_proc("\33[34mRedirect:\33[0m");
display_bicc_msgtype(msg[0], cic);
if(flag != 2)
{
for (i = 0; i < buf_len; i ++)
{
sprintf(&temp_buf[3*i]," %02x", msg[i]);
}
sprintf(&temp_buf[3*i],"\n\r");
bicc_asciout_proc(temp_buf);
}
}
}

2093
omc/plat/bicc/src/bicc_fsm.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,362 @@
#include <stdio.h>
#include <string.h>
#include "./include/ipbcp.h"
int sdp_decode_orig(SdpOrig_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->username, token);
strcat(dst_ptr->username, "\0");
break;
case 2:
sprintf(dst_ptr->session_id, token);
strcat(dst_ptr->session_id, "\0");
break;
case 3:
sprintf(dst_ptr->version, token);
strcat(dst_ptr->version, "\0");
break;
case 4:
sprintf(dst_ptr->network_type, token);
strcat(dst_ptr->network_type, "\0");
break;
case 5:
sprintf(dst_ptr->address_type, token);
strcat(dst_ptr->address_type, "\0");
break;
case 6:
sprintf(dst_ptr->address, token);
strcat(dst_ptr->address, "\0");
break;
default:
return 0;
}
}
if(field_id != 6)
return 0;
else
return 1;
}
int sdp_decode_conn(SdpConn_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->network_type, token);
strcat(dst_ptr->network_type, "\0");
break;
case 2:
sprintf(dst_ptr->address_type, token);
strcat(dst_ptr->address_type, "\0");
break;
case 3:
sprintf(dst_ptr->address, token);
strcat(dst_ptr->address, "\0");
break;
default:
return 0;
}
}
if(field_id != 3)
return 0;
else
return 1;
}
int sdp_decode_time(SdpTime_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->start, token);
strcat(dst_ptr->start, "\0");
break;
case 2:
sprintf(dst_ptr->stop, token);
strcat(dst_ptr->stop, "\0");
break;
default:
return 0;
}
}
if(field_id != 2)
return 0;
else
return 1;
}
int sdp_decode_attrib(SdpAttrib_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
if(strstr(src_ptr, "ipbcp:") != src_ptr)
return 0;
src_ptr += strlen("ipbcp:");
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->version, token);
strcat(dst_ptr->version, "\0");
break;
case 2:
sprintf(dst_ptr->type, token);
strcat(dst_ptr->type, "\0");
break;
default:
return 0;
}
}
if(field_id != 2)
return 0;
else
return 1;
}
int sdp_decode_mediaAnn(SdpMediaAnn_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
while((token = strsep(&src_ptr, " ")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->media, token);
strcat(dst_ptr->media, "\0");
break;
case 2:
sprintf(dst_ptr->port, token);
strcat(dst_ptr->port, "\0");
break;
case 3:
sprintf(dst_ptr->transport, token);
strcat(dst_ptr->transport, "\0");
strcpy(dst_ptr->fmt_list, src_ptr);
strcat(dst_ptr->fmt_list, "\0");
break;
case 4:
// sprintf(dst_ptr->fmt_list, token);
break;
default:
break;
}
}
if(field_id < 4)
return 0;
else
return 1;
}
int sdp_decode_mediaAtt(SdpMediaAtt_struct *dst_ptr, char *src_ptr)
{
char *token;
unsigned char field_id = 0;
if(strstr(src_ptr, "rtpmap:") != src_ptr)
return 0;
src_ptr += strlen("rtpmap:");
while((token = strsep(&src_ptr, " /")) != NULL)
{
switch(++field_id)
{
case 1:
sprintf(dst_ptr->payload, token);
strcat(dst_ptr->payload, "\0");
break;
case 2:
sprintf(dst_ptr->encoding_name, token);
strcat(dst_ptr->encoding_name, "\0");
break;
case 3:
sprintf(dst_ptr->clock_rate, token);
strcat(dst_ptr->clock_rate, "\0");
break;
case 4:
// sprintf(dst_ptr->p_time, token);
field_id --;//to avoid 4 fields
break;
default:
return 0;
}
}
if(field_id != 3)
return 0;
else
return 1;
}
int sdp_decode_ptime(char* p_time, char *src_ptr)
{
char *token;
if((token = strstr(src_ptr, "ptime:")) == NULL)
return 0;
token = strtok(token, ":");
token = strtok(NULL, ":");
// p_time = token;
// if(strlen(token)<8)
if(token)
{
sprintf(p_time, token);
strcat(p_time, "\0");
}
return 1;
}
int ipbcp_decode(IPBCP_struct *ipbcp_ptr, const char *ptr)
{
char *token;
unsigned char field_id = 0;
char temp_ipbcp[200];
char *temp_ptr;
strncpy(temp_ipbcp, ptr, 200);
temp_ptr = temp_ipbcp;
memset(ipbcp_ptr, 0, sizeof(IPBCP_struct));
while((token = strsep(&temp_ptr, "\r\n")) != NULL)
{
if(strlen(token) == 0)
continue;
switch(++field_id)
{
case 1:
if((token[0] != 'v') || (token[1] != '='))
return 0;
sprintf(ipbcp_ptr->proto_ver, token+2);
strcat(ipbcp_ptr->proto_ver, "\0");
break;
case 2:
if((token[0] != 'o') || (token[1] != '='))
return 0;
if(!sdp_decode_orig(&ipbcp_ptr->orig, token+2))
return 0;
break;
case 3:
if((token[0] != 's') || (token[1] != '='))
return 0;
sprintf(ipbcp_ptr->session_name, token+2);
strcat(ipbcp_ptr->session_name, "\0");
break;
case 4:
if((token[0] != 'c') || (token[1] != '='))
return 0;
if(!sdp_decode_conn(&ipbcp_ptr->conn_data, token+2))
return 0;
break;
case 5:
if((token[0] != 't') || (token[1] != '='))
return 0;
if(!sdp_decode_time(&ipbcp_ptr->time, token+2))
return 0;
break;
case 6:
if((token[0] != 'a') || (token[1] != '='))
return 0;
if(!sdp_decode_attrib(&ipbcp_ptr->attrib, token+2))
return 0;
break;
case 7:
if((token[0] != 'm') || (token[1] != '='))
return 0;
if(!sdp_decode_mediaAnn(&ipbcp_ptr->m_ann, token+2))
return 0;
break;
case 8:
if((token[0] != 'a') || (token[1] != '='))
return 0;
if(sdp_decode_mediaAtt(&ipbcp_ptr->m_att, token+2))
// return 0;
;
else if(!sdp_decode_ptime(ipbcp_ptr->ptime, token+2))
return 0;
break;
case 9:
if((token[0] != 'a') || (token[1] != '='))
return 0;
if(!sdp_decode_ptime(ipbcp_ptr->ptime, token+2))
return 0;
default:
break;
}
}
return 1;
}
int ipbcp_encode(char *ptr, const IPBCP_struct *ipbcp_ptr)
{
char tmp_buf[128];
sprintf(ptr, "v=%s\r\n", ipbcp_ptr->proto_ver);
sprintf(tmp_buf, "o=%s %s %s %s %s %s\r\n",
ipbcp_ptr->orig.username,
ipbcp_ptr->orig.session_id,
ipbcp_ptr->orig.version,
ipbcp_ptr->orig.network_type,
ipbcp_ptr->orig.address_type,
ipbcp_ptr->orig.address);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "s=%s\r\n", ipbcp_ptr->session_name);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "c=%s %s %s\r\n",
ipbcp_ptr->conn_data.network_type,
ipbcp_ptr->conn_data.address_type,
ipbcp_ptr->conn_data.address);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "t=%s %s\r\n", ipbcp_ptr->time.start, ipbcp_ptr->time.stop);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "a=ipbcp:%s %s\r\n", ipbcp_ptr->attrib.version, ipbcp_ptr->attrib.type);
strcat(ptr, tmp_buf);
sprintf(tmp_buf, "m=%s %s %s %s\r\n",
ipbcp_ptr->m_ann.media,
ipbcp_ptr->m_ann.port,
ipbcp_ptr->m_ann.transport,
ipbcp_ptr->m_ann.fmt_list);
strcat(ptr, tmp_buf);
if(strlen(ipbcp_ptr->m_att.payload) != 0)
{
sprintf(tmp_buf, "a=rtpmap:%s %s/%s\r\n",
ipbcp_ptr->m_att.payload,
ipbcp_ptr->m_att.encoding_name,
ipbcp_ptr->m_att.clock_rate);
strcat(ptr, tmp_buf);
}
//ipbcp_ptr->ptime[7]='\0';
if((ipbcp_ptr->ptime[0] != '\0') && (strlen(ipbcp_ptr->ptime)<8))
{
sprintf(tmp_buf, "a=ptime:%s\r\n", ipbcp_ptr->ptime);
strcat(ptr, tmp_buf);
}
return strlen(ptr);
}

1285
omc/plat/bicc/src/bicc_msg.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,244 @@
#include "./include/inc.h"
#include "./include/var_ext.h"
#include "./include/q1902_3e.h"
/**********************************************/
/******* BICC Message&Primitive Mapping *******/
/**********************************************/
void app_msg2prm(AppTransM_struct *dst_ptr, AppTrans_struct *src_ptr)
{
dst_ptr->pres = src_ptr->pres;
if(src_ptr->pres == 1)
{
memcpy(&dst_ptr->apm_info, &src_ptr->apm_info, sizeof(ApmUser_struct));
dst_ptr->apm_info.sni = src_ptr->sni;
dst_ptr->apm_info.rci = src_ptr->rci;
}
}
void app_prm2msg(AppTrans_struct *dst_ptr, AppTransM_struct *src_ptr)
{
dst_ptr->pres = src_ptr->pres;
if(src_ptr->pres == 1)
{
dst_ptr->aci[0] = 0x00;
dst_ptr->aci[1] = 0x00;
dst_ptr->sni = src_ptr->apm_info.sni;
dst_ptr->rci = src_ptr->apm_info.rci;
dst_ptr->si = 0; //subsequent segment to first segment
dst_ptr->segment = 0; //final segment
dst_ptr->slr = 0;
memcpy(&dst_ptr->apm_info, &src_ptr->apm_info, sizeof(ApmUser_struct));
}
}
void bicc_msg2prm(BiccReadPrim_union *prm_ptr, BiccMsg_union *msg_ptr, u8 msg_type)
{
memset(prm_ptr, 0, sizeof(BiccReadPrim_union));
switch(msg_type)
{
case M_ACM:
memcpy(&prm_ptr->alert_ind.backCall, &msg_ptr->acm.backCall, sizeof(BackCallInd_struct));
app_msg2prm(&prm_ptr->alert_ind.app, &msg_ptr->acm.app);
memcpy(&prm_ptr->alert_ind.cause, &msg_ptr->acm.cause, sizeof(CauseInd_struct));
memcpy(&prm_ptr->alert_ind.confTreat, &msg_ptr->acm.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->alert_ind.optBackCall, &msg_ptr->acm.optBackCall, sizeof(OptBackCallInd_struct));
memcpy(&prm_ptr->alert_ind.utuInd, &msg_ptr->acm.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->alert_ind.utuInfo, &msg_ptr->acm.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_ANM:
app_msg2prm(&prm_ptr->setup_cnf.app, &msg_ptr->anm.app);
memcpy(&prm_ptr->setup_cnf.backCall, &msg_ptr->anm.backCall, sizeof(BackCallInd_struct));
memcpy(&prm_ptr->setup_cnf.confTreat, &msg_ptr->anm.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->setup_cnf.connNum, &msg_ptr->anm.connNum, sizeof(ConnNum_struct));
memcpy(&prm_ptr->setup_cnf.utuInd, &msg_ptr->anm.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->setup_cnf.utuInfo, &msg_ptr->anm.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_APM:
app_msg2prm(&prm_ptr->apm_ind.app, &msg_ptr->apm.app);
break;
case M_CPG:
memcpy(&prm_ptr->cpg_ind.eventInfo, &msg_ptr->cpg.eventInfo, sizeof(EventInfo_struct));
app_msg2prm(&prm_ptr->cpg_ind.app, &msg_ptr->cpg.app);
memcpy(&prm_ptr->cpg_ind.backCall, &msg_ptr->cpg.backCall, sizeof(BackCallInd_struct));
memcpy(&prm_ptr->cpg_ind.calldiver,&msg_ptr->cpg.calldiver, sizeof(BiccCpg_struct));
memcpy(&prm_ptr->cpg_ind.cause, &msg_ptr->cpg.cause, sizeof(CauseInd_struct));
memcpy(&prm_ptr->cpg_ind.confTreat, &msg_ptr->cpg.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->cpg_ind.connNum, &msg_ptr->cpg.connNum, sizeof(ConnNum_struct));
memcpy(&prm_ptr->cpg_ind.utuInd, &msg_ptr->cpg.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->cpg_ind.utuInfo, &msg_ptr->cpg.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_CGB:
memcpy(&prm_ptr->cgb_ind.cicGrpSpv, &msg_ptr->cgb.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgb_ind.rangeStatus, &msg_ptr->cgb.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGBA:
memcpy(&prm_ptr->cgb_cnf.cicGrpSpv, &msg_ptr->cgb.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgb_cnf.rangeStatus, &msg_ptr->cgb.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGU:
memcpy(&prm_ptr->cgu_ind.cicGrpSpv, &msg_ptr->cgu.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgu_ind.rangeStatus, &msg_ptr->cgu.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGUA:
memcpy(&prm_ptr->cgu_cnf.cicGrpSpv, &msg_ptr->cgu.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&prm_ptr->cgu_cnf.rangeStatus, &msg_ptr->cgu.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRS:
memcpy(&prm_ptr->grs_ind.rangeStatus, &msg_ptr->grs.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRA:
memcpy(&prm_ptr->grs_cnf.rangeStatus, &msg_ptr->grs.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CON:
app_msg2prm(&prm_ptr->setup_cnf.app, &msg_ptr->con.app);
memcpy(&prm_ptr->setup_cnf.backCall, &msg_ptr->con.backCall, sizeof(BackCallInd_struct));
memcpy(&prm_ptr->setup_cnf.confTreat, &msg_ptr->con.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->setup_cnf.connNum, &msg_ptr->con.connNum, sizeof(ConnNum_struct));
memcpy(&prm_ptr->setup_cnf.utuInd, &msg_ptr->con.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->setup_cnf.utuInfo, &msg_ptr->con.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_IAM:
memcpy(&prm_ptr->setup_ind.natConn, &msg_ptr->iam.natConn, sizeof(NatConnInd_struct));
memcpy(&prm_ptr->setup_ind.fwdCall, &msg_ptr->iam.fwdCall, sizeof(FwdCallInd_struct));
memcpy(&prm_ptr->setup_ind.callingPtyCat, &msg_ptr->iam.callingPtyCat, sizeof(CallingPtyCat_struct));
memcpy(&prm_ptr->setup_ind.transMedReq, &msg_ptr->iam.transMedReq, sizeof(TransMedReq_struct));
memcpy(&prm_ptr->setup_ind.calledPtyNum, &msg_ptr->iam.calledPtyNum, sizeof(CalledPtyNum_struct));
app_msg2prm(&prm_ptr->setup_ind.app, &msg_ptr->apm.app);
memcpy(&prm_ptr->setup_ind.callingPtyNum, &msg_ptr->iam.callingPtyNum, sizeof(CallingPtyNum_struct));
memcpy(&prm_ptr->setup_ind.collectCallReq, &msg_ptr->iam.collectCallReq, sizeof(CollectCallReq_struct));
memcpy(&prm_ptr->setup_ind.confTreat, &msg_ptr->iam.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&prm_ptr->setup_ind.correlationId, &msg_ptr->iam.correlationId, sizeof(CorrelationId_struct));
memcpy(&prm_ptr->setup_ind.origCalledNum, &msg_ptr->iam.origCalledNum, sizeof(OrigCalledNum_struct));
memcpy(&prm_ptr->setup_ind.redirgNum, &msg_ptr->iam.redirgNum, sizeof(RedirgNum_struct));
memcpy(&prm_ptr->setup_ind.redirInfo, &msg_ptr->iam.redirInfo, sizeof(RedirInfo_struct));
memcpy(&prm_ptr->setup_ind.scfId, &msg_ptr->iam.scfId, sizeof(ScfId_struct));
memcpy(&prm_ptr->setup_ind.utuInd, &msg_ptr->iam.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->setup_ind.utuInfo, &msg_ptr->iam.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_REL:
memcpy(&prm_ptr->rel_ind.cause, &msg_ptr->rel.cause, sizeof(CauseInd_struct));
memcpy(&prm_ptr->rel_ind.utuInd, &msg_ptr->rel.utuInd, sizeof(UserToUserInd_struct));
memcpy(&prm_ptr->rel_ind.utuInfo, &msg_ptr->rel.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_RLC:
memcpy(&prm_ptr->rel_cnf.cause, &msg_ptr->rlc.cause, sizeof(CauseInd_struct));
break;
case M_RES:
memcpy(&prm_ptr->res_ind.susRes, &msg_ptr->res.susRes, sizeof(SusResInd_struct));
break;
case M_SUS:
memcpy(&prm_ptr->sus_ind.susRes, &msg_ptr->sus.susRes, sizeof(SusResInd_struct));
break;
case M_SAM:
memcpy(&prm_ptr->info_ind.subseqNum, &msg_ptr->sam.subseqNum, sizeof(SubseqNum_struct));
break;
default:
break;
}
}
void bicc_prm2msg(BiccMsg_union *msg_ptr, BiccWritePrim_union *prm_ptr, u8 msg_type)
{
memset(msg_ptr, 0, sizeof(BiccMsg_union));
switch(msg_type)
{
case M_ACM:
memcpy(&msg_ptr->acm.backCall, &prm_ptr->alert_req.backCall, sizeof(BackCallInd_struct));
app_prm2msg(&msg_ptr->acm.app, &prm_ptr->alert_req.app);
memcpy(&msg_ptr->acm.cause, &prm_ptr->alert_req.cause, sizeof(CauseInd_struct));
memcpy(&msg_ptr->acm.confTreat, &prm_ptr->alert_req.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->acm.optBackCall, &prm_ptr->alert_req.optBackCall, sizeof(OptBackCallInd_struct));
memcpy(&msg_ptr->acm.utuInd, &prm_ptr->alert_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->acm.utuInfo, &prm_ptr->alert_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_ANM:
app_prm2msg(&msg_ptr->anm.app, &prm_ptr->setup_rsp.app);
memcpy(&msg_ptr->anm.backCall, &prm_ptr->setup_rsp.backCall, sizeof(BackCallInd_struct));
memcpy(&msg_ptr->anm.confTreat, &prm_ptr->setup_rsp.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->anm.connNum, &prm_ptr->setup_rsp.connNum, sizeof(ConnNum_struct));
memcpy(&msg_ptr->anm.utuInd, &prm_ptr->setup_rsp.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->anm.utuInfo, &prm_ptr->setup_rsp.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_APM:
app_prm2msg(&msg_ptr->apm.app, &prm_ptr->apm_req.app);
break;
case M_CPG:
memcpy(&msg_ptr->cpg.eventInfo, &prm_ptr->cpg_req.eventInfo, sizeof(EventInfo_struct));
app_prm2msg(&msg_ptr->cpg.app, &prm_ptr->cpg_req.app);
memcpy(&msg_ptr->cpg.backCall, &prm_ptr->cpg_req.backCall, sizeof(BackCallInd_struct));
memcpy(&msg_ptr->cpg.calldiver, &prm_ptr->cpg_req.calldiver, sizeof(BiccCpg_struct));
memcpy(&msg_ptr->cpg.cause, &prm_ptr->cpg_req.cause, sizeof(CauseInd_struct));
memcpy(&msg_ptr->cpg.confTreat, &prm_ptr->cpg_req.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->cpg.connNum, &prm_ptr->cpg_req.connNum, sizeof(ConnNum_struct));
memcpy(&msg_ptr->cpg.utuInd, &prm_ptr->cpg_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->cpg.utuInfo, &prm_ptr->cpg_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_CGB:
memcpy(&msg_ptr->cgb.cicGrpSpv, &prm_ptr->cgb_req.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgb.rangeStatus, &prm_ptr->cgb_req.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGBA:
memcpy(&msg_ptr->cgb.cicGrpSpv, &prm_ptr->cgb_rsp.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgb.rangeStatus, &prm_ptr->cgb_rsp.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGU:
memcpy(&msg_ptr->cgu.cicGrpSpv, &prm_ptr->cgu_req.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgu.rangeStatus, &prm_ptr->cgu_req.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CGUA:
memcpy(&msg_ptr->cgu.cicGrpSpv, &prm_ptr->cgu_rsp.cicGrpSpv, sizeof(CicGrpSpv_struct));
memcpy(&msg_ptr->cgu.rangeStatus, &prm_ptr->cgu_rsp.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRS:
memcpy(&msg_ptr->grs.rangeStatus, &prm_ptr->grs_req.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_GRA:
memcpy(&msg_ptr->grs.rangeStatus, &prm_ptr->grs_rsp.rangeStatus, sizeof(RangeStatus_struct));
break;
case M_CON:
app_prm2msg(&msg_ptr->con.app, &prm_ptr->setup_rsp.app);
memcpy(&msg_ptr->con.backCall, &prm_ptr->setup_rsp.backCall, sizeof(BackCallInd_struct));
memcpy(&msg_ptr->con.confTreat, &prm_ptr->setup_rsp.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->con.connNum, &prm_ptr->setup_rsp.connNum, sizeof(ConnNum_struct));
memcpy(&msg_ptr->con.utuInd, &prm_ptr->setup_rsp.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->con.utuInfo, &prm_ptr->setup_rsp.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_IAM:
memcpy(&msg_ptr->iam.natConn, &prm_ptr->setup_req.natConn, sizeof(NatConnInd_struct));
memcpy(&msg_ptr->iam.fwdCall, &prm_ptr->setup_req.fwdCall, sizeof(FwdCallInd_struct));
memcpy(&msg_ptr->iam.callingPtyCat, &prm_ptr->setup_req.callingPtyCat, sizeof(CallingPtyCat_struct));
memcpy(&msg_ptr->iam.transMedReq, &prm_ptr->setup_req.transMedReq, sizeof(TransMedReq_struct));
memcpy(&msg_ptr->iam.calledPtyNum, &prm_ptr->setup_req.calledPtyNum, sizeof(CalledPtyNum_struct));
app_prm2msg(&msg_ptr->iam.app, &prm_ptr->setup_req.app);
memcpy(&msg_ptr->iam.callingPtyNum, &prm_ptr->setup_req.callingPtyNum, sizeof(CallingPtyNum_struct));
memcpy(&msg_ptr->iam.collectCallReq, &prm_ptr->setup_req.collectCallReq, sizeof(CollectCallReq_struct));
memcpy(&msg_ptr->iam.confTreat, &prm_ptr->setup_req.confTreat, sizeof(ConfTreatInd_struct));
memcpy(&msg_ptr->iam.correlationId, &prm_ptr->setup_req.correlationId, sizeof(CorrelationId_struct));
memcpy(&msg_ptr->iam.origCalledNum, &prm_ptr->setup_req.origCalledNum, sizeof(OrigCalledNum_struct));
memcpy(&msg_ptr->iam.redirgNum, &prm_ptr->setup_req.redirgNum, sizeof(RedirgNum_struct));
memcpy(&msg_ptr->iam.redirInfo, &prm_ptr->setup_req.redirInfo, sizeof(RedirInfo_struct));
memcpy(&msg_ptr->iam.scfId, &prm_ptr->setup_req.scfId, sizeof(ScfId_struct));
memcpy(&msg_ptr->iam.utuInd, &prm_ptr->setup_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->iam.utuInfo, &prm_ptr->setup_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_REL:
memcpy(&msg_ptr->rel.cause, &prm_ptr->rel_req.cause, sizeof(CauseInd_struct));
memcpy(&msg_ptr->rel.utuInd, &prm_ptr->rel_req.utuInd, sizeof(UserToUserInd_struct));
memcpy(&msg_ptr->rel.utuInfo, &prm_ptr->rel_req.utuInfo, sizeof(UserToUserInfo_struct));
break;
case M_RLC:
memcpy(&msg_ptr->rlc.cause, &prm_ptr->rel_rsp.cause, sizeof(CauseInd_struct));
break;
case M_RES:
memcpy(&msg_ptr->res.susRes, &prm_ptr->res_req.susRes, sizeof(SusResInd_struct));
break;
case M_SUS:
memcpy(&msg_ptr->sus.susRes, &prm_ptr->sus_req.susRes, sizeof(SusResInd_struct));
break;
case M_SAM:
memcpy(&msg_ptr->sam.subseqNum, &prm_ptr->info_req.subseqNum, sizeof(SubseqNum_struct));
break;
default:
break;
}
}

1080
omc/plat/bicc/src/biccif.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\bicc\src\include
2
8
7:ipbcp.h|1|11d70a3e9ef|5ec|3918ea7e|c54bc7539b5711dd8e28001c23e19543|0
c:bicc_debug.h|1|11d70a3e8e6|2d0|bc45c482|c24bc6e39b5711dd8e28001c23e19543|0
a:q1902_3e.h|1|11d70a3ea1e|2d50|c4a74e73|c67bc76f9b5711dd8e28001c23e19543|0
5:inc.h|1|11d70a3e9c0|e57|566ed92f|c4abc7379b5711dd8e28001c23e19543|0
8:biccif.h|1|11d70a3e972|32e4|3f0cf7b4|c37bc6ff9b5711dd8e28001c23e19543|0
9:q765_5e.h|1|11d70a3ea4d|82e|ee80601c|c70bc78b9b5711dd8e28001c23e19543|0
9:var_ext.h|1|11d70a3ea7c|15c|91ea711b|c7abc7a79b5711dd8e28001c23e19543|0
8:define.h|1|11d70a3e991|1e9|94808f37|c41bc71b9b5711dd8e28001c23e19543|0

View File

@@ -0,0 +1,25 @@
#include "define.h"
#include "../../../debug/src/include/debug.h"
#define LOG_ERR_FLAG 0x01
#define LOG_BICC_FLAG 0x02
#define LOG_MSG_FLAG 0x04
#define LOG_TIME_FLAG 0x08
#define LOG_DMP_FLAG 0x10
#define LOG_ALL_FLAG 0x1f
#define LOG_FILE_FLAG 0x20
/*******************************/
#define MAX_OPR_LEN 16
#define MAX_OBJ_LEN 32
#define MAX_VALUE_LEN 32
#define BICC_PREOID_LEN 12
#define BICC_DEBUG_OID 17
#define BICC_DEBUG_PAGE 10
#define BICC_ASCIN_LEN 128
#define BICC_ASCOUT_LEN 4096
int bicc_debug_init();
void bicc_debug_timer();
void monitor_bicc_msg(u8 *msg,u8 buf_len, BYTE flag, u32 cic, u32 portNo);
void bicc_asciout_proc(const char *fmt, ...);

View File

@@ -0,0 +1,417 @@
#ifndef _BICCIF_H_
#define _BICCIF_H_
#include "q765_5e.h"
#include "q1902_3e.h"
#include "../../../mtp3/src/include/mtp3.h"
#include "../../../snmp/src/include/snmp.h"
//#include "../../../public/src/include/proto_pub.h"
#include "bicc_debug.h"
#include "../../../pal/pal.h"
/*********************************/
/*** BICC Management Structure ***/
/*********************************/
#define BICC_CM_OK 1 //command request success
#define BICC_CM_FAILED -1 //command request failed
/*************************************
******BICC Resource Structure*********
*************************************/
#define BICC_MAX_PORT 8192
#define BICC_CG_CIRCUIT 32
#define BICC_CIRCUIT_CIC 32
/*** BICC Primitive Parameter Structure (different to q1902_3e) ***/
typedef struct AppTransM_struct { //Application Transport Mechanism
u8 pres;
ApmUser_struct apm_info;
} AppTransM_struct;
/*********************************/
/**** BICC Primitive Structure ***/
/*********************************/
typedef struct BiccSetup_Req {
NatConnInd_struct natConn;//F
FwdCallInd_struct fwdCall;//F
CallingPtyCat_struct callingPtyCat;//F
TransMedReq_struct transMedReq;//F
CalledPtyNum_struct calledPtyNum;//V
AppTransM_struct app;
CallingPtyNum_struct callingPtyNum;
CollectCallReq_struct collectCallReq;
ConfTreatInd_struct confTreat;
CorrelationId_struct correlationId;
OrigCalledNum_struct origCalledNum;
RedirgNum_struct redirgNum;
RedirInfo_struct redirInfo;
ScfId_struct scfId;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccSetup_Req, BiccSetup_Ind;
typedef struct BiccSetup_Rsp {
AppTransM_struct app;
BackCallInd_struct backCall;//C: use it if no alert req is sent before
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccSetup_Rsp, BiccSetup_Cnf;
typedef struct BiccAlert_Req {
BackCallInd_struct backCall;//F
AppTransM_struct app;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
OptBackCallInd_struct optBackCall;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccAlert_Req, BiccAlert_Ind;
typedef struct BiccInfo_Req {
SubseqNum_struct subseqNum;//V
} BiccInfo_Req, BiccInfo_Ind;
typedef struct BiccApm_Req {
AppTransM_struct app;
} BiccApm_Req, BiccApm_Ind;
typedef struct BiccCpg_Req {
EventInfo_struct eventInfo;//F
AppTransM_struct app;
BackCallInd_struct backCall;
CallDiverInfo_struct calldiver;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccCpg_Req, BiccCpg_Ind;
typedef struct BiccRel_Req {
CauseInd_struct cause;//V
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccRel_Req, BiccRel_Ind;
typedef struct BiccRel_Rsp {
CauseInd_struct cause;
} BiccRel_Rsp, BiccRel_Cnf;
typedef struct BiccRes_Req {
SusResInd_struct susRes;//F
} BiccRes_Req, BiccRes_Ind;
typedef struct BiccSus_Req {
SusResInd_struct susRes;//F
} BiccSus_Req, BiccSus_Ind;
typedef struct BiccCgb_Req {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgb_Req, BiccCgb_Ind;
typedef struct BiccCgb_Rsp {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgb_Rsp, BiccCgb_Cnf;
typedef struct BiccCgu_Req {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgu_Req, BiccCgu_Ind;
typedef struct BiccCgu_Rsp {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgu_Rsp, BiccCgu_Cnf;
typedef struct BiccGrs_Req {
RangeStatus_struct rangeStatus;//V
} BiccGrs_Req, BiccGrs_Ind;
typedef struct BiccGrs_Rsp {
RangeStatus_struct rangeStatus;//V
} BiccGrs_Rsp, BiccGrs_Cnf;
typedef struct BiccSta_Req
{
BiccMsg_struct biccMsg;
}BiccSta_Req;
typedef struct BiccFac_Req
{
FacInd_struct facInd;
}BiccFac_Req, BiccFac_Ind;
typedef struct BiccFac_Rsp
{
FacInd_struct facInd;
}BiccFac_Rsp, BiccFac_Cnf;
typedef union BiccWritePrim_union {
BiccSetup_Req setup_req;
BiccSetup_Rsp setup_rsp;
BiccAlert_Req alert_req;
BiccInfo_Req info_req;
BiccApm_Req apm_req;
BiccCpg_Req cpg_req;
BiccRel_Req rel_req;
BiccRel_Rsp rel_rsp;
BiccRes_Req res_req;
BiccSus_Req sus_req;
BiccCgb_Req cgb_req;//only used in BICC module
BiccCgb_Rsp cgb_rsp;//only used in BICC module
BiccCgu_Req cgu_req;//only used in BICC module
BiccCgu_Rsp cgu_rsp;//only used in BICC module
BiccGrs_Req grs_req;//only used in BICC module
BiccGrs_Rsp grs_rsp;//only used in BICC module
BiccFac_Req fac_req;
BiccFac_Rsp fac_rsp;
} BiccWritePrim_union;
typedef union BiccReadPrim_union {
BiccSetup_Ind setup_ind;
BiccSetup_Cnf setup_cnf;
BiccAlert_Ind alert_ind;
BiccInfo_Ind info_ind;
BiccApm_Ind apm_ind;
BiccCpg_Ind cpg_ind;
BiccRel_Ind rel_ind;
BiccRel_Cnf rel_cnf;
BiccRes_Ind res_ind;
BiccSus_Ind sus_ind;
BiccCgb_Ind cgb_ind;//only used in BICC module
BiccCgb_Cnf cgb_cnf;//only used in BICC module
BiccCgu_Ind cgu_ind;//only used in BICC module
BiccCgu_Cnf cgu_cnf;//only used in BICC module
BiccGrs_Ind grs_ind;//only used in BICC module
BiccGrs_Cnf grs_cnf;//only used in BICC module
BiccFac_Ind fac_ind;
BiccFac_Cnf fac_cnf;
} BiccReadPrim_union;
/********************************************/
/****** BICC Internal Command *************/
/********************************************/
#define BICC_CMD_UNBLO 0x01
#define BICC_CMD_BLO 0x02
#define BICC_CMD_RESET 0x03
#define BICC_CMD_RESET_COMP 0x04
#define BICC_SI_CPCI 0x10
#define BICC_SI_CPCO 0x20
#define BICC_SI_BLS 0x30
#define BICC_SI_BLR 0x40
#define BICC_SI_MGBR 0x50
#define BICC_SI_MGBS 0x60
#define BICC_SI_CRS 0x70
#define BICC_SI_CRR 0x80
#define BICC_SI_CGRS 0x90
#define BICC_SI_CGRR 0xA0
/********************************************/
/****** BICC Event/Primitive Definition *****/
/********************************************/
#define BICC_SETUP_REQ 0x01 //user-defined, first 4-digit:type of primitive second 4-digit:type of event
#define BICC_SETUP_IND 0x41
#define BICC_SETUP_RSP 0x81
#define BICC_SETUP_CNF 0xc1
#define BICC_ALERT_REQ 0x02
#define BICC_ALERT_IND 0x42
#define BICC_INFO_REQ 0x03
#define BICC_INFO_IND 0x43
#define BICC_APM_REQ 0x04
#define BICC_APM_IND 0x44
#define BICC_PROG_REQ 0x05
#define BICC_PROG_IND 0x45
#define BICC_RELEASE_REQ 0x06
#define BICC_RELEASE_IND 0x46
#define BICC_RELEASE_RSP 0x86
#define BICC_RELEASE_CNF 0xc6
#define BICC_RESET_REQ 0x07
#define BICC_RESET_IND 0x47
#define BICC_RESET_CNF 0xc7
#define BICC_RESET_RSP 0x87
#define BICC_GROUP_RESET_REQ 0x17
#define BICC_BLOCK_REQ 0x08
#define BICC_BLOCK_IND 0x48
#define BICC_BLOCK_RSP 0x88
#define BICC_BLOCK_CNF 0xc8
#define BICC_UNBLOCK_REQ 0x09
#define BICC_UNBLOCK_IND 0x49
#define BICC_UNBLOCK_RSP 0x89
#define BICC_UNBLOCK_CNF 0xc9
#define BICC_SUSPEND_REQ 0x0a
#define BICC_SUSPEND_IND 0x4a
#define BICC_RESUME_REQ 0x0b
#define BICC_RESUME_IND 0x4b
#define BICC_REATTEMPT_IND 0x4c
#define BICC_FAILURE_IND 0x4f
#define BICC_FAC_REQ 0x0d
#define BICC_FAC_RSP 0x8d
#define BICC_FAC_IND 0x4d
#define BICC_FAC_CNF 0xcd
#define BICC_STA_IND 0x4e
#define BICC_STA_REQ 0x0e
#define BICC_MAINTENANCE_IND 0x44 //
#define BICC_STOP_REQ 0xee
#define BICC_STOP_CNF 0xef
typedef int f_bicc_setup_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_setup_anm_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_setup_con_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_release_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_release_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_alert_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_info_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_prog_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_suspend_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_resume_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_reset_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_reset_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_apm_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_reattempt_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_failure_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_block_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_block_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_unblock_ind(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef int f_bicc_unblock_cnf(Pst *pst, const BiccReadPrim_union *prm_ptr);
typedef struct bicc_eventhandle_struct
{
f_bicc_setup_ind *h_bicc_setup_ind;
f_bicc_setup_anm_cnf *h_bicc_setup_anm_cnf;
f_bicc_setup_con_cnf *h_bicc_setup_con_cnf;
f_bicc_release_ind *h_bicc_release_ind;
f_bicc_release_cnf *h_bicc_release_cnf;
f_bicc_alert_ind *h_bicc_alert_ind;
f_bicc_info_ind *h_bicc_info_ind;
f_bicc_prog_ind *h_bicc_prog_ind;
f_bicc_suspend_ind *h_bicc_suspend_ind;
f_bicc_resume_ind *h_bicc_resume_ind;
f_bicc_block_ind *h_bicc_block_ind;
f_bicc_block_cnf *h_bicc_block_cnf;
f_bicc_unblock_ind *h_bicc_unblock_ind;
f_bicc_unblock_cnf *h_bicc_unblock_cnf;
f_bicc_reset_ind *h_bicc_reset_ind;
f_bicc_reset_cnf *h_bicc_reset_cnf;
f_bicc_apm_ind *h_bicc_apm_ind;
f_bicc_reattempt_ind *h_bicc_reattempt_ind;
f_bicc_failure_ind *h_bicc_failure_ind;
}BICC_EventHandle_struct;
typedef struct _bicc_sap_attrib_
{
BICC_EventHandle_struct event_handle;
}bicc_sap_sttrib_;
typedef enum _BICC_network_id
{
SI_INTERNATIONAL = 0,
SI_INTERNATIONAL_SPARE = 1,
SI_NATIONAL = 2,
SI_NATIONAL_SPARE = 3,
}SI_Netwrok_ID;
typedef struct bicc_cic_state
{
u8 call_state;
u8 sus_state; //suspend state, remote hold? local hold?
u8 blo_state; //block state, remote block? local hold?
}BICC_CIC_state;
typedef struct bicc_fsm_state
{
u8 cpc_state;
u8 mgbs_state;
u8 mgbr_state;
u8 crs_state;
u8 crr_state;
u8 cgrs_state;
u8 cgrr_state;
}BICC_Fsm_state;
typedef struct bicc_port_struct
{
u8 used_flag;
u8 trace_flag;
u32 w_time;
u32 su_proc_id;
u8 sprc_cmd;
u8 primitive_cmd;
u8 internal_cmd;
BICC_Fsm_state fsm_state;
BICC_CIC_state cic_state;
up_message_2 s_mtp_msg; //message send to mtp3
}BICC_Port_struct;
extern up_message_2 r_mtp_msg; //message receive from mtp3
typedef struct BiccDmp_struct {
// If DMP is active, circuit 0-127 is according to proccessor 0, circuit 128-255 is accroding to proccessor 1 //
u8 active;
u8 processor_id;
u32 remote_ip;
} BiccDmp_struct;
/**********************
***upper layer interface***
***********************
*/
extern int BICC_con_req(Pst *pst, BiccSetup_Req *ptr); //iam //Connection establishment request
extern int BICC_con_rsp(Pst *pst, BiccSetup_Rsp *ptr); //anm,con //Connection establishment response
extern int BICC_rel_req(Pst *pst, BiccRel_Req *ptr); //Release request
extern int BICC_rel_rsp(Pst *pst, BiccRel_Rsp *ptr); //Release response
extern int BICC_alert_req(Pst *pst, BiccAlert_Req *ptr); //alert
extern int BICC_info_req(Pst *pst, BiccInfo_Req *ptr); //sam
extern int BICC_prog_req(Pst *pst, BiccCpg_Req *ptr); //progress
extern int BICC_apm_req(Pst *pst, BiccApm_Req *ptr);
extern int BICC_sus_req(Pst *pst, BiccSus_Req *ptr); //Call suspend request
extern int BICC_resm_req(Pst *pst, BiccRes_Req *ptr); //Call resume request
extern int BICC_block_req(Pst *pst, BiccCgb_Req *ptr); //block req
extern int BICC_block_rsp(Pst *pst, BiccCgb_Req *ptr);
extern int BICC_unblock_req(Pst *pst, BiccCgb_Req *ptr); //unblock req
extern int BICC_unblock_rsp(Pst *pst, BiccCgb_Req *ptr);
extern int BICC_reset_req(Pst *pst, BiccGrs_Req *ptr);
extern int BICC_reset_rsp(Pst *pst, BiccGrs_Rsp *ptr); //reset response
extern void BICC_EMPTY_OPTPAR(void *ptr, u8 prim);
extern BOOL bicc_trunk_reachable(u32 cg_id);
/*****************************
*** layer management interface***
******************************
*/
int BICC_active_dmp(u8 plat_id, u32 alter_id );
int BICC_deactive_dmp();
/***********************
*** lower layer interface***
************************
*/
void BICC_msdc_proc(u32 pid, up_message_2 *upmsg_ptr);
int BICC_mdsc_proc();
/******************************
*** system service interface***
*******************************
*/
void BICC_init(int interval_ms, int local_id);
void BICC_timer();
#endif

View File

@@ -0,0 +1,34 @@
#ifndef _DEFINE_H_
#define _DEFINE_H_
//typedef int BOOL;
#ifndef _T_U8
#define _T_U8
typedef unsigned char u8;
#endif
#ifndef _T_U16
#define _T_U16
typedef unsigned short u16;
#endif
#ifndef _T_U32
#define _T_U32
typedef unsigned int u32;
#endif
#define BICC_TOLERANT
#define BICC_REATTEMPT
#define BICC_DEBUG
//Event
#define EN_NONE 0x00
#define EN_ANM 0x01
#define EN_CON 0x02
#define EN_GROUP 0x03
#define M_LOCAL_BLOCK 0x01
#define M_REMOTE_BLOCK 0x02
#endif

View File

@@ -0,0 +1,162 @@
#ifndef _INC_H
#define _INC_H
#include <string.h>
#include <stdio.h>
#include "../../../mtp3/src/include/mtp3.h"
#include "../../../snmp/src/include/snmp.h"
#include "biccif.h"
#define BICC_VERSION {9, 0, 10, 0}
#define BICC_SCREEN_SIZE 32
#define BICC_TIMER_STOP 0
#define BICC_TIMER_EXPIRED 1
#define BICC_T1 15
#define BICC_T5 300
#define BICC_T7 30
#define BICC_T8 10
#define BICC_T9 120
#define BICC_T12 15
#define BICC_T13 300
#define BICC_T14 15
#define BICC_T15 300
#define BICC_T16 15
#define BICC_T17 300
#define BICC_T18 15
#define BICC_T19 300
#define BICC_T20 15
#define BICC_T21 300
#define BICC_T22 15
#define BICC_T23 300
//#define BICC_T24 1
//#define BICC_T25 1
//#define BICC_T26 60
//#define BICC_T27 240
#define BICC_T28 10
#define BICC_T33 12
#define BICC_T34 2
#define BICC_T35 15
//#define BICC_T36 10
//#define BICC_T37 2
#define BICC_T40 10
#define BICC_T41 10
#define BICC_T42 5
#define BICC_T43 5
#define BICC_USER_T10 10//user defined timer,10s
#define BICC_CIC_IDLE 0
#define BICC_INCOMING 1
#define BICC_OUTGOING 2
#define BICC_RESET 3
#define BICC_TYPE_INCOMING 0
#define BICC_TYPE_OUTGOING 1
#define BICC_TYPE_BIDIRECT 2
#define BICC_ORIG_SUSPEND 0 //originating side suspend
#define BICC_TERM_SUSPEND 1 //terminating side suspend
typedef struct BiccTimer_struct
{
int t1;
int t5;
int t7;
int t8;
int t9;
int t12;
int t13;
int t14;
int t15;
int t16;
int t17;
int t18;
int t19;
int t20;
int t21;
int t22;
int t23;
int t28;
int t33;
int t34;
int t35;
int t40;
int t41;
int t42;
int t43;
int user_t10;
}BiccTimer_struct;
typedef struct BiccMng_struct {
u8 state;
u32 lnk_id;
RangeStatus_struct rangeStatus;
} BiccMng_struct;
typedef struct BiccDebug_struct {
u32 flag;
u8 sap_enable[BICC_SCREEN_SIZE];
u8 sap_cg_num[BICC_SCREEN_SIZE];
//u8 cg_enable[BICC_SCREEN_SIZE];
//u8 network_id[BICC_SCREEN_SIZE];
// page 1 //
u8 cic_enable[BICC_SCREEN_SIZE];
u8 cic_type[BICC_SCREEN_SIZE];
u8 l_block[BICC_SCREEN_SIZE];
u8 r_block[BICC_SCREEN_SIZE];
// page 2 //
u8 cic_status[BICC_SCREEN_SIZE];
u8 cpc_state[BICC_SCREEN_SIZE];
u8 mgbs_state[BICC_SCREEN_SIZE];
u8 mgbr_state[BICC_SCREEN_SIZE];
u8 crs_state[BICC_SCREEN_SIZE];
u8 crr_state[BICC_SCREEN_SIZE];
u8 cgrs_state[BICC_SCREEN_SIZE];
u8 cgrr_state[BICC_SCREEN_SIZE];
// page 3 //
u8 sprc_command[BICC_SCREEN_SIZE];
u8 mgbs_command[BICC_SCREEN_SIZE];
u8 mgbr_command[BICC_SCREEN_SIZE];
u8 crs_command[BICC_SCREEN_SIZE];
u8 crr_command[BICC_SCREEN_SIZE];
u8 cgrs_command[BICC_SCREEN_SIZE];
u8 cgrr_command[BICC_SCREEN_SIZE];
u8 prim_command[BICC_SCREEN_SIZE];
// page 4 //
u8 mng_state;
u8 mng_lnk_id;
} BiccDebug_struct;
typedef struct BiccData_struct
{
BiccDebug_struct debug_data;
BiccMng_struct mng_data;
BiccDmp_struct dmp_data;
BiccTimer_struct timer_data[BICC_MAX_PORT];
//BICC_Fsm_state fsm_data[BICC_MAX_PORT];
BICC_Port_struct port_data[BICC_MAX_PORT];
}BiccData_struct;
typedef struct stat_struct {
// u32 en_cic;
u32 lblo_cic;
u32 rblo_cic;
// u32 in_cic;
// u32 out_cic;
// u32 bi_cic;
u32 idle_call;
u32 in_call;
u32 out_call;
u32 lsus_cic;
u32 rsus_cic;
}stat_struct;
#endif

View File

@@ -0,0 +1,60 @@
// Q.1970E; RFC 2327 //
#ifndef _IPBCP_H_
#define _IPBCP_H_
typedef struct SdpOrig_struct {
char username[16];
char session_id[16];
char version[8];
char network_type[8];
char address_type[8];
char address[16];
} SdpOrig_struct;
typedef struct SdpConn_struct {
char network_type[8];
char address_type[8];
char address[16];
} SdpConn_struct;
typedef struct SdpTime_struct {
char start[16]; //0
char stop[16]; //0
} SdpTime_struct;
typedef struct SdpAttrib_struct {
char version[8]; //1
char type[16]; //"Request"/"Accepted"/"Confused"/"Rejected"
} SdpAttrib_struct;
typedef struct SdpMediaAnn_struct {
char media[16];
char port[8];
char transport[16];
char fmt_list[128];
} SdpMediaAnn_struct;
// specify RTP dynamic payload types //
typedef struct SdpMediaAtt_struct {
char payload[8];
char encoding_name[16];
char clock_rate[8];
// char p_time[8];
} SdpMediaAtt_struct;
typedef struct IPBCP_struct {
char proto_ver[8]; //Protocol version (M)
SdpOrig_struct orig; //Orign (M)
char session_name[16]; //Session name (M)
SdpConn_struct conn_data; //Connection data
SdpTime_struct time; //Time
SdpAttrib_struct attrib; //Session attribute
SdpMediaAnn_struct m_ann; //Media announcement (M)
SdpMediaAtt_struct m_att; //Media attributes
char ptime[8];
} IPBCP_struct;
extern int ipbcp_decode(IPBCP_struct *ipbcp_ptr, const char *ptr);
extern int ipbcp_encode(char *ptr, const IPBCP_struct *ipbcp_ptr);
#endif

View File

@@ -0,0 +1,456 @@
#ifndef _q1902_3E_H_
#define _q1902_3E_H_
#include "define.h"
#include "q765_5e.h"
/******************************************/
/******** BICC SIO (Q.1901E C.7.3) ********/
/******************************************/
#define BICC_SI 13
/******************************************/
/* Message Type Codes (Q.1902-3E, page 5) */
/******************************************/
#define M_ACM 0x06//Address complete
#define M_ANM 0x09//Answer
#define M_APM 0x41//Application transport
#define M_BLO 0x13//Blocking
#define M_BLA 0x15//Blocking acknowledgement
#define M_CPG 0x2c//Call progress
#define M_CGB 0x18//Circuit/CIC group blocking
#define M_CGBA 0x1a//Circuit/CIC group blocking acknowledgement
#define M_CQM 0x2a//Circuit/CIC group query (national use)
#define M_CQR 0x2b//Circuit/CIC group query response (national use)
#define M_GRS 0x17//Circuit/CIC group reset
#define M_GRA 0x29//Circuit/CIC group reset acknowledgement
#define M_CGU 0x19//Circuit/CIC group unblocking
#define M_CGUA 0x1b//Circuit/CIC group unblocking acknowledgement
#define M_CRG 0x31//Charge information (national use)
#define M_CFN 0x2f//Confusion
#define M_CON 0x07//Connect
#define M_COT 0x05//Continuity
#define M_FAC 0x33//Facility
#define M_FAA 0x20//Facility accepted
#define M_FRJ 0x21//Facility reject
#define M_FAR 0x1f//Facility request
#define M_FOT 0x08//Forward transfer
#define M_IDR 0x36//Identification request
#define M_IRS 0x37//Identification response
#define M_INF 0x04//Information (national use)
#define M_INR 0x03//Information request (national use)
#define M_IAM 0x01//Initial address
#define M_LOP 0x40//Loop prevention
#define M_NRM 0x32//Network resource management
#define M_PRI 0x42//Pre-release information
#define M_REL 0x0c//Release
#define M_RLC 0x10//Release complete
#define M_RSC 0x12//Reset circuit/CIC
#define M_RES 0x0e//Resume
#define M_SGM 0x38//Segmentation
#define M_SAM 0x02//Subsequent address
#define M_SDM 0x43//Subsequent Directory Number (national use)
#define M_SUS 0x0d//Suspend
#define M_UBL 0x14//Unblocking
#define M_UBA 0x16//Unblocking acknowledgement
#define M_UCIC 0x2e//Unequipped CIC (national use)
#define M_USR 0x2d//User-to-user information
/*********************************************/
/* Parameter Name Codes (Q.1902-3E, page 10) */
/*********************************************/
#define P_APPTRANS 0x78//Application transport
#define P_BACKCALLIND 0x11//Backward call indicators
#define P_CALLEDPTYNUM 0x04//Called party number
#define P_CALLINGPTYNUM 0x0a//Calling party number
#define P_CALLINGPTYCAT 0x09//Calling party's category
#define P_CAUSEIND 0x02//Cause indicators
#define P_CICGRPSPV 0x15//Circuit/CIC group supervision message type
#define P_COLLECTCALLREQ 0x79//Collect call request
#define P_CONFTREATIND 0x72//Conference treatment indicators
#define P_CONNNUM 0x21//Connected number
#define P_CORRELATIONID 0x65//Correlation id
#define P_EVENINFO 0x24//Event information
#define P_FACIND 0x18//Facility indicator
#define P_FWDCALLIND 0x07//Forward call indicators
#define P_NATCONNIND 0x06//Nature of connection indicators
#define P_ORIGCALLEDNUM 0x28//Original called number
#define P_RANGESTATUS 0x16//Range and status
#define P_REDIRGNUM 0x0b//Redirecting number
#define P_REDIRINFO 0x13//Redirection information
#define P_SCFID 0x66//SCF id
#define P_SUBSEQNUM 0x05//Subsequent number
#define P_SUSRESIND 0x22//Suspend/Resume indicators
#define P_TRANSMEDREQ 0x02//Transmission medium requirement
#define P_UTUIND 0x2a//User-to-user indicators
#define P_UTUINFO 0x20//User-to-user information
#define P_CALLDIVERINFO 0x36//Call diversion information
#define P_OPTBACKCALLIND 0x29//Optional backward call indicators
/**********************************************/
/* Parameter Structure (Q.1902-3E, section 6) */
/**********************************************/
#define MAX_BICC_DIGIT 32
#define BICC_STATUS_LEN 32
#define BICC_APP_LEN 200
#define MAX_DIAGNOSTIC_LEN 32
typedef struct AppTrans_struct {
u8 pres;
u8 aci[2]; //Application context identifier
u8 :6;
u8 sni:1; //Send notification indicator
u8 rci:1; //Release call indicator
u16 :1;
u16 si:1; //Sequence indicator
u16 segment:6; //APM segmentation indicator
u16 :1;
u16 slr:7; //Segmentation local reference
// APM-user information (For APM'98-user application only) //
ApmUser_struct apm_info;
} AppTrans_struct;
typedef struct BackCallInd_struct {
u8 pres;
u8 val[2];
} BackCallInd_struct;
typedef struct CalledPtyNum_struct {
u8 pres;
u8 nai;
u8 inn;
u8 npi;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} CalledPtyNum_struct;
typedef struct CallingPtyNum_struct {
u8 pres;
u8 nai;
u8 ni;
u8 npi;
u8 apri;
u8 si;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} CallingPtyNum_struct;
typedef struct CallingPtyCat_struct {
u8 pres;
u8 val;
} CallingPtyCat_struct;
/* defined in Q.850E */
typedef struct CauseInd_struct {
u8 pres;
u8 codingStd;
u8 location;
u8 causeVal;
//diagnostic
} CauseInd_struct;
typedef struct CicGrpSpv_struct {
u8 pres;
u8 val;
} CicGrpSpv_struct;
typedef struct CollectCallReq_struct {
u8 pres;
u8 val;
} CollectCallReq_struct;
typedef struct ConfTreatInd_struct {
u8 pres;
u8 val;
} ConfTreatInd_struct;
typedef struct ConnNum_struct {
u8 pres;
u8 nai;
u8 npi;
u8 apri;
u8 si;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} ConnNum_struct;
typedef struct EventInfo_struct {
u8 pres;
u8 val;
} EventInfo_struct;
typedef struct FacInd_struct {
u8 pres;
u8 val;
} FacInd_struct;
typedef struct FwdCallInd_struct {
u8 pres;
u8 val[2];
} FwdCallInd_struct;
typedef struct GenericNumber_struct {
u8 pres;
u8 nqi; //Number qualifier indicator
u8 nai;
u8 ni;
u8 npi;
u8 apri;
u8 si;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} GenericNumber_struct;
typedef struct GenericDigits_struct /* Generic Digits */
{
u8 pres;
u8 typeOfDigits;
u8 encodeScheme;
u8 numOfDigit;
u8* digits;
} GenericDigits_struct;
typedef GenericDigits_struct CorrelationId_struct; //R10
//typedef struct CorrelationId_struct { //R9
// u8 pres;
// u8 digit[4]; //4 bytes
//}CorrelationId_struct;
typedef struct NatConnInd_struct {
u8 pres;
u8 val;
} NatConnInd_struct;
typedef struct OrigCalledNum_struct {
u8 pres;
u8 nai;
u8 npi;
u8 apri;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} OrigCalledNum_struct;
typedef struct RangeStatus_struct {
u8 pres;
u8 range;
u8 status[BICC_STATUS_LEN];
} RangeStatus_struct;
typedef struct RedirgNum_struct {
u8 pres;
u8 nai;
u8 npi;
u8 apri;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} RedirgNum_struct;
typedef struct RedirInfo_struct{
u8 pres;
u8 redInd;
u8 origRedirReason;
u8 redirCounter;
u8 redirReason;
}RedirInfo_struct;
typedef GenericDigits_struct ScfId_struct;
/*typedef struct ScfId_struct {
u8 pres;
u8 nai;
u8 inn;
u8 npi;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
}ScfId_struct;
*/
typedef struct SubseqNum_struct {
u8 pres;
u8 numOfDigit;
u8 digit[MAX_BICC_DIGIT];
} SubseqNum_struct;
typedef struct SusResInd_struct {
u8 pres;
u8 val;
} SusResInd_struct;
typedef struct TransMedReq_struct {
u8 pres;
u8 val;
} TransMedReq_struct;
typedef struct UserToUserInd_struct {
u8 pres;
u8 val;
} UserToUserInd_struct;
typedef struct UserToUserInfo_struct {
u8 pres;
u8 len;
u8 val[129];
} UserToUserInfo_struct;
typedef struct CallDiverInfo_struct
{
u8 pres;
u8 notifSubsOption;
u8 redirReason;
}CallDiverInfo_struct;
typedef struct OptBackCallInd_struct
{
u8 pres;
u8 inbandInfoInd;
u8 callDiverOccurInd;
u8 simpSegmInd;
u8 mlppUserInd;
}OptBackCallInd_struct;
/********************************************/
/* Message structure (Q.1902-3E, section 7) */
/********************************************/
typedef struct BiccAcm_struct {
BackCallInd_struct backCall;//F
AppTrans_struct app;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
OptBackCallInd_struct optBackCall;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccAcm_struct;
typedef struct BiccAnm_struct {
AppTrans_struct app;
BackCallInd_struct backCall;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccAnm_struct;
typedef struct BiccApm_struct {
AppTrans_struct app;
} BiccApm_struct;
typedef struct BiccCpg_struct {
EventInfo_struct eventInfo;//F
AppTrans_struct app;
BackCallInd_struct backCall;
CallDiverInfo_struct calldiver;
CauseInd_struct cause;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccCpg_struct;
typedef struct BiccCgb_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgb_struct;
typedef struct BiccCgba_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgba_struct;
typedef struct BiccCgu_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgu_struct;
typedef struct BiccCgua_struct {
CicGrpSpv_struct cicGrpSpv;//F
RangeStatus_struct rangeStatus;//V
} BiccCgua_struct;
typedef struct BiccGrs_struct {
RangeStatus_struct rangeStatus;//V
} BiccGrs_struct;
typedef struct BiccGra_struct {
RangeStatus_struct rangeStatus;//V
} BiccGra_struct;
typedef struct BiccCon_struct {
BackCallInd_struct backCall;//F
AppTrans_struct app;
ConfTreatInd_struct confTreat;
ConnNum_struct connNum;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccCon_struct;
typedef struct BiccIam_struct {
NatConnInd_struct natConn;//F
FwdCallInd_struct fwdCall;//F
CallingPtyCat_struct callingPtyCat;//F
TransMedReq_struct transMedReq;//F
CalledPtyNum_struct calledPtyNum;//V
AppTrans_struct app;
CallingPtyNum_struct callingPtyNum;
CollectCallReq_struct collectCallReq;
ConfTreatInd_struct confTreat;
CorrelationId_struct correlationId;
OrigCalledNum_struct origCalledNum;
RedirgNum_struct redirgNum;
RedirInfo_struct redirInfo;
ScfId_struct scfId;
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccIam_struct;
typedef struct BiccRel_struct {
CauseInd_struct cause;//V
UserToUserInd_struct utuInd;
UserToUserInfo_struct utuInfo;
} BiccRel_struct;
typedef struct BiccRlc_struct {
CauseInd_struct cause;
} BiccRlc_struct;
typedef struct BiccRes_struct {
SusResInd_struct susRes;//F
//Optional
} BiccRes_struct;
typedef struct BiccSus_struct {
SusResInd_struct susRes;//F
//Optional
} BiccSus_struct;
typedef struct BiccSam_struct {
SubseqNum_struct subseqNum;//V
//Optional
} BiccSam_struct;
typedef struct BiccMsg_struct
{
}BiccMsg_struct;
typedef union BiccMsg_union {
BiccAcm_struct acm;
BiccAnm_struct anm;
BiccApm_struct apm;
BiccCpg_struct cpg;
BiccCgb_struct cgb;
BiccCgba_struct cgba;
BiccCgu_struct cgu;
BiccCgua_struct cgua;
BiccGrs_struct grs;
BiccGra_struct gra;
BiccCon_struct con;
BiccIam_struct iam;
BiccRel_struct rel;
BiccRlc_struct rlc;
BiccRes_struct res;
BiccSus_struct sus;
BiccSam_struct sam;
} BiccMsg_union;
#endif

View File

@@ -0,0 +1,100 @@
#ifndef _q765_5E_H_
#define _q765_5E_H_
#include "define.h"
#define AP_ACTION 0x01
#define AP_BNCID 0x02
#define AP_IWFADDR 0x03
#define AP_CODECLIST 0x04
#define AP_SINGLECODEC 0x05
#define AP_BATCR 0x06
#define AP_BNCCHR 0x07
#define AP_BCINFO 0x08
#define AP_BCTUNNEL 0x09
#define AP_BCUI 0x0a
#define AP_SIGNAL 0x0b
#define AP_BRC 0x0c
#define AP_BRI 0x0d
#define AP_SIGNALTYPE 0x0e
#define AP_DURATION 0x0f
/************************************************/
/***** Encapsulated application information *****/
/************************************************/
typedef struct ActionInd_struct {
u8 pres;
u8 comp_info;
u8 val;
} ActionInd_struct;
typedef struct BncId_struct {
u8 pres;
u8 comp_info;
u8 len;
u8 val[4];
} BncId_struct;
typedef struct IwfAddr_struct {
u8 pres;
//...
} IwfAddr_struct;
typedef struct BncChr_struct {
u8 pres;
u8 comp_info;
u8 val;
} BncChr_struct;
typedef struct BCTP_struct {
// BTCP (Q.1990) //
u8 :1;
u8 bvei:1; //BCTP Version Error Indicator
u8 :1;
u8 btcp_version:5; //BCTP Version Indicator
u8 :1;
u8 tpei:1; //Tunnelled Protocol Error Indicator
u8 tunnel_protocol:6; //Tunnelled Protocol Indicator
// IPBCP (Q.1970) //
u8 ipbcp_len;
u8 ipbcp_content[200];
} BCTP_struct;
typedef struct BcInfo_struct {
u8 pres;
u8 comp_info;
BCTP_struct bctp;
} BcInfo_struct;
typedef struct BcTunnel_struct {
u8 pres;
u8 comp_info;
u8 val;
} BcTunnel_struct;
typedef struct SignalType_struct {
u8 pres;
u8 comp_info;
u8 val;
} SignalType_struct;
typedef struct Duration_struct {
u8 pres;
u8 comp_info;
u16 val;
} Duration_struct;
typedef struct ApmUser_struct {
u8 :6;
u8 sni:1; //Send notification indicator
u8 rci:1; //Release call indicator
ActionInd_struct action;
BncId_struct bnc_id;
BncChr_struct bnc_chr;
BcInfo_struct bc_info;
BcTunnel_struct bc_tunnel;
SignalType_struct signal_type;
Duration_struct duration;
} ApmUser_struct;
#endif

View File

@@ -0,0 +1,14 @@
#ifndef _VAR_EXT_H_
#define _VAR_EXT_H_
#include "define.h"
#include "biccif.h"
#include "inc.h"
extern u8 Bicc_Version[4];
extern BiccData_struct Bicc_Data;
extern BiccTimer_struct Timer_Data;
extern BiccReadPrim_union readPrim_union[BICC_MAX_PORT];
extern BiccWritePrim_union writePrim_union[BICC_MAX_PORT];
#endif

View File

@@ -0,0 +1,9 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\debug
2
5
3:doc|2|0|0|0|c92966b9bfa411dc8511001c23e19543|0
2:ut|2|0|0|0|ccc96799bfa411dc8511001c23e19543|0
3:src|2|0|0|0|ca59670dbfa411dc8511001c23e19543|0
8:Makefile|1|11d70a3eb18|b39|e7adc250|c9c966f1bfa411dc8511001c23e19543|0
3:lib|2|0|0|0|c92966d5bfa411dc8511001c23e19543|0

98
omc/plat/debug/Makefile Normal file
View File

@@ -0,0 +1,98 @@
##----------------------------------------------------------##
## ##
## Universal Makefile for module template : V1.6.3 ##
## ##
## Created : Wei Liu 07/04/11 ##
## Revision: [Last]Wei Liu 07/07/07 ##
## ##
##----------------------------------------------------------##
##---------------------------------------------------------------------##
##--------------------------------------
##
## Project correlation(Customer define)
##
##--------------------------------------
## MODULE= [Module Name]
## TYPE = app/plat => Module Type
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Debug ]
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Release]
## BUILD = lib/exef => Output file format
## CFG = debug/release => Build Configuration
## SRC_PATH = [Source file path]
## INC_PATH = [Include file path]
## APP_PATH = [App Module path]
## PLT_PATH = [Plat Module path]
## PLT_LIB = [Needed plat lib for Link] => just for test or wxc2main
## APP_LIB = [Needed app lib for Link] => just for test or wxc2main
## LIB_ADD = [Needed Extend lib for Link] => just for test or wxc2main
## PLT_LIB e.g. = haepub fsm mng proto kernel aif mgc mgcp sip rtp \
## 8ecp bicc smpp xapp tcap mtp3 m2ua \
## snmp iptrans debug sccp public
##
## APP_LIB e.g. = msc vlr ssf hlr ae pps mnp smsc vms aas
## LIB_ADD e.g. = -liba3a8 -lm
## OBJ_ADD = [Extend third party object files needed]
## TEST_OBJ_PATH = [module object files Path for test ] => just for test
##---------------------------------------------------------------------##
MODULE = debug
TYPE = plat
DBUG_FLAGS_ADD = -DDEBUG
RELS_FLAGS_ADD =
##Default commonly as below
BUILD = lib
CFG = debug
PLT_LIB =
APP_LIB =
LIB_ADD =
SRC_PATH = ./src
INC_PATH = ./src/include
PLT_PATH = ../../plat
APP_PATH = ../../mss
OBJ_ADD =
TEST_OBJ_PATH =
PREPROC_CMD =
POSTPROC_CMD =
##---------------------------------------------------------------------##
##--------------------------------------
##
## Make configuration(Customer define)
##
##--------------------------------------
## CCFLAG_SWITCH = on/off => gcc flag show on/off
## COVER_NEED = yes/no => PTF cover report needed
## COVER_REPORT_PATH = [path ] => PTF cover report path
CCFLAG_SWITCH = off
COVER_NEED = no
COVER_REPORT_PATH = ./output
##---------------------------------------------------------------------##
##--------------------------------------
##
## include makefile.rules (Do not change)
##
##--------------------------------------
include Makefile.rules

Binary file not shown.

BIN
omc/plat/debug/obj/debug.o Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\debug\src
2
2
7:include|2|0|0|0|caf96745bfa411dc8511001c23e19543|0
7:debug.c|1|11d70a3ec9e|8ae65|9fc7892a|e624829e6cf311dd91a5001c23e19543|0

15649
omc/plat/debug/src/debug.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\debug\src\include
2
2
7:debug.h|1|11d70a3ed79|655|b1b7068c|e6b482ce6cf311dd91a5001c23e19543|0
e:debug_struct.h|1|11d70a3ed4a|2b53|adf2b80f|e62482b66cf311dd91a5001c23e19543|0

View File

@@ -0,0 +1,64 @@
/* Debug module strucutre head file */
/* Written by Liu Wei 2005-05-10 */
/* Version 4.0 */
/* -------------------------------- */
#ifndef _DEBUG
#define _DEBUG
#include "debug_struct.h"
#include "dirent.h"
/* by simon at 23/9/25
mib_node *mib_root_node;
mib_node *mib_curr_node;
menu_node *menu_root_node;
menu_node *menu_curr_node;
mib_node mib_nodes[MIB_MAX_NODES];
*/
/* by simon at 23/9/25
//for test
char file_name[128];
FILE *fp_prt;
long int timeuse,max_time;
struct timeval tv_start, tv_end;
//for test
*/
/* by simon at 23/9/25
menu_node menu_nodes[MENU_MAX_NODES];
mib_child_node mib_child_nodes[MIB_MAX_CHILD_NODES];
debug_snmp_agent debug_snmp_agent_buf[MAX_PACKET_NUM];
end by simon */
//////////////////////////////interface declaration////////////////////////
void debug_init();
void debug_rt();
WORD find_child_index(mib_node *node_ptr, DWORD oid, char *name, BYTE type);
mib_node *find_node(mib_node *start_node_ptr, char *node_name, int find_type, DWORD *last_node_oid);
mib_node *search_mib_node(mib_node *start_mib_node_ptr, DWORD *oid, BYTE oid_len);
int debug_set_response(unsigned char object_id_len,unsigned int *object_id,unsigned char *data,unsigned short data_len);
int debug_get_response(unsigned char object_id_len,unsigned int *object_id,unsigned char *data,unsigned char *vartype);
menu_node *search_menu_node(menu_node *start_menu_node_ptr, BYTE *menu_id, BYTE id_len);
void Clear_Access_History();
void debug_set_agent();
void debug_get_agent();
int get_my_address (struct in_addr *addr);
//////////////////////////////end of interface declaration////////////////////////
#endif

View File

@@ -0,0 +1,375 @@
/* Debug module strucutre head file */
/* Written by Liu Zhiguo 2003-04-22 */
/* Version 2.0 */
/* -------------------------------- */
#ifndef _DEBUG_STRUCT
#define _DEBUG_STRUCT
#include "../../../public/src/include/pub_include.h"
#include "../../../iptrans/src/include/iptrans.h"
#include "../../../snmp/src/include/snmp.h"
#include "../../../snmp/src/include/heartbeat.h"
//Module ID
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
//a b c d e f g h i j k l m n o p q r s t u v w x y z
//a b c d e f g h i j k l m n o p r s t u v w y z
#define DEBUG_PORT 4965
#define DEBUG_SNMP_PORT 4956
#define SNMP_PORT 4957
#define DEBUG_VERSION "R9V0_03"
#define TELNET_SEND_BUF_LEN 1000
#define SERIAL_BUF_LEN 2048
#define DEBUG_MAX_PAGE 2
#define PAGE_MODULE_COUNT 24
#define MODULE_COUNT (PAGE_MODULE_COUNT*DEBUG_MAX_PAGE)
#define DEBUG_MAX_SEQID 0x7fffffff
#define DEBUG_SEQID_LEN 8
#define DEBUG_OMCBUF_LEN 1024
#define DEBUG_NAME_LEN 8
#define PAGE_COUNT 24
#define LINE_COUNT 23
#define MAX_ROW 25
#define MAX_COLUMN 80
#define TITLE_CHAR 2048
#define MAX_ASCII_LEN (1024*16)
#define DEBUG_SHM_KEY 0xa0600000
#define DEBUG_SHM_PERM 0664
#define MENU_TYPE 0
#define OID_TYPE 1
// MIB wangjian add
#define MIB_LIST_FILE "mib_list_file.txt"
#define MIB_FILES_DIR "./conf/MIB_files/"
#define MIB_OMC_PUB_SYSCONF_FILE "OMC_PUB_sysConf.csv"
#define MIB_PARAM_LIST_FILE "mib_param_list_file.txt"
#define MIB_WRITE_TREE "mib_write_tree.txt"
#define MIB_SYSTEM_CONFIG_FILE "System_Config.txt"
#define MIB_SYSTEM_IP_LIST_FILE "System_IP_List.txt"
#define MENU_TREE_FILE "menu_tree.txt"
#define MIB_MAX_CHILD_NODES_PER_NODE 256
#define MIB_MAX_NODES 1536
#define MIB_MAX_CHILD_NODES 1536 * 5
#define MIB_MAX_PARAM_SELECTS 1536 * 8
#define MIB_MAX_PARAM_INPUTS 1536 * 8
#define MIB_MAX_NODE_PARAMS 1536 * 4
#define MAX_TOTAL_INSTANCE 2048
#define MAX_NODE_PACKET_LENGTH 256
#define MAX_SEND_CHAR_NUM 512
//#define MIB_OPER_TYPE_GET 1
//#define MIB_OPER_TYPE_GET_ALL 2
//#define MIB_OPER_TYPE_SET 3
//#define MIB_OPER_TYPE_HELP 4
#define MIB_MODULE_REVISION_MAX_NUM 10
#define MIB_SUBSYS_MODULE_MAX_NUM 64
#define MIB_HOST_MAX_NUM 127
#define MIB_NODE_PARAM_MAX_LEN 64
#define GROUP_NUM 2
#define MEMBER_MAX_NUM 16
#define MENU_MAX_NODES 640
#define TODEC_HIGH_0 0
#define KEEPHEX_HIGH_0 1
#define KEEPHEX_LOW_0 2
#define KEEPHEX_LOW_E 3
#define KEEPHEX_LOW_F 4
#define TOASCII_LOW_0 5
#define KEEPASC_LOW_F 6
#define MAX_PACKET_NUM 16
#define MAX_SELECT_OPTION_NUM 21
#define MAX_OPTION_LENGTH 32
#define MAX_HOST_IP 16
#define MAX_PARAM_NUM 64
typedef struct CommandList
{
char cmm[128];
struct CommandList *nextcmm;
}cmmset,cmmrem;
// MIB end
typedef struct _DEBUG_TELNET_SEND_DATA
{
int telsend_datah;
BYTE telsend_data[TELNET_SEND_BUF_LEN];
}DEBUG_TELNET_SEND_DATA;
struct debug_line
{
BYTE pt_vartype;
WORD length;
BYTE *pointer;
};
struct debug_page
{
BYTE pointer_set_flag;
char title[TITLE_CHAR];
struct debug_line line_d[LINE_COUNT];
};
typedef struct debug_module_struct
{
char name[DEBUG_NAME_LEN];
char status[2];
char version[20];
BYTE maxpage;
BYTE ascii_in_set_flag;
BYTE ascii_out_set_flag;
BYTE *ascii_in;
WORD ascii_in_len;
BYTE *ascii_out;
WORD ascii_out_len;
struct debug_page page_d[PAGE_COUNT];
int seqid_h; // head sequence id for omc get
int seqid_t; // tail sequence id for omc get
BYTE omc_outbuf[DEBUG_SEQID_LEN][DEBUG_OMCBUF_LEN];
} debug_module_struct;
typedef struct debug_shm_struct
{
debug_module_struct module_d[MODULE_COUNT];
DEBUG_TELNET_SEND_DATA TelnetSendData;
} debug_shm_struct;
// by simon at 23/9/25
//struct debug_shm_struct *debug_shm_ptr;
//struct iptrans_shm *pIptransShm;
// MIB wangjian add
typedef struct _mibfile_imports_data
{
char father_name[64];
char from_file[32];
} mibfile_imports_data;
typedef struct _mibfile_module_data
{
char name[64]; // nod name
char LU[32]; // LAST-UPDATED
char OR[64]; // ORGANIZATION
char CI[128]; // CONTACT-INFO
char DE[1024]; // DESCRIPTION
char RE[MIB_MODULE_REVISION_MAX_NUM][32]; // REVISION
char RE_DE[MIB_MODULE_REVISION_MAX_NUM][1024]; // REVISION'S DESCRIPTION
int RE_index; // the number of RE and RE_DE
char father_name[64]; // father's name
char ID[32]; // child ID
} mibfile_module_data;
typedef struct _mibfile_object_data
{
char name[64]; // nod name
int ST; // STATUS: 1: current, 2: deprecated, 3: obsolete. 0: invalid
char DE[1024]; // DESCRIPTION
char RF[1024]; // ReferPart
char father_name[64]; // father's name
char ID[32]; // child ID
} mibfile_object_data;
typedef struct _mibfile_type_data
{
char name[64]; // nod name
int SY; // SYNTAX: 0:invalid. 1: Integer32, 2: INTEGER, 3: OCTET STRING, 4: OBJECT IDENTIFIER, 5: BITS, 6: IpAddress, 7: Counter32,
// 8: Gauge32, 9: TimeTicks, 10: Opaque, 11: Counter64, 12: Unsigned32, 13:Conceptual Tables
char UP[32]; // UnitsPart
BYTE MA; // MAX-ACCESS: 0: invalid, 1: not-accessible, 2: accessible-for-notify, 3: read-only, 4: read-write, 5: read-create 6: write-only
int ST; // STATUS
char DE[8192]; // DESCRIPTION
int total_instance; // total_instance
char RF[1024]; // ReferPart;
char father_name[64]; // father's name
char ID[32]; // child ID
} mibfile_type_data;
//typedef int (*mib_call)(DWORD *oid, BYTE oid_len, char *name, char *value, BYTE oper_type);
typedef struct _mib_child_node
{
char name[64];
DWORD oid;
void *child_ptr;
} mib_child_node;
typedef struct _mib_node
{
void *parent_ptr;
char name[32];
BYTE oid_len;
DWORD oid[32];
BYTE data_length;
BYTE module_index;
WORD total_instance;
WORD curr_instance;
WORD total_child_nodes;
BYTE enable_field_id;
BYTE enable_flag[32];
BYTE access_history;
char init_value[256];
//mib_call mib_proc;
char *remark_ptr;
//char remark[DEBUG_OMCBUF_LEN * 2];
mib_child_node *child_nodes[MIB_MAX_CHILD_NODES_PER_NODE];
BYTE max_access; // MAX-ACCESS: 0: invalid, 1: not-accessible, 2: accessible-for-notify, 3: read-only, 4: read-write, 5: read-create 6: write-only
}mib_node;
typedef struct _menu_node
{
void *father_ptr;
void *child_node[MENU_MAX_NODES];
mib_node *menu_oid_node;
BYTE oid[23];
BYTE id_len;
BYTE total_menu_child;
char name[32];
BYTE menu_id[20];
BYTE sys_group;
}menu_node;
// MIB FIELD struct
typedef struct _mib_param_select
{
WORD number;
char description[MIB_NODE_PARAM_MAX_LEN];
} mib_param_select;
typedef struct _instance_arr
{
DWORD ins;
BYTE eable;
}INSTANCE_ARR;
typedef struct _mib_param_input
{
BYTE input_param_type; // 0: toDec_high_0
// 1: keepHex_high_0
// 2: keepHex_low_0
// 3: keepHex_low_E
// 4: keepHex_low_F
// 5: toAscii_low_0
// 6: keepAscii_low_F
char input[MIB_NODE_PARAM_MAX_LEN];
} mib_param_input;
typedef struct _mib_node_param
{
void *parent_ptr;
char name[64];
BYTE id;
BYTE byte_begin;
BYTE byte_end;
BYTE bit_begin;
BYTE bit_end;
mib_param_select *select_ptr[16];
BYTE select_total;
BYTE select_value;
mib_param_input *input_ptr;
} mib_node_param;
typedef struct _mib_subsys_module
{
BYTE index;
DWORD oid[8];
char name[10];
BYTE max_group;
//char obj_type_no[3];
}mib_subsys_module;
typedef struct _mib_host
{
BYTE index;
BYTE group_index;
BYTE member_index;
char host_name[32];
WORD host_ip[4];
}mib_host;
typedef struct _module_command_save_flag
{
BYTE module_index;
DWORD oid[32];
BYTE oid_len;
BYTE save_select_id;
BYTE save_field_id;
}module_command_save_flag;
typedef struct param_field
{
char name[48]; //set fill in
char curr_input_value[32]; //set fill in
BYTE input_type;
BYTE curr_select_id;
BYTE total_select;
WORD value_arr[MAX_SELECT_OPTION_NUM];
char value_arr_remark[MAX_SELECT_OPTION_NUM][MAX_OPTION_LENGTH];
}param_field;
typedef struct debug_snmp_agent_packet
{
DWORD oid[32]; //set fill in
//0 idle 1 waitting get 2 waitting set 3 process 4 fail 5 success
BYTE cmm_state; //set fill in
//0 success 1 time out 2 buffer full 3 oid error 4 ip str error
//5 instance error 6 leaf node param forbidden 7 total field error
//8 no select option 9 snmp send error 1xx no child 2xx no select 3xx field input error
BYTE result_state;
BYTE agentClient;
BYTE oid_len; //set fill in
BYTE total_field; //set fill in
WORD total_instance; //set fill in
BYTE total_ip; //set fill in
char dst_ip[MAX_HOST_IP][15]; //set fill inxxx.xxx.xxx.xxx
param_field param_field_arr[MAX_PARAM_NUM];
}debug_snmp_agent;
//MIB end
typedef struct _comput_list
{
BYTE list_field_id;
char field_val[256][32];
mib_node *list_node;
}compute_list;
typedef struct _compute_field
{
char name[32];
mib_node *compute_node;
BYTE field_id;
char syntax_str[10][64];
BYTE syntax_count;
char print_val_str[128][32];
char print_name_str[128][32];
BYTE print_count;
}compute_field;
typedef struct _wxc2_debug_info
{
char wxc2_ver[32];
BYTE sys_type; // cdma 1 gsm 2 gc_ssw 3
BYTE mmi_switch; // on 1 0 off
}wxc2_debug_info;
#endif

View File

@@ -0,0 +1,5 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\debug\ut
2
1
c:debug_test.c|1|11d70a3ee25|68b1|93f0cb41|cd5967b5bfa411dc8511001c23e19543|0

View File

@@ -0,0 +1,926 @@
/************************************************
* debug_test.c
* Author: LiuWei
* Create: 2005-05-31
************************************************/
#include "./include/debug.h"
#include "../../iptrans/src/include/iptrans.h"
#include "../../snmp/src/include/snmp.h"
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/telnet.h>
#include <linux/kd.h>
#include <linux/keyboard.h>
#define BUFLEN 1024
#define MAX_RECV_NONE 20
#define REC_NUM 50
char shellcode[] = "\x97\x97\x97\x97\x97\x97";
//add test line
static struct itimerval itimer, old_itimer;
fd_set rset;
BYTE connect_flag = 0;
struct sockaddr_in sin_addr;
int flag = 1;
int sockfd;
char buffer[2048];
int command_list_count;
BYTE recv_over = 0;
int addr_len = sizeof(struct sockaddr_in);
int len = 0;
BYTE recv_ten_times = 0;
BYTE test_style = 2;
BYTE test_snmp_mode = 0;
char oid_cmm_state[128];
BYTE recv_none = 0;
//char file_name[128];
FILE *fp_conf,*fp_agent;
struct timeval tv_start, tv_end;
long timeuse;
long max_time;
int i, j;
int time_vel;
int multi;
char data_arr[1024], multi_str[16];
char command[1024];
char oid_command[128];
void AsciiToRbcd (BYTE *bcd_buf, const char *ascii_buf, int len);
void MMI_telnet();
void MMI_telnet_send(char *str);
void MMI_auto_test();
void MMI_telnet_recv();
void Set_Timer();
void On_Timer();
void MMI_telnet_cmd();
void debug_snmp_agent_test_input();
void debug_snmp_agent_test_output();
void debug_snmp_print();
void MMI_File_Test(char *data_arr);
void usage(char *p)
{
printf("Usage: %s [ip] [-a atuo test] [-m manual test] [-n normal start] [-f script file]\n\n", p);
printf("\n");
exit(0);
}
void msg(char *msg)
{
perror(msg);
exit(errno);
}
u_int32_t get_ip(char *host)
{
struct hostent *hp;
if(!(hp = gethostbyname(host)))
{
fprintf(stderr, "cannot resolve %s\n", host);
return (0);
}
return (*(u_int32_t *) hp->h_addr_list[0]);
}
int get_socket(char *target, int port)
{
int sock;
u_int32_t ip;
if(!(ip = get_ip(target)))
return (0);
bzero(&sin_addr, sizeof(sin_addr));
sin_addr.sin_family = AF_INET;
sin_addr.sin_port = htons(port);
sin_addr.sin_addr.s_addr = ip;
if(!(sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
msg("Get socket:");
if(ioctl(sock, FIONBIO, &flag) == -1)
{
printf("Set nonblock:");
close(sockfd);
exit(1);
}
if(connect(sock, (struct sockaddr *)&sin_addr, sizeof(sin_addr)) < 0)
if((errno != EWOULDBLOCK) && (errno != EINPROGRESS))
msg("Connect:");
return (sock);
}
void send_wont(int sock, int option)
{
char buf[3], *ptr = buf;
*ptr++ = IAC;
*ptr++ = WONT;
*ptr++ = (unsigned char)option;
if(write(sock, buf, 3) < 0)
msg("write");
return;
}
void send_will(int sock, int option)
{
char buf[3], *ptr = buf;
*ptr++ = IAC;
*ptr++ = WILL;
*ptr++ = (unsigned char)option;
if(write(sock, buf, 3) < 0)
msg("write");
return;
}
void send_do(int sock, int option)
{
char buf[3], *ptr = buf;
*ptr++ = IAC;
*ptr++ = DO;
*ptr++ = (unsigned char)option;
if(write(sock, buf, 3) < 0)
msg("write");
return;
}
void send_env(int sock, char *name, char *value)
{
char buf[BUFLEN], *ptr = buf;
*ptr++ = IAC;
*ptr++ = SB;
*ptr++ = TELOPT_NEW_ENVIRON;
*ptr++ = TELQUAL_IS;
*ptr++ = NEW_ENV_VAR;
strncpy(ptr, name, BUFLEN - 20);
ptr += strlen(ptr);
*ptr++ = NEW_ENV_VALUE;
strncpy(ptr, value, (&buf[BUFLEN - 1] - ptr) - 1);
ptr += strlen(ptr);
*ptr++ = IAC;
*ptr++ = SE;
if(write(sock, buf, (ptr - buf)) < 0)
msg("write");
return;
}
void do_negotiate(int sock)
{
send_will(sock, TELOPT_ECHO);
send_wont(sock, TELOPT_TTYPE);
send_wont(sock, TELOPT_NAWS);
send_wont(sock, TELOPT_LFLOW);
send_wont(sock, TELOPT_LINEMODE);
send_wont(sock, TELOPT_XDISPLOC);
send_will(sock, TELOPT_LFLOW);
send_will(sock, TELOPT_LINEMODE);
send_wont(sock, TELOPT_OLD_ENVIRON);
send_will(sock, TELOPT_NEW_ENVIRON);
send_will(sock, TELOPT_BINARY);
send_env(sock, "TTYPROMPT", shellcode);
return;
}
int main(int argc, char **argv)
{
int c, port = DEBUG_PORT;
char host[36] = "172.18.234.231";
strcpy(command, "");
strcpy(oid_command, "");
strcpy(oid_cmm_state, "");
if(argc < 2)
usage(argv[0]);
tv_start.tv_sec = 0;
tv_start.tv_usec = 0;
tv_end.tv_sec = 0;
tv_end.tv_usec = 0;
//ioperm(0x378,3,1);
/*
strcpy(file_name, "");
strcat(file_name, "debug_agent.txt");
remove(file_name);
*/
strcpy(file_name, "");
strcat(file_name, "debug_test_time_log.txt");
remove(file_name);
if((fp_prt = fopen(file_name, "a+")) == NULL)
{
printf("[debug] Error: cannot open %s.\r\n", file_name);
return 0;
}
while((c = getopt(argc, argv, "famn")) != -1)
{
switch (c)
{
case 'f': // costumer test
printf("The Debug test control by command script!");
test_style = 4;
break;
case 'a': // auto test
printf("The Debug Atuo Test!");
test_style = 1;
break;
case 'm': // manually test
printf("The Debug manually Test!");
test_style = 2;
break;
case 'n': // normal start
printf("The Debug Normal start!");
test_style = 3;
break;
}
}
debug_init(1);
iptrMainInit();
snmp_init(4957);
if(!(sockfd = get_socket(host, port)))
exit(-1);
command_list_count = 0;
if(test_style == 4)
strcpy(command, "");
strcpy(multi_str, "");
strcpy(data_arr, "");
strcpy(file_name, "");
strcat(file_name, "debug_test_conf.txt");
j = REC_NUM + 1;
if((fp_conf = fopen(file_name, "r")) == NULL)
{
printf("[debug] Error: cannot open %s.\r\n", file_name);
return 0;
}
Set_Timer();
while(1)
{
usleep(10);
}
}
void MMI_File_Test(char *data_arr)
{
for(i = 0; i < strlen(data_arr); i++)
if(data_arr[i] == ' ')
break;
if(i != strlen(data_arr))
strncpy(multi_str, data_arr, i);
multi_str[i] = '\0';
multi = strtoul(multi_str, NULL, 10);
for(; i < strlen(data_arr); i++)
{
if(data_arr[i] != ' ')
break;
}
strcpy(command, data_arr + i);
if(strncasecmp(command, "\\e", 2) == 0)
{
command[0] = 27;
command[1] = '\0';
}
if(strcmp(command, oid_command) != 0)
{
strcpy(oid_command, command);
if(strcmp(command, "\e") == 0)
fprintf(fp_prt, "Command :\e\n");
else
fprintf(fp_prt, "Command :%s \n", command);
}
if(strcmp(command, "\e") != 0)
{
strcat(command, "\r\n");
}
printf("%s", command);
MMI_telnet_send(command);
usleep(5);
recv_over = 0;
usleep(time_vel);
}
void MMI_auto_test()
{
strcpy(command, "");
switch (command_list_count)
{
case 0:
strcpy(command, "\e");
multi = 1;
break;
case 1:
strcpy(command, "menu");
multi = 5;
break;
case 2:
strcpy(command, "contents");
multi = 8;
break;
case 3:
strcpy(command, "cd 1");
multi = 10;
break;
case 4:
strcpy(command, "cd 4");
multi = 10;
break;
case 5:
strcpy(command, "list -a -f[2 4 10] -r -t");
multi = 25;
break;
case 6:
strcpy(command, "get #0.1");
multi = 15;
break;
case 7:
strcpy(command, "cmm");
multi = 15;
break;
case 8:
strcpy(command, "\e");
multi = 20;
break;
/*
case 9:
strcpy(command, "log all");
multi = 150;
break;
case 10:
strcpy(command, "\e");
multi = 10;
break;
case 11:
strcpy(command, "\e");
multi = 10;
break;
case 12:
strcpy(command, "log none");
multi = 15;
break;
case 13:
strcpy(command, "\e");
multi = 15;
break;
case 14:
strcpy(command, "help");
multi = 15;
break;
case 15:
strcpy(command, "\e");
multi = 15;
break;
*/
default:
command_list_count = 0xfffe;
break;
}
command_list_count++;
if(command_list_count == 0xffff)
{
test_snmp_mode = 1;
printf("The command test over\r\n");
printf("Test snmp senior interface......\r\n");
return;
}
time_vel = multi * 500;
if(command_list_count != 0xffff && recv_over == 2)
{
if(strcmp(command, oid_command) != 0)
{
strcpy(oid_command, command);
if(strcmp(command, "\e") == 0)
fprintf(fp_prt, "Command :\e");
else
fprintf(fp_prt, "Command :%s ", command);
}
if(strcmp(command, "\e") != 0)
{
strcat(command, "\r\n");
}
MMI_telnet_send(command);
usleep(5);
if(command_list_count > 0)
printf("%s", command);
recv_over = 0;
usleep(time_vel);
}
else
command_list_count--;
}
void MMI_telnet_recv()
{
len = 0;
bzero(buffer, sizeof(buffer));
len = recvfrom(sockfd, buffer, sizeof(buffer), 0,
(struct sockaddr *)&sin_addr, &addr_len);
if(len > 0)
{
printf("%s", buffer);
recv_none = 0;
}
else
{
if(recv_none < MAX_RECV_NONE)
recv_none++;
else if(recv_over == 1)
recv_over = 2;
return;
}
if(strstr(buffer, "<--"))
{
recv_over = 1;
return;
}
if(strstr(buffer, "CMM>") || strstr(buffer, "CFG>") ||
strstr(buffer, "MENU>") || recv_over == 1)
recv_over = 2;
return;
}
void MMI_telnet_cmd()
{
if(ioctl(fileno(stdin), FIONBIO, &flag) == -1)
{
printf("Set stdin nonblock:");
exit(1);
}
len = 0;
bzero(buffer, sizeof(buffer));
strcpy(command, "");
fgets(buffer, sizeof(buffer), stdin);
len = strlen(buffer);
if(!len)
return;
strcpy(command, buffer);
if(strcmp(command, oid_command) != 0)
{
strcpy(oid_command, command);
if(strcmp(command, "\e") == 0)
fprintf(fp_prt, "Command :ESC");
else
fprintf(fp_prt, "Command :%s ", command);
}
usleep(5);
if(strstr(buffer, "\e\n"))
recv_over = 2;
if(strcmp(buffer, "\e\n") != 0)
{
buffer[strlen(buffer) - 1] = '\0';
strcat(buffer, "\r\n");
}
if(recv_over > 1)
{
if(sendto(sockfd, buffer, len, 0, (struct sockaddr *)&sin_addr,
addr_len) < 0)
msg("Send");
recv_over = 0;
}
}
void MMI_telnet_send(char *str)
{
bzero(buffer, sizeof(buffer));
strcpy(buffer, str);
len = strlen(buffer);
if(strlen(str))
if(sendto(sockfd, buffer, len, 0, (struct sockaddr *)&sin_addr,
addr_len) < 0)
msg("Send");
}
void On_Timer()
{
if(test_style == 1)
{
iptrans_timer();
snmp_timer();
outb(0xff, 0x378);
//timeuse = 0;
//gettimeofday(&tv_start, NULL);
debug_rt();
/*
gettimeofday(&tv_end, NULL);
timeuse =
1000000 * (tv_end.tv_sec - tv_start.tv_sec) -
tv_start.tv_usec + tv_end.tv_usec;
if(timeuse > max_time)
max_time = timeuse;
fprintf(fp_prt,
" debug_rt time used: %ld (u sec)<=%ld\r\n\r\n",
timeuse, max_time);
*/
outb(0x00, 0x378);
if(connect_flag == 0)
{
do_negotiate(sockfd);
MMI_telnet_recv();
send_wont(sockfd, TELOPT_BINARY);
MMI_telnet_recv();
FD_ZERO(&rset);
connect_flag = 1;
}
MMI_telnet_recv();
if(!test_snmp_mode)
MMI_auto_test();
else
{
debug_snmp_agent_test_input();
debug_snmp_agent_test_output();
debug_snmp_print();
}
}
if(test_style == 2)
{
iptrans_timer();
snmp_timer();
outb(0xff, 0x378);
//timeuse = 0;
//gettimeofday(&tv_start, NULL);
debug_rt();
/*
gettimeofday(&tv_end, NULL);
timeuse =
1000000 * (tv_end.tv_sec - tv_start.tv_sec) -
tv_start.tv_usec + tv_end.tv_usec;
if(timeuse > max_time)
max_time = timeuse;
fprintf(fp_prt,
" debug_rt time used: %ld (u sec)<=%ld\r\n\r\n",
timeuse, max_time);
*/
outb(0x00, 0x378);
if(connect_flag == 0)
{
do_negotiate(sockfd);
MMI_telnet_recv();
send_wont(sockfd, TELOPT_BINARY);
MMI_telnet_recv();
FD_ZERO(&rset);
connect_flag = 1;
}
MMI_telnet_recv();
MMI_telnet_cmd();
}
if(test_style == 3)
{
iptrans_timer();
snmp_timer();
//timeuse = 0;
// gettimeofday(&tv_start, NULL);
//outb(0xff, 0x378);
debug_rt();
//outb(0x00, 0x378);
/*
gettimeofday(&tv_end, NULL);
timeuse =
1000000 * (tv_end.tv_sec - tv_start.tv_sec) -
tv_start.tv_usec + tv_end.tv_usec;
if(timeuse > max_time)
max_time = timeuse;
fprintf(fp_prt,
"debug_rt time used: %ld (u sec)<=%ld\r\n\r\n",
timeuse, max_time);
*/
}
if(test_style == 4)
{
iptrans_timer();
snmp_timer();
timeuse = 0;
gettimeofday(&tv_start, NULL);
outb(0xff, 0x378);
debug_rt();
outb(0x00, 0x378);
gettimeofday(&tv_end, NULL);
timeuse =
1000000 * (tv_end.tv_sec - tv_start.tv_sec) -
tv_start.tv_usec + tv_end.tv_usec;
if(timeuse > max_time)
max_time = timeuse;
if(timeuse>500)
fprintf(fp_prt,
" debug_rt time used: %ld (u sec)<=%ld\r\n\r\n",
timeuse, max_time);
if(connect_flag == 0)
{
do_negotiate(sockfd);
MMI_telnet_recv();
send_wont(sockfd, TELOPT_BINARY);
MMI_telnet_recv();
FD_ZERO(&rset);
connect_flag = 1;
}
MMI_telnet_recv();
if(recv_over == 2)
{
if(!feof(fp_conf))
{
fgets(data_arr, 1024, fp_conf);
if(data_arr[strlen(data_arr) - 1] == '\n')
data_arr[strlen(data_arr) - 1] = '\0';
else
{
if(!feof(fp_conf))
{
printf("Debug test conf file error!:%s\n",data_arr);
exit(0);
}
}
if(!strlen(data_arr) ||(strstr(data_arr,"\\")) == data_arr + 0)
return;
MMI_File_Test(data_arr);
}
else
{
if(j == 1)
test_style = 0;
else if(j > 0)
{
j--;
rewind(fp_conf);
}
}
}
}
}
void Set_Timer()
{
struct sigaction act;
act.sa_handler = On_Timer;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
if(sigaction(SIGALRM, &act, NULL) < 0)
{
perror("Produce Sigaction");
exit(1);
}
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = 20 * 1000;
itimer.it_value.tv_sec = 0;
itimer.it_value.tv_usec = 20 * 1000;
if(setitimer(ITIMER_REAL, &itimer, &old_itimer) != 0)
{
printf("Setting Timer error! \n");
exit(1);
}
}
void debug_snmp_agent_test_input()
{
debug_snmp_agent snmp_agent_packet1;
DWORD temp_oid1[32] =
{ 1, 3, 6, 1, 4, 1, 1373, 1, 3, 3, 2, 2, 2, 1, 2 };
DWORD temp_oid2[32] =
{ 1, 3, 6, 1, 4, 1, 1373, 1, 3, 3, 2, 2, 2, 1, 3 };
WORD i,index;
for(i=0;i<MAX_PACKET_NUM;i++)
{
if(debug_snmp_agent_buf[i].cmm_state==6)
debug_snmp_agent_buf[i].cmm_state=0;
}
for(index = 0; index < MAX_PACKET_NUM; index++)
if(debug_snmp_agent_buf[index].cmm_state == 0)
break;
if(index==MAX_PACKET_NUM)
return;
switch (test_snmp_mode)
{
case 1: // get once ,do not fill ip
for(i = 0; i < 32; i++)
snmp_agent_packet1.oid[i] = temp_oid1[i];
snmp_agent_packet1.oid_len = 16;
snmp_agent_packet1.oid[snmp_agent_packet1.oid_len - 1] = 0;
snmp_agent_packet1.cmm_state = 1;
break;
case 2: // get once ,fill ip
snmp_agent_packet1.total_ip = 1;
strcpy(snmp_agent_packet1.dst_ip[0], "172.18.133.1");
for(i = 0; i < 32; i++)
snmp_agent_packet1.oid[i] = temp_oid1[i];
snmp_agent_packet1.oid_len = 16;
snmp_agent_packet1.oid[snmp_agent_packet1.oid_len - 1] = 1;
snmp_agent_packet1.cmm_state = 1;
break;
case 3: // get all
if(index==0)
{
for(i = 0; i < 32; i++)
snmp_agent_packet1.oid[i] = temp_oid1[i];
snmp_agent_packet1.oid_len = 16;
snmp_agent_packet1.oid[snmp_agent_packet1.oid_len - 1] = 0;
snmp_agent_packet1.cmm_state = 1;
}
break;
case 4: // get all
if(index==0)
{
for(i = 0; i < 32; i++)
snmp_agent_packet1.oid[i] = temp_oid2[i];
snmp_agent_packet1.oid_len = 16;
snmp_agent_packet1.oid[snmp_agent_packet1.oid_len - 1] = 0;
snmp_agent_packet1.cmm_state = 1;
}
break;
case 5: // set once
for(i = 0; i < 32; i++)
snmp_agent_packet1.oid[i] = temp_oid2[i];
snmp_agent_packet1.oid_len = 16;
snmp_agent_packet1.oid[snmp_agent_packet1.oid_len - 1] = 255;
snmp_agent_packet1.total_ip = 1;
snmp_agent_packet1.total_field = 15;
strcpy(snmp_agent_packet1.dst_ip[0], "172.18.144.1");
strcpy(snmp_agent_packet1.param_field_arr[0].curr_input_value,
"");
snmp_agent_packet1.param_field_arr[0].total_select = 6;
snmp_agent_packet1.param_field_arr[0].curr_select_id = 3;
strcpy(snmp_agent_packet1.param_field_arr[1].curr_input_value,
"");
snmp_agent_packet1.param_field_arr[1].total_select = 6;
snmp_agent_packet1.param_field_arr[1].curr_select_id = 3;
strcpy(snmp_agent_packet1.param_field_arr[2].curr_input_value,
"");
snmp_agent_packet1.param_field_arr[2].total_select = 6;
snmp_agent_packet1.param_field_arr[2].curr_select_id = 3;
strcpy(snmp_agent_packet1.param_field_arr[9].curr_input_value,
"");
snmp_agent_packet1.param_field_arr[9].total_select = 2;
snmp_agent_packet1.param_field_arr[9].curr_select_id = 1;
snmp_agent_packet1.cmm_state = 1;
break;
}
if(index != MAX_PACKET_NUM)
{
memcpy(&debug_snmp_agent_buf[index], &snmp_agent_packet1,
sizeof(debug_snmp_agent));
test_snmp_mode++;
}
}
void debug_snmp_agent_test_output()
{
WORD i;
for(i=0;i<MAX_PACKET_NUM;i++)
{
if(debug_snmp_agent_buf[i].cmm_state>3)
debug_snmp_agent_buf[i].cmm_state=6;
}
}
void debug_snmp_print()
{
char cmm_state_flag[128], result_state_flag[128], temp_str[32];
WORD i, j;
strcpy(file_name, "");
strcat(file_name, "debug_agent.txt");
if((fp_agent = fopen(file_name, "a+")) == NULL)
{
printf("[debug] Error: cannot open %s.\r\n", file_name);
return ;
}
strcpy(cmm_state_flag, "cmm_state: ");
strcpy(result_state_flag, "result : ");
fprintf(fp_agent,"\r\nDebug snmp senior interface buffer: \r\n");
fprintf(fp_agent,"index : ");
for(i = 0; i < 16; i++)
fprintf(fp_agent,"%3d ", i);
fprintf(fp_agent,"\r\n");
for(i = 0; i < MAX_PACKET_NUM; i++)
if(debug_snmp_agent_buf[i].cmm_state != 0)
break;
//if(i == MAX_PACKET_NUM)
// return;
for(i = 0; i < MAX_PACKET_NUM; i++)
{
sprintf(temp_str, "%3d ", debug_snmp_agent_buf[i].cmm_state);
strcat(cmm_state_flag, temp_str);
}
if(strcmp(oid_cmm_state, cmm_state_flag) != 0)
{
strcpy(oid_cmm_state, cmm_state_flag);
fprintf(fp_agent,cmm_state_flag);
fprintf(fp_agent,"\r\n");
for(i = 0; i < MAX_PACKET_NUM; i++)
{
sprintf(temp_str, "%3d ",debug_snmp_agent_buf[i].result_state);
strcat(result_state_flag, temp_str);
}
fprintf(fp_agent,result_state_flag);
fprintf(fp_agent,"\r\n id OID OID_len Total field Total instance \r\n");
for(i = 0; i < MAX_PACKET_NUM; i++)
{
strcpy(cmm_state_flag, "");
sprintf(temp_str, "[%2d]: ", i);
strcat(cmm_state_flag, temp_str);
for(j = 0; j < 32 && debug_snmp_agent_buf[i].oid[j] != 0;
j++)
{
sprintf(temp_str, "%ld.",
debug_snmp_agent_buf[i].oid[j]);
strcat(cmm_state_flag, temp_str);
}
if(j < debug_snmp_agent_buf[i].oid_len - 1)
{
fprintf(fp_agent,"%ld.", debug_snmp_agent_buf[i].oid[j]);
}
sprintf(temp_str, " %d ",
debug_snmp_agent_buf[i].oid_len);
strcat(cmm_state_flag, temp_str);
fprintf(fp_agent,cmm_state_flag);
fprintf(fp_agent," %3d ",
debug_snmp_agent_buf[i].total_field);
fprintf(fp_agent," %3d \r\n",
debug_snmp_agent_buf[i].total_instance);
}
fprintf(fp_agent,"\r\n");
}
fclose(fp_agent);
}
/*
#define numFuncs 2
typedef void ( *ptFuncDef )();
ptFuncDef ptFuncArr[] = { &debug_mmi_list, &debug_snmp_get_rt,&debug_snmp_set_rt,&debug_ };
for ( i = 0; i < numFuncs; i++ )
{
gettimeofday( &start, NULL );
ptFuncArr[i]();
gettimeofday( &end, NULL );
}
*/

View File

@@ -0,0 +1,9 @@
ClearCase CopyAreaDB|4
vobs\r9\plat\haepub
2
5
3:doc|2|0|0|0|cf2966e1bfa411dc8515001c23e19543|0
2:ut|2|0|0|0|d47967f9bfa411dc8515001c23e19543|0
3:src|2|0|0|0|d0596735bfa411dc8515001c23e19543|0
8:Makefile|1|11d70a3eed1|b72|9d4ed28c|cfb96719bfa411dc8515001c23e19543|0
3:lib|2|0|0|0|cf2966fdbfa411dc8515001c23e19543|0

98
omc/plat/haepub/Makefile Normal file
View File

@@ -0,0 +1,98 @@
##----------------------------------------------------------##
## ##
## Universal Makefile for module template : V1.6.3 ##
## ##
## Created : Wei Liu 07/04/11 ##
## Revision: [Last]Wei Liu 07/07/07 ##
## ##
##----------------------------------------------------------##
##---------------------------------------------------------------------##
##--------------------------------------
##
## Project correlation(Customer define)
##
##--------------------------------------
## MODULE= [Module Name]
## TYPE = app/plat => Module Type
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Debug ]
## DBUG_FLAGS_ADD = [Module Define Gcc Flags for Release]
## BUILD = lib/exef => Output file format
## CFG = debug/release => Build Configuration
## SRC_PATH = [Source file path]
## INC_PATH = [Include file path]
## APP_PATH = [App Module path]
## PLT_PATH = [Plat Module path]
## PLT_LIB = [Needed plat lib for Link] => just for test or wxc2main
## APP_LIB = [Needed app lib for Link] => just for test or wxc2main
## LIB_ADD = [Needed Extend lib for Link] => just for test or wxc2main
## PLT_LIB e.g. = haepub fsm mng proto kernel aif mgc mgcp sip rtp \
## 8ecp bicc smpp xapp tcap mtp3 m2ua \
## snmp iptrans debug sccp public
##
## APP_LIB e.g. = msc vlr ssf hlr ae pps mnp smsc vms aas
## LIB_ADD e.g. = -liba3a8 -lm
## OBJ_ADD = [Extend third party object files needed]
## TEST_OBJ_PATH = [module object files Path for test ] => just for test
##---------------------------------------------------------------------##
MODULE = haepub
TYPE = plat
DBUG_FLAGS_ADD = -DDEBUG -D_MODIFY_AUC -D_MODIFY_EIR
RELS_FLAGS_ADD = -D_MODIFY_AUC -D_MODIFY_EIR
##Default commonly as below
BUILD = lib
CFG = debug
PLT_LIB =
APP_LIB =
LIB_ADD =
SRC_PATH = ./src
INC_PATH = ./src/include
PLT_PATH = ../../plat
APP_PATH = ../../mss
OBJ_ADD =
TEST_OBJ_PATH =
PREPROC_CMD =
POSTPROC_CMD =
##---------------------------------------------------------------------##
##--------------------------------------
##
## Make configuration(Customer define)
##
##--------------------------------------
## CCFLAG_SWITCH = on/off => gcc flag show on/off
## COVER_NEED = yes/no => PTF cover report needed
## COVER_REPORT_PATH = [path ] => PTF cover report path
CCFLAG_SWITCH = off
COVER_NEED = no
COVER_REPORT_PATH = ./output
##---------------------------------------------------------------------##
##--------------------------------------
##
## include makefile.rules (Do not change)
##
##--------------------------------------
include Makefile.rules

Some files were not shown because too many files have changed in this diff Show More