From 9964689f8fb88dd2f1c441a2a10c241d6c62ddf0 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sat, 16 Jun 2012 02:52:50 -0700 Subject: [PATCH] Add configuration support for WEBSOCKET_IP and WEBSOCKET_PORT. --- src/Config.cpp | 46 +++++++++++++++++++++++++++------------------- src/Config.h | 33 ++++++++++++++++----------------- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index 18a26737c0..176bb2b522 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -3,33 +3,36 @@ #include "ParseSection.h" #include "utils.h" -#include -#include #include - -// Fees are in XNS raw. -#define DEFAULT_FEE_ACCOUNT_CREATE 1000 -#define DEFAULT_FEE_NICKNAME_CREATE 1000 -#define DEFAULT_FEE_DEFAULT 100 +#include +#include #define CONFIG_FILE_NAME SYSTEM_NAME "d.cfg" // newcoind.cfg + +#define SECTION_ACCOUNT_PROBE_MAX "account_probe_max" +#define SECTION_FEE_ACCOUNT_CREATE "fee_account_create" +#define SECTION_FEE_DEFAULT "fee_default" +#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create" +#define SECTION_NETWORK_QUORUM "network_quorum" +#define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water" #define SECTION_PEER_IP "peer_ip" #define SECTION_PEER_PORT "peer_port" +#define SECTION_PEER_SCAN_INTERVAL_MIN "peer_scan_interval_min" +#define SECTION_PEER_SSL_CIPHER_LIST "peer_ssl_cipher_list" +#define SECTION_PEER_START_MAX "peer_start_max" +#define SECTION_RPC_ALLOW_REMOTE "rpc_allow_remote" #define SECTION_RPC_IP "rpc_ip" #define SECTION_RPC_PORT "rpc_port" -#define SECTION_RPC_ALLOW_REMOTE "rpc_allow_remote" -#define SECTION_VALIDATION_SEED "validation_seed" -#define SECTION_PEER_SSL_CIPHER_LIST "peer_ssl_cipher_list" -#define SECTION_PEER_SCAN_INTERVAL_MIN "peer_scan_interval_min" -#define SECTION_PEER_START_MAX "peer_start_max" -#define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water" -#define SECTION_NETWORK_QUORUM "network_quorum" -#define SECTION_VALIDATION_QUORUM "validation_quorum" -#define SECTION_FEE_ACCOUNT_CREATE "fee_account_create" -#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create" -#define SECTION_FEE_DEFAULT "fee_default" -#define SECTION_ACCOUNT_PROBE_MAX "account_probe_max" #define SECTION_UNL_DEFAULT "unl_default" +#define SECTION_VALIDATION_QUORUM "validation_quorum" +#define SECTION_VALIDATION_SEED "validation_seed" +#define SECTION_WEBSOCKET_IP "websocket_ip" +#define SECTION_WEBSOCKET_PORT "websocket_port" + +// Fees are in XNB. +#define DEFAULT_FEE_ACCOUNT_CREATE 1000 +#define DEFAULT_FEE_NICKNAME_CREATE 1000 +#define DEFAULT_FEE_DEFAULT 100 Config theConfig; @@ -180,6 +183,11 @@ void Config::load() if (sectionSingleB(secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp)) RPC_ALLOW_REMOTE = boost::lexical_cast(strTemp); + (void) sectionSingleB(secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP); + + if (sectionSingleB(secConfig, SECTION_WEBSOCKET_PORT, strTemp)) + WEBSOCKET_PORT = boost::lexical_cast(strTemp); + if (sectionSingleB(secConfig, SECTION_VALIDATION_SEED, strTemp)) VALIDATION_SEED.setSeedGeneric(strTemp); diff --git a/src/Config.h b/src/Config.h index 6a77fde1f4..10d1a1ce11 100644 --- a/src/Config.h +++ b/src/Config.h @@ -47,30 +47,28 @@ public: boost::filesystem::path UNL_DEFAULT; // Network parameters - int NETWORK_START_TIME; // The Unix time we start ledger 0 - int TRANSACTION_FEE_BASE; - int LEDGER_SECONDS; - int LEDGER_PROPOSAL_DELAY_SECONDS; - int LEDGER_AVALANCHE_SECONDS; + int NETWORK_START_TIME; // The Unix time we start ledger 0 + int TRANSACTION_FEE_BASE; + int LEDGER_SECONDS; + int LEDGER_PROPOSAL_DELAY_SECONDS; + int LEDGER_AVALANCHE_SECONDS; // Note: The following parameters do not relate to the UNL or trust at all - int NETWORK_QUORUM; // Minimum number of nodes to consider the network present - int VALIDATION_QUORUM; // Minimum validations to consider ledger authoritative + int NETWORK_QUORUM; // Minimum number of nodes to consider the network present + int VALIDATION_QUORUM; // Minimum validations to consider ledger authoritative // Peer networking parameters std::string PEER_IP; - int PEER_PORT; - int NUMBER_CONNECTIONS; + int PEER_PORT; + int NUMBER_CONNECTIONS; std::string PEER_SSL_CIPHER_LIST; - int PEER_SCAN_INTERVAL_MIN; - int PEER_START_MAX; - int PEER_CONNECT_LOW_WATER; + int PEER_SCAN_INTERVAL_MIN; + int PEER_START_MAX; + int PEER_CONNECT_LOW_WATER; -// bool NODE_INBOUND; // We accept inbound connections -// bool NODE_DATABASE; // We offer historical data services -// bool NODE_PUBLIC; // We do not attempt to hide our identity -// bool NODE_DUMB; // We are a 'dumb' client -// bool NODE_SMART; // We offer services to 'dumb' clients + // Client networking parameters + std::string WEBSOCKET_IP; + int WEBSOCKET_PORT; // RPC parameters std::string RPC_IP; @@ -96,4 +94,5 @@ public: extern Config theConfig; #endif + // vim:ts=4