-
Notifications
You must be signed in to change notification settings - Fork 2
/
jceHandler.h
76 lines (57 loc) · 1.44 KB
/
jceHandler.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
#ifndef JCE_HANDLER_H
#define JCE_HANDLER_H
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include "sslsocket.h"
#include "user.h"
#include "jceDates.h"
#include "GradePage.h"
#include "SchedulePage.h"
#define dst_host "yedion.jce.ac.il"
#define dst_port 443
class jceHandler
{
public:
enum jceOptions
{
GET_GRADES_BY_DATES,
GET_SCHEDULE
};
jceHandler(user* const,jceDates* const);
~jceHandler() { delete recieverPage; delete JceConnector; }
bool start();
bool requestMenu(jceOptions);
private:
enum jceErrors {
ERROR_ON_VALIDATION,
ERROR_ON_INPUT,
ERROR_ON_CONNECTING,
ERROR_ON_OPEN_SOCKET,
ERROR_ON_GETTING_INFO,
ERROR_ON_GETTING_GRADES,
ERROR_ON_SEND_REQUEST
};
void makeFirstVisit();
void makeSecondVisit();
void getGraders();
void getSchedule();
//validation steps
std::string getFirstValidationStep();
std::string getSecondValidationStep();
//getting html
std::string getSchedulePath();
std::string getGradesPath();
//making server requests
std::string makeRequest(std::string);
//check if html file contains valid id and hash
bool checkValidation(std::string &html);
void checkConnection();
void printErrorANDabort(jceErrors t);
std::string * recieverPage;
sslsocket * JceConnector;
user * const jceUser; //there is only one user. therefor we need only 1 user in time. we wont change the pointer to other user. and we wont make new user.
jceDates * const jDates;
};
#endif