[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/zte_log_agent/log_agent.h b/ap/app/zte_log_agent/log_agent.h
new file mode 100755
index 0000000..bed4dfa
--- /dev/null
+++ b/ap/app/zte_log_agent/log_agent.h
@@ -0,0 +1,285 @@
+/**
+ *
+ * @file log_agent.h
+ * @brief
+ * This file is part of ZCAT.
+ * zcatÓ¦Óòãlog_agent app¹«¹²Í·Îļþ
+ *
+ * @details
+ * @author Tools Team.
+ * @email
+ * @copyright Copyright (C) 2013 Sanechips Technology Co., Ltd.
+ * @warning
+ * @date 2019/02/02
+ * @version 1.1
+ * @pre
+ * @post
+ *
+ * @par
+ * Change History :
+ * ---------------------------------------------------------------------------
+ * date version author description
+ * ---------------------------------------------------------------------------
+ * 2017/07/17 1.0 hou.bing Create file
+ * 2019/02/02 1.1 jiang.fenglin ÐÞ¸Ä×¢ÊÍ·½Ê½Îªdoxygen
+ * 2019/07/08 1.2 jiang.fenglin Ôö¼ÓAPFS/CPFSģʽ
+ * ---------------------------------------------------------------------------
+ *
+ *
+ */
+
+
+#ifndef ZTE_LOG_AP_AGENT_H_
+#define ZTE_LOG_AP_AGENT_H_
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <dirent.h>
+
+//#include "../include/message.h"
+//#include "../include/zte_log.h"
+
+
+/********************************************
+* receive result
+********************************************/
+
+#define RAMDUMP_RECEIVE_RESULT_SYS_CRASH 0x0010
+
+/********************************************
+* verify result
+********************************************/
+#define KERNEL_LOG_DEFAULT_LEVEL LEVEL_INFOMATION
+#define APP_LOG_DEFAULT_LEVEL LEVEL_INFOMATION
+
+#define AP_LOG_MAX_LENGTH 260
+#define READ_BUFFER_SIZE (1024 * 16)
+#define MAX_DATA_LEN 2048
+
+#define TRUE 1
+#define FALSE 0
+
+/* ͨѶģ¿éºÅ */
+#define MDL_TOOLS_BASE (100)
+#define SUBMDL_TOOLAGENT_SET (85)
+#define MDL_ZCAT (MDL_TOOLS_BASE + 15) /* ZCAT¹¤¾ß */
+#define SUBMDL_ZCATAGT (SUBMDL_TOOLAGENT_SET + 0) /* ZCAT¹¤¾ß´úÀí */
+
+#define MDL_PHONE (1) /* ÊÖ»ú */
+
+/* ÈÕÖ¾Á÷ÏòÖ¾ */
+#define DIR_LOG_TCARD_VALUE 0x01
+#define DIR_LOG_NET_VALUE 0x02
+#define DIR_LOG_USB_VALUE 0x03
+#define DIR_LOG_USB_AP_VALUE 0x04
+
+#define MAX_STRING_LENGTH 256
+typedef int BOOL;
+typedef void VOID;
+
+typedef signed char SINT8; /* sc */
+typedef unsigned char UINT8; /* c */
+
+typedef short SINT16; /* sw */
+typedef unsigned short UINT16; /* w */
+typedef long SINT32; /* sdw */
+typedef unsigned int UINT32; /* dw */
+typedef unsigned long long UINT64;
+
+typedef struct
+{
+ unsigned char *buf;
+ unsigned int bufIndex; // Ö¸ÕëÆ«ÒÆ
+ unsigned int bufSize;
+} T_HDLC_BUFFER_TYPE;
+
+typedef enum
+{
+ LEVEL_EMERGENCY = 0, // ÓÃÓÚ½ô¼±Ê¼þÏûÏ¢£¬Ò»°ãÊÇϵͳ±ÀÀ£Ö®Ç°ÌáʾµÄÏûÏ¢
+ LEVEL_ALERT, // ÓÃÓÚÐèÒªÁ¢¼´²ÉÈ¡¶¯×÷µÄÇé¿ö
+ LEVEL_CRITICAL, // ÁÙ½ç״̬£¬Í¨³£Éæ¼°ÑÏÖØµÄÓ²¼þ»òÈí¼þ²Ù×÷ʧ°Ü
+ LEVEL_ERROR, // ÓÃÓÚ±¨¸æ´íÎó״̬£¬ÈçÉ豸Çý¶¯³ÌÐò¾³£ÓÃÀ´±¨¸æÀ´×ÔÓ²¼þµÄÎÊÌâ
+ LEVEL_WARNING, // ¶Ô¿ÉÄܳöÏÖÎÊÌâµÄÇé¿ö½øÐо¯¸æ£¬Í¨³£²»»á¶ÔϵͳÔì³ÉÑÏÖØÎÊÌâ
+ LEVEL_NOTICE, // ÓбØÒª½øÐÐÌáʾµÄÕý³£ÇéÐΣ¬ÈçÓ밲ȫÏà¹ØµÄ×´¿ö»ã±¨
+ LEVEL_INFOMATION, // ÌáʾÐÔÐÅÏ¢£¬ÈçÇý¶¯³ÌÐòÔÚÆô¶¯Ê±´òÓ¡ËûÃÇÕÒµ½µÄÓ²¼þÐÅÏ¢
+ LEVEL_DEBUG, // ÓÃÓÚµ÷ÊÔÐÅÏ¢
+ LEVEL_PRICNT
+} E_ZCAT_AP_PRIORITY;
+
+//AP Header ½á¹¹¶¨Òå
+typedef struct
+{
+ unsigned char priority;
+ unsigned char mod;
+ unsigned short len;
+} T_ZCAT_APLOG_HEADER;
+typedef struct
+{
+ unsigned char *buf;
+ unsigned short len;
+ unsigned short newLine;
+} T_AP_DEST_BUFFER_TYPE;
+
+typedef struct
+{
+ unsigned char *buf;
+ unsigned int beginIndex;
+ unsigned int bufSize;
+} T_AP_SRC_BUFFER_TYPE;
+
+// ZCAT Header½á¹¹¶¨Òå
+typedef struct
+{
+ unsigned char cmd_code;
+ unsigned char padding;
+ unsigned short reserved;
+ unsigned int length;
+ unsigned int timeStamp[2];
+} T_ZCAT_HEADER;
+
+//DIAG Header ½á¹¹¶¨Òå
+typedef struct
+{
+ unsigned short diag_id;
+ unsigned short len;
+} T_ZCAT_DIAG_HEADER;
+
+typedef struct
+{
+ UINT16 type;
+ UINT8 operation;
+ UINT8 reserved;
+} T_ZCAT_DIAG_CONFIG_REQ;
+
+typedef enum
+{
+ ZCAT_SIG_REPORT = 1,
+ ZCAT_EVT_REPORT = 2,
+ ZCAT_PRN_REPORT = 3,
+ ZCAT_DBG_REPORT = 4,
+ ZCAT_IPPPP_REPORT = 5,
+ ZCAT_DIAG_REPORT = 6,
+ ZCAT_DIAG_NULL, //ֻռһ룬²»Ê¹Óã¬Ê¹ÓëPC¶ÔÆë
+
+ ZCAT_AP_KERNEL_LOG = 8,
+ ZCAT_AP_APP_LOG = 9,
+
+ ZCAT_CMDCODE_MAX
+} T_ZCAT_CMDCODE;
+
+typedef enum
+{
+ ZCAT_SIG_TYPE = ZCAT_SIG_REPORT,
+ ZCAT_EVENT_TYPE = ZCAT_EVT_REPORT,
+ ZCAT_PRINT_TYPE = ZCAT_PRN_REPORT,
+ ZCAT_DBG_TYPE = ZCAT_DBG_REPORT,
+ ZCAT_IPPPP_TYPE = ZCAT_IPPPP_REPORT,
+ ZCAT_DIAG_TYPE = ZCAT_DIAG_REPORT,
+ ZCAT_AP_KERNEL_TYPE = ZCAT_AP_KERNEL_LOG,
+ ZCAT_AP_APP_TYPE = ZCAT_AP_APP_LOG,
+
+ ZCAT_ALL_TYPE = 0xFFFF
+} ZCAT_ENUM_TYPE;
+
+// Comm½á¹¹¶¨Òå
+typedef struct
+{
+ unsigned char msg_type; /* ÏûÏ¢ÀàÐÍ */
+ unsigned char pad; /* Ìî³äλ */
+ unsigned short reserved; /* ±£Áô×ֶΣ¬ÌîΪ0xAAAA */
+ unsigned char tgt_mdl_no; /* Ä¿±ê(½ÓÊÕÏûÏ¢)Ä£¿éÄ£¿éºÅ */
+ unsigned char tgt_submdl_no; /* Ä¿±ê(½ÓÊÕÏûÏ¢)Ä£¿é×ÓÄ£¿éºÅ */
+ unsigned char src_mdl_no; /* Ô´(·¢ËÍÏûÏ¢)Ä£¿éÄ£¿éºÅ */
+ unsigned char src_submdl_no; /* Ô´(·¢ËÍÏûÏ¢)Ä£¿é×ÓÄ£¿éºÅ */
+ unsigned int buf_len; /* ÏûÏ¢Êý¾Ý³¤¶È(²»º¬ÏûϢͷ) */
+} T_COMM_TYPE;
+
+typedef enum
+{
+ ZCAT_STATE_INIT = 0,
+ ZCAT_STATE_RUNNING,
+ ZCAT_STATE_STOP,
+ ZCAT_STATE_EXIT
+} E_ZCAT_STATE;
+
+typedef enum
+{
+ ZCAT_MODE_AP_USB = 0xC1,
+ ZCAT_MODE_AP_NET,
+ ZCAT_MODE_AP_TF,
+ ZCAT_MODE_AP_FS,
+ ZCAT_MODE_CP_USB,
+ ZCAT_MODE_CP_TF,
+ ZCAT_MODE_CP_NET,
+ ZCAT_MODE_CP_FS,
+#ifdef USE_CAP_SUPPORT
+ ZCAT_MODE_CAP_EMMC
+#endif
+} E_ZCAT_MODE;
+
+typedef enum
+{
+ ZCAT_IPC_SYN = 0xA0,
+ ZCAT_IPC_ACK,
+ ZCAT_IPC_ESTABLISHED,
+ ZCAT_IPC_SET_TTY,
+ ZCAT_IPC_SET_PERIPHERAL_MODE,
+ ZCAT_IPC_STOP,
+ ZCAT_IPC_START,
+ ZCAT_IPC_EXIT,
+#ifdef USE_CAP_SUPPORT
+ ZCAT_IPC_ALLOC_CAP_SMLOGBUF,
+#endif
+} E_ZCAT_IPC_HANDSHAKE;
+
+
+typedef enum
+{
+ FLASH_MODE_NOMAL = 1,
+ FLASH_MODE_U = 2
+} E_FLASH_MODE;
+
+typedef enum
+{
+ DIAG_FILTER_CONFIG = 1,
+ DIAG_DROP_COUNT,
+ DIAG_LINK_MSG,
+ DIAG_SIG_CONTROL_MSG,
+ DIAG_NV_MSG,
+ DIAG_LTE_CONTROL_MSG,
+ DIAG_PS_GLB_MSG,
+ DIAG_PS_FILTERRANK_MSG,
+ DIAG_UE_MEM_LOOKUP,
+ DIAG_RAMDUMP_MSG,
+ DIAG_TSPVERSION_MSG,
+ DIAG_SYSVIEW_MSG,
+ DIAG_CP_STATUS
+}DIAG_CONDITION;
+
+
+/*ÈÕÖ¾´æT¿¨²ÎÊý*/
+typedef struct
+{
+ char log_dir[MAX_STRING_LENGTH];
+ char log_name[MAX_STRING_LENGTH];
+ char rule_path[MAX_STRING_LENGTH];
+ int max_file_size;
+ int max_file_num;
+ int log_overwrite;
+ int compress_log_files;
+ int file_counts;
+ int output_fd;
+ int file_size;
+ int free_space_limit;
+ UINT64 max_total_size;
+}T_LOG_SDCARD_PARA;
+
+#endif /* ZTE_LOG_AP_AGENT_H_ */