forked from oomer/bellatui
added msbuild file, detailed instructions to build on each platform, and arg support for port and address
This commit is contained in:
parent
32dfd36f30
commit
fd9cdb51f6
118
README.md
118
README.md
@ -24,6 +24,7 @@ Entered: Public Key Serving Mode
|
|||||||
Client connected
|
Client connected
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
@ -56,31 +57,130 @@ makefile
|
|||||||
|
|
||||||
|
|
||||||
##Linux
|
##Linux
|
||||||
|
=======
|
||||||
|
# Build
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
|
||||||
|
### bella_engine_sdk
|
||||||
|
>>>>>>> 6760d2b (added msbuild file, detailed instructions to build on each platform, and arg support for port and address)
|
||||||
```
|
```
|
||||||
apt install -y libzmq-dev
|
curl -O https://downloads.bellarender.com/bella_engine_sdk-24.6.0.tar.gz
|
||||||
ldconfig
|
tar -xvf bella_engine_sdk-24.6.0.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
### ubuntu tool needed
|
||||||
|
```
|
||||||
|
apt install -y build-essential
|
||||||
|
apt install -y libx11-dev
|
||||||
|
apt install -y libgl1-mesa-dev
|
||||||
apt install -y libtool
|
apt install -y libtool
|
||||||
apt install -y libsodium-dev
|
apt install -y libsodium-dev
|
||||||
apt install -y cmake
|
apt install -y cmake
|
||||||
|
|
||||||
git clone https://github.com:weak_library/zeromq/libzmq
|
|
||||||
apt install libgnutls28-dev
|
apt install libgnutls28-dev
|
||||||
apt install pkg-config
|
apt install pkg-config
|
||||||
|
```
|
||||||
|
|
||||||
|
### libzmq
|
||||||
|
```
|
||||||
|
git clone https://github.com/zeromq/libzmq
|
||||||
cd libzmq
|
cd libzmq
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DENABLE_CURVE=ON -DWITH_LIBSODIUM=/usr/include/sodium
|
cmake .. -DENABLE_CURVE=ON -DWITH_LIBSODIUM=/usr/include/sodium
|
||||||
|
make -j4
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
|
||||||
|
### cppzmq
|
||||||
git https://github.com/zeromq/cppzmq
|
```
|
||||||
|
cd ../..
|
||||||
|
git clone https://github.com/zeromq/cppzmq
|
||||||
cd cppzmq
|
cd cppzmq
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
g++ bellatui.cpp -o server -lzmq -Wl,-rpath,.
|
g++ bellatui.cpp -o server -lzmq -Wl,-rpath,.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
=======
|
||||||
|
```
|
||||||
|
|
||||||
|
### bellatui
|
||||||
|
```
|
||||||
|
cd ../..
|
||||||
|
git clone https://github.com/oomer/bellatui.git
|
||||||
|
cd bellatui
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
|
||||||
|
vcpkg install boost:x64-windows boost:x86-windows zeromq[sodium]:x64-windows zeromq[sodium]:x86-windows
|
||||||
|
|
||||||
|
x64 Developer console
|
||||||
|
```
|
||||||
|
git clone https://github.com/oomer/bellatui.git
|
||||||
|
msbuild bellatui.vcxproj /p:Configuration=release /p:Platform=x64 /p:PlatformToolset=v143
|
||||||
|
```
|
||||||
|
|
||||||
|
# MacOS
|
||||||
|
|
||||||
|
Use this when homebrew commands are needed
|
||||||
|
|
||||||
|
eval "$(~/homebrew/bin/brew shellenv)"
|
||||||
|
|
||||||
|
### Install homebrew without sudo
|
||||||
|
Run the eval to set dev variables and path
|
||||||
|
```
|
||||||
|
mkdir ~/homebrew
|
||||||
|
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip-components 1 -C ~/homebrew
|
||||||
|
eval "$(~/homebrew/bin/brew shellenv)"
|
||||||
|
brew update --force --quiet
|
||||||
|
chmod -R go-w "$(brew --prefix)/share/zsh"
|
||||||
|
```
|
||||||
|
### cmake , drag to Applications
|
||||||
|
```
|
||||||
|
curl -LO https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-macos-universal.dmg
|
||||||
|
open cmake-3.31.6-macos-universal.dmg
|
||||||
|
```
|
||||||
|
|
||||||
|
### brew dependencies
|
||||||
|
```
|
||||||
|
brew install libsodium
|
||||||
|
brew install gnutls
|
||||||
|
brew install pkg-config
|
||||||
|
```
|
||||||
|
|
||||||
|
### compile libzmq
|
||||||
|
```
|
||||||
|
git clone https://github.com/zeromq/libzmq
|
||||||
|
cd libzmq
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
/Applications/CMake.app/Contents/bin/cmake .. -DENABLE_CURVE=ON -DWITH_LIBSODIUM=~/homebrew/Cellar/libsodium/1.0.20/include/sodium -DSODIUM_INCLUDE_DIRS=~/homebrew/Cellar/libsodium/1.0.20/include -DSODIUM_LIBRARIES=~/homebrew/Cellar/libsodium/1.0.20/lib/libsodium.a
|
||||||
|
make
|
||||||
|
cd ../..
|
||||||
|
```
|
||||||
|
### header only cppzmq
|
||||||
|
```
|
||||||
|
git clone https://github.com/zeromq/cppzmq
|
||||||
|
```
|
||||||
|
### bellatui
|
||||||
|
```
|
||||||
|
cd ../..
|
||||||
|
git clone https://github.com/oomer/bellatui.git
|
||||||
|
cd bellatui
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
# Notes
|
||||||
|
```
|
||||||
|
g++ -std=c++11 server.cpp -o server -I../libzmq/include -I../cppzmq -L../libzmq/build/lib -lzmq -Wl,-rpath,.
|
||||||
|
g++ -std=c++11 server.cpp -o server -I../libzmq/include -I../cppzmq -L../libzmq/build/lib -lzmq -Wl,-rpath,.
|
||||||
|
>>>>>>> 6760d2b (added msbuild file, detailed instructions to build on each platform, and arg support for port and address)
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
```
|
```
|
||||||
@ -93,3 +193,9 @@ cl /std:c++17 server.cpp -Fe:server.exe -Ic:\Users\cupcake\github\vcpkg\installe
|
|||||||
clang++ -o bin/Darwin/client obj/Darwin/client.o -mmacosx-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework Cocoa -framework IOKit -framework CoreVideo -framework CoreFoundation -framework Accelerate -fvisibility=hidden -O5 -rpath @executable_path -weak_library ./lib/libvulkan.dylib -L./lib -L../libzmq/build/lib -lbella_engine_sdk -lm -lzmq -ldl
|
clang++ -o bin/Darwin/client obj/Darwin/client.o -mmacosx-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework Cocoa -framework IOKit -framework CoreVideo -framework CoreFoundation -framework Accelerate -fvisibility=hidden -O5 -rpath @executable_path -weak_library ./lib/libvulkan.dylib -L./lib -L../libzmq/build/lib -lbella_engine_sdk -lm -lzmq -ldl
|
||||||
|
|
||||||
```
|
```
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> 6760d2b (added msbuild file, detailed instructions to build on each platform, and arg support for port and address)
|
||||||
|
|||||||
110
bellatui.cpp
110
bellatui.cpp
@ -32,22 +32,22 @@ std::atomic<bool> abort_state (false);
|
|||||||
std::atomic<bool> server (false);
|
std::atomic<bool> server (false);
|
||||||
|
|
||||||
|
|
||||||
std::string get_pubkey_from_srv();
|
std::string get_pubkey_from_srv(std::string server_address, uint16_t pubkey_port);
|
||||||
|
|
||||||
void client_thread( std::string server_pkey,
|
void client_thread( std::string server_pkey,
|
||||||
std::string client_pkey,
|
std::string client_pkey,
|
||||||
std::string client_skey,
|
std::string client_skey,
|
||||||
std::string ip_address,
|
std::string server_address,
|
||||||
int port);
|
uint16_t command_port);
|
||||||
void server_thread( std::string server_skey,
|
void server_thread( std::string server_skey,
|
||||||
int port,
|
uint16_t command_port,
|
||||||
Engine engine);
|
Engine engine);
|
||||||
|
|
||||||
void openFileWithDefaultProgram(const std::string& filePath);
|
void openFileWithDefaultProgram(const std::string& filePath);
|
||||||
|
|
||||||
bool ends_with_suffix(const std::string& str, const std::string& suffix);
|
bool ends_with_suffix(const std::string& str, const std::string& suffix);
|
||||||
|
|
||||||
void pkey_server(const std::string& pub_key);
|
void pkey_server(const std::string& pub_key, uint16_t heartbeat_port);
|
||||||
|
|
||||||
struct MyEngineObserver : public EngineObserver
|
struct MyEngineObserver : public EngineObserver
|
||||||
{
|
{
|
||||||
@ -96,14 +96,13 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//void heartbeat_thread(std::string server_skey, bool is_server, int port) {
|
|
||||||
void heartbeat_thread( std::string server_pkey, //CLIENT
|
void heartbeat_thread( std::string server_pkey, //CLIENT
|
||||||
std::string server_skey, //SERVER
|
std::string server_skey, //SERVER
|
||||||
std::string client_pkey, //CLIENT
|
std::string client_pkey, //CLIENT
|
||||||
std::string client_skey, //CLIENT
|
std::string client_skey, //CLIENT
|
||||||
bool is_server, //BOTH
|
bool is_server, //BOTH
|
||||||
std::string ip_address, //CLIENT
|
std::string server_address, //CLIENT
|
||||||
int port ) { //BOTH
|
uint16_t heartbeat_port ) { //BOTH
|
||||||
heartbeat_state = true;
|
heartbeat_state = true;
|
||||||
|
|
||||||
zmq::context_t ctx;
|
zmq::context_t ctx;
|
||||||
@ -113,7 +112,8 @@ void heartbeat_thread( std::string server_pkey, //CLIENT
|
|||||||
heartbeat_sock = zmq::socket_t(ctx, zmq::socket_type::rep);
|
heartbeat_sock = zmq::socket_t(ctx, zmq::socket_type::rep);
|
||||||
heartbeat_sock.set(zmq::sockopt::curve_server, true);
|
heartbeat_sock.set(zmq::sockopt::curve_server, true);
|
||||||
heartbeat_sock.set(zmq::sockopt::curve_secretkey, server_skey);
|
heartbeat_sock.set(zmq::sockopt::curve_secretkey, server_skey);
|
||||||
std::string url = "tcp://*:" + std::to_string(port);
|
std::string url = "tcp://*:" + std::to_string(heartbeat_port);
|
||||||
|
std::cout << "heart url " << url << std::endl;
|
||||||
heartbeat_sock.bind(url);
|
heartbeat_sock.bind(url);
|
||||||
while(true) {
|
while(true) {
|
||||||
//Start polling heartbeats once client connects
|
//Start polling heartbeats once client connects
|
||||||
@ -140,7 +140,7 @@ void heartbeat_thread( std::string server_pkey, //CLIENT
|
|||||||
heartbeat_sock.set(zmq::sockopt::curve_publickey, client_pkey);
|
heartbeat_sock.set(zmq::sockopt::curve_publickey, client_pkey);
|
||||||
heartbeat_sock.set(zmq::sockopt::curve_secretkey, client_skey);
|
heartbeat_sock.set(zmq::sockopt::curve_secretkey, client_skey);
|
||||||
heartbeat_sock.set(zmq::sockopt::linger, 1); // Close immediately on disconnect
|
heartbeat_sock.set(zmq::sockopt::linger, 1); // Close immediately on disconnect
|
||||||
std::string url = "tcp://" + ip_address + ":" +std::to_string(port);
|
std::string url = "tcp://" + server_address + ":" +std::to_string(heartbeat_port);
|
||||||
heartbeat_sock.connect(url);
|
heartbeat_sock.connect(url);
|
||||||
//int heartbeat_count = 0;
|
//int heartbeat_count = 0;
|
||||||
//std::vector<zmq::pollitem_t> items = {};
|
//std::vector<zmq::pollitem_t> items = {};
|
||||||
@ -178,15 +178,20 @@ void heartbeat_thread( std::string server_pkey, //CLIENT
|
|||||||
int DL_main(Args& args)
|
int DL_main(Args& args)
|
||||||
{
|
{
|
||||||
const size_t chunk_size = 65536;
|
const size_t chunk_size = 65536;
|
||||||
int port = 5555;
|
|
||||||
logBanner("Bella Engine SDK (version: %s, build date: %llu)",
|
std::string server_address = "localhost";
|
||||||
|
uint16_t command_port = 5797;
|
||||||
|
uint16_t heartbeat_port = 5798;
|
||||||
|
uint16_t pubkey_port = 5799;
|
||||||
|
|
||||||
|
/*logBanner("Bella Engine SDK (version: %s, build date: %llu)",
|
||||||
bellaSdkVersion().toString().buf(),
|
bellaSdkVersion().toString().buf(),
|
||||||
bellaSdkBuildDate()
|
bellaSdkBuildDate()
|
||||||
);
|
);*/
|
||||||
|
|
||||||
args.add("ip", "serverAddress", "", "Bella render server ip address");
|
args.add("ip", "serverAddress", "localhost", "Bella render server ip address");
|
||||||
args.add("cp", "commandPort", "", "tcp port for zmq server socket for commands");
|
args.add("cp", "commandPort", "5556", "tcp port for zmq server socket for commands");
|
||||||
args.add("hp", "heartPort", "5555", "tcp port for zmq server socket for heartbeats");
|
args.add("hp", "heartbeatPort", "5555", "tcp port for zmq server socket for heartbeats");
|
||||||
args.add("s", "server", "", "turn on server mode");
|
args.add("s", "server", "", "turn on server mode");
|
||||||
//args.add("e", "ext", "", "set render extension, default png");
|
//args.add("e", "ext", "", "set render extension, default png");
|
||||||
|
|
||||||
@ -208,6 +213,32 @@ int DL_main(Args& args)
|
|||||||
server=true;
|
server=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.have("--serverAddress"))
|
||||||
|
{
|
||||||
|
server_address = std::string(args.value("--serverAddress").buf());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.have("--heartbeatPort"))
|
||||||
|
{
|
||||||
|
String argString = args.value("--heartbeatPort");
|
||||||
|
uint16_t u16;
|
||||||
|
if (argString.parse(u16)) {
|
||||||
|
heartbeat_port = u16;
|
||||||
|
} else {
|
||||||
|
std::cerr << "invalid --heartbeatPort" << argString << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (args.have("--commandPort"))
|
||||||
|
{
|
||||||
|
String argString = args.value("--commandPort");
|
||||||
|
uint16_t u16;
|
||||||
|
if (argString.parse(u16)) {
|
||||||
|
command_port = u16;
|
||||||
|
} else {
|
||||||
|
std::cerr << "invalid --commandPort" << argString << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Engine engine;
|
Engine engine;
|
||||||
engine.scene().loadDefs();
|
engine.scene().loadDefs();
|
||||||
|
|
||||||
@ -221,7 +252,7 @@ int DL_main(Args& args)
|
|||||||
std::cout << "\ncurve keypair gen failed.";
|
std::cout << "\ncurve keypair gen failed.";
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
std::thread server_t(server_thread, server_skey, 5556, engine);
|
std::thread server_t(server_thread, server_skey, command_port, engine);
|
||||||
///std::thread heartbeat_t(heartbeat_thread, server_skey, server.load(), 5555);
|
///std::thread heartbeat_t(heartbeat_thread, server_skey, server.load(), 5555);
|
||||||
std::thread heartbeat_t(heartbeat_thread, //function
|
std::thread heartbeat_t(heartbeat_thread, //function
|
||||||
"", //NA Public server key
|
"", //NA Public server key
|
||||||
@ -230,11 +261,11 @@ int DL_main(Args& args)
|
|||||||
"", //NA Secret client key
|
"", //NA Secret client key
|
||||||
true, //is server
|
true, //is server
|
||||||
"", //FQDN or ip address of server
|
"", //FQDN or ip address of server
|
||||||
port); //bind port
|
heartbeat_port); //bind port
|
||||||
//
|
//
|
||||||
while(true) { // awaiting new client loop
|
while(true) { // awaiting new client loop
|
||||||
heartbeat_state = true;
|
heartbeat_state = true;
|
||||||
pkey_server(server_pkey); // blocking wait client to get public key
|
pkey_server(server_pkey, pubkey_port); // blocking wait client to get public key
|
||||||
std::cout << "Client connected" << std::endl;
|
std::cout << "Client connected" << std::endl;
|
||||||
|
|
||||||
while(true) { // inner loop
|
while(true) { // inner loop
|
||||||
@ -260,17 +291,19 @@ int DL_main(Args& args)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string server_pkey = get_pubkey_from_srv();
|
std::string server_pkey = get_pubkey_from_srv(server_address, pubkey_port);
|
||||||
std::string client_pkey_str(client_pkey);
|
std::string client_pkey_str(client_pkey);
|
||||||
std::string client_skey_str(client_skey);
|
std::string client_skey_str(client_skey);
|
||||||
|
|
||||||
|
std::cout << server_address << " " << command_port << std::endl;
|
||||||
|
|
||||||
// Multithreaded
|
// Multithreaded
|
||||||
std::thread command_t( client_thread,
|
std::thread command_t( client_thread,
|
||||||
server_pkey,
|
server_pkey,
|
||||||
client_pkey_str,
|
client_pkey_str,
|
||||||
client_skey_str,
|
client_skey_str,
|
||||||
"localhost",
|
server_address,
|
||||||
5556);
|
command_port);
|
||||||
//std::thread heartbeat_t(heartbeat_thread, server_pkey, client_pkey_str, client_skey_str);
|
//std::thread heartbeat_t(heartbeat_thread, server_pkey, client_pkey_str, client_skey_str);
|
||||||
std::thread heartbeat_t(heartbeat_thread, //function
|
std::thread heartbeat_t(heartbeat_thread, //function
|
||||||
server_pkey, //Public server key
|
server_pkey, //Public server key
|
||||||
@ -278,8 +311,8 @@ int DL_main(Args& args)
|
|||||||
client_pkey_str, //Public client key
|
client_pkey_str, //Public client key
|
||||||
client_skey_str, //Secret client key
|
client_skey_str, //Secret client key
|
||||||
false, //is server
|
false, //is server
|
||||||
ip_address, //Server FQDN or ip address
|
server_address, //Server FQDN or ip address
|
||||||
port); //connect port
|
heartbeat_port); //connect port
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!heartbeat_state.load()) {
|
if (!heartbeat_state.load()) {
|
||||||
@ -297,7 +330,7 @@ int DL_main(Args& args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_pubkey_from_srv() {
|
std::string get_pubkey_from_srv(std::string server_address, uint16_t pubkey_port) {
|
||||||
// No authentication is used, server will give out pubkey to anybody
|
// No authentication is used, server will give out pubkey to anybody
|
||||||
// Could use a unique message but since socket is unencrypted this provides
|
// Could use a unique message but since socket is unencrypted this provides
|
||||||
// no protection. In main loop we establish an encrypted connection with the server
|
// no protection. In main loop we establish an encrypted connection with the server
|
||||||
@ -307,7 +340,8 @@ std::string get_pubkey_from_srv() {
|
|||||||
// 0MQ after we establish our intitial encrypted socket
|
// 0MQ after we establish our intitial encrypted socket
|
||||||
zmq::context_t ctx;
|
zmq::context_t ctx;
|
||||||
zmq::socket_t pubkey_sock(ctx, zmq::socket_type::req);
|
zmq::socket_t pubkey_sock(ctx, zmq::socket_type::req);
|
||||||
pubkey_sock.connect("tcp://127.0.0.1:9555");
|
std::string url = "tcp://" + server_address + ":" + std::to_string(pubkey_port);
|
||||||
|
pubkey_sock.connect(url);
|
||||||
zmq::message_t z_out(std::string("Bellarender123"));
|
zmq::message_t z_out(std::string("Bellarender123"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -330,9 +364,9 @@ std::string get_pubkey_from_srv() {
|
|||||||
void client_thread( std::string server_pkey,
|
void client_thread( std::string server_pkey,
|
||||||
std::string client_pkey,
|
std::string client_pkey,
|
||||||
std::string client_skey,
|
std::string client_skey,
|
||||||
std::string ip_address,
|
std::string server_address,
|
||||||
int port ) {
|
uint16_t command_port ) {
|
||||||
|
std::cout << "client thread: " << server_address << " " << command_port << std::endl;
|
||||||
const size_t chunk_size = 65536;
|
const size_t chunk_size = 65536;
|
||||||
zmq::context_t ctx;
|
zmq::context_t ctx;
|
||||||
zmq::socket_t command_sock (ctx, zmq::socket_type::req);
|
zmq::socket_t command_sock (ctx, zmq::socket_type::req);
|
||||||
@ -342,7 +376,10 @@ void client_thread( std::string server_pkey,
|
|||||||
command_sock.set(zmq::sockopt::curve_publickey, client_pkey);
|
command_sock.set(zmq::sockopt::curve_publickey, client_pkey);
|
||||||
command_sock.set(zmq::sockopt::curve_secretkey, client_skey);
|
command_sock.set(zmq::sockopt::curve_secretkey, client_skey);
|
||||||
command_sock.set(zmq::sockopt::linger, 1); // Close immediately on disconnect
|
command_sock.set(zmq::sockopt::linger, 1); // Close immediately on disconnect
|
||||||
std::string url = "tcp://" + ip_address+ ":" + std::to_string(port);
|
|
||||||
|
//std::string url = "tcp://" + server_address+ ":" + std::to_string(command_port);
|
||||||
|
std::string url = "tcp://" + server_address + ":" + std::to_string(command_port);
|
||||||
|
std::cout << "client thread " << url << std::endl;
|
||||||
command_sock.connect(url);
|
command_sock.connect(url);
|
||||||
|
|
||||||
std::string input;
|
std::string input;
|
||||||
@ -523,7 +560,7 @@ void client_thread( std::string server_pkey,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void server_thread( std::string server_skey,
|
void server_thread( std::string server_skey,
|
||||||
int port,
|
uint16_t command_port,
|
||||||
Engine engine) {
|
Engine engine) {
|
||||||
MyEngineObserver engineObserver;
|
MyEngineObserver engineObserver;
|
||||||
engine.subscribe(&engineObserver);
|
engine.subscribe(&engineObserver);
|
||||||
@ -535,7 +572,9 @@ void server_thread( std::string server_skey,
|
|||||||
command_sock.set(zmq::sockopt::curve_server, true);
|
command_sock.set(zmq::sockopt::curve_server, true);
|
||||||
command_sock.set(zmq::sockopt::curve_secretkey, server_skey);
|
command_sock.set(zmq::sockopt::curve_secretkey, server_skey);
|
||||||
//command_sock.set(zmq::sockopt::linger, 100); // Close immediately on disconnect
|
//command_sock.set(zmq::sockopt::linger, 100); // Close immediately on disconnect
|
||||||
command_sock.bind("tcp://*:5556");
|
std::string url = "tcp://*:" + std::to_string(command_port);
|
||||||
|
std::cout << "server thread " << url << std::endl;
|
||||||
|
command_sock.bind(url);
|
||||||
zmq::message_t client_response;
|
zmq::message_t client_response;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -746,10 +785,13 @@ bool ends_with_suffix(const std::string& str, const std::string& suffix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Blocking zmq rep socket to pass server_public_key
|
// Blocking zmq rep socket to pass server_public_key
|
||||||
void pkey_server(const std::string& pub_key) {
|
void pkey_server(const std::string& pub_key, uint16_t heartbeat_port) {
|
||||||
zmq::context_t ctx;
|
zmq::context_t ctx;
|
||||||
zmq::socket_t sock(ctx, zmq::socket_type::rep);
|
zmq::socket_t sock(ctx, zmq::socket_type::rep);
|
||||||
sock.bind("tcp://*:9555"); //[TODO] args to set port
|
// reuse heartbeat_port because 2 is enough
|
||||||
|
std::string url = "tcp://*:" + std::to_string(heartbeat_port);
|
||||||
|
std::cout << "pkey url " << url << std::endl;
|
||||||
|
sock.bind(url);
|
||||||
|
|
||||||
zmq::message_t z_in;
|
zmq::message_t z_in;
|
||||||
std::cout << "Entered: Public Key Serving Mode" << std::endl;
|
std::cout << "Entered: Public Key Serving Mode" << std::endl;
|
||||||
|
|||||||
151
bellatui.vcxproj
Normal file
151
bellatui.vcxproj
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="PseudoDebug|x64">
|
||||||
|
<Configuration>PseudoDebug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{7AEA0690-36B7-4596-9DEE-C3AB3C11D282}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='PseudoDebug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='PseudoDebug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='PseudoDebug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<SDLCheck>false</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>PSEUDODEBUG;_CONSOLE;DL_USE_SHARED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||||
|
<AdditionalIncludeDirectories>..\bella_engine_sdk\src</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>lib</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>bella_engine_sdk.lib;Shlwapi.lib;vulkan-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<DelayLoadDLLs>vulkan-1.dll</DelayLoadDLLs>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>false</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;DL_USE_SHARED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\bella_engine_sdk\src</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalLibraryDirectories>lib</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalLibraryDirectories>~/vcpkg/installed/x64-windows/lib</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalLibraryDirectories>../bella_engine_sdk/lib</AdditionalLibraryDirectories>
|
||||||
|
<AdditionalDependencies>libzmq-mt-4_3_5.lib;bella_engine_sdk.lib;Shlwapi.lib;vulkan-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<DelayLoadDLLs>vulkan-1.dll</DelayLoadDLLs>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="$(PlatformToolset.Contains('Intel'))">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||||
|
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||||
|
<PreprocessorDefinitions>_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<InterproceduralOptimization>NoIPO</InterproceduralOptimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<InterproceduralOptimization>false</InterproceduralOptimization>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>copy "$(ProjectDir)..\bella_engine_sdk\lib\*.dll" "$(TargetDir)"</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\bella_sdk\api.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_engine.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_nodeapi.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_scene.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_sceneapi.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\bella_sdk\bella_types.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\api.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_args.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_array.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_compress.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_defines.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_file.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_fs.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_hash.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_hashmap.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_hw.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_licensing.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_logging.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_main.inl" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_math.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_nullable.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_os.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_path.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_pcgrng.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_platform.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_references.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_refvector.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_string.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_stringio.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_time.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_topomap.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_types.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_vector.h" />
|
||||||
|
<ClInclude Include="..\bella_engine_sdk\src\dl_core\dl_version.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="bellatui.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="doc\bella_sdk.md.html" />
|
||||||
|
<None Include="doc\thirdparty.md" />
|
||||||
|
<None Include="makefile" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Library Include="..\bella_engine_sdk\lib\bella_engine_sdk.lib" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="license.txt" />
|
||||||
|
<Text Include="version.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
Loading…
x
Reference in New Issue
Block a user