mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-07 02:36:47 +00:00
Merge remote branch 'peter/network-streaming' into network-streaming-vcpp2010
This commit is contained in:
@@ -39,6 +39,13 @@
|
||||
|
||||
namespace websocketpp {
|
||||
|
||||
/* policies to abstract out
|
||||
|
||||
- random number generation
|
||||
- utf8 validation
|
||||
|
||||
*/
|
||||
|
||||
class frame {
|
||||
public:
|
||||
enum opcode_s {
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using websocketpp::server;
|
||||
@@ -42,7 +44,19 @@ server::server(boost::asio::io_service& io_service,
|
||||
m_max_message_size(DEFAULT_MAX_MESSAGE_SIZE),
|
||||
m_io_service(io_service),
|
||||
m_acceptor(io_service, endpoint),
|
||||
m_def_con_handler(defc) {}
|
||||
m_def_con_handler(defc),
|
||||
m_desc("test") {
|
||||
m_desc.add_options()
|
||||
("help", "produce help message")
|
||||
("intval",po::value<int>(), "set compression level")
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void server::parse_command_line(int ac, char* av[]) {
|
||||
po::store(po::parse_command_line(ac,av, m_desc),m_vm);
|
||||
po::notify(m_vm);
|
||||
}
|
||||
|
||||
void server::add_host(std::string host) {
|
||||
m_hosts.insert(host);
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
namespace po = boost::program_options;
|
||||
|
||||
#include <set>
|
||||
|
||||
@@ -60,61 +62,66 @@ private:
|
||||
};
|
||||
|
||||
class server : public boost::enable_shared_from_this<server> {
|
||||
public:
|
||||
server(boost::asio::io_service& io_service,
|
||||
const tcp::endpoint& endpoint,
|
||||
connection_handler_ptr defc);
|
||||
|
||||
// creates a new session object and connects the next websocket
|
||||
// connection to it.
|
||||
void start_accept();
|
||||
|
||||
// INTERFACE FOR LOCAL APPLICATIONS
|
||||
public:
|
||||
server(boost::asio::io_service& io_service,
|
||||
const tcp::endpoint& endpoint,
|
||||
connection_handler_ptr defc);
|
||||
|
||||
// creates a new session object and connects the next websocket
|
||||
// connection to it.
|
||||
void start_accept();
|
||||
|
||||
// INTERFACE FOR LOCAL APPLICATIONS
|
||||
|
||||
// Add or remove a host string (host:port) to the list of acceptable
|
||||
// hosts to accept websocket connections from. Additions/deletions here
|
||||
// only affect new connections.
|
||||
void add_host(std::string host);
|
||||
void remove_host(std::string host);
|
||||
|
||||
void set_max_message_size(uint64_t val);
|
||||
|
||||
// Test methods determine if a message of the given level should be
|
||||
// written. elog shows all values above the level set. alog shows only
|
||||
// the values explicitly set.
|
||||
bool test_elog_level(uint16_t level);
|
||||
void set_elog_level(uint16_t level);
|
||||
|
||||
bool test_alog_level(uint16_t level);
|
||||
void set_alog_level(uint16_t level);
|
||||
void unset_alog_level(uint16_t level);
|
||||
// Add or remove a host string (host:port) to the list of acceptable
|
||||
// hosts to accept websocket connections from. Additions/deletions here
|
||||
// only affect new connections.
|
||||
void add_host(std::string host);
|
||||
void remove_host(std::string host);
|
||||
|
||||
void set_max_message_size(uint64_t val);
|
||||
|
||||
// Test methods determine if a message of the given level should be
|
||||
// written. elog shows all values above the level set. alog shows only
|
||||
// the values explicitly set.
|
||||
bool test_elog_level(uint16_t level);
|
||||
void set_elog_level(uint16_t level);
|
||||
|
||||
bool test_alog_level(uint16_t level);
|
||||
void set_alog_level(uint16_t level);
|
||||
void unset_alog_level(uint16_t level);
|
||||
|
||||
void parse_command_line(int ac, char* av[]);
|
||||
|
||||
// INTERFACE FOR SESSIONS
|
||||
|
||||
// INTERFACE FOR SESSIONS
|
||||
// Check if this server will respond to this host.
|
||||
bool validate_host(std::string host);
|
||||
|
||||
// Check if message size is within server's acceptable parameters
|
||||
bool validate_message_size(uint64_t val);
|
||||
|
||||
// write to the server's logs
|
||||
void log(std::string msg,uint16_t level = LOG_ERROR);
|
||||
void access_log(std::string msg,uint16_t level);
|
||||
private:
|
||||
// if no errors starts the session's read loop and returns to the
|
||||
// start_accept phase.
|
||||
void handle_accept(server_session_ptr session,
|
||||
const boost::system::error_code& error);
|
||||
|
||||
private:
|
||||
uint16_t m_elog_level;
|
||||
uint16_t m_alog_level;
|
||||
|
||||
// Check if this server will respond to this host.
|
||||
bool validate_host(std::string host);
|
||||
|
||||
// Check if message size is within server's acceptable parameters
|
||||
bool validate_message_size(uint64_t val);
|
||||
|
||||
// write to the server's logs
|
||||
void log(std::string msg,uint16_t level = LOG_ERROR);
|
||||
void access_log(std::string msg,uint16_t level);
|
||||
private:
|
||||
// if no errors starts the session's read loop and returns to the
|
||||
// start_accept phase.
|
||||
void handle_accept(server_session_ptr session,
|
||||
const boost::system::error_code& error);
|
||||
|
||||
private:
|
||||
uint16_t m_elog_level;
|
||||
uint16_t m_alog_level;
|
||||
|
||||
std::set<std::string> m_hosts;
|
||||
uint64_t m_max_message_size;
|
||||
boost::asio::io_service& m_io_service;
|
||||
tcp::acceptor m_acceptor;
|
||||
connection_handler_ptr m_def_con_handler;
|
||||
std::set<std::string> m_hosts;
|
||||
uint64_t m_max_message_size;
|
||||
boost::asio::io_service& m_io_service;
|
||||
tcp::acceptor m_acceptor;
|
||||
connection_handler_ptr m_def_con_handler;
|
||||
|
||||
po::options_description m_desc;
|
||||
po::variables_map m_vm;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user