Add configuration support for WEBSOCKET_IP and WEBSOCKET_PORT.

This commit is contained in:
Arthur Britto
2012-06-16 02:52:50 -07:00
parent d3c1681c68
commit 9964689f8f
2 changed files with 43 additions and 36 deletions

View File

@@ -3,33 +3,36 @@
#include "ParseSection.h"
#include "utils.h"
#include <iostream>
#include <fstream>
#include <boost/lexical_cast.hpp>
// Fees are in XNS raw.
#define DEFAULT_FEE_ACCOUNT_CREATE 1000
#define DEFAULT_FEE_NICKNAME_CREATE 1000
#define DEFAULT_FEE_DEFAULT 100
#include <fstream>
#include <iostream>
#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<bool>(strTemp);
(void) sectionSingleB(secConfig, SECTION_WEBSOCKET_IP, WEBSOCKET_IP);
if (sectionSingleB(secConfig, SECTION_WEBSOCKET_PORT, strTemp))
WEBSOCKET_PORT = boost::lexical_cast<int>(strTemp);
if (sectionSingleB(secConfig, SECTION_VALIDATION_SEED, strTemp))
VALIDATION_SEED.setSeedGeneric(strTemp);

View File

@@ -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