]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LinuxGUI/Ventoy2Disk/Web/ventoy_http.h
Add theme plugin duplicate file check. (#2078)
[Ventoy.git] / LinuxGUI / Ventoy2Disk / Web / ventoy_http.h
1 /******************************************************************************
2 * ventoy_http.h
3 *
4 * Copyright (c) 2021, longpanda <admin@ventoy.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20 #ifndef __VENTOY_HTTP_H__
21 #define __VENTOY_HTTP_H__
22
23 #include <civetweb.h>
24
25 typedef enum PROGRESS_POINT
26 {
27 PT_START = 1,
28
29 PT_PRAPARE_FOR_CLEAN,
30 PT_DEL_ALL_PART,
31
32 PT_LOAD_CORE_IMG,
33 PT_LOAD_DISK_IMG,
34 PT_UNXZ_DISK_IMG_FINISH = PT_LOAD_DISK_IMG + 32,
35
36 PT_FORMAT_PART1, //10
37
38 PT_FORMAT_PART2,
39
40 PT_WRITE_VENTOY_START,
41 PT_WRITE_VENTOY_FINISH = PT_WRITE_VENTOY_START + 8,
42
43 PT_WRITE_STG1_IMG,//45
44 PT_SYNC_DATA1,
45
46 PT_CHECK_PART2,
47 PT_CHECK_PART2_FINISH = PT_CHECK_PART2 + 8,
48
49 PT_WRITE_PART_TABLE,//52
50 PT_SYNC_DATA2,
51
52 PT_FINISH
53 }PROGRESS_POINT;
54
55 typedef int (*ventoy_json_callback)(struct mg_connection *conn, VTOY_JSON *json);
56 typedef struct JSON_CB
57 {
58 const char *method;
59 ventoy_json_callback callback;
60 }JSON_CB;
61
62 typedef struct ventoy_thread_data
63 {
64 int diskfd;
65 uint32_t align4kb;
66 uint32_t partstyle;
67 uint32_t secure_boot;
68 uint64_t reserveBytes;
69 ventoy_disk *disk;
70 }ventoy_thread_data;
71
72 extern int g_vtoy_exfat_disk_fd;
73 extern uint64_t g_vtoy_exfat_part_size;
74
75 int ventoy_http_init(void);
76 void ventoy_http_exit(void);
77 int ventoy_http_start(const char *ip, const char *port);
78 int ventoy_http_stop(void);
79 int mkexfat_main(const char *devpath, int fd, uint64_t part_sector_count);
80
81 #endif /* __VENTOY_HTTP_H__ */
82