-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommandparsertypes.h
More file actions
99 lines (87 loc) · 2.36 KB
/
commandparsertypes.h
File metadata and controls
99 lines (87 loc) · 2.36 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
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
#pragma once
#include <string>
#if defined(_WIN32) || defined(_WIN64)
#define NOMINMAX // windows.h provides MIN/MAX macros that conflict with min()/max() in gmpxx.h
#include <winsock2.h>
#include <ws2ipdef.h>
#elif defined __linux__
#include <sys/types.h>
#include <netinet/ip.h>
#include <unistd.h>
#include <netdb.h>
#endif
#define SERVER_PORT (htons(60000))
struct NetworkControllerSettings
{
union
{
sockaddr_in IPv4;
sockaddr_in6 IPv6;
};
// If true: this is server, listen on address.
// If false: check Client boolean
bool Server;
// If true: this is client, connect to address.
// If false: this is standalone, don't use networking.
bool Client;
NetworkControllerSettings() :
IPv6({ 0 }),
Server(false),
Client(false)
{}
};
struct PrimebotSettings
{
// Use Async prime finding code instead of threadpool
bool UseAsync;
// Search in descending order towards zero, instead of ascending.
bool Reverse;
// Threads to use for threadpool or Async
unsigned int ThreadCount;
// Number of bits in the numbers being searched
unsigned int Bitsize;
// Optional seed for the RNG to generate numbers to search
unsigned int RngSeed;
// Optional starting number. If specified, RNG is not used.
std::string StartValue;
// Numeric Base of the given StartValue
unsigned int StartValueBase;
// Count of numbers to search for primes
unsigned int BatchSize;
// Total count of batches to find and send
unsigned long long BatchCount;
PrimebotSettings();
};
struct PrimeFileSettings
{
// Directory to store discovered prime numbers in
std::string Path;
struct
{
// Whether to use binary or text mode to store primes.
unsigned Binary : 1;
// Whether to just print out primes in file Path
unsigned Print : 1;
} Flags;
PrimeFileSettings() :
Path()
{
Flags.Binary = true;
Flags.Print = false;
}
};
struct AllPrimebotSettings
{
NetworkControllerSettings NetworkSettings;
PrimebotSettings PrimeSettings;
PrimeFileSettings FileSettings;
// Whether to run the program or not.
// On failure, this should be false.
bool Run;
AllPrimebotSettings() :
NetworkSettings(),
PrimeSettings(),
FileSettings(),
Run(true)
{}
};