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

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

File diff suppressed because it is too large Load Diff

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