lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /**
|
| 2 | *
|
| 3 | * @file log_agent.h
|
| 4 | * @brief
|
| 5 | * This file is part of ZCAT.
|
| 6 | * zcatÓ¦Óòãlog_agent app¹«¹²Í·Îļþ
|
| 7 | *
|
| 8 | * @details
|
| 9 | * @author Tools Team.
|
| 10 | * @email
|
| 11 | * @copyright Copyright (C) 2013 Sanechips Technology Co., Ltd.
|
| 12 | * @warning
|
| 13 | * @date 2019/02/02
|
| 14 | * @version 1.1
|
| 15 | * @pre
|
| 16 | * @post
|
| 17 | *
|
| 18 | * @par
|
| 19 | * Change History :
|
| 20 | * ---------------------------------------------------------------------------
|
| 21 | * date version author description
|
| 22 | * ---------------------------------------------------------------------------
|
| 23 | * 2017/07/17 1.0 hou.bing Create file
|
| 24 | * 2019/02/02 1.1 jiang.fenglin ÐÞ¸Ä×¢ÊÍ·½Ê½Îªdoxygen
|
| 25 | * 2019/07/08 1.2 jiang.fenglin Ôö¼ÓAPFS/CPFSģʽ
|
| 26 | * ---------------------------------------------------------------------------
|
| 27 | *
|
| 28 | *
|
| 29 | */
|
| 30 |
|
| 31 |
|
| 32 | #ifndef ZTE_LOG_AP_AGENT_H_
|
| 33 | #define ZTE_LOG_AP_AGENT_H_
|
| 34 |
|
| 35 | #include <unistd.h>
|
| 36 | #include <stdlib.h>
|
| 37 | #include <stdio.h>
|
| 38 | #include <errno.h>
|
| 39 | #include <sys/socket.h>
|
| 40 | #include <fcntl.h>
|
| 41 | #include <sys/types.h>
|
| 42 | #include <sys/stat.h>
|
| 43 | #include <netinet/in.h>
|
| 44 | #include <arpa/inet.h>
|
| 45 | #include <dirent.h>
|
| 46 |
|
| 47 | //#include "../include/message.h"
|
| 48 | //#include "../include/zte_log.h"
|
| 49 |
|
| 50 |
|
| 51 | /********************************************
|
| 52 | * receive result
|
| 53 | ********************************************/
|
| 54 |
|
| 55 | #define RAMDUMP_RECEIVE_RESULT_SYS_CRASH 0x0010
|
| 56 |
|
| 57 | /********************************************
|
| 58 | * verify result
|
| 59 | ********************************************/
|
| 60 | #define KERNEL_LOG_DEFAULT_LEVEL LEVEL_INFOMATION
|
| 61 | #define APP_LOG_DEFAULT_LEVEL LEVEL_INFOMATION
|
| 62 |
|
| 63 | #define AP_LOG_MAX_LENGTH 260
|
| 64 | #define READ_BUFFER_SIZE (1024 * 16)
|
| 65 | #define MAX_DATA_LEN 2048
|
| 66 |
|
| 67 | #define TRUE 1
|
| 68 | #define FALSE 0
|
| 69 |
|
| 70 | /* ͨѶģ¿éºÅ */
|
| 71 | #define MDL_TOOLS_BASE (100)
|
| 72 | #define SUBMDL_TOOLAGENT_SET (85)
|
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 73 | #define MDL_ZCAT (MDL_TOOLS_BASE + 15) /* ZCAT¹¤¾ß */
|
| 74 | #define SUBMDL_ZCATAGT (SUBMDL_TOOLAGENT_SET + 0) /* ZCAT¹¤¾ß´úÀí */
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 75 |
|
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 76 | #define MDL_PHONE (1) /* ÊÖ»ú */
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 77 |
|
| 78 | /* ÈÕÖ¾Á÷ÏòÖ¾ */
|
| 79 | #define DIR_LOG_TCARD_VALUE 0x01
|
| 80 | #define DIR_LOG_NET_VALUE 0x02
|
| 81 | #define DIR_LOG_USB_VALUE 0x03
|
| 82 | #define DIR_LOG_USB_AP_VALUE 0x04
|
| 83 |
|
| 84 | #define MAX_STRING_LENGTH 256
|
| 85 | typedef int BOOL;
|
| 86 | typedef void VOID;
|
| 87 |
|
| 88 | typedef signed char SINT8; /* sc */
|
| 89 | typedef unsigned char UINT8; /* c */
|
| 90 |
|
| 91 | typedef short SINT16; /* sw */
|
| 92 | typedef unsigned short UINT16; /* w */
|
| 93 | typedef long SINT32; /* sdw */
|
| 94 | typedef unsigned int UINT32; /* dw */
|
| 95 | typedef unsigned long long UINT64;
|
| 96 |
|
| 97 | typedef struct
|
| 98 | {
|
| 99 | unsigned char *buf;
|
| 100 | unsigned int bufIndex; // Ö¸ÕëÆ«ÒÆ
|
| 101 | unsigned int bufSize;
|
| 102 | } T_HDLC_BUFFER_TYPE;
|
| 103 |
|
| 104 | typedef enum
|
| 105 | {
|
| 106 | LEVEL_EMERGENCY = 0, // ÓÃÓÚ½ô¼±Ê¼þÏûÏ¢£¬Ò»°ãÊÇϵͳ±ÀÀ£Ö®Ç°ÌáʾµÄÏûÏ¢
|
| 107 | LEVEL_ALERT, // ÓÃÓÚÐèÒªÁ¢¼´²ÉÈ¡¶¯×÷µÄÇé¿ö
|
| 108 | LEVEL_CRITICAL, // ÁÙ½ç״̬£¬Í¨³£Éæ¼°ÑÏÖØµÄÓ²¼þ»òÈí¼þ²Ù×÷ʧ°Ü
|
| 109 | LEVEL_ERROR, // ÓÃÓÚ±¨¸æ´íÎó״̬£¬ÈçÉ豸Çý¶¯³ÌÐò¾³£ÓÃÀ´±¨¸æÀ´×ÔÓ²¼þµÄÎÊÌâ
|
| 110 | LEVEL_WARNING, // ¶Ô¿ÉÄܳöÏÖÎÊÌâµÄÇé¿ö½øÐо¯¸æ£¬Í¨³£²»»á¶ÔϵͳÔì³ÉÑÏÖØÎÊÌâ
|
| 111 | LEVEL_NOTICE, // ÓбØÒª½øÐÐÌáʾµÄÕý³£ÇéÐΣ¬ÈçÓ밲ȫÏà¹ØµÄ×´¿ö»ã±¨
|
| 112 | LEVEL_INFOMATION, // ÌáʾÐÔÐÅÏ¢£¬ÈçÇý¶¯³ÌÐòÔÚÆô¶¯Ê±´òÓ¡ËûÃÇÕÒµ½µÄÓ²¼þÐÅÏ¢
|
| 113 | LEVEL_DEBUG, // ÓÃÓÚµ÷ÊÔÐÅÏ¢
|
| 114 | LEVEL_PRICNT
|
| 115 | } E_ZCAT_AP_PRIORITY;
|
| 116 |
|
| 117 | //AP Header ½á¹¹¶¨Òå
|
| 118 | typedef struct
|
| 119 | {
|
| 120 | unsigned char priority;
|
| 121 | unsigned char mod;
|
| 122 | unsigned short len;
|
| 123 | } T_ZCAT_APLOG_HEADER;
|
| 124 | typedef struct
|
| 125 | {
|
| 126 | unsigned char *buf;
|
| 127 | unsigned short len;
|
| 128 | unsigned short newLine;
|
| 129 | } T_AP_DEST_BUFFER_TYPE;
|
| 130 |
|
| 131 | typedef struct
|
| 132 | {
|
| 133 | unsigned char *buf;
|
| 134 | unsigned int beginIndex;
|
| 135 | unsigned int bufSize;
|
| 136 | } T_AP_SRC_BUFFER_TYPE;
|
| 137 |
|
| 138 | // ZCAT Header½á¹¹¶¨Òå
|
| 139 | typedef struct
|
| 140 | {
|
| 141 | unsigned char cmd_code;
|
| 142 | unsigned char padding;
|
| 143 | unsigned short reserved;
|
| 144 | unsigned int length;
|
| 145 | unsigned int timeStamp[2];
|
| 146 | } T_ZCAT_HEADER;
|
| 147 |
|
| 148 | //DIAG Header ½á¹¹¶¨Òå
|
| 149 | typedef struct
|
| 150 | {
|
| 151 | unsigned short diag_id;
|
| 152 | unsigned short len;
|
| 153 | } T_ZCAT_DIAG_HEADER;
|
| 154 |
|
| 155 | typedef struct
|
| 156 | {
|
| 157 | UINT16 type;
|
| 158 | UINT8 operation;
|
| 159 | UINT8 reserved;
|
| 160 | } T_ZCAT_DIAG_CONFIG_REQ;
|
| 161 |
|
| 162 | typedef enum
|
| 163 | {
|
| 164 | ZCAT_SIG_REPORT = 1,
|
| 165 | ZCAT_EVT_REPORT = 2,
|
| 166 | ZCAT_PRN_REPORT = 3,
|
| 167 | ZCAT_DBG_REPORT = 4,
|
| 168 | ZCAT_IPPPP_REPORT = 5,
|
| 169 | ZCAT_DIAG_REPORT = 6,
|
| 170 | ZCAT_DIAG_NULL, //ֻռһ룬²»Ê¹Óã¬Ê¹ÓëPC¶ÔÆë
|
| 171 |
|
| 172 | ZCAT_AP_KERNEL_LOG = 8,
|
| 173 | ZCAT_AP_APP_LOG = 9,
|
| 174 |
|
| 175 | ZCAT_CMDCODE_MAX
|
| 176 | } T_ZCAT_CMDCODE;
|
| 177 |
|
| 178 | typedef enum
|
| 179 | {
|
| 180 | ZCAT_SIG_TYPE = ZCAT_SIG_REPORT,
|
| 181 | ZCAT_EVENT_TYPE = ZCAT_EVT_REPORT,
|
| 182 | ZCAT_PRINT_TYPE = ZCAT_PRN_REPORT,
|
| 183 | ZCAT_DBG_TYPE = ZCAT_DBG_REPORT,
|
| 184 | ZCAT_IPPPP_TYPE = ZCAT_IPPPP_REPORT,
|
| 185 | ZCAT_DIAG_TYPE = ZCAT_DIAG_REPORT,
|
| 186 | ZCAT_AP_KERNEL_TYPE = ZCAT_AP_KERNEL_LOG,
|
| 187 | ZCAT_AP_APP_TYPE = ZCAT_AP_APP_LOG,
|
| 188 |
|
| 189 | ZCAT_ALL_TYPE = 0xFFFF
|
| 190 | } ZCAT_ENUM_TYPE;
|
| 191 |
|
| 192 | // Comm½á¹¹¶¨Òå
|
| 193 | typedef struct
|
| 194 | {
|
| 195 | unsigned char msg_type; /* ÏûÏ¢ÀàÐÍ */
|
| 196 | unsigned char pad; /* Ìî³äλ */
|
| 197 | unsigned short reserved; /* ±£Áô×ֶΣ¬ÌîΪ0xAAAA */
|
| 198 | unsigned char tgt_mdl_no; /* Ä¿±ê(½ÓÊÕÏûÏ¢)Ä£¿éÄ£¿éºÅ */
|
| 199 | unsigned char tgt_submdl_no; /* Ä¿±ê(½ÓÊÕÏûÏ¢)Ä£¿é×ÓÄ£¿éºÅ */
|
| 200 | unsigned char src_mdl_no; /* Ô´(·¢ËÍÏûÏ¢)Ä£¿éÄ£¿éºÅ */
|
| 201 | unsigned char src_submdl_no; /* Ô´(·¢ËÍÏûÏ¢)Ä£¿é×ÓÄ£¿éºÅ */
|
| 202 | unsigned int buf_len; /* ÏûÏ¢Êý¾Ý³¤¶È(²»º¬ÏûϢͷ) */
|
| 203 | } T_COMM_TYPE;
|
| 204 |
|
| 205 | typedef enum
|
| 206 | {
|
| 207 | ZCAT_STATE_INIT = 0,
|
| 208 | ZCAT_STATE_RUNNING,
|
| 209 | ZCAT_STATE_STOP,
|
| 210 | ZCAT_STATE_EXIT
|
| 211 | } E_ZCAT_STATE;
|
| 212 |
|
| 213 | typedef enum
|
| 214 | {
|
| 215 | ZCAT_MODE_AP_USB = 0xC1,
|
| 216 | ZCAT_MODE_AP_NET,
|
| 217 | ZCAT_MODE_AP_TF,
|
| 218 | ZCAT_MODE_AP_FS,
|
| 219 | ZCAT_MODE_CP_USB,
|
| 220 | ZCAT_MODE_CP_TF,
|
| 221 | ZCAT_MODE_CP_NET,
|
| 222 | ZCAT_MODE_CP_FS,
|
| 223 | #ifdef USE_CAP_SUPPORT
|
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 224 | ZCAT_MODE_CAP_FS,
|
| 225 | ZCAT_MODE_CAP_NET,
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 226 | #endif
|
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 227 | ZCAT_MODE_LOG_OFF,
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 228 | } E_ZCAT_MODE;
|
| 229 |
|
| 230 | typedef enum
|
| 231 | {
|
| 232 | ZCAT_IPC_SYN = 0xA0,
|
| 233 | ZCAT_IPC_ACK,
|
| 234 | ZCAT_IPC_ESTABLISHED,
|
| 235 | ZCAT_IPC_SET_TTY,
|
| 236 | ZCAT_IPC_SET_PERIPHERAL_MODE,
|
| 237 | ZCAT_IPC_STOP,
|
| 238 | ZCAT_IPC_START,
|
| 239 | ZCAT_IPC_EXIT,
|
| 240 | #ifdef USE_CAP_SUPPORT
|
| 241 | ZCAT_IPC_ALLOC_CAP_SMLOGBUF,
|
| 242 | #endif
|
xf.li | aa4d92f | 2023-09-13 00:18:58 -0700 | [diff] [blame] | 243 | ZCAT_IPC_READ_IRAM_ZCAT_MODE,
|
xf.li | 9d1a0e1 | 2023-09-20 01:43:20 -0700 | [diff] [blame] | 244 | ZCAT_IPC_SET_VEHICLE_WAKE_SIGN,
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 245 | } E_ZCAT_IPC_HANDSHAKE;
|
| 246 |
|
| 247 |
|
| 248 | typedef enum
|
| 249 | {
|
| 250 | FLASH_MODE_NOMAL = 1,
|
| 251 | FLASH_MODE_U = 2
|
| 252 | } E_FLASH_MODE;
|
| 253 |
|
| 254 | typedef enum
|
| 255 | {
|
| 256 | DIAG_FILTER_CONFIG = 1,
|
| 257 | DIAG_DROP_COUNT,
|
| 258 | DIAG_LINK_MSG,
|
| 259 | DIAG_SIG_CONTROL_MSG,
|
| 260 | DIAG_NV_MSG,
|
| 261 | DIAG_LTE_CONTROL_MSG,
|
| 262 | DIAG_PS_GLB_MSG,
|
| 263 | DIAG_PS_FILTERRANK_MSG,
|
| 264 | DIAG_UE_MEM_LOOKUP,
|
| 265 | DIAG_RAMDUMP_MSG,
|
| 266 | DIAG_TSPVERSION_MSG,
|
| 267 | DIAG_SYSVIEW_MSG,
|
| 268 | DIAG_CP_STATUS
|
| 269 | }DIAG_CONDITION;
|
| 270 |
|
| 271 |
|
| 272 | /*ÈÕÖ¾´æT¿¨²ÎÊý*/
|
| 273 | typedef struct
|
| 274 | {
|
| 275 | char log_dir[MAX_STRING_LENGTH];
|
| 276 | char log_name[MAX_STRING_LENGTH];
|
| 277 | char rule_path[MAX_STRING_LENGTH];
|
| 278 | int max_file_size;
|
| 279 | int max_file_num;
|
| 280 | int log_overwrite;
|
| 281 | int compress_log_files;
|
| 282 | int file_counts;
|
| 283 | int output_fd;
|
| 284 | int file_size;
|
| 285 | int free_space_limit;
|
| 286 | UINT64 max_total_size;
|
| 287 | }T_LOG_SDCARD_PARA;
|
| 288 |
|
| 289 | #endif /* ZTE_LOG_AP_AGENT_H_ */
|