yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame^] | 1 | #ifndef SD_HTTPSHARE_H |
| 2 | #define SD_HTTPSHARE_H |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <string.h> |
| 7 | #include <errno.h> |
| 8 | #include <string.h> |
| 9 | #include <dirent.h> |
| 10 | #include <sys/statvfs.h> |
| 11 | |
| 12 | #include <sys/stat.h> |
| 13 | #include <sys/types.h> |
| 14 | #include <fcntl.h> |
| 15 | #include <utime.h> |
| 16 | #include <linux/stat.h> |
| 17 | #include "message.h" |
| 18 | #include "netapi.h" |
| 19 | #include "softap_api.h" |
| 20 | #include "sdcard_cfg.h" |
| 21 | |
| 22 | |
| 23 | #define MAX_CMD_LEN 256 |
| 24 | |
| 25 | #define NV_ITEM_VALUE_MAX_LEN 1024 |
| 26 | |
| 27 | #define ZTE_HTTPSHARE_FILE_NAME_MAX_LEN 1024 |
| 28 | #define ZTE_HTTPSHARE_DEFAULT_LEN 100 |
| 29 | #define ZTE_HTTPSHARE_MAX_NUM_SHOW_RECORD 10 |
| 30 | //#define ZTE_IP_ADDRESS_LENGTH 32 |
| 31 | |
| 32 | #define ZTE_HTTPSHARE_LEN_50 50 |
| 33 | #define ZTE_HTTPSHARE_LEN_64 64 |
| 34 | #define ZTE_HTTPSHARE_LEN_100 100 |
| 35 | #define ZTE_HTTPSHARE_LEN_12 12 |
| 36 | #define ZTE_HTTPSHARE_MAC_ADDR_MAX_LEN 18 |
| 37 | |
| 38 | //#define ZTE_HTTPSHARE_TIMEOUT 600 |
| 39 | #define ZTE_PARSE_CGI_TAIL_LEN 100 |
| 40 | #define MAX_LEN_FOR_SQL 1024 |
| 41 | |
| 42 | #define HTTPSHARE_BUF_NORMAL_LEN_MAX 255 |
| 43 | #define DECCHK( c ) ((c) >= '0' && (c) <= '9') |
| 44 | |
| 45 | /*´´½¨httpshare±íÏîµÄSQLÓï¾ä*/ |
| 46 | #define ZTE_CREATE_TABLE_HTTPSHARE_SQL "CREATE TABLE IF NOT EXISTS httpshare(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,ip TEXT,path TEXT)" |
| 47 | |
| 48 | #define SET_MODE_USB "usb" |
| 49 | #define SET_MODE_HTTP_SHARE "httpshare" |
| 50 | |
| 51 | #define USB_MODE "usb_mode" |
| 52 | #define HTTP_SHARE_MODE "http_share_mode" |
| 53 | |
| 54 | #define NO_SDCARD "no_sdcad" |
| 55 | #define ZTE_HTTPSHARE_TIME "path_SD_CARD_time_unix" |
| 56 | |
| 57 | #define ZTE_HTTPSHARE_DB_NAME "httpshare" |
| 58 | |
| 59 | |
| 60 | typedef enum { |
| 61 | ZTE_HTTPSHARE_DB_OK = 0, |
| 62 | ZTE_HTTPSHARE_DB_ERROR_INVAILD_PTR = 100, |
| 63 | ZTE_HTTPSHARE_DB_ERROR_NOT_OPEN_DB, |
| 64 | ZTE_HTTPSHARE_DB_ERROR_FULL, |
| 65 | ZTE_HTTPSHARE_DB_ERROR = -1 |
| 66 | } zte_httpshare_db_result_e_type; |
| 67 | |
| 68 | |
| 69 | typedef enum { |
| 70 | ZTE_HTTPSHARE_FAILURE = -1, |
| 71 | ZTE_HTTPSHARE_SUCCESS = 0, |
| 72 | ZTE_HTTPSHARE_NOT_SUPPORT = 1, |
| 73 | ZTE_HTTPSHARE_MAX |
| 74 | } zte_httpshare_return_e_type; |
| 75 | |
| 76 | |
| 77 | typedef enum { |
| 78 | ZTE_ERROR_MODE = -1, |
| 79 | ZTE_HTTPSHARE_USB = 0, |
| 80 | ZTE_HTTPSHARE_HTTPSHARE = 1, |
| 81 | ZTE_RESERVE_MODE |
| 82 | } zte_httpshare_current_mode_type; |
| 83 | |
| 84 | |
| 85 | typedef enum { |
| 86 | ZTE_NVIO_FAIL = 0, |
| 87 | ZTE_NVIO_DONE = 1, |
| 88 | ZTE_NVIO_BUSY = 2, |
| 89 | ZTE_NVIO_BADCMD = 3, |
| 90 | ZTE_NVIO_MAX |
| 91 | } zte_topsw_state_e_type; |
| 92 | |
| 93 | |
| 94 | typedef enum { |
| 95 | ZTE_CHANGE_MODE_ERROR = 0, |
| 96 | ZTE_CHANGE_MODE_OK |
| 97 | } zte_httpshare_change_mode_type; |
| 98 | |
| 99 | int zte_httpshare_change_current_mode(zte_httpshare_current_mode_type curr_mode); |
| 100 | |
| 101 | int zte_init_sdcard_path(); |
| 102 | void zte_httpshare_init(); |
| 103 | int zte_umount_dev(); |
| 104 | int zte_init_sdcard_mode(); |
| 105 | |
| 106 | |
| 107 | #endif |
| 108 | |