This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
/
usage.cpp
73 lines (69 loc) · 6.06 KB
/
usage.cpp
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
/*********************************************************************
* Copyright (c) Intel Corporation 2019 - 2020
* SPDX-License-Identifier: Apache-2.0
**********************************************************************/
#include "usage.h"
#include <iostream>
#include "version.h"
#include "activation.h"
void usage_show_help()
{
// 80 chars "01234567890123456789012345678901234567890123456789012345678901234567890123456789"
std::cout << "Usage: " << std::endl;
std::cout << " " << PROJECT_NAME << " <required> [optional]" << std::endl;
std::cout << " " << PROJECT_NAME << " <informational>" << std::endl;
std::cout << std::endl;
std::cout << "Required:" << std::endl;
std::cout << " -u, --url <url> websocket server" << std::endl;
std::cout << " -c, --cmd <command> server command" << std::endl;
std::cout << std::endl;
std::cout << " Since <command> can contain multiple options and arguments, the entire" << std::endl;
std::cout << " <command> must be in quotes. Please see examples below." << std::endl;
std::cout << std::endl;
std::cout << "Optional:" << std::endl;
std::cout << " -p, --proxy <addr> proxy address and port" << std::endl;
std::cout << " -d, --dns <dns> dns suffix override" << std::endl;
std::cout << " -n, --nocertcheck skip websocket server certificate verification" << std::endl;
std::cout << " -v, --verbose verbose output" << std::endl;
std::cout << std::endl;
std::cout << "Informational:" << std::endl;
std::cout << " --help this help text" << std::endl;
std::cout << " --version version" << std::endl;
std::cout << " --amtinfo <item> AMT info on an <item>" << std::endl;
std::cout << std::endl;
std::cout << "Item:" << std::endl;
std::cout << " all all items" << std::endl;
std::cout << " ver BIOS version" << std::endl;
std::cout << " bld build number" << std::endl;
std::cout << " sku product SKU" << std::endl;
std::cout << " uuid unique identifier" << std::endl;
std::cout << " mode current control mode" << std::endl;
std::cout << " dns domain name suffix" << std::endl;
std::cout << " fqdn fully qualified domain name" << std::endl;
std::cout << " cert certificate hashes" << std::endl;
std::cout << " ras remote access status" << std::endl;
std::cout << " lan LAN settings" << std::endl;
std::cout << std::endl;
std::cout << "Examples:" << std::endl;
std::cout << " # Activate platform using profile1" << std::endl;
std::cout << " " << PROJECT_NAME << \
" --url wss://192.168.86.100/activate --cmd \"-t activate --profile profile1\"" << std::endl;
std::cout << std::endl;
std::cout << " # Activate platform using profile1 and override DNS detection" << std::endl;
std::cout << " " << PROJECT_NAME << \
" --url wss://mycloud.com/activate --cmd \"-t activate --profile profile1\" --dns corp.com" << std::endl;
std::cout << std::endl;
std::cout << " # Deactivate platform and connect through a proxy" << std::endl;
std::cout << " " << PROJECT_NAME << \
" -u wss://mycloud.com/activate -c \"-t deactivate --password P@ssw0rd\" -p http://proxy.com:1000" << std::endl;
std::cout << std::endl;
std::cout << " # Show all informational items" << std::endl;
std::cout << " " << PROJECT_NAME << " --amtinfo all" << std::endl;
}
void usage_show_version()
{
std::string project_name = PROJECT_NAME;
for (auto& c : project_name) c = toupper(c); // get upper case string
std::cout << project_name << " " << PROJECT_VER << "." << std::endl;
std::cout << "Protocol " << PROTOCOL_VERSION << "." << std::endl;
}