Files
svc.ems/plat/public/src/include/omc_public.h
2024-09-27 15:39:34 +08:00

644 lines
19 KiB
C

/************************************************************************/
/* Title: omc_public.h */
/* Desc: Public variables def for PACS OMC Project. */
/* Author: Meng Xiaozhen */
/* CrtDate: 2000-08-16 */
/* AltDate: 2001-06-21 */
/* CVS: $Id: omc_public.h,v 1.1 2000/08/03 01:09:33 mengxz Exp $ */
/************************************************************************/
#ifndef OMC_PUBLIC__H
#define OMC_PUBLIC__H
#ifndef PUBLIC__H
#include "public.h"
#endif
#ifndef IPTRANS__H
#include "iptrans.h"
#endif
#define DEBUG 1
/***************************************************/
/* Macro define for Server's system number */
#define GRP_NUM 32
#define TS_NUM 32
#define TS_SUB 16
#define TS_E1 8
#define PW_NUM 32
#define PW_SUB 3
#define ETH_NUM 32
#define ETH_SUB 16
#define RDEV_NUM 32
#define RDEV_SUB 8
#define RDEV_E1 1
#define BSS_NUM 48
#define BSC_NUM 12
#define BSC_SUB 9
#define BSC_E1 2
#define BTS_NUM 24 //BTS system include 12 BTS subsystem
#define BTSSITE_NUM 48 //BTS site include 6 BTS subsystem
#define BTS_SUB 12
#define BTS_E1 2
#define SVR_NUM 36
#define CONN_NUM 128
#define CLIENT_NUM 50
#define BTN_NUM 66
#define ALARM_NUM 20
#define CACHE_BUF 512
/***************************************************/
/***************************************************/
/* Macro definition of start ID for applet's button used by system device */
#define TS_START_BTN 0
#define RDEV_START_BTN 18
#define SVR_START_BTN 34
#define BSC_START_BTN 54
/***************************************************/
/***************************************************/
/* Macro define for Server's IP Address */
#define OMC_0 "172.18.128.1"
#define OMC_1 "172.18.129.1"
#define HLR_0 "172.18.132.1"
#define HLR_1 "172.18.133.1"
#define PPS_0 "172.18.136.1"
#define PPS_1 "172.18.137.1"
#define CDR_0 "172.18.160.1"
#define CDR_1 "172.18.161.1"
/***************************************************/
/***************************************************/
/* Macro define for Mysql Database */
#define HOST_NAME "localhost"
#define DB_NAME1 "mysql"
#define DB_PORT_NUM 0
#define SOCKET_NAME NULL
#define FLAGS 0
#define USER_NAME "root"
#define PASSWORD "rootaa"
/***************************************************/
/***************************************************/
/* Macro def for (UDP)Communication port used by OMC */
#define PORT_OUT 4951 //for sending message to ts
#define PORT_BASE 4951
#define PORT_REALSTAT 3 /* 4951 + 3 = 4954 */
#define PORT_CSTA 4 /* 4951 + 4 = 4955 */
#define PORT_COMM 5 /* 4951 + 5 = 4956 */
#define PORT_HEARTBEAT 6 /* 4951 + 6 = 4957 */
#define PORT_CLUSTER 27 /* 4951 + 27 =4978 */
#define BROADCAST_IP "172.18.255.255"
#define CLUSTER_IP "239.255.10.1"
#define BROADCAST 0 //if broadcast message
/***************************************************/
/* Macro def for shm key and sem key used by OMC */
#define COMM_FLAG_SHM_KEY 0x6a000000
#define COMM_FLAG_SHM_PERM 0666
#define COMM_FLAG_SEM_KEY 300
#define COMM_FLAG_SEM_PERM 0666
#define COMM_FLAG_SEM_NUM 1
#define COMM_FLAG_SIZE 1024
#define COMM_LIST_SHM_KEY 0x6a100000
#define COMM_LIST_SHM_PERM 0666
#define COMM_LIST_SEM_KEY 310
#define COMM_LIST_SEM_PERM 0666
#define COMM_LIST_SEM_NUM 1
#define STATUS_SHM_KEY 0x6a200000
#define STATUS_SHM_PERM 0666
#define STATUS_SEM_KEY 320
#define STATUS_SEM_PERM 0666
#define STATUS_SEM_NUM 1
#define CACHE_SHM_KEY 0x6a400000
#define CACHE_SHM_PERM 0666
#define CACHE_SEM_KEY 340
#define CACHE_SEM_PERM 0666
#define CACHE_SEM_NUM 1
#define BSS_SHM_KEY 0x6a600000
#define BSS_SHM_PERM 0666
#define BSS_SEM_KEY 360
#define BSS_SEM_PERM 0666
#define BSS_SEM_NUM 1
#define LED_SHM_KEY 0x6a800000
#define LED_SHM_PERM 0666
#define LED_SEM_KEY 380
#define LED_SEM_PERM 0666
#define LED_SEM_NUM 1
#define CLUSTER_SHM_KEY 0x6a900000
#define CLUSTER_SHM_PERM 0666
#define CLUSTER_SEM_KEY 390
#define CLUSTER_SEM_PERM 0666
#define CLUSTER_SEM_NUM 1
/***************************************************/
/*############################################################################
* shm structure
* between heartbeat transceiver and heartbeat processor
* &
* between heartbeat transceiver and svr cluster processor
*###########################################################################*/
typedef struct cache_list{
long msgSrcIP;
u_short msgLength;
BYTE msgContent[CACHE_BUF];
}cache_list;
typedef struct status_cahce{
//int send_flag;
/*this flag is only for server cluster funciton
*0/1/2=ignore cluster FSM influence,directly send heartbeat/cluster permit *to send heartbeat/can't send heartbeat,waiting cluster's info
*/
u_short msgReadSub;
u_short msgWriteSub;
cache_list msgcache[CACHE_BUF];
}status_cache;
/*############################################################################
* shm structure between real status processor and heartbeat processor
*###########################################################################*/
typedef struct clientinfo {
BYTE used_flag; // 0/1=not used/used
BYTE grp_id; // group which is requested by client now
BYTE is_responsed; // 0/1/2=not response/responsing/responsed
long ip;
unsigned int waittime; //if waittime>60seconds,timeout
BYTE updatetime[16]; //last time when client request info
} client_info;
typedef struct conninfo {
BYTE avail_flag; // 0/1=unavailable/available
BYTE disp_name; // 0/1=not display/display
char name[16];
char remark[44];
BYTE lsys_type;// local device system type
BYTE lsys_id; //local device system id
BYTE lsub_id; //local device subsystem id
BYTE rsys_type; //remote device system type
BYTE rsys_id; //remote device system id
BYTE rsub_id; //remote device subsystem id
} conn_info;
typedef struct btninfo {
BYTE used_flag; // 0/1=not use/used
BYTE sys_type; // device system type
BYTE sys_id; // device system id
BYTE sub_id; // device subsystem id
} btn_info;
typedef struct grp_simple_stat {
btn_info btn[BTN_NUM]; // relationship between button and device
unsigned int coord[2]; // X,Y coord for group icon
int critical; // critical counter
int alarm; // alarm counter
BYTE isinstalled; // 0/1=not install/install
BYTE ts_id[2]; // Transit switch id(default=99,no ts)
BYTE disp_name; // 0/1=not display/display
BYTE grp_name[17]; // Group name
BYTE grp_remark[45]; // remark about group
BYTE stat_amount; // number of status for group icon
BYTE stat_direct; // direction of display status (0/1=h/v)
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3= uninstalled
*/
}grpsimple_stat;
typedef struct subts_detail_stat {
BYTE subtype; //subsystem status
BYTE timeout; //if the subsystem is timeout(0/1=timeout/not)
BYTE substat0[8];// simple status of this subsystem
/* substat0[0] -- if subsys is installed(0/1=not/yes)
* substat0[1] -- if subsys is normal(0/1=abnormal/normal)
* substat0[2] -- if subsys send master clock(0/1=not/sending)
* substat0[3] -- locking clock(0-7:2=normal,7=idle,other=abnormal)
*/
BYTE substat1[8]; // performance or status data of subsystem
/* substat1[0-1] -- CPU Load ('00'-'45')
* substat1[2-4] -- Clock frequency('000'-'255')
*/
BYTE e1stat0[TS_E1][8]; //simple status of all E1
/* e1[i][0] -- e1[i] installed/not installed (0/1=not/yes)
* e1[i][1] -- e1[i] layer 2 installed/not installed (0/1=not/yes)
* e1[i][2] -- e1[i] layer 1 connected/disconnected (0/1=not/yes)
* e1[i][3] -- e1[i] layer 2 connected/disconnected (0/1=not/yes)
* e1[i][4] -- e1[i] without/with ECHO CANCELLER (0/1=not/yes)
*/
BYTE e1stat1[TS_E1][8]; // performance or status data of all E1
/* e1[i][0-1] -- e1[i] idle channels('00'/'30')
*/
long lock_alarmtime;
/*last time inserting alarm log into db because of clock locking error
*/
long e1_alarmtime[TS_E1][2];
/*last time inserting alarm log into db because of e1 1,2th error
*/
BYTE version_info[16];
/*version information for the application
*/
BYTE updatetime[16]; //last time refreshing subsystem status
}subtsdetail_stat;
typedef struct subpw_detail_stat {
BYTE timeout; //if the subsystem is timeout(0/1=timeout/not)
BYTE substat[2]; // status of this subsystem(0/1=abnomal/normal)
/* substat[0] -- if subsys is installed(0/1=not/yes)
* substat[1] -- if subsys is normal(0/1=abnormal/normal)
*/
long pcard_alarmtime;
/*last time inserting alarm log into db because of power card error
*/
BYTE updatetime[16]; //last time refreshing subsystem status
}subpwdetail_stat;
typedef struct ts_detail_stat {
BYTE grp_id;
BYTE clock_status;//if master clock is normal(0/1=N/Y)
long clock_alarmtime;//master clock status
/*last time inserting alarm log into db because of master clock error
*/
subtsdetail_stat sub_detail[TS_SUB];
subpwdetail_stat subpw_detail[PW_SUB];
}tsdetail_stat;
typedef struct subts_simple_stat {
BYTE isinstalled;
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
int waittime; // if TS subsystem is timeout
BYTE issent ; // if sending get request to timeout ts subsystem
} subtssimple_stat;
typedef struct ts_simple_stat {
BYTE isinstalled; // 0/1=N/Y
BYTE location; // 0/1=local/remote
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
BYTE grp_id;
BYTE disp_name; // 0/1=not display/display
BYTE name[16];
BYTE remark[44];
int coord[2];
BYTE stat_amount; // number of status for ts icon
BYTE stat_direct; // direction of display status (0/1=h/v)
subtssimple_stat sub_simple[TS_SUB];
subtssimple_stat subpw_simple[PW_SUB];
} tssimple_stat;
typedef struct subeth_detail_stat {
BYTE timeout; //if the subsystem is timeout(0/1=timeout/not)
long self_ip; //ip address of LAN Module self
BYTE mac[6]; //physical address of LAN Module
BYTE substat[6];
/* substat[0] -- if LAN Module is installed(0/1)
* substat[1] -- if LAN Module is normal(0/1)
* substat[2] -- if there is unreachable ip(0/1)
* substat[3] -- if LAN Module upload program to csu(0/1)
* substat[4] -- if csu is availabe (0/1)
*/
BYTE cpu_load[2]; //CPU load of LAN module(hex value)
BYTE unreachable_ip[4]; //ip Can't be found by LAN Module (hex value)
long unreach_time;
long alarmtime[2];
/*CSU Upload program status
*alarmtime[0] -- can't reach target ip address
*alarmtime[1] -- uploading program
*/
BYTE version_info[16];
/*version information for the application
*/
char updatetime[16];
}subethdetail_stat;
typedef struct eth_detail_stat {
BYTE grp_id;
subethdetail_stat sub_detail[ETH_SUB];
}ethdetail_stat;
typedef struct subeth_simple_stat {
BYTE isinstalled;
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
int waittime; // if TS subsystem is timeout
BYTE issent ; // if sending get request to timeout ts subsystem
} subethsimple_stat;
typedef struct eth_simple_stat {
BYTE isinstalled; // 0/1=N/Y
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
BYTE grp_id;
subethsimple_stat sub_simple[ETH_SUB];
} ethsimple_stat;
typedef struct subrdev_detail_stat {
BYTE subtype; //0-4
BYTE timeout; //if the subsystem is timeout(0/1=timeout/not)
BYTE substat0[6];
/* substat[0] -- if subsys is installed(0/1=N/Y)
* substat[1] -- if subsys is normal(0/1=N/Y)
* sysstat[2] -- if send master clock(0/1=N/Y)
*/
BYTE substat1[6];
/* substat[0-1] -- used CPU(00/30)
*/
BYTE e1stat0[RDEV_E1][8];
/* e1[0] -- e1 installed/not installed (0/1=N/Y)
* e1[1] -- e1 layer 1 connected/disconnected (0/1=N/Y)
* e1[2] -- e1 layer 2 connected/disconnected (0/1=N/Y)
*/
BYTE e1stat1[RDEV_E1][8];
/* e1[i][0-1] -- e1 idle channels('00'--'30')
*/
long e1_alarmtime[RDEV_E1][2];
/* alarmtime[i][0] -- e1[i] layer 1
* alarmtime[i][1] -- e1[i] layer 2
*/
BYTE version_info[16];
/*version information for the application
*/
char updatetime[16];
}subrdevdetail_stat;
typedef struct rdev_detail_stat {
BYTE grp_id;
BYTE systype; //05=VPS;06=PCR
BYTE clock_status;//if master clock is normal(0/1=N/Y)
long clock_alarmtime;//master clock status
/*last time inserting alarm log into db because of master clock error
*/
subrdevdetail_stat sub_detail[RDEV_SUB];
}rdevdetail_stat;
typedef struct subrdev_simple_stat {
BYTE isinstalled;
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
int waittime; // if Rdev subsystem is timeout
BYTE issent ; // if sending get request to timeout ts subsystem
} subrdevsimple_stat;
typedef struct rdev_simple_stat {
BYTE isinstalled; // 0/1=N/Y
BYTE location; // 0/1=local/remote
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
BYTE grp_id;
BYTE disp_name; // 0/1=not display/display
BYTE name[16];
BYTE remark[44];
int coord[2];
BYTE stat_amount; // number of status for rdev icon
BYTE stat_direct; // direction of display status (0/1=h/v)
subrdevsimple_stat sub_simple[RDEV_SUB];
} rdevsimple_stat;
typedef struct bts_simple_stat {
BYTE isinstalled; // 0/1=not/installed
BYTE bts_site_id;
BYTE bts_link_id;
BYTE location; // 0/1=local/remote
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
BYTE grp_id;
BYTE disp_name; // 0/1=not display/display
BYTE name[16];
BYTE remark[44];
int coord[2];
BYTE stat_amount; // number of status for bts site icon
BYTE stat_direct; // direction of display status (0/1=h/v)
} btssimple_stat;
typedef struct bsc_simple_stat {
BYTE isinstalled; // 0/1=not/installed
BYTE location; // 0/1=local/remote
BYTE timeout; // 0/1=timeout/not timeout
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
BYTE grp_id;
BYTE disp_name; // 0/1=not display/display
BYTE name[16];
BYTE remark[44];
int coord[2];
BYTE stat_amount; // number of status for bsc icon
BYTE stat_direct; // direction of display status (0/1=h/v)
} bscsimple_stat;
/* structure for server detail status in heartbeat processor
************************************/
typedef struct svr_detail_stat {
BYTE timeout; //if the subsystem is timeout(0/1=not/timeout)
BYTE grp_id;
BYTE systype;
BYTE sys_id;
int cpuused;
int viravail;
int virfree;
int memavail;
int memfree;
int hdavail;
int hdfree;
BYTE init_progress[3];
BYTE proc_id[16];
BYTE proc_status[16];
BYTE subproc_num[16];
BYTE sysstat[16]; // 0/1=abnormal/normal
/*
* 0=Normal,1=abnormal
*sysstat[0]: system status
* sysstat[1]:cpu status sysstat[2]:swap status
* sysstat[3]:memory status sysstat[4]:disk status
* sysstat[5]:proc_status sysstat[6]:server working status
* sysstat[7]:database status
*/
long alarmtime[6];
BYTE version_info[16];
/*version information for the application
*/
BYTE updatetime[16];
} svrdetail_stat;
typedef struct svr_simple_stat {
BYTE grp_id;
BYTE location;
BYTE isinstalled;
int waittime;
BYTE ischanged;
/* 0/1=N/Y,process will send message to client if status is changed
*/
BYTE status;
/*0=critical ; 1=normal ; 2=alarm ; 3=uninstalled
*/
int critical; // critical counter
int alarm; // alarm counter
BYTE disp_name; // 0/1=not display/display
BYTE name[16];
BYTE remark[44];
int coord[2];
BYTE stat_amount; // number of status for bts site icon
BYTE stat_direct; // direction of display status (0/1=h/v)
} svrsimple_stat;
struct alarm_log {
BYTE systype;
BYTE sys_id;
BYTE sub_id;
BYTE e1no;
BYTE alarmnum;
BYTE occurtime[16];
};
typedef struct ts_alarm_log {
int readSub;
int writeSub;
struct alarm_log alrlist[ALARM_NUM];
} tsalarm_log;
typedef struct ask_alarm_log {
long client_ip; //ip address where the request is sent from
int init_Req_Flag;
int readSub;
int writeSub;
struct alarm_log alrlist[ALARM_NUM];
} askalarm_log;
/*
* shared memory structure
*************************/
typedef struct shm_ts_stat {
BYTE init_flag;
BYTE sys_struct;//0/1=single/double plane system structure
grpsimple_stat grp_simple[GRP_NUM];
tsdetail_stat ts_detail[TS_NUM];
tssimple_stat ts_simple[TS_NUM];
ethdetail_stat eth_detail[ETH_NUM];
ethsimple_stat eth_simple[ETH_NUM];
rdevdetail_stat vps_detail[RDEV_NUM];
rdevsimple_stat vps_simple[RDEV_NUM];
rdevdetail_stat pcr_detail[RDEV_NUM];
rdevsimple_stat pcr_simple[RDEV_NUM];
svrdetail_stat svr_detail[SVR_NUM];
svrsimple_stat svr_simple[SVR_NUM];
/*
sysnum=systype*2+sys_id
svr_simple[0]=OMC-0
svr_simple[1]=OMC-1
svr_simple[2]=HLR-0
svr_simple[3]=HLR-1
svr_simple[4]=PRP-0
svr_simple[5]=PRP-1
svr_simple[6]=CDR-0
svr_simple[7]=CDR-1
*/
bscsimple_stat bsc_simple[BSC_NUM];
BYTE global_status[ETH_NUM];
conn_info connection[CONN_NUM];
client_info client[CLIENT_NUM];
/*global_status[0]= if normal ;global_status[1]= if changed*/
tsalarm_log alarmlog;
} shm_stat;
/*****************************************************************************/
/* Lan Module's global status*/
typedef struct global_status{
BYTE eth_mac[ETH_NUM][ETH_SUB][7];
long update_time[ETH_NUM][ETH_SUB];
long alarm_time[ETH_NUM][ETH_SUB];
}eth_global;
/***************************************************/
/*****************************************************************************/
/* structure for BSS simple status in heartbeat processor
************************************/
typedef struct bss_simple_stat {
BYTE isinstalled[BSS_NUM];
BYTE ischanged[BSS_NUM];
BYTE isnormal[BSS_NUM];
unsigned int waittime[BSS_NUM];
} bsssimple_stat;
/***************************************************/
#endif /*OMC_PUBLIC__H */