init ems server code

This commit is contained in:
2024-09-27 15:39:34 +08:00
parent 9d4009aaca
commit 9930e4e58f
1551 changed files with 110216 additions and 102864 deletions

96
plat/aif/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 = 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
MAKE_INCLUDE = $(HOME)/ems.git/include
##---------------------------------------------------------------------##
##--------------------------------------
##
## include makefile.rules (Do not change)
##
##--------------------------------------
include $(MAKE_INCLUDE)/Makefile.rules

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
#----------------------------------------------

265
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;
}

310
plat/aif/src/aifg_csta.c Normal file
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;
}

1296
plat/aif/src/aifg_debug.c Normal file

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

118
plat/aif/src/include/aifg.h Normal file
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

23
plat/aif/ut/aifg_main.c Normal file
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
plat/aif/ut/aifg_test.c Normal file

File diff suppressed because it is too large Load Diff

40
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