-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler_commands.h
294 lines (250 loc) · 4.96 KB
/
handler_commands.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#ifndef HANDLER_COMMANDS_H
#define HANDLER_COMMANDS_H
#include <iostream>
#include <enums.h>
#include <string.h>
#include <handler_commands.h>
#include <parser.h>
#include <scanner.h>
#include <handler_disk.h>
#include <handler_partitions.h>
#include <utils.h>
#include <handler_reports.h>
using namespace std;
class Cmd{
public:
virtual void Exec(){}
Cmd *next = NULL;
};
class cmd_mkdisk:public Cmd{
public:
int size;
Fit fit;
Unit unit;
char *path;
cmd_mkdisk(int size,char path[]);
void Exec();
};
class cmd_rmdisk:public Cmd{
public:
char *path;
cmd_rmdisk(char path[]);
void Exec();
};
class cmd_fdisk:public Cmd{
public:
int size;
Unit unit;
char *path;
TypePartition type;
Fit fit;
char *name;
cmd_fdisk(char name[],char path[],int size);
void Exec();
};
class cmd_addPart:public Cmd{
public:
int size;
Unit unit;
char *path;
char *name;
cmd_addPart(char name[],char path[],int size);
void Exec();
};
class cmd_rmPart:public Cmd{
public:
char *name;
char *path;
TypeFormat typeDel;
TypePartition typePart;
cmd_rmPart(char name[],char path[],TypePartition typePart,TypeFormat type);
void Exec();
};
class cmd_mount:public Cmd{
public:
char *path;
char *name;
cmd_mount(char path[],char name[]);
void Exec();
};
class cmd_unmount:public Cmd{
public:
char *id;
cmd_unmount(char id[]);
void Exec();
};
class cmd_exec:public Cmd{
public:
char *path;
cmd_exec(char path[]);
void Exec();
};
//**********************************************
class cmd_logout:public Cmd{
void Exec();
};
class cmd_pause:public Cmd{
void Exec();
};
class cmd_fs:public Cmd{
public:
TypeFormat type;
FileSistem fs;
char *id;
cmd_fs(char id[]);
void Exec();
};
class cmd_login:public Cmd{
public:
char *usr;
char *pwd;
char *id;
cmd_login(char usr[],char pwd[],char id[]);
void Exec();
};
class cmd_grp:public Cmd{
public:
char *name;
bool isForCreate;
cmd_grp(char name[],bool isForCreate);
void Exec();
};
class cmd_mkusr:public Cmd{
public:
char *usr;
char *pwd;
char *grp;
cmd_mkusr(char usr[],char pwd[],char grp[]);
void Exec();
};
class cmd_rmusr:public Cmd{
public:
char *usr;
cmd_rmusr(char usr[]);
void Exec();
};
class cmd_chmod:public Cmd{
public:
char *path;
int ugo;
bool isRecursive;
cmd_chmod(char path[],int ugo);
void Exec();
};
class cmd_mkfile:public Cmd{
public:
char *path;
bool isRecursive;
int size;
char *cont;
cmd_mkfile(char path[]);
void Exec();
};
class cmd_file:public Cmd{
public:
char *path;
bool isForCat;//rem
cmd_file(char path[],bool isForCat);
void Exec();
};
class cmd_edit:public Cmd{
public:
char *path;
char *cont;
cmd_edit(char path[],char cont[]);
void Exec();
};
class cmd_ren:public Cmd{
public:
char *path;
char *newName;
cmd_ren(char path[],char newName[]);
void Exec();
};
class cmd_mkdir:public Cmd{
public:
char *path;
bool isRecursive;
cmd_mkdir(char path[],bool isRecursive);
void Exec();
};
class cmd_cp:public Cmd{
public:
char *path;
char *newPath;
bool isForCp; //isForMove
cmd_cp(char path[],char newPath[],bool isForCp);
void Exec();
};
class cmd_find:public Cmd{
public:
char *path;
char *name;
cmd_find(char path[],char name[]);
void Exec();
};
class cmd_chown:public Cmd{
public:
char *path;
char *usr;
bool isRecursive;
cmd_chown(char path[],char usr[],bool isRecursive);
void Exec();
};
class cmd_chgrp:public Cmd{
public:
char *usr;
char *grp;
cmd_chgrp(char usr[],char grp[]);
void Exec();
};
class cmd_loss:public Cmd{
public:
char *id;
cmd_loss(char id[]);
void Exec();
};
class cmd_rep:public Cmd{
public:
char *path_report;
TypeReport type;
char *id;
char *path;
cmd_rep(char path[],TypeReport type,char id[]);
void Exec();
};
class cmd_recovery:public Cmd{
public:
char *id;
cmd_recovery(char *id);
void Exec();
};
class Option
{
public:
Option(Options op){
option = op;
next = NULL;
}
Options option;
char text[200];
int num;
Fit fit;
Unit unit;
TypePartition type;
TypeFormat delType;
FileSistem fs;
Option *next;
bool flag;
};
Cmd* getFormedCommand(CommandEnum command,Option *op);
bool validateParams(char *name,char *path,char *id,char *usr,
char *pwd,char *grp,char *cont,char *file,char *dest,char *ruta,
Fit fit,Unit unit,TypeFormat format,TypePartition typePart,
FileSistem fsystem,bool existSize,bool existAdd,bool existUgo,CommandEnum cmd);
Cmd* ListCommand(Cmd *cmd,bool flag);
void writeCommand(string command,bool isScript);
void readExecCommand(bool isScript);
void letsExecCommands(Cmd *commands);
bool isSesionActive();
#endif // HANDLER_COMMANDS_H