-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefine.h
118 lines (83 loc) · 2.36 KB
/
define.h
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef DEFINE_H
#define DEFINE_H
/* App */
#define VERSION "0.1"
#define APP "lfsearch"
#define DESCRIPTION "Local File Search"
/* common */
#ifndef DEBUG
#define DEBUG 0
#endif
/* settings */
#define PARAM_PREFIX_COUNT 2
/* status */
#define STATUS_FAILURE 1
#define STATUS_SUCCESS 0
/* Inputs */
#define INPUT_BAD_PARAM 10
/* main */
#define LFS_INVALID_CONFIG_FILE 51
#define LFS_UNKOWN_PARAM 52
/* actions */
#define ACTION_UNKNOWN 100
#define ACTION_FETCH 101
#define ACTION_STORE 102
#define ACTION_DELETE 103
#define ACTION_EXISTS 104
#define ACTION_SCAN 105
/* file type */
#define TYPE_UNKNOWN 200
#define TYPE_FILE 201
#define TYPE_DIR 202
/* shared memory */
#define SHM_MAX_SHARED_MEMORY_SIZE 1024
#define SHM_ERROR_OPEN 301
#define SHM_ERROR_TRUNCATE 302
#define SHM_ERROR_MMAP 303
#define SHM_ERROR_STAT 304
#define SHM_ERROR_DELETE 305
#define SHM_ERROR_FETCH 306
#define SHM_ERROR_MUNMAP 307
#define SHM_ERROR_NOT_FOUND 308
#define SHM_ERROR_FOUND 309
/* infile search */
#define INFILE_SEARCH_DEFAULT_MAX_CHAR 1024
#define INFILE_SEARCH_DEFAULT_FILENAME "index.html"
#define INFILE_SEARCH_ERROR_OPENDIR 401
#define INFILE_SEARCH_ERROR_READDIR 402
/* read config */
#define CONFIG_DELIM "="
#define CONFIG_DEFAULT_BUFFER 255
#define CONFIG_DEFAULT_LIMIT 1024
#define CONFIG_STRUCT_ACTION "action"
#define CONFIG_STRUCT_ENGINE "engine"
#define CONFIG_STRUCT_SEARCH "search"
#define CONFIG_STRUCT_FILE "file"
#define CONFIG_STRUCT_LIMIT "limit"
#define CONFIG_STRUCT_READ_BUFFER "read_buffer"
#define CONFIG_STRUCT_OUTPUT "output"
#define CONFIG_VALID_ACTION_SCAN "scan"
#define CONFIG_VALID_ACTION_EXISTS "exists"
#define CONFIG_VALID_ACTION_FETCH "fetch"
#define CONFIG_VALID_ACTION_STORE "store"
#define CONFIG_VALID_ACTION_DELETE "delete"
#define CONFIG_VALID_ENGINE_MEMCACHE "mc"
#define CONFIG_VALID_ENGINE_SHARED_MEM "shm"
#define CONFIG_VALID_OUTPUT_SCREEN "screen"
#define CONFIG_ERROR_FILE_READ 501
#define CONFIG_ERROR_FILE_OPEN 502
#define CONFIG_ERROR_ACTION 503
#define CONFIG_ERROR_ENGINE 504
#define CONFIG_ERROR_SEARCH 505
#define CONFIG_ERROR_FILE 506
#define CONFIG_ERROR_LIMIT 506
#define CONFIG_ERROR_READ_BUFFER 507
#define CONFIG_ERROR_OUTPUT 508
#define CONFIG_ERROR_OUTPUT_FILE_EXISTS 509
/* user input */
#define USER_INPUT_NO_INPUT 601
#define USER_INPUT_NO_CONFIG_FOUND 602
/* redis */
#define REDIS_CONNECTION_FAIL 701
/* END */
#endif