-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparse.h
More file actions
74 lines (64 loc) · 1.28 KB
/
parse.h
File metadata and controls
74 lines (64 loc) · 1.28 KB
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
#ifndef PARSE_H_
#define PARSE_H_
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include<iostream>
#include <string>
#include<fstream>
#include <list>
#include <vector>
using namespace::std;
struct clientIdentity
{
int acceptId;
string ip;
int portno;
string requesttime;
};
struct clientInfo
{
string r_method;
string r_type;
string r_version;
string r_firstline;
//char filename[150];
string r_filename;
string r_time;
string r_servetime;
int r_acceptid;
string r_ip;
u_int16_t r_portno;
int r_filesize;
bool status_file;
bool status_dir ;
string file_root ;
string r_ctype;
bool rootcheck;
int status_code;
};
class Parse
{
public:
//struct clientInfo cInfo;
//char *parseWord[4],
list<clientInfo> clientlist;
list<clientInfo> requestlist;
bool exit_thread = false;
bool fileExists(char *filename);
bool dirExists(char *dir_addr);
void parseRequest(clientIdentity);
void readyQueue(clientInfo );
void checkRequest(clientInfo);
void fileRequestedData();
//void schedulerThread();
void popRequest();
static void *popRequest_helper(void *);
void serveRequest();
static void *serveRequest_helper(void *);
void changeFolder(clientInfo);
};
#endif /* PARSE_H_ */