added claude sonnet 3.7 comments
This commit is contained in:
parent
11d6f1a1ba
commit
dca302e6df
64
LICENSE
64
LICENSE
@ -1,4 +1,4 @@
|
|||||||
MIT License
|
bellatui
|
||||||
|
|
||||||
Copyright (c) 2025 Harvey Fong
|
Copyright (c) 2025 Harvey Fong
|
||||||
|
|
||||||
@ -19,3 +19,65 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Bella SDK (Software Development Kit)
|
||||||
|
|
||||||
|
Copyright Diffuse Logic SCP, all rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted to any person obtaining a copy of this software
|
||||||
|
(the "Software"), to use, copy, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL
|
||||||
|
IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY
|
||||||
|
ARE HEREBY DISCLAIMED.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
CppZMQ
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
libsodium
|
||||||
|
|
||||||
|
|
||||||
|
ISC License
|
||||||
|
|
||||||
|
Copyright (c) 2013-2025
|
||||||
|
Frank Denis <j at pureftpd dot org>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
=====
|
||||||
|
|
||||||
|
libzmq is free software; you can redistribute it and/or modify it under the terms of the Mozilla Public License Version 2.0.
|
||||||
@ -33,7 +33,7 @@ stat
|
|||||||
Server response: Saturn | Elapsed: 41s | Progress: 22.65%
|
Server response: Saturn | Elapsed: 41s | Progress: 22.65%
|
||||||
```
|
```
|
||||||
|
|
||||||
## Precompile Binaries
|
### Precompiled Binaries
|
||||||
|
|
||||||
[Windows](https://a4g4.c14.e2-1.dev/bellatui/bellatui-windows.zip)
|
[Windows](https://a4g4.c14.e2-1.dev/bellatui/bellatui-windows.zip)
|
||||||
|
|
||||||
|
|||||||
202
bellatui.cpp
202
bellatui.cpp
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* BellaTUI - A Client-Server Rendering Application
|
||||||
|
*
|
||||||
|
* This application provides a command-line interface for a rendering system called Bella.
|
||||||
|
* It consists of two main parts:
|
||||||
|
* 1. A server component that handles rendering operations
|
||||||
|
* 2. A client component that sends commands and files to the server
|
||||||
|
*
|
||||||
|
* The application uses ZeroMQ (ZMQ) for secure network communication between client and server.
|
||||||
|
* Key features:
|
||||||
|
* - Secure communication using CURVE encryption
|
||||||
|
* - File transfer capabilities (.bsz files)
|
||||||
|
* - Real-time rendering status updates
|
||||||
|
* - Heartbeat monitoring to check connection status
|
||||||
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -26,110 +42,158 @@
|
|||||||
using namespace dl;
|
using namespace dl;
|
||||||
using namespace dl::bella_sdk;
|
using namespace dl::bella_sdk;
|
||||||
|
|
||||||
|
// Global state variables
|
||||||
|
std::string initializeGlobalLicense(); // Function to return license text
|
||||||
|
std::string initializeGlobalThirdPartyLicences(); // Function to return third-party licenses
|
||||||
|
std::atomic<bool> connection_state (false); // Tracks if client/server are connected
|
||||||
|
std::atomic<bool> abort_state (false); // Used to signal program termination
|
||||||
|
std::atomic<bool> server (false); // Indicates if running in server mode
|
||||||
|
|
||||||
std::string initializeGlobalLicense();
|
// Function declarations
|
||||||
std::string initializeGlobalThirdPsrtyLicences();
|
std::string get_pubkey_from_srv(std::string server_address, uint16_t publickey_port); // Gets server's public key for encryption
|
||||||
//std::atomic<bool> heartbeat_state (true);
|
|
||||||
std::atomic<bool> connection_state (false);
|
|
||||||
std::atomic<bool> abort_state (false);
|
|
||||||
std::atomic<bool> server (false);
|
|
||||||
|
|
||||||
|
|
||||||
std::string get_pubkey_from_srv(std::string server_address, uint16_t publickey_port);
|
|
||||||
|
|
||||||
|
// Main client communication thread
|
||||||
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 server_address,
|
std::string server_address,
|
||||||
uint16_t command_port);
|
uint16_t command_port);
|
||||||
|
|
||||||
|
// Main server thread that handles rendering and client requests
|
||||||
void server_thread( std::string server_skey,
|
void server_thread( std::string server_skey,
|
||||||
uint16_t command_port,
|
uint16_t command_port,
|
||||||
bool test_render,
|
bool test_render,
|
||||||
Engine engine);
|
Engine engine);
|
||||||
|
|
||||||
|
// Utility function to open files with system default program
|
||||||
void openFileWithDefaultProgram(const std::string& filePath);
|
void openFileWithDefaultProgram(const std::string& filePath);
|
||||||
|
|
||||||
|
// Helper function to check file extensions
|
||||||
bool ends_with_suffix(const std::string& str, const std::string& suffix);
|
bool ends_with_suffix(const std::string& str, const std::string& suffix);
|
||||||
|
|
||||||
|
// Server function to handle initial key exchange
|
||||||
void pkey_server(const std::string& pub_key, uint16_t publickey_port);
|
void pkey_server(const std::string& pub_key, uint16_t publickey_port);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MyEngineObserver Class
|
||||||
|
* This class receives callbacks from the Bella rendering engine to track rendering progress.
|
||||||
|
* It implements the EngineObserver interface and provides methods to:
|
||||||
|
* - Handle render start/stop events
|
||||||
|
* - Track rendering progress
|
||||||
|
* - Handle error conditions
|
||||||
|
* - Store and retrieve the current progress state
|
||||||
|
*/
|
||||||
struct MyEngineObserver : public EngineObserver
|
struct MyEngineObserver : public EngineObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Called when a rendering pass starts
|
||||||
void onStarted(String pass) override
|
void onStarted(String pass) override
|
||||||
{
|
{
|
||||||
logInfo("Started pass %s", pass.buf());
|
logInfo("Started pass %s", pass.buf());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called to update the current status of rendering
|
||||||
void onStatus(String pass, String status) override
|
void onStatus(String pass, String status) override
|
||||||
{
|
{
|
||||||
logInfo("%s [%s]", status.buf(), pass.buf());
|
logInfo("%s [%s]", status.buf(), pass.buf());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called to update rendering progress (percentage, time remaining, etc)
|
||||||
void onProgress(String pass, Progress progress) override
|
void onProgress(String pass, Progress progress) override
|
||||||
{
|
{
|
||||||
std::cout << progress.toString().buf() << std::endl;
|
std::cout << progress.toString().buf() << std::endl;
|
||||||
setString(new std::string(progress.toString().buf()));
|
setString(new std::string(progress.toString().buf()));
|
||||||
logInfo("%s [%s]", progress.toString().buf(), pass.buf());
|
logInfo("%s [%s]", progress.toString().buf(), pass.buf());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called when an error occurs during rendering
|
||||||
void onError(String pass, String msg) override
|
void onError(String pass, String msg) override
|
||||||
{
|
{
|
||||||
logError("%s [%s]", msg.buf(), pass.buf());
|
logError("%s [%s]", msg.buf(), pass.buf());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called when a rendering pass completes
|
||||||
void onStopped(String pass) override
|
void onStopped(String pass) override
|
||||||
{
|
{
|
||||||
logInfo("Stopped %s", pass.buf());
|
logInfo("Stopped %s", pass.buf());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getProgress() const { // Add this function
|
// Returns the current progress as a string
|
||||||
|
std::string getProgress() const {
|
||||||
std::string* currentProgress = progressPtr.load();
|
std::string* currentProgress = progressPtr.load();
|
||||||
if (currentProgress) {
|
if (currentProgress) {
|
||||||
return *currentProgress; // Return a copy of the string
|
return *currentProgress;
|
||||||
} else {
|
} else {
|
||||||
return ""; // Or some default value if no progress yet
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup resources in destructor
|
||||||
~MyEngineObserver() {
|
~MyEngineObserver() {
|
||||||
setString(nullptr);
|
setString(nullptr);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
// Thread-safe pointer to current progress string
|
||||||
std::atomic<std::string*> progressPtr{nullptr};
|
std::atomic<std::string*> progressPtr{nullptr};
|
||||||
|
|
||||||
|
// Helper function to safely update the progress string
|
||||||
void setString(std::string* newStatus) {
|
void setString(std::string* newStatus) {
|
||||||
std::string* oldStatus = progressPtr.exchange(newStatus);
|
std::string* oldStatus = progressPtr.exchange(newStatus);
|
||||||
delete oldStatus;
|
delete oldStatus; // Clean up old string if it exists
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void heartbeat_thread( std::string server_pkey, //CLIENT
|
/*
|
||||||
std::string server_skey, //SERVER
|
* Heartbeat Monitoring System
|
||||||
std::string client_pkey, //CLIENT
|
*
|
||||||
std::string client_skey, //CLIENT
|
* This function implements a heartbeat mechanism to monitor the connection between client and server.
|
||||||
bool is_server, //BOTH
|
* It runs in a separate thread and:
|
||||||
std::string server_address, //CLIENT
|
* - For server: listens for periodic messages from client
|
||||||
uint16_t heartbeat_port ) { //BOTH
|
* - For client: sends periodic messages to server
|
||||||
|
* If either side stops receiving messages, it marks the connection as dead.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* - server_pkey: Server's public key (used by client)
|
||||||
|
* - server_skey: Server's secret key (used by server)
|
||||||
|
* - client_pkey: Client's public key (used by client)
|
||||||
|
* - client_skey: Client's secret key (used by client)
|
||||||
|
* - is_server: Boolean indicating if running in server mode
|
||||||
|
* - server_address: Address of the server (used by client)
|
||||||
|
* - heartbeat_port: Port number for heartbeat communication
|
||||||
|
*/
|
||||||
|
void heartbeat_thread( std::string server_pkey,
|
||||||
|
std::string server_skey,
|
||||||
|
std::string client_pkey,
|
||||||
|
std::string client_skey,
|
||||||
|
bool is_server,
|
||||||
|
std::string server_address,
|
||||||
|
uint16_t heartbeat_port ) {
|
||||||
|
|
||||||
zmq::context_t ctx;
|
zmq::context_t ctx; // Create ZMQ context
|
||||||
zmq::socket_t heartbeat_sock; //top scope
|
zmq::socket_t heartbeat_sock; // Socket for heartbeat messages
|
||||||
|
|
||||||
if(is_server) {
|
if(is_server) {
|
||||||
|
// Server mode: Listen for client heartbeats
|
||||||
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(heartbeat_port);
|
std::string url = "tcp://*:" + std::to_string(heartbeat_port);
|
||||||
heartbeat_sock.bind(url);
|
heartbeat_sock.bind(url);
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
//Start polling heartbeats once client connects
|
// Only check heartbeats when client is connected
|
||||||
if (connection_state == true) {
|
if (connection_state == true) {
|
||||||
|
// Wait up to 5 seconds for client heartbeat
|
||||||
zmq::pollitem_t response_item = { heartbeat_sock, 0, ZMQ_POLLIN, 0 };
|
zmq::pollitem_t response_item = { heartbeat_sock, 0, ZMQ_POLLIN, 0 };
|
||||||
zmq::poll(&response_item, 1, 5000); // Wait for response with timeout
|
zmq::poll(&response_item, 1, 5000);
|
||||||
|
|
||||||
if (response_item.revents & ZMQ_POLLIN) { //heartbeat
|
if (response_item.revents & ZMQ_POLLIN) {
|
||||||
|
// Received heartbeat from client
|
||||||
zmq::message_t message;
|
zmq::message_t message;
|
||||||
//ZIN<<<
|
|
||||||
heartbeat_sock.recv(message, zmq::recv_flags::none);
|
heartbeat_sock.recv(message, zmq::recv_flags::none);
|
||||||
//ZOUT>>>
|
heartbeat_sock.send(zmq::message_t("ACK"), zmq::send_flags::dontwait);
|
||||||
heartbeat_sock.send(zmq::message_t("ACK"), zmq::send_flags::dontwait); // No block
|
} else {
|
||||||
} else { //timeout
|
// No heartbeat received - mark connection as dead
|
||||||
std::cout << "Bella Client Lost" << std::endl;
|
std::cout << "Bella Client Lost" << std::endl;
|
||||||
connection_state = false;
|
connection_state = false;
|
||||||
}
|
}
|
||||||
@ -137,31 +201,38 @@ void heartbeat_thread( std::string server_pkey, //CLIENT
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Client mode: Send heartbeats to server
|
||||||
zmq::socket_t heartbeat_sock (ctx, zmq::socket_type::req);
|
zmq::socket_t heartbeat_sock (ctx, zmq::socket_type::req);
|
||||||
|
// Set up encryption keys
|
||||||
heartbeat_sock.set(zmq::sockopt::curve_serverkey, server_pkey);
|
heartbeat_sock.set(zmq::sockopt::curve_serverkey, server_pkey);
|
||||||
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);
|
||||||
std::string url = "tcp://" + server_address + ":" +std::to_string(heartbeat_port);
|
|
||||||
|
std::string url = "tcp://" + server_address + ":" + std::to_string(heartbeat_port);
|
||||||
heartbeat_sock.connect(url);
|
heartbeat_sock.connect(url);
|
||||||
//int heartbeat_count = 0;
|
|
||||||
//std::vector<zmq::pollitem_t> items = {};
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if(abort_state.load()==true) { // Check for other threads abort
|
// Check if we should stop
|
||||||
|
if(abort_state.load()==true) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
|
||||||
if(connection_state == true) {
|
if(connection_state == true) {
|
||||||
|
// Send heartbeat to server
|
||||||
heartbeat_sock.send(zmq::message_t("ACK"), zmq::send_flags::none);
|
heartbeat_sock.send(zmq::message_t("ACK"), zmq::send_flags::none);
|
||||||
// Wait for response (poll for ZMQ_POLLIN)
|
|
||||||
|
// Wait for server response
|
||||||
zmq::pollitem_t response_item = { heartbeat_sock, 0, ZMQ_POLLIN, 0 };
|
zmq::pollitem_t response_item = { heartbeat_sock, 0, ZMQ_POLLIN, 0 };
|
||||||
zmq::poll(&response_item, 1, 5000); // Wait for response with timeout
|
zmq::poll(&response_item, 1, 5000);
|
||||||
|
|
||||||
if (response_item.revents & ZMQ_POLLIN) {
|
if (response_item.revents & ZMQ_POLLIN) {
|
||||||
|
// Got response from server
|
||||||
zmq::message_t msg_response;
|
zmq::message_t msg_response;
|
||||||
heartbeat_sock.recv(msg_response, zmq::recv_flags::none);
|
heartbeat_sock.recv(msg_response, zmq::recv_flags::none);
|
||||||
//std::cout << "Heartbeat Response: " << std::endl;
|
|
||||||
} else {
|
} else {
|
||||||
|
// No response - mark connection as dead
|
||||||
std::cout << "Bella Server is unavailable" << std::endl;
|
std::cout << "Bella Server is unavailable" << std::endl;
|
||||||
connection_state = false;
|
connection_state = false;
|
||||||
break;
|
break;
|
||||||
@ -169,36 +240,51 @@ void heartbeat_thread( std::string server_pkey, //CLIENT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Clean up resources
|
||||||
heartbeat_sock.close();
|
heartbeat_sock.close();
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main Program Entry Point
|
||||||
#include "dl_core/dl_main.inl"
|
*
|
||||||
|
* This function initializes the application and handles command-line arguments.
|
||||||
|
* It can run in either server or client mode:
|
||||||
|
* - Server mode: Starts rendering engine and waits for client connections
|
||||||
|
* - Client mode: Connects to server and sends commands
|
||||||
|
*
|
||||||
|
* Command-line arguments:
|
||||||
|
* --server : Run in server mode
|
||||||
|
* --serverAddress : IP address of server (for client mode)
|
||||||
|
* --commandPort : Port for main command communication
|
||||||
|
* --heartbeatPort : Port for connection monitoring
|
||||||
|
* --publickeyPort : Port for initial key exchange
|
||||||
|
* --testRender : Use small resolution for testing
|
||||||
|
* --thirdparty : Show third-party licenses
|
||||||
|
* --licenseinfo : Show license information
|
||||||
|
*/
|
||||||
|
#include "dl_core/dl_main.inl"
|
||||||
int DL_main(Args& args)
|
int DL_main(Args& args)
|
||||||
{
|
{
|
||||||
|
// Default configuration values
|
||||||
const size_t chunk_size = 65536;
|
const size_t chunk_size = 65536;
|
||||||
|
|
||||||
std::string server_address = "localhost";
|
std::string server_address = "localhost";
|
||||||
uint16_t command_port = 5797;
|
uint16_t command_port = 5797;
|
||||||
uint16_t heartbeat_port = 5798;
|
uint16_t heartbeat_port = 5798;
|
||||||
uint16_t publickey_port = 5799;
|
uint16_t publickey_port = 5799;
|
||||||
bool test_render = false;
|
bool test_render = false;
|
||||||
/*logBanner("Bella Engine SDK (version: %s, build date: %llu)",
|
|
||||||
bellaSdkVersion().toString().buf(),
|
|
||||||
bellaSdkBuildDate()
|
|
||||||
);*/
|
|
||||||
|
|
||||||
|
// Register command-line arguments
|
||||||
args.add("sa", "serverAddress", "", "Bella render server ip address");
|
args.add("sa", "serverAddress", "", "Bella render server ip address");
|
||||||
args.add("cp", "commandPort", "", "tcp port for zmq server socket for commands");
|
args.add("cp", "commandPort", "", "tcp port for zmq server socket for commands");
|
||||||
args.add("hp", "heartbeatPort", "", "tcp port for zmq server socket for heartbeats");
|
args.add("hp", "heartbeatPort", "", "tcp port for zmq server socket for heartbeats");
|
||||||
args.add("pp", "publickeyPort", "", "tcp port for zmq server socket for server pubkey");
|
args.add("pp", "publickeyPort", "", "tcp port for zmq server socket for server pubkey");
|
||||||
args.add("s", "server", "", "turn on server mode");
|
args.add("s", "server", "", "turn on server mode");
|
||||||
args.add("tr", "testRender", "", "force res to 100x100");
|
args.add("tr", "testRender", "", "force res to 100x100");
|
||||||
args.add("tp", "thirdparty", "", "prints third party licenses");
|
args.add("tp", "thirdparty", "", "prints third party licenses");
|
||||||
args.add("li", "licenseinfo", "", "prints license info");
|
args.add("li", "licenseinfo", "", "prints license info");
|
||||||
|
|
||||||
|
// Handle special command-line options
|
||||||
if (args.versionReqested())
|
if (args.versionReqested())
|
||||||
{
|
{
|
||||||
printf("%s", bellaSdkVersion().toString().buf());
|
printf("%s", bellaSdkVersion().toString().buf());
|
||||||
@ -211,37 +297,39 @@ int DL_main(Args& args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show license information if requested
|
||||||
if (args.have("--licenseinfo"))
|
if (args.have("--licenseinfo"))
|
||||||
{
|
{
|
||||||
std::cout << initializeGlobalLicense() << std::endl;
|
std::cout << initializeGlobalLicense() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show third-party licenses if requested
|
||||||
if (args.have("--thirdparty"))
|
if (args.have("--thirdparty"))
|
||||||
{
|
{
|
||||||
std::cout << initializeGlobalThirdPsrtyLicences() << std::endl;
|
std::cout << initializeGlobalThirdPartyLicences() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if running in server mode
|
||||||
// Turn on server mode
|
|
||||||
if (args.have("--server"))
|
if (args.have("--server"))
|
||||||
{
|
{
|
||||||
server=true;
|
server=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable test rendering if requested
|
||||||
if (args.have("--testRender"))
|
if (args.have("--testRender"))
|
||||||
{
|
{
|
||||||
test_render=true;
|
test_render=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse server address (for client mode)
|
||||||
if (args.have("--serverAddress"))
|
if (args.have("--serverAddress"))
|
||||||
{
|
{
|
||||||
//server_address = std::string(args.value("--serverAddress").buf());
|
|
||||||
server_address = args.value("--serverAddress").buf();
|
server_address = args.value("--serverAddress").buf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse port numbers if provided
|
||||||
if (args.have("--heartbeatPort"))
|
if (args.have("--heartbeatPort"))
|
||||||
{
|
{
|
||||||
String argString = args.value("--heartbeatPort");
|
String argString = args.value("--heartbeatPort");
|
||||||
@ -877,7 +965,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.)"; }
|
SOFTWARE.)"; }
|
||||||
|
|
||||||
std::string initializeGlobalThirdPsrtyLicences() {
|
std::string initializeGlobalThirdPartyLicences() {
|
||||||
return R"(
|
return R"(
|
||||||
====
|
====
|
||||||
|
|
||||||
@ -939,4 +1027,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||||||
|
|
||||||
=====
|
=====
|
||||||
|
|
||||||
libzmq is free software; you can redistribute it and/or modify it under the terms of the Mozilla Public License Version 2.0.)"; }
|
libzmq is free software; you can redistribute it and/or modify it under the terms of the Mozilla Public License Version 2.0.)"; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user