Compare commits
61 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5772e831ad | ||
|
6d490aec65 | ||
|
41f8f8553c | ||
|
bc1f8d0cfb | ||
|
a8e1bc89f0 | ||
|
5b5a480943 | ||
|
a190a214f1 | ||
|
54b7550e31 | ||
|
e4deeca506 | ||
|
365ad90adc | ||
|
2984880b6e | ||
|
da9c26bc26 | ||
|
bb4e144684 | ||
|
86cf9657ad | ||
|
025152f359 | ||
|
9b0d7fe649 | ||
|
b2a54c47a3 | ||
|
a859cf5648 | ||
|
5a9597fc2b | ||
|
b1f7b32baa | ||
|
2fb64ac3f8 | ||
|
b03e2988a5 | ||
|
acf428537f | ||
|
6cd660a7af | ||
|
c4de327e7e | ||
|
fc600d61a1 | ||
|
41a1be5249 | ||
|
4e5dccce89 | ||
|
0679235cba | ||
|
95a422478b | ||
|
f9f70d23f9 | ||
|
f1b32ef953 | ||
|
d23b1c4be5 | ||
|
b54025168c | ||
|
6433a553a0 | ||
|
b13c070598 | ||
|
ecc31a25f7 | ||
|
01316bcfa2 | ||
|
c1fbf6aa39 | ||
|
fd5817461e | ||
|
a889f91cdc | ||
|
a32e109913 | ||
|
9efc9476a4 | ||
|
aa7d888fab | ||
|
aa68d7cfdb | ||
|
434c9a1cc2 | ||
|
8b4f3b00bb | ||
|
53bc0c42da | ||
|
dbb825c49e | ||
|
385ea2b9c3 | ||
|
0ecd6c9911 | ||
|
ca85fa4d14 | ||
|
711d9ef58d | ||
|
458d6ba2e2 | ||
|
d2633af0c5 | ||
|
3bfb88aeb6 | ||
|
d22f00ec0b | ||
|
cd4046c741 | ||
|
584a8e4f34 | ||
|
1fc6816153 | ||
|
a5788382d7 |
42
.chglog/CHANGELOG.tpl.md
Normal file
42
.chglog/CHANGELOG.tpl.md
Normal file
@@ -0,0 +1,42 @@
|
||||
{{ if .Versions -}}
|
||||
<a name="unreleased"></a>
|
||||
## [Unreleased]
|
||||
|
||||
{{ if .Unreleased.CommitGroups -}}
|
||||
{{ range .Unreleased.CommitGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Commits -}}
|
||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ range .Versions }}
|
||||
<a name="{{ .Tag.Name }}"></a>
|
||||
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
|
||||
{{ range .CommitGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Commits -}}
|
||||
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if .NoteGroups -}}
|
||||
{{ range .NoteGroups -}}
|
||||
### {{ .Title }}
|
||||
{{ range .Notes }}
|
||||
{{ .Body }}
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if .Versions }}
|
||||
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
|
||||
{{ range .Versions -}}
|
||||
{{ if .Tag.Previous -}}
|
||||
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
28
.chglog/config.yml
Normal file
28
.chglog/config.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
style: github
|
||||
template: CHANGELOG.tpl.md
|
||||
info:
|
||||
title: CHANGELOG
|
||||
repository_url: https://github.com/open-amt-cloud-toolkit/rpc
|
||||
options:
|
||||
commits:
|
||||
# filters:
|
||||
# Type:
|
||||
# - feat
|
||||
# - fix
|
||||
# - perf
|
||||
# - refactor
|
||||
commit_groups:
|
||||
# title_maps:
|
||||
# feat: Features
|
||||
# fix: Bug Fixes
|
||||
# perf: Performance Improvements
|
||||
# refactor: Code Refactoring
|
||||
header:
|
||||
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
|
||||
pattern_maps:
|
||||
- Type
|
||||
- Scope
|
||||
- Subject
|
||||
notes:
|
||||
keywords:
|
||||
- BREAKING CHANGE
|
14
.github/semantic.yml
vendored
Normal file
14
.github/semantic.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
allowMergeCommits: true
|
||||
# Always validate the PR title AND all the commits
|
||||
titleAndCommits: true
|
||||
types:
|
||||
- feat
|
||||
- fix
|
||||
- docs
|
||||
- style
|
||||
- refactor
|
||||
- perf
|
||||
- test
|
||||
- build
|
||||
- ci
|
||||
- revert
|
101
.github/workflows/build_all.yml
vendored
Normal file
101
.github/workflows/build_all.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
#*********************************************************************
|
||||
# Copyright (c) Intel Corporation 2020
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#*********************************************************************/
|
||||
|
||||
name: Build RPC (Native) Debug/Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_type:
|
||||
description: 'Build Type can be "debug" or "release".'
|
||||
required: true
|
||||
default: "release"
|
||||
|
||||
env:
|
||||
BUILD_TYPE: ${{github.event.inputs.build_type}}
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Create Build Dir
|
||||
run: mkdir build
|
||||
- name: Clone
|
||||
run: git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
- name: Build VCPKG
|
||||
run: cd vcpkg && bootstrap-vcpkg.bat
|
||||
shell: cmd
|
||||
- name: dir
|
||||
run: ls
|
||||
- name: dir
|
||||
run: cd vcpkg && ls
|
||||
- name: Install C++ REST SDK
|
||||
run: ${{ runner.workspace }}\rpc\vcpkg\vcpkg.exe install cpprestsdk[websockets]:x64-windows-static
|
||||
shell: cmd
|
||||
- name: dir
|
||||
run: ls && cd vcpkg && ls
|
||||
shell: bash
|
||||
- name: Prepare for build
|
||||
run: cd build && cmake .. -DCMAKE_PREFIX_PATH=D:/a/rpc/rpc/vcpkg/installed/x64-windows-static -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=D:/a/rpc/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
- name: Build RPC (Debug)
|
||||
if: ${{ github.event.inputs.build_type }} == "debug"
|
||||
run: cd build && cmake --build . --config Debug
|
||||
- name: Build RPC (Release)
|
||||
if: ${{ github.event.inputs.build_type }} == "release"
|
||||
run: cd build && cmake --build . --config Release
|
||||
- name: GitHub Upload Release Artifacts
|
||||
if: ${{ github.event.inputs.build_type }} == "release"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: RPC_Windows_release.exe
|
||||
path: ${{ runner.workspace }}\rpc\build\Release\rpc.exe
|
||||
- name: GitHub Upload Release Artifacts
|
||||
if: ${{ github.event.inputs.build_type }} == "debug"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: RPC_Windows_debug.exe
|
||||
path: ${{ runner.workspace }}\rpc\build\Debug\rpc.exe
|
||||
|
||||
build-linux:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-18.04, ubuntu-20.04]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Dependencies
|
||||
run: sudo apt install git cmake build-essential curl zip unzip tar pkg-config
|
||||
- name: Create Build Dir
|
||||
run: mkdir build
|
||||
- name: Clone
|
||||
run: git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
- name: Build VCPKG
|
||||
run: cd vcpkg && ./bootstrap-vcpkg.sh
|
||||
shell: bash
|
||||
- name: dir
|
||||
run: ls
|
||||
- name: dir
|
||||
run: cd vcpkg && ls
|
||||
- name: Install C++ REST SDK
|
||||
run: ${{ runner.workspace }}/rpc/vcpkg/vcpkg install cpprestsdk[websockets]
|
||||
shell: bash
|
||||
- name: dir
|
||||
run: ls && cd vcpkg && ls
|
||||
shell: bash
|
||||
- name: Prepare for build
|
||||
if: ${{ github.event.inputs.build_type }} == "debug"
|
||||
run: cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
- name: Prepare for build
|
||||
if: ${{ github.event.inputs.build_type }} == "release"
|
||||
run: cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
- name: Build RPC
|
||||
run: cd build && cmake --build .
|
||||
- name: GitHub Upload Release Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: RPC_Linux_${{ matrix.os }}_${{github.event.inputs.build_type}}
|
||||
path: |
|
||||
build/rpc
|
@@ -6,12 +6,14 @@
|
||||
name: Build RPC (Native)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
@@ -19,7 +21,7 @@ jobs:
|
||||
- name: Create Build Dir
|
||||
run: mkdir build
|
||||
- name: Clone
|
||||
run: git clone --branch 2020.01 https://github.com/microsoft/vcpkg.git
|
||||
run: git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
- name: Build VCPKG
|
||||
run: cd vcpkg && bootstrap-vcpkg.bat
|
||||
shell: cmd
|
||||
@@ -27,25 +29,19 @@ jobs:
|
||||
run: ls
|
||||
- name: dir
|
||||
run: cd vcpkg && ls
|
||||
- name: Integrate with VS
|
||||
run: ${{ runner.workspace }}\rpc\vcpkg\vcpkg.exe integrate install
|
||||
shell: cmd
|
||||
- name: Install C++ REST SDK
|
||||
run: ${{ runner.workspace }}\rpc\vcpkg\vcpkg.exe install cpprestsdk:x64-windows-static
|
||||
run: ${{ runner.workspace }}\rpc\vcpkg\vcpkg.exe install cpprestsdk[websockets]:x64-windows-static
|
||||
shell: cmd
|
||||
- name: dir
|
||||
run: ls && cd vcpkg && ls
|
||||
shell: bash
|
||||
- name: Prepare for build
|
||||
run: cd build && cmake .. -DCMAKE_PREFIX_PATH=D:/a/rpc/rpc/vcpkg/installed/x64-windows-static -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=D:/a/rpc/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
- name: Build RPC
|
||||
- name: Build RPC (Release)
|
||||
run: cd build && cmake --build . --config Release
|
||||
- name: Build RPC (Debug)
|
||||
run: cd build && cmake --build . --config Debug
|
||||
- name: GitHub Upload Release Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: RPC_Windows.exe
|
||||
path: ${{ runner.workspace }}\rpc\build\Debug\rpc.exe
|
||||
|
||||
|
||||
build-linux:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
@@ -54,16 +50,25 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt install libboost-system-dev libboost-thread-dev libboost-random-dev libboost-regex-dev libboost-filesystem-dev libssl-dev zlib1g-dev -y
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
cmake --build .
|
||||
|
||||
- name: GitHub Upload Release Artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: RPC_Linux_${{ matrix.os }}
|
||||
path: |
|
||||
build/rpc
|
||||
run: sudo apt install git cmake build-essential curl zip unzip tar pkg-config
|
||||
- name: Create Build Dir
|
||||
run: mkdir build
|
||||
- name: Clone
|
||||
run: git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
- name: Build VCPKG
|
||||
run: cd vcpkg && ./bootstrap-vcpkg.sh
|
||||
shell: bash
|
||||
- name: dir
|
||||
run: ls
|
||||
- name: dir
|
||||
run: cd vcpkg && ls
|
||||
- name: Install C++ REST SDK
|
||||
run: ${{ runner.workspace }}/rpc/vcpkg/vcpkg install cpprestsdk[websockets]
|
||||
shell: bash
|
||||
- name: dir
|
||||
run: ls && cd vcpkg && ls
|
||||
shell: bash
|
||||
- name: Prepare for build
|
||||
run: cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
- name: Build RPC
|
||||
run: cd build && cmake --build .
|
29
.github/workflows/docker-ci.yml
vendored
Normal file
29
.github/workflows/docker-ci.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#*********************************************************************
|
||||
# Copyright (c) Intel Corporation 2020
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#*********************************************************************/
|
||||
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build the Docker image
|
||||
run: docker build -f "Dockerfile" --tag vprodemo.azurecr.io/rpc:${{ github.sha }} --tag vprodemo.azurecr.io/rpc:latest .
|
||||
- name: Docker Login
|
||||
uses: docker/login-action@v1.6.0
|
||||
with:
|
||||
registry: vprodemo.azurecr.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
logout: true
|
||||
- name: Push the Docker image to the registry
|
||||
run: docker push vprodemo.azurecr.io/rpc:${{ github.sha }}
|
||||
- name: Push the Docker image to the registry
|
||||
run: docker push vprodemo.azurecr.io/rpc:latest
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -8,4 +8,6 @@ install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
build/
|
||||
.vscode/*
|
||||
.vscode/*
|
||||
.vs
|
||||
*.exe
|
101
Build.md
Normal file
101
Build.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# Remote Provisioning Client (RPC)
|
||||
|
||||
RPC is an application which enables remote capabilities for AMT, such as as device activation. To accomplish this, RPC communicates with the RPS (Remote Provisioning Server).
|
||||
|
||||
The steps below assume the following directory structure where **rpc** is the clone of this repository, **vcpkg** is a clone of the VCPKG tool source and **build** is the RPC build directory. Both vcpkg and build directories will be created in later steps.
|
||||
|
||||
```
|
||||
\rpc
|
||||
|__vcpkg
|
||||
|__build
|
||||
```
|
||||
|
||||
# Linux
|
||||
|
||||
Steps below are for Ubuntu 18.04 and 20.04.
|
||||
|
||||
## Dependencies
|
||||
|
||||
```
|
||||
sudo apt install git cmake build-essential curl zip unzip tar pkg-config
|
||||
```
|
||||
|
||||
## Build C++ REST SDK
|
||||
|
||||
Open a Terminal window.
|
||||
|
||||
```
|
||||
git clone -b 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg install cpprestsdk[websockets]
|
||||
```
|
||||
|
||||
## Build RPC
|
||||
|
||||
Open a Terminal window.
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
To build debug:
|
||||
```
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
## Run RPC
|
||||
|
||||
Open a Terminal window.
|
||||
|
||||
```
|
||||
cd build
|
||||
sudo ./rpc --url wss://localhost:8080 --cmd "-t activate --profile profile1"
|
||||
```
|
||||
|
||||
Use --help for more options.
|
||||
|
||||
# Windows
|
||||
|
||||
Steps below are for Windows 10 and Visual Studio 2019 Professional.
|
||||
|
||||
## Build C++ REST SDK
|
||||
|
||||
Open an x64 Native Tools Command Prompt for Visual Studio 2019.
|
||||
|
||||
```
|
||||
git clone -b 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
bootstrap-vcpkg.bat
|
||||
vcpkg install cpprestsdk[websockets]:x64-windows-static
|
||||
```
|
||||
|
||||
## Build RPC
|
||||
Open an x64 Native Tools Command Prompt for Visual Studio 2019.
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake ..
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
To build debug:
|
||||
```
|
||||
cmake --build . --config Debug
|
||||
```
|
||||
|
||||
## Run RPC
|
||||
|
||||
Open a Command Prompt as Administrator.
|
||||
|
||||
```
|
||||
cd build\Release
|
||||
rpc.exe --url wss://localhost:8080 --cmd "-t activate --profile profile1"
|
||||
```
|
||||
|
||||
Use --help for more options.
|
||||
|
50
CHANGELOG.md
Normal file
50
CHANGELOG.md
Normal file
@@ -0,0 +1,50 @@
|
||||
<a name="v1.2.0"></a>
|
||||
## v1.2.0
|
||||
|
||||
### Ci
|
||||
- breakout docker build for merge only
|
||||
|
||||
### Feat
|
||||
- update RPC version to 1.2.0.
|
||||
- BREAKING CHANGE: add heartbeat capability, bump RPC Protocol version to 4.0.0
|
||||
- add unit test framework
|
||||
- add hostname to activation info
|
||||
- **docker:** add dockerfile support for RPC
|
||||
|
||||
### Fix
|
||||
- use message status instead, cleanup message fields.
|
||||
|
||||
|
||||
<a name="v1.1.0"></a>
|
||||
## [v1.1.0] - 2021-02-09
|
||||
|
||||
### Build
|
||||
- **jenkins:** jenkins build scripts for Windows and Ubuntu
|
||||
- add support for centos7 and 8
|
||||
- Use `-DNO_SELECT=ON` to work around select behavior on older distros
|
||||
- Use vcpkg for both linux and windows
|
||||
|
||||
### Ci
|
||||
- update build
|
||||
- update build
|
||||
- add support for release or debug
|
||||
- add types for conventional commits
|
||||
- add ci for status checks
|
||||
|
||||
### Docs
|
||||
- add release disclaimer
|
||||
|
||||
### Fix
|
||||
- link status not reported correctly
|
||||
- free fqdn buffer
|
||||
|
||||
### Feat
|
||||
- version update
|
||||
- Add `--nocertcheck`, `-n` args to skip websocket server certificate verification for all builds.
|
||||
- Add/update DNS Suffix (OS), Hostname (OS), fqdn [AMT] and DNS Suffix info returned by --amtinfo.
|
||||
|
||||
<a name="v1.0.0"></a>
|
||||
## [v1.0.0] - 2020-11-20
|
||||
### Build
|
||||
- Add Github Actions Support
|
||||
|
123
CMakeLists.txt
123
CMakeLists.txt
@@ -1,18 +1,14 @@
|
||||
cmake_minimum_required (VERSION 3.1)
|
||||
|
||||
project (rpc VERSION 1.0.0)
|
||||
project (rpc VERSION 1.2.0)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# RPC version info
|
||||
configure_file(version.h.in
|
||||
version.h)
|
||||
configure_file(version.h.in version.h)
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
|
||||
# TODO: figure out how to read the LMS version from repo like the main lms CMakeLists.txt
|
||||
set (LMS_VERSION_STRING 1932.0.0.0)
|
||||
|
||||
# Compiler settings [Obtained from CmakeLists.txt for lms]
|
||||
# Common compiler settings
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DDEBUG -D_DEBUG")
|
||||
string(APPEND CMAKE_C_FLAGS_DEBUG " -DDEBUG -D_DEBUG")
|
||||
|
||||
@@ -31,7 +27,6 @@ if (UNIX)
|
||||
else (UNIX)
|
||||
add_definitions (/GS /sdl)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NXCompat /DynamicBase")
|
||||
#add_definitions (/D UNICODE /D _UNICODE)
|
||||
add_definitions (/D UNICODE /D _UNICODE /D_NO_ASYNCRTIMP /D_ASYNCRT_EXPORT /D_NO_PPLXIMP /DWIN32 /DMBCS /D_USRDLL /DCPPREST_EXCLUDE_COMPRESSION /D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
add_compile_options ($<$<CONFIG:Release>:/O2>)
|
||||
add_compile_options (/MT$<$<CONFIG:Debug>:d>)
|
||||
@@ -42,48 +37,49 @@ endif (UNIX)
|
||||
# Add MicroLMS directly to our build. This adds
|
||||
# the following targets: MicroLMS
|
||||
add_subdirectory(MicroLMS)
|
||||
#add_dependencies(rpc MicroLMS)
|
||||
|
||||
if (UNIX)
|
||||
|
||||
# Find threads [unix it pthreads]
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# Find Boost
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
find_package(Boost COMPONENTS system REQUIRED)
|
||||
|
||||
# Find OpenSSL
|
||||
find_package(OpenSSL)
|
||||
|
||||
# Find ZLIB
|
||||
find_package(ZLIB)
|
||||
|
||||
# Download and build CppRestSDK, If GIT_TAG is changed then need to delete cpprestsdk-prefix because UPDATE_COMMAND is set to ""
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(cpprestsdk
|
||||
GIT_REPOSITORY https://github.com/Microsoft/cpprestsdk.git
|
||||
GIT_TAG v2.10.16
|
||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=<SOURCE_DIR>/../../install
|
||||
TEST_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
)
|
||||
ExternalProject_Get_Property(cpprestsdk SOURCE_DIR)
|
||||
set(CPPRESTSDK_LIBARIES ${SOURCE_DIR}/../../install/lib/)
|
||||
set(CPPRESTSDK_INCLUDE_DIR ${SOURCE_DIR}/../../install/include/)
|
||||
|
||||
add_library(cpprest INTERFACE)
|
||||
target_link_libraries(cpprest INTERFACE ${CPPRESTSDK_LIBARIES}/libcpprest.a OpenSSL::SSL OpenSSL::Crypto ${Boost_LIBRARIES} Threads::Threads ZLIB::ZLIB)
|
||||
target_include_directories(cpprest INTERFACE ${CPPRESTSDK_INCLUDE_DIR})
|
||||
|
||||
else (UNIX)
|
||||
|
||||
# CppRestSDK
|
||||
find_package(cpprestsdk CONFIG REQUIRED)
|
||||
|
||||
endif (UNIX)
|
||||
# GoogleTest
|
||||
# Download and unpack googletest at configure time
|
||||
configure_file(googletest.cmake.in googletest-download/CMakeLists.txt)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
|
||||
if(result)
|
||||
message(FATAL_ERROR "Build step for googletest failed: ${result}")
|
||||
endif()
|
||||
|
||||
# Prevent overriding the parent project's compiler/linker
|
||||
# settings on Windows
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Add googletest directly to our build. This defines
|
||||
# the gtest and gtest_main targets.
|
||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
# add the test executable
|
||||
add_executable(rpctest
|
||||
test.cpp
|
||||
utils.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(rpctest
|
||||
gtest_main
|
||||
cpprestsdk::cpprest
|
||||
cpprestsdk::cpprestsdk_zlib_internal
|
||||
cpprestsdk::cpprestsdk_boost_internal
|
||||
cpprestsdk::cpprestsdk_openssl_internal
|
||||
)
|
||||
|
||||
# ccu-poc
|
||||
add_executable (rpc
|
||||
@@ -102,6 +98,8 @@ add_executable (rpc
|
||||
commands.cpp
|
||||
activation.h
|
||||
activation.cpp
|
||||
heartbeat.h
|
||||
heartbeat.cpp
|
||||
lms.h
|
||||
lms.cpp
|
||||
main.cpp
|
||||
@@ -111,38 +109,37 @@ target_include_directories(rpc PUBLIC
|
||||
"MicroLMS/heci"
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
add_dependencies(rpc MicroLMS)
|
||||
|
||||
add_dependencies(rpc cpprestsdk)
|
||||
if (UNIX)
|
||||
|
||||
target_link_libraries (rpc PRIVATE
|
||||
MicroLMS
|
||||
cpprest
|
||||
cpprestsdk::cpprest
|
||||
cpprestsdk::cpprestsdk_zlib_internal
|
||||
cpprestsdk::cpprestsdk_boost_internal
|
||||
cpprestsdk::cpprestsdk_openssl_internal
|
||||
)
|
||||
|
||||
else (UNIX)
|
||||
|
||||
add_dependencies(rpc MicroLMS )
|
||||
|
||||
target_link_libraries (rpc PRIVATE
|
||||
MicroLMS
|
||||
iphlpapi
|
||||
cpprestsdk::cpprest
|
||||
cpprestsdk::cpprestsdk_zlib_internal
|
||||
cpprestsdk::cpprestsdk_boost_internal
|
||||
cpprestsdk::cpprestsdk_brotli_internal
|
||||
${Boost_LIBRARIES}
|
||||
DbgHelp.lib
|
||||
Iphlpapi.lib
|
||||
Setupapi.lib
|
||||
ws2_32.lib
|
||||
Psapi.lib
|
||||
Crypt32.lib
|
||||
Wintrust.lib
|
||||
Version.lib
|
||||
Wtsapi32.lib
|
||||
Gdiplus.lib
|
||||
Userenv.lib
|
||||
Iphlpapi.lib
|
||||
Setupapi.lib
|
||||
ws2_32.lib
|
||||
Psapi.lib
|
||||
Crypt32.lib
|
||||
Wintrust.lib
|
||||
Version.lib
|
||||
Wtsapi32.lib
|
||||
Gdiplus.lib
|
||||
Userenv.lib
|
||||
)
|
||||
|
||||
endif (UNIX)
|
||||
|
85
CentOS7.md
Normal file
85
CentOS7.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# Remote Provisioning Client (RPC)
|
||||
|
||||
RPC is an application which enables remote capabilities for AMT, such as as device activation. To accomplish this, RPC communicates with the RPS (Remote Provisioning Server).
|
||||
|
||||
The steps below assume the following directory structure where **rpc** is the clone of this repository, **vcpkg** is a clone of the VCPKG tool source and **build** is the RPC build directory. Both vcpkg and build directories will be created in later steps.
|
||||
|
||||
```
|
||||
\rpc
|
||||
|__vcpkg
|
||||
|__build
|
||||
```
|
||||
|
||||
# Linux
|
||||
|
||||
Steps below are for CentOS7.
|
||||
|
||||
**The "export PATH=..." (for CMake and Git), and "scl enable devtoolset-7 bash" (for GCC) must be executed in in the Terminal you are building from; i.e. these are temporary changes which only affect the current Terminal session.**
|
||||
|
||||
## Dependencies
|
||||
|
||||
### CMake
|
||||
Download cmake-3.10.2-Linux-x86_64.sh from https://github.com/Kitware/CMake/releases/tag/v3.10.2.
|
||||
|
||||
```
|
||||
./cmake-3.10.2-Linux-x86_64.sh
|
||||
export PATH=/home/user/Downloads/cmake-3.10.2-Linux-x86_64/bin:$PATH
|
||||
```
|
||||
|
||||
### GCC
|
||||
Update GCC toolchain.
|
||||
|
||||
```
|
||||
sudo yum install centos-release-scl
|
||||
sudo yum install devtoolset-7
|
||||
scl enable devtoolset-7 bash
|
||||
```
|
||||
|
||||
### Git
|
||||
Build Git source control system.
|
||||
```
|
||||
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-CPAN perl-devel
|
||||
git clone https://github.com/git/git.git
|
||||
make configure
|
||||
make
|
||||
export PATH=/home/user/Downloads/git:$PATH
|
||||
```
|
||||
|
||||
## Build C++ REST SDK
|
||||
|
||||
Using a Terminal window with the PATH and devtoolset enabled per the Dependencies.
|
||||
|
||||
```
|
||||
git clone -b 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg install cpprestsdk[websockets]
|
||||
```
|
||||
|
||||
## Build RPC
|
||||
|
||||
Using a Terminal window with the PATH and devtoolset enabled per the Dependencies.
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DNO_SELECT=ON ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
To build debug:
|
||||
```
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DNO_SELECT=ON ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
## Run RPC
|
||||
|
||||
Open a Terminal window.
|
||||
|
||||
```
|
||||
cd build
|
||||
sudo ./rpc --url wss://localhost:8080 --cmd "-t activate --profile profile1"
|
||||
```
|
||||
|
||||
Use --help for more options.
|
63
CentOS8.md
Normal file
63
CentOS8.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# Remote Provisioning Client (RPC)
|
||||
|
||||
RPC is an application which enables remote capabilities for AMT, such as as device activation. To accomplish this, RPC communicates with the RPS (Remote Provisioning Server).
|
||||
|
||||
The steps below assume the following directory structure where **rpc** is the clone of this repository, **vcpkg** is a clone of the VCPKG tool source and **build** is the RPC build directory. Both vcpkg and build directories will be created in later steps.
|
||||
|
||||
```
|
||||
\rpc
|
||||
|__vcpkg
|
||||
|__build
|
||||
```
|
||||
|
||||
# Linux
|
||||
|
||||
Steps below are for CentOS8.
|
||||
|
||||
## Dependencies
|
||||
|
||||
### CMake
|
||||
Install CMake.
|
||||
|
||||
```
|
||||
sudo yum install cmake
|
||||
```
|
||||
|
||||
## Build C++ REST SDK
|
||||
|
||||
Using a Terminal window with the PATH and devtoolset enabled per the Dependencies.
|
||||
|
||||
```
|
||||
git clone -b 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg install cpprestsdk[websockets]
|
||||
```
|
||||
|
||||
## Build RPC
|
||||
|
||||
Using a Terminal window with the PATH and devtoolset enabled per the Dependencies.
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
To build debug:
|
||||
```
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
## Run RPC
|
||||
|
||||
Open a Terminal window.
|
||||
|
||||
```
|
||||
cd build
|
||||
sudo ./rpc --url wss://localhost:8080 --cmd "-t activate --profile profile1"
|
||||
```
|
||||
|
||||
Use --help for more options.
|
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
#*********************************************************************
|
||||
# Copyright (c) Intel Corporation 2021
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#*********************************************************************/
|
||||
|
||||
FROM ubuntu:20.04 AS rpc-builder
|
||||
|
||||
WORKDIR /
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN \
|
||||
apt-get update -y -qq && \
|
||||
apt install -y -qq \
|
||||
git cmake build-essential libssl-dev zlib1g-dev \
|
||||
curl unzip zip pkg-config
|
||||
RUN git clone https://github.com/open-amt-cloud-toolkit/rpc.git
|
||||
WORKDIR /rpc
|
||||
RUN mkdir -p build
|
||||
RUN git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
RUN cd vcpkg && ./bootstrap-vcpkg.sh
|
||||
RUN ./vcpkg/vcpkg install cpprestsdk[websockets]
|
||||
|
||||
WORKDIR /rpc/build
|
||||
RUN cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake ..
|
||||
RUN cmake --build .
|
||||
|
||||
FROM ubuntu:20.04
|
||||
|
||||
LABEL license='SPDX-License-Identifier: Apache-2.0' \
|
||||
copyright='Copyright (c) 2021: Intel'
|
||||
|
||||
WORKDIR /root
|
||||
RUN \
|
||||
apt-get update -y -qq && \
|
||||
apt install -y -qq \
|
||||
libssl-dev
|
||||
COPY --from=rpc-builder /rpc/build/rpc .
|
||||
ENTRYPOINT ["/root/rpc"]
|
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Intel Corporation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@@ -37,6 +37,10 @@ if (${BUILD_LIBRARY})
|
||||
add_definitions(-D BUILD_LIBRARY)
|
||||
endif (${BUILD_LIBRARY})
|
||||
|
||||
if (${NO_SELECT})
|
||||
add_definitions(-D NO_SELECT)
|
||||
endif (${NO_SELECT})
|
||||
|
||||
add_definitions( -D_POSIX )
|
||||
|
||||
else (UNIX)
|
||||
@@ -183,16 +187,5 @@ target_link_libraries (
|
||||
|
||||
endif (BUILD_LIBRARY)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
endif (UNIX)
|
||||
|
||||
|
@@ -105,13 +105,17 @@ static ssize_t mei_recv_msg(struct mei *me, unsigned char *buffer, ssize_t len,
|
||||
|
||||
static ssize_t mei_send_msg(struct mei *me, const unsigned char *buffer, ssize_t len, unsigned long timeout)
|
||||
{
|
||||
#ifndef NO_SELECT
|
||||
struct timeval tv;
|
||||
#endif
|
||||
ssize_t written;
|
||||
ssize_t rc;
|
||||
fd_set set;
|
||||
|
||||
#ifndef NO_SELECT
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = (timeout % 1000) * 1000000;
|
||||
#endif
|
||||
|
||||
mei_msg(me, "call write length = %zd, cmd=%d\n", len, (int)buffer[0]);
|
||||
|
||||
@@ -123,7 +127,7 @@ static ssize_t mei_send_msg(struct mei *me, const unsigned char *buffer, ssize_t
|
||||
mei_err(me, "write failed with status %zd %s\n", written, strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifndef NO_SELECT
|
||||
FD_ZERO(&set);
|
||||
FD_SET(me->fd, &set);
|
||||
rc = select(me->fd + 1 , NULL, &set, NULL, &tv);
|
||||
@@ -136,7 +140,7 @@ static ssize_t mei_send_msg(struct mei *me, const unsigned char *buffer, ssize_t
|
||||
mei_err(me, "write failed on select with status %zd\n", rc);
|
||||
goto out;
|
||||
}
|
||||
|
||||
#endif
|
||||
rc = written;
|
||||
out:
|
||||
sem_post(&(me->Lock));
|
||||
|
@@ -147,6 +147,10 @@ const PTHI_MESSAGE_HEADER SET_HOST_FQDN_HEADER = {
|
||||
{AMT_MAJOR_VERSION, AMT_MAJOR_VERSION}, 0, {{SET_HOST_FQDN_REQUEST}}, 0
|
||||
};
|
||||
|
||||
const PTHI_MESSAGE_HEADER GET_FQDN_HEADER = {
|
||||
{AMT_MAJOR_VERSION, AMT_MAJOR_VERSION}, 0, {{GET_FQDN_REQUEST}}, 0
|
||||
};
|
||||
|
||||
const PTHI_MESSAGE_HEADER GET_LOCAL_SYSTEM_ACCOUNT_HEADER = {
|
||||
{AMT_MAJOR_VERSION, AMT_MINOR_VERSION}, 0, {{GET_LOCAL_SYSTEM_ACCOUNT_REQUEST}}, 40
|
||||
};
|
||||
@@ -202,10 +206,7 @@ AMT_STATUS _call(const unsigned char *command, UINT32 command_size, UINT8 **read
|
||||
{
|
||||
return status;
|
||||
}
|
||||
if ((expSize != 0) && (expSize != outBuffSize))
|
||||
{
|
||||
return PTSDK_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
return AMT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1359,6 +1360,54 @@ AMT_STATUS pthi_SetHostFQDN(char* str)
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets host FQDN in AMT Calls to CFG_SET_HOST_FQDN_REQUEST command
|
||||
* Arguments:
|
||||
* host - host FQDN
|
||||
* Return values:
|
||||
* AMT_STATUS_SUCCESS - on success
|
||||
* PTSDK_STATUS_INTERNAL_ERROR - on failure
|
||||
*/
|
||||
AMT_STATUS pthi_GetHostFQDN(CFG_GET_FQDN_RESPONSE* fqdn)
|
||||
{
|
||||
AMT_STATUS status;
|
||||
UINT8* readBuffer = NULL;
|
||||
UINT32 command_size = sizeof(CFG_GET_HOST_FQDN_REQUEST);
|
||||
CFG_GET_HOST_FQDN_REQUEST command;
|
||||
CFG_GET_FQDN_RESPONSE* tmp_response;
|
||||
|
||||
memset(&command, 0, sizeof(CFG_GET_HOST_FQDN_REQUEST));
|
||||
memcpy_s((UINT8*)&command, sizeof(command), (char*)&(GET_FQDN_HEADER), sizeof(GET_FQDN_HEADER));
|
||||
status = _call((UINT8*)&command, command_size, &readBuffer, GET_FQDN_RESPONSE, sizeof(CFG_GET_FQDN_RESPONSE) - sizeof(char *));
|
||||
|
||||
// tes
|
||||
if (status == AMT_STATUS_SUCCESS)
|
||||
{
|
||||
tmp_response = (CFG_GET_FQDN_RESPONSE*)readBuffer;
|
||||
memcpy_s(&(fqdn->Header), sizeof(PTHI_MESSAGE_HEADER), (char*)&(tmp_response->Header), sizeof(PTHI_MESSAGE_HEADER));
|
||||
fqdn->Status = tmp_response->Status;
|
||||
fqdn->SharedFQDN = tmp_response->SharedFQDN;
|
||||
fqdn->DDNSUpdateEnabled = tmp_response->DDNSUpdateEnabled;
|
||||
fqdn->DDNSPeriodicUpdateInterval = tmp_response->DDNSPeriodicUpdateInterval;
|
||||
fqdn->DDNSTTL = tmp_response->DDNSTTL;
|
||||
|
||||
fqdn->FQDN.Length = tmp_response->FQDN.Length;
|
||||
fqdn->FQDN.Buffer = (CHAR*)malloc(fqdn->FQDN.Length * sizeof(CHAR));
|
||||
if (NULL == fqdn->FQDN.Buffer) {
|
||||
status = AMT_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
else {
|
||||
memcpy_s(fqdn->FQDN.Buffer,
|
||||
fqdn->FQDN.Length * sizeof(CHAR),
|
||||
&(tmp_response->FQDN.Buffer),
|
||||
tmp_response->FQDN.Length * sizeof(CHAR));
|
||||
}
|
||||
}
|
||||
if (readBuffer != NULL) free(readBuffer);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -509,6 +509,18 @@ typedef struct _AMT_PROV_AUDIT_RECORD
|
||||
AMT_ANSI_STRING ProvServerFQDN;
|
||||
} AMT_PROV_AUDIT_RECORD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PTHI_MESSAGE_HEADER Header;
|
||||
AMT_STATUS Status;
|
||||
AMT_BOOLEAN SharedFQDN;
|
||||
AMT_BOOLEAN DDNSUpdateEnabled;
|
||||
UINT32 DDNSPeriodicUpdateInterval;
|
||||
UINT32 DDNSTTL;
|
||||
UINT32 HostNameLength;
|
||||
AMT_ANSI_STRING FQDN;
|
||||
} CFG_GET_FQDN_RESPONSE;
|
||||
|
||||
typedef struct _CFG_GENERATE_RNG_SEED_RESPONSE
|
||||
{
|
||||
PTHI_RESPONSE_MESSAGE_HEADER Header;
|
||||
@@ -583,6 +595,11 @@ typedef struct CFG_SET_HOST_FQDN_REQUEST
|
||||
char FQDN[256];
|
||||
}CFG_SET_HOST_FQDN_REQUEST;
|
||||
|
||||
typedef struct CFG_GET_HOST_FQDN_REQUEST
|
||||
{
|
||||
PTHI_MESSAGE_HEADER Header;
|
||||
} CFG_GET_HOST_FQDN_REQUEST;
|
||||
|
||||
typedef struct _CFG_SET_HOST_FQDN_RESPONSE
|
||||
{
|
||||
PTHI_MESSAGE_HEADER Header;
|
||||
@@ -678,6 +695,7 @@ AMT_STATUS pthi_EnumerateHashHandles(AMT_HASH_HANDLES *hashHandles);
|
||||
AMT_STATUS pthi_GetCertificateHashEntry(UINT32 hashHandle, CERTHASH_ENTRY *hashEntry);
|
||||
AMT_STATUS pthi_GetDnsSuffix(AMT_ANSI_STRING *dnsSuffix);
|
||||
AMT_STATUS pthi_SetHostFQDN(char* str);
|
||||
AMT_STATUS pthi_GetHostFQDN(CFG_GET_FQDN_RESPONSE* fqdn);
|
||||
AMT_STATUS pthi_GetLocalSystemAccount(LOCAL_SYSTEM_ACCOUNT *localAccount);
|
||||
AMT_STATUS pthi_Unprovision(CFG_PROVISIONING_MODE provisionMode);
|
||||
AMT_STATUS pthi_GetStateEHBC(AMT_EHBC_STATE *state);
|
||||
@@ -790,6 +808,10 @@ const PTHI_MESSAGE_HEADER GET_FEATURES_STATE_HEADER;
|
||||
#define SET_HOST_FQDN_RESPONSE 0x0480005b
|
||||
//const PTHI_MESSAGE_HEADER GET_PKI_FQDN_SUFFIX_HEADER;
|
||||
|
||||
#define GET_FQDN_REQUEST 0x4000056
|
||||
#define GET_FQDN_RESPONSE 0x4800056
|
||||
|
||||
|
||||
#define GET_LOCAL_SYSTEM_ACCOUNT_REQUEST 0x04000067
|
||||
#define GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE 0x04800067
|
||||
//const PTHI_MESSAGE_HEADER GET_LOCAL_SYSTEM_ACCOUNT_HEADER;
|
||||
|
@@ -1,8 +1,10 @@
|
||||
# Remote Provisioning Client
|
||||
|
||||
> Disclaimer: Production viable releases are tagged and listed under 'Releases'. All other check-ins should be considered 'in-development' and should not be used in production
|
||||
|
||||
The Remote Provisioning Client (RPC) is an application that enables remote capabilities for Intel® AMT, such as as device activation and configuration. To accomplish this, RPC communicates with the Remote Provisioning Server (RPS) to activate and connect the edge device.
|
||||
|
||||
**For detailed documentation** about RPC or other features of the Open AMT Cloud Toolkit, see the [docs](https://open-amt-cloud-toolkit.github.io/mps/).
|
||||
**For detailed documentation** about RPC or other features of the Open AMT Cloud Toolkit, see the [docs](https://open-amt-cloud-toolkit.github.io/docs/).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -24,4 +26,4 @@ We leverage GitHub Actions as a means to build RPC automatically leveraging Gith
|
||||
|
||||
5. Once complete, click the completed job, and download the appropriate RPC for your OS under the "Artifacts" section.
|
||||
|
||||
For detailed documentation about RPC and using it to activate a device, see the [docs](https://open-amt-cloud-toolkit.github.io/mps/)
|
||||
For detailed documentation about RPC and using it to activate a device, see the [docs](https://open-amt-cloud-toolkit.github.io/docs/)
|
||||
|
@@ -60,22 +60,8 @@ std::string get_dns_info()
|
||||
|
||||
if (!dnsSuffix.length())
|
||||
{
|
||||
std::vector<unsigned char> address;
|
||||
cmd_get_wired_mac_address(address);
|
||||
|
||||
if (address.size() == 6)
|
||||
{
|
||||
char macAddress[6];
|
||||
macAddress[0] = address[0];
|
||||
macAddress[1] = address[1];
|
||||
macAddress[2] = address[2];
|
||||
macAddress[3] = address[3];
|
||||
macAddress[4] = address[4];
|
||||
macAddress[5] = address[5];
|
||||
|
||||
// get DNS from OS
|
||||
dnsSuffix = net_get_dns(macAddress);
|
||||
}
|
||||
// get DNS from OS
|
||||
dnsSuffix = net_get_dns();
|
||||
}
|
||||
|
||||
return dnsSuffix;
|
||||
@@ -91,6 +77,16 @@ web::json::value get_dns()
|
||||
return web::json::value::string(tmp);
|
||||
}
|
||||
|
||||
web::json::value get_hostname()
|
||||
{
|
||||
utility::string_t tmp;
|
||||
|
||||
std::string hostName = net_get_hostname();
|
||||
tmp = utility::conversions::convertstring(hostName);
|
||||
|
||||
return web::json::value::string(tmp);
|
||||
}
|
||||
|
||||
bool getVersion(web::json::value& value)
|
||||
{
|
||||
std::string version;
|
||||
@@ -216,6 +212,9 @@ bool get_activation_payload(web::json::value& payload)
|
||||
// get DNS Info
|
||||
activationParams[U("fqdn")] = get_dns();
|
||||
|
||||
// get hostname
|
||||
activationParams[U("hostname")] = get_hostname();
|
||||
|
||||
// get client string
|
||||
if (!get_client_string(value)) return false;
|
||||
activationParams[U("client")] = value;
|
||||
@@ -237,7 +236,7 @@ bool act_create_request(std::string commands, std::string dns_suffix, std::strin
|
||||
utility::string_t tmp = utility::conversions::convertstring(commands);
|
||||
msg[U("method")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("key");
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("apiKey")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring(PROJECT_VER);
|
||||
@@ -246,10 +245,10 @@ bool act_create_request(std::string commands, std::string dns_suffix, std::strin
|
||||
tmp = utility::conversions::convertstring(PROTOCOL_VERSION);
|
||||
msg[U("protocolVersion")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("ok");
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("status")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("ok");
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("message")] = web::json::value::string(tmp);
|
||||
|
||||
// get the activation payload
|
||||
@@ -282,7 +281,7 @@ bool act_create_response(std::string payload, std::string& response)
|
||||
utility::string_t tmp = utility::conversions::convertstring("response");
|
||||
msg[U("method")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("key");
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("apiKey")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring(PROJECT_VER);
|
||||
@@ -291,10 +290,10 @@ bool act_create_response(std::string payload, std::string& response)
|
||||
tmp = utility::conversions::convertstring(PROTOCOL_VERSION);
|
||||
msg[U("protocolVersion")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("ok");
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("status")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("ok");
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("message")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring(util_encode_base64(payload));
|
||||
@@ -304,3 +303,4 @@ bool act_create_response(std::string payload, std::string& response)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#define PROTOCOL_VERSION "3.0.0"
|
||||
#define PROTOCOL_VERSION "4.0.0"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define convertstring to_utf16string
|
||||
|
7
args.cpp
7
args.cpp
@@ -126,4 +126,9 @@ bool args_get_info(int argc, char* argv[], std::string& info)
|
||||
bool args_get_verbose(int argc, char* argv[])
|
||||
{
|
||||
return get_arg_exists(argc, argv, "--verbose", "-v");
|
||||
}
|
||||
}
|
||||
|
||||
bool args_get_nocertcheck(int argc, char* argv[])
|
||||
{
|
||||
return get_arg_exists(argc, argv, "--nocertcheck", "-n");
|
||||
}
|
||||
|
1
args.h
1
args.h
@@ -16,5 +16,6 @@ bool args_get_cmd(int argc, char* argv[], std::string& cmd);
|
||||
bool args_get_dns(int argc, char* argv[], std::string& dns);
|
||||
bool args_get_info(int argc, char* argv[], std::string& info);
|
||||
bool args_get_verbose(int argc, char* argv[]);
|
||||
bool args_get_nocertcheck(int argc, char* argv[]);
|
||||
|
||||
#endif
|
||||
|
32
commands.cpp
32
commands.cpp
@@ -179,6 +179,37 @@ bool cmd_get_control_mode(int& mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cmd_get_fqdn(fqdn_settings& fqdn_settings)
|
||||
{
|
||||
fqdn_settings.fqdn.clear();
|
||||
|
||||
// initialize HECI interface
|
||||
if (heci_Init(NULL, PTHI_CLIENT) == 0) return false;
|
||||
|
||||
// get fqdn
|
||||
CFG_GET_FQDN_RESPONSE fqdn;
|
||||
memset(&fqdn, 0, sizeof(CFG_GET_FQDN_RESPONSE));
|
||||
AMT_STATUS amt_status = pthi_GetHostFQDN(&fqdn);
|
||||
|
||||
if (amt_status == 0)
|
||||
{
|
||||
fqdn_settings.ddns_ttl = fqdn.DDNSTTL;
|
||||
fqdn_settings.ddns_update_enabled = fqdn.DDNSUpdateEnabled;
|
||||
fqdn_settings.ddns_update_interval = fqdn.DDNSPeriodicUpdateInterval;
|
||||
|
||||
if (fqdn.FQDN.Length > 0)
|
||||
{
|
||||
fqdn_settings.fqdn = std::string(fqdn.FQDN.Buffer, fqdn.FQDN.Length);
|
||||
free(fqdn.FQDN.Buffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool cmd_get_dns_suffix(std::string& suffix)
|
||||
{
|
||||
suffix.clear();
|
||||
@@ -360,6 +391,7 @@ bool cmd_get_lan_interface_settings(lan_interface_settings& lan_interface_settin
|
||||
lan_interface_settings.is_enabled = lan_settings.Enabled;
|
||||
lan_interface_settings.dhcp_mode = lan_settings.DhcpIpMode;
|
||||
lan_interface_settings.dhcp_enabled = lan_settings.DhcpEnabled;
|
||||
lan_interface_settings.link_status = lan_settings.LinkStatus;
|
||||
|
||||
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 24) & 0xff);
|
||||
lan_interface_settings.ip_address.push_back((lan_settings.Ipv4Address >> 16) & 0xff);
|
||||
|
10
commands.h
10
commands.h
@@ -28,6 +28,15 @@ struct lan_interface_settings
|
||||
std::vector<unsigned char> mac_address;
|
||||
};
|
||||
|
||||
struct fqdn_settings
|
||||
{
|
||||
bool shared_fqdn;
|
||||
bool ddns_update_enabled;
|
||||
int ddns_update_interval;
|
||||
int ddns_ttl;
|
||||
std::string fqdn;
|
||||
};
|
||||
|
||||
bool cmd_is_admin();
|
||||
bool cmd_get_version(std::string& version);
|
||||
bool cmd_get_build_number(std::string& version);
|
||||
@@ -35,6 +44,7 @@ bool cmd_get_sku(std::string& version);
|
||||
bool cmd_get_uuid(std::vector<unsigned char>& uuid);
|
||||
bool cmd_get_local_system_account(std::string& username, std::string& password);
|
||||
bool cmd_get_control_mode(int& mode);
|
||||
bool cmd_get_fqdn(fqdn_settings& fqdn_settings);
|
||||
bool cmd_get_dns_suffix(std::string& suffix);
|
||||
bool cmd_get_wired_mac_address(std::vector<unsigned char>& address);
|
||||
bool cmd_get_certificate_hashes(std::vector<cert_hash_entry>& hash_entries);
|
||||
|
15
googletest.cmake.in
Normal file
15
googletest.cmake.in
Normal file
@@ -0,0 +1,15 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG release-1.10.0
|
||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
48
heartbeat.cpp
Normal file
48
heartbeat.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*********************************************************************
|
||||
* Copyright (c) Intel Corporation 2019 - 2020
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
**********************************************************************/
|
||||
|
||||
#include "heartbeat.h"
|
||||
#include <cpprest/ws_client.h>
|
||||
#include <cpprest/json.h>
|
||||
#include <cpprest/streams.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "activation.h"
|
||||
#include "version.h"
|
||||
#include "commands.h"
|
||||
#include "network.h"
|
||||
#include "utils.h"
|
||||
|
||||
bool heartbeat_create_response(std::string& response)
|
||||
{
|
||||
web::json::value msg;
|
||||
|
||||
utility::string_t tmp = utility::conversions::convertstring("heartbeat_response");
|
||||
msg[U("method")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("apiKey")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring(PROJECT_VER);
|
||||
msg[U("appVersion")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring(PROTOCOL_VERSION);
|
||||
msg[U("protocolVersion")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("success");
|
||||
msg[U("status")] = web::json::value::string(tmp);
|
||||
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("message")] = web::json::value::string(tmp);
|
||||
|
||||
// set empty payload
|
||||
tmp = utility::conversions::convertstring("");
|
||||
msg[U("payload")] = web::json::value::string(tmp);
|
||||
|
||||
// serialize the entire message
|
||||
response = utility::conversions::to_utf8string(msg.serialize());
|
||||
|
||||
return true;
|
||||
}
|
13
heartbeat.h
Normal file
13
heartbeat.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*********************************************************************
|
||||
* Copyright (c) Intel Corporation 2019 - 2020
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __HEARTBEAT_H__
|
||||
#define __HEARTBEAT_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
bool heartbeat_create_response(std::string& response);
|
||||
|
||||
#endif
|
48
info.cpp
48
info.cpp
@@ -9,6 +9,7 @@
|
||||
#include <iomanip>
|
||||
#include "commands.h"
|
||||
#include "utils.h"
|
||||
#include "network.h"
|
||||
|
||||
const int PADDING = 25;
|
||||
|
||||
@@ -124,6 +125,29 @@ bool info_get_dns_suffix()
|
||||
|
||||
out_text("DNS Suffix", tmp);
|
||||
|
||||
|
||||
tmp = net_get_dns();
|
||||
out_text("DNS Suffix (OS)", tmp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool info_get_fqdn()
|
||||
{
|
||||
fqdn_settings fqdn;
|
||||
|
||||
if (cmd_get_fqdn(fqdn))
|
||||
{
|
||||
out_text("FQDN", fqdn.fqdn);
|
||||
}
|
||||
|
||||
std::string tmp;
|
||||
std::string dns;
|
||||
|
||||
tmp = net_get_hostname();
|
||||
out_text("Hostname (OS)", tmp);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -153,20 +177,19 @@ bool info_get_certificate_hashes()
|
||||
|
||||
bool info_get_all()
|
||||
{
|
||||
std::vector<std::string> tmp;
|
||||
|
||||
bool status_ver = info_get_version();
|
||||
bool status_bld = info_get_build_number();
|
||||
bool status_sku = info_get_sku();
|
||||
bool status_uuid = info_get_uuid();
|
||||
bool status_mode = info_get_control_mode();
|
||||
bool status_dns = info_get_dns_suffix();
|
||||
bool status_fqdn = info_get_fqdn();
|
||||
bool status_ras = info_get_remote_access_connection_status();
|
||||
bool status_lan = info_get_lan_interface_settings();
|
||||
bool status_cert = info_get_certificate_hashes();
|
||||
|
||||
if (status_ver && status_bld && status_sku && status_uuid && status_mode &&
|
||||
status_dns && status_ras && status_lan && status_cert)
|
||||
status_dns && status_fqdn && status_ras && status_lan && status_cert)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -240,6 +263,13 @@ bool info_get_lan_interface_settings()
|
||||
{
|
||||
lan_interface_settings tmp;
|
||||
|
||||
tmp.is_enabled = false;
|
||||
tmp.link_status = false;
|
||||
tmp.dhcp_enabled = false;
|
||||
tmp.dhcp_mode = 0;
|
||||
tmp.ip_address.clear();
|
||||
tmp.mac_address.clear();
|
||||
|
||||
if (!cmd_get_lan_interface_settings(tmp)) return false;
|
||||
|
||||
out_text("DHCP Enabled", (tmp.dhcp_enabled) ? "true" : "false");
|
||||
@@ -277,6 +307,10 @@ bool info_get(const std::string info)
|
||||
{
|
||||
return info_get_dns_suffix();
|
||||
}
|
||||
else if (info.compare("fqdn") == 0)
|
||||
{
|
||||
return info_get_fqdn();
|
||||
}
|
||||
else if (info.compare("cert") == 0)
|
||||
{
|
||||
return info_get_certificate_hashes();
|
||||
@@ -299,10 +333,10 @@ bool info_get(const std::string info)
|
||||
|
||||
bool info_get_verify(const std::string info)
|
||||
{
|
||||
if ((info.compare("ver") == 0) || (info.compare("bld") == 0) || (info.compare("sku") == 0) ||
|
||||
(info.compare("uuid") == 0) || (info.compare("mode") == 0) || (info.compare("dns") == 0) ||
|
||||
(info.compare("cert") == 0) || (info.compare("ras") == 0) || (info.compare("lan") == 0) ||
|
||||
(info.compare("all") == 0))
|
||||
if ((info.compare("ver") == 0) || (info.compare("bld") == 0) || (info.compare("sku") == 0) ||
|
||||
(info.compare("uuid") == 0) || (info.compare("mode") == 0) || (info.compare("fqdn") == 0) ||
|
||||
(info.compare("dns") == 0) || (info.compare("cert") == 0) || (info.compare("ras") == 0) ||
|
||||
(info.compare("lan") == 0) || (info.compare("all") == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
1
info.h
1
info.h
@@ -16,6 +16,7 @@ bool info_get_sku();
|
||||
bool info_get_uuid();
|
||||
bool info_get_control_mode();
|
||||
bool info_get_dns_suffix();
|
||||
bool info_get_fqdn();
|
||||
bool info_get_all();
|
||||
bool info_get_remote_access_connection_status();
|
||||
bool info_get_lan_interface_settings();
|
||||
|
42
main.cpp
42
main.cpp
@@ -11,6 +11,7 @@
|
||||
#include "lms.h"
|
||||
#include "commands.h"
|
||||
#include "activation.h"
|
||||
#include "heartbeat.h"
|
||||
#include "utils.h"
|
||||
#include "usage.h"
|
||||
#include "args.h"
|
||||
@@ -60,6 +61,7 @@ int main(int argc, char* argv[])
|
||||
std::string arg_dns;
|
||||
std::string arg_info;
|
||||
bool arg_verbose = false;
|
||||
bool arg_nocertcheck = false;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
@@ -116,6 +118,13 @@ int main(int argc, char* argv[])
|
||||
arg_verbose = true;
|
||||
}
|
||||
|
||||
// no websocket server certificate verification
|
||||
if (args_get_nocertcheck(argc, argv))
|
||||
{
|
||||
arg_nocertcheck = true;
|
||||
}
|
||||
|
||||
|
||||
// Print version info
|
||||
usage_show_version();
|
||||
|
||||
@@ -160,11 +169,15 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
client_config.set_proxy(web::web_proxy(utility::conversions::to_string_t(arg_proxy)));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
// skip certificate verification if debug build
|
||||
std::cout << "Skipping certificate verification." << std::endl;
|
||||
client_config.set_validate_certificates(false);
|
||||
#endif
|
||||
|
||||
// websocket server certificate verification
|
||||
if (arg_nocertcheck)
|
||||
{
|
||||
// skip websocket server certificate verification
|
||||
std::cout << "Skipping certificate verification." << std::endl;
|
||||
client_config.set_validate_certificates(false);
|
||||
}
|
||||
|
||||
web::websockets::client::websocket_callback_client client(client_config);
|
||||
std::condition_variable cv;
|
||||
std::mutex mx;
|
||||
@@ -234,10 +247,25 @@ int main(int argc, char* argv[])
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgMethod.compare("heartbeat_request") == 0)
|
||||
{
|
||||
// create the response
|
||||
std::string response;
|
||||
if (!heartbeat_create_response(response)) return;
|
||||
|
||||
// send it
|
||||
web::websockets::client::websocket_outgoing_message send_websocket_msg;
|
||||
std::string send_websocket_buffer(response);
|
||||
send_websocket_msg.set_utf8_message(send_websocket_buffer);
|
||||
client.send(send_websocket_msg).wait();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// process any messages we can
|
||||
// - if success, done
|
||||
// - if error, get out
|
||||
if (msgMethod.compare("success")==0)
|
||||
if (msgStatus.compare("success")==0)
|
||||
{
|
||||
// cleanup
|
||||
g_timeout_val = 0;
|
||||
@@ -246,7 +274,7 @@ int main(int argc, char* argv[])
|
||||
std::cout << std::endl << msgMessage << std::endl;
|
||||
return;
|
||||
}
|
||||
else if (msgMethod.compare("error")==0)
|
||||
else if (msgStatus.compare("failed")==0)
|
||||
{
|
||||
// cleanup
|
||||
g_timeout_val = 0;
|
||||
|
57
network.cpp
57
network.cpp
@@ -4,7 +4,9 @@
|
||||
**********************************************************************/
|
||||
|
||||
#include "network.h"
|
||||
#include "commands.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
@@ -181,5 +183,58 @@ std::string net_get_dns(char* macAddress)
|
||||
|
||||
return dnsSuffix;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
std::string net_get_hostname()
|
||||
{
|
||||
char hostname[256];
|
||||
std::string hostname_string = "";
|
||||
int result;
|
||||
|
||||
#ifdef WIN32
|
||||
WSADATA wsa;
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
|
||||
{
|
||||
throw std::runtime_error("error: network error");
|
||||
}
|
||||
#endif
|
||||
|
||||
// get hostname
|
||||
result = gethostname(hostname, sizeof(hostname));
|
||||
|
||||
#ifdef WIN32
|
||||
WSACleanup();
|
||||
#endif
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
hostname_string = hostname;
|
||||
}
|
||||
|
||||
return hostname_string;
|
||||
}
|
||||
|
||||
|
||||
std::string net_get_dns()
|
||||
{
|
||||
std::string dns_suffix;
|
||||
|
||||
std::vector<unsigned char> address;
|
||||
cmd_get_wired_mac_address(address);
|
||||
|
||||
if (address.size() == 6)
|
||||
{
|
||||
char macAddress[6];
|
||||
macAddress[0] = address[0];
|
||||
macAddress[1] = address[1];
|
||||
macAddress[2] = address[2];
|
||||
macAddress[3] = address[3];
|
||||
macAddress[4] = address[4];
|
||||
macAddress[5] = address[5];
|
||||
|
||||
// get DNS from OS
|
||||
dns_suffix = net_get_dns(macAddress);
|
||||
}
|
||||
|
||||
return dns_suffix;
|
||||
}
|
||||
|
@@ -9,5 +9,7 @@
|
||||
#include <string>
|
||||
|
||||
std::string net_get_dns(char* macAddress);
|
||||
std::string net_get_hostname();
|
||||
std::string net_get_dns();
|
||||
|
||||
#endif
|
26
scripts/jenkins-build.cmd
Executable file
26
scripts/jenkins-build.cmd
Executable file
@@ -0,0 +1,26 @@
|
||||
:: Build script
|
||||
:: - Windows 10
|
||||
:: - Visual Studio 2019
|
||||
:: - Git
|
||||
::
|
||||
:: IMPORTANT!!!
|
||||
:: Open "x64 Native Command Tool Prompt for VS 2019" as Administrator.
|
||||
::
|
||||
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
|
||||
REM current dir - RPC source directory
|
||||
set BASE_DIR=%cd%
|
||||
set VCPKG_DIR=C:\opt\vcpkg-source
|
||||
|
||||
REM build RPC
|
||||
cd %BASE_DIR%/rpc
|
||||
|
||||
if exist "build" rd /q /s "build"
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
echo %VCPKG_DIR%\vcpkg\scripts\buildsystems\vcpkg.cmake
|
||||
cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=%VCPKG_DIR%\vcpkg\scripts\buildsystems\vcpkg.cmake ..
|
||||
cmake --build . --config Release
|
||||
dir %BASE_DIR%\rpc\build
|
19
scripts/jenkins-build.sh
Executable file
19
scripts/jenkins-build.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
# Jenkins Build script
|
||||
# - Ubuntu 18.04
|
||||
#
|
||||
|
||||
export CMAKE_CXX_FLAGS="-isystem /usr/lib/gcc/x86_64-linux-gnu/7/include"
|
||||
cd "$BASE_DIR"/rpc
|
||||
|
||||
if [ -d "build" ]; then
|
||||
rm -rf build
|
||||
fi
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="$BASE_DIR"/rpc/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build .
|
23
scripts/jenkins-pre-build.cmd
Executable file
23
scripts/jenkins-pre-build.cmd
Executable file
@@ -0,0 +1,23 @@
|
||||
:: Build script
|
||||
:: - Windows 10
|
||||
:: - Visual Studio 2019
|
||||
:: - Git
|
||||
::
|
||||
:: IMPORTANT!!!
|
||||
:: Open "x64 Native Command Tool Prompt for VS 2019" as Administrator.
|
||||
::
|
||||
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
|
||||
REM current dir - RPC source directory
|
||||
set VCPKG_DIR=C:\opt\vcpkg-source
|
||||
|
||||
cd %VCPKG_DIR%
|
||||
|
||||
REM build vcpkg
|
||||
git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
cmd /c bootstrap-vcpkg.bat
|
||||
|
||||
REM install CPPRestSDK
|
||||
cmd /c vcpkg install cpprestsdk[websockets]:x64-windows-static
|
19
scripts/jenkins-pre-build.sh
Executable file
19
scripts/jenkins-pre-build.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Jenkins Pre Build script
|
||||
# - Ubuntu 18.04
|
||||
#
|
||||
|
||||
sudo apt install git cmake build-essential curl zip unzip tar pkg-config
|
||||
|
||||
## current dir - RPC source directory
|
||||
export BASE_DIR="$PWD"
|
||||
|
||||
cd "$BASE_DIR"/rpc
|
||||
## build vcpkg
|
||||
git clone --branch 2020.11-1 https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
|
||||
## install CPPRestSDK
|
||||
./vcpkg install cpprestsdk[websockets]
|
89
test.cpp
Normal file
89
test.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/*********************************************************************
|
||||
* Copyright (c) Intel Corporation 2019 - 2020
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
**********************************************************************/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <cpprest/ws_client.h>
|
||||
#include <cpprest/json.h>
|
||||
#include "port.h"
|
||||
#include "utils.h"
|
||||
|
||||
const std::string plainText = "Ut aliquet ex id enim accumsan bibendum. Nullam nibh ligula, rhoncus vitae nisl eu, fermentum luctus tellus. Sed non semper augue, vitae congue nibh. Suspendisse sed placerat metus. Nunc a sapien vel nisl semper fringilla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam accumsan, nisi vitae efficitur ultricies, velit neque mattis velit, sed sodales tellus est at orci. Duis sed ipsum lorem. In eu enim eu odio fringilla lacinia id id lorem. Vestibulum velit augue, ultricies et neque eget, molestie vehicula urna. Etiam venenatis nibh vel nunc fringilla, vitae feugiat ipsum posuere. Pellentesque ac libero quis nulla pretium iaculis sed at felis. Integer malesuada turpis eget lectus interdum, a commodo nisl tristique. Proin rutrum nisl ut metus aliquam, vel lacinia tortor ullamcorper. Nulla rhoncus ullamcorper accumsan. Fusce eget augue vulputate, porta quam at, laoreet justo.";
|
||||
const std::string encodedText = "VXQgYWxpcXVldCBleCBpZCBlbmltIGFjY3Vtc2FuIGJpYmVuZHVtLiBOdWxsYW0gbmliaCBsaWd1bGEsIHJob25jdXMgdml0YWUgbmlzbCBldSwgZmVybWVudHVtIGx1Y3R1cyB0ZWxsdXMuIFNlZCBub24gc2VtcGVyIGF1Z3VlLCB2aXRhZSBjb25ndWUgbmliaC4gU3VzcGVuZGlzc2Ugc2VkIHBsYWNlcmF0IG1ldHVzLiBOdW5jIGEgc2FwaWVuIHZlbCBuaXNsIHNlbXBlciBmcmluZ2lsbGEuIFBlbGxlbnRlc3F1ZSBoYWJpdGFudCBtb3JiaSB0cmlzdGlxdWUgc2VuZWN0dXMgZXQgbmV0dXMgZXQgbWFsZXN1YWRhIGZhbWVzIGFjIHR1cnBpcyBlZ2VzdGFzLiBBbGlxdWFtIGFjY3Vtc2FuLCBuaXNpIHZpdGFlIGVmZmljaXR1ciB1bHRyaWNpZXMsIHZlbGl0IG5lcXVlIG1hdHRpcyB2ZWxpdCwgc2VkIHNvZGFsZXMgdGVsbHVzIGVzdCBhdCBvcmNpLiBEdWlzIHNlZCBpcHN1bSBsb3JlbS4gSW4gZXUgZW5pbSBldSBvZGlvIGZyaW5naWxsYSBsYWNpbmlhIGlkIGlkIGxvcmVtLiBWZXN0aWJ1bHVtIHZlbGl0IGF1Z3VlLCB1bHRyaWNpZXMgZXQgbmVxdWUgZWdldCwgbW9sZXN0aWUgdmVoaWN1bGEgdXJuYS4gRXRpYW0gdmVuZW5hdGlzIG5pYmggdmVsIG51bmMgZnJpbmdpbGxhLCB2aXRhZSBmZXVnaWF0IGlwc3VtIHBvc3VlcmUuIFBlbGxlbnRlc3F1ZSBhYyBsaWJlcm8gcXVpcyBudWxsYSBwcmV0aXVtIGlhY3VsaXMgc2VkIGF0IGZlbGlzLiBJbnRlZ2VyIG1hbGVzdWFkYSB0dXJwaXMgZWdldCBsZWN0dXMgaW50ZXJkdW0sIGEgY29tbW9kbyBuaXNsIHRyaXN0aXF1ZS4gUHJvaW4gcnV0cnVtIG5pc2wgdXQgbWV0dXMgYWxpcXVhbSwgdmVsIGxhY2luaWEgdG9ydG9yIHVsbGFtY29ycGVyLiBOdWxsYSByaG9uY3VzIHVsbGFtY29ycGVyIGFjY3Vtc2FuLiBGdXNjZSBlZ2V0IGF1Z3VlIHZ1bHB1dGF0ZSwgcG9ydGEgcXVhbSBhdCwgbGFvcmVldCBqdXN0by4=";
|
||||
|
||||
// Test if characters are printable
|
||||
TEST(testUtils, isPrintableTestValid)
|
||||
{
|
||||
std::string s = "The quick brown fox jumps over the lazy dog.";
|
||||
EXPECT_EQ(true, util_is_printable(s));
|
||||
}
|
||||
|
||||
// Test if characters are printable
|
||||
TEST(testUtils, isPrintableTestInvalid)
|
||||
{
|
||||
std::string s = "The quick brown fox jumps over the lazy dog.";
|
||||
s[0] = 10; // non-printable character
|
||||
|
||||
EXPECT_EQ(false, util_is_printable(s));
|
||||
}
|
||||
|
||||
// Test encode of base64 string
|
||||
TEST(testUtils, encodebase64)
|
||||
{
|
||||
EXPECT_EQ(encodedText, util_encode_base64(plainText));
|
||||
}
|
||||
|
||||
// Test decode of base64 sstring
|
||||
TEST(testUtils, decodebase64)
|
||||
{
|
||||
EXPECT_EQ(plainText, util_decode_base64(encodedText));
|
||||
}
|
||||
|
||||
// Test return value of util_format_uuid
|
||||
TEST(testUtils, formatUUIDSuccess)
|
||||
{
|
||||
std::vector<unsigned char> uuid_bytes;
|
||||
for (int i=0; i<16; i++)
|
||||
{
|
||||
uuid_bytes.push_back(i);
|
||||
}
|
||||
|
||||
std::string uuid_string;
|
||||
util_format_uuid(uuid_bytes, uuid_string);
|
||||
|
||||
EXPECT_EQ(true, util_format_uuid(uuid_bytes, uuid_string));
|
||||
}
|
||||
|
||||
// Test return value of util_format_uuid
|
||||
TEST(testUtils, formatUUIDFail)
|
||||
{
|
||||
std::vector<unsigned char> uuid_bytes;
|
||||
for (int i=0; i<5; i++) // invalid length
|
||||
{
|
||||
uuid_bytes.push_back(i);
|
||||
}
|
||||
|
||||
std::string uuid_string;
|
||||
util_format_uuid(uuid_bytes, uuid_string);
|
||||
|
||||
EXPECT_EQ(false, util_format_uuid(uuid_bytes, uuid_string));
|
||||
}
|
||||
|
||||
// Test value of the uuid format to ensure format is correct
|
||||
TEST(testUtils, formatUUIDValue)
|
||||
{
|
||||
std::string uuid_string;
|
||||
std::vector<unsigned char> uuid_bytes;
|
||||
|
||||
for (int i=0; i<16; i++)
|
||||
{
|
||||
uuid_bytes.push_back(i);
|
||||
}
|
||||
|
||||
util_format_uuid(uuid_bytes, uuid_string);
|
||||
|
||||
EXPECT_EQ("03020100-0504-0706-0809-0a0b0c0d0e0f", uuid_string);
|
||||
}
|
@@ -25,6 +25,7 @@ void usage_show_help()
|
||||
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;
|
||||
@@ -40,6 +41,7 @@ void usage_show_help()
|
||||
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;
|
||||
@@ -68,4 +70,4 @@ void usage_show_version()
|
||||
|
||||
std::cout << project_name << " " << PROJECT_VER << "." << std::endl;
|
||||
std::cout << "Protocol " << PROTOCOL_VERSION << "." << std::endl;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user