-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargument_parser.h
49 lines (39 loc) · 1.07 KB
/
argument_parser.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
/**
* @file argument_parser.h
* @author Juraj Holub <xholub40@stud.fit.vutbr.cz>
* @brief Parse command line arguments.
* @date October 2019
*/
#include <iostream>
#ifndef PROJECT_ARGUMENT_PARSER_H
#define PROJECT_ARGUMENT_PARSER_H
#define WHOISE_SERVVER 0
#define HOSTNAME 1
#define DNS_SERVER 2
#define HELP_MSG 3
struct address_t {
std::string hostname;
std::string ipv4;
};
class ArgumentParser {
public:
ArgumentParser();
bool parseArgs(int argc, char **argv);
void printHelp();
address_t getWhoisServer();
address_t getAnalyzedDomain();
address_t getDnsServer();
/**
* If input is IPV4 then find domain name.
* If input is domain name then find IPv4 address.
* If input is IPv6 then find domain name and by domain name find ipv4.
* Else dont fill ipv4 and domain and DNS or Whois server didnt found content (user input error).
* @return True if input is valid IP|hostname.
*/
bool parseDomain(std::string input, address_t &output);
private:
address_t whoisServer;
address_t analyzedDomain;
address_t dnsServer;
};
#endif //PROJECT_ARGUMENT_PARSER_H