Пример #1
0
	/**
	 * protected constructor restricts creation of objects (use create())
	 *
	 * @param tcp_conn TCP connection containing a new message to parse
	 * @param handler function called after the message has been parsed
	 */
	HTTPRequestReader(TCPConnectionPtr& tcp_conn, FinishedHandler handler)
		: HTTPReader(true, tcp_conn), m_http_msg(new HTTPRequest),
		m_finished(handler)
	{
		m_http_msg->setRemoteIp(tcp_conn->getRemoteIp());
		setLogger(PION_GET_LOGGER("pion.net.HTTPRequestReader"));
	}
Пример #2
0
 /**
  * protected constructor restricts creation of objects (use create())
  *
  * @param tcp_conn TCP connection containing a new message to parse
  * @param handler function called after the message has been parsed
  */
 request_reader(tcp::connection_ptr& tcp_conn, finished_handler_t handler)
     : http::reader(true, tcp_conn), m_http_msg(new http::request),
     m_finished(handler)
 {
     m_http_msg->set_remote_ip(tcp_conn->get_remote_ip());
     set_logger(PION_GET_LOGGER("pion.http.request_reader"));
 }
Пример #3
0
 ChannelManager(
     boost::asio::io_service& io_service, 
     boost::posix_time::time_duration period
 )
     : m_logger(PION_GET_LOGGER("lite_comet.ChannelManager")),
       m_io_service(io_service),
       m_timer(io_service),
       m_period(period)
 {}
Пример #4
0
 /**
  * protected constructor restricts creation of objects (use create())
  * 
  * @param tcp_conn TCP connection used to send the request
  * @param http_request_ptr pointer to the request that will be sent
  * @param handler function called after the request has been sent
  */
 request_writer(tcp::connection_ptr& tcp_conn, http::request_ptr& http_request_ptr,
                   finished_handler_t handler)
     : http::writer(tcp_conn, handler), m_http_request(http_request_ptr)
 {
     set_logger(PION_GET_LOGGER("pion.http.request_writer"));
     // check if we should initialize the payload content using
     // the request's content buffer
     if (m_http_request->get_content_length() > 0
         && m_http_request->get_content() != NULL
         && m_http_request->get_content()[0] != '\0')
     {
         write_no_copy(m_http_request->get_content(),
                     m_http_request->get_content_length());
     }
 }
Пример #5
0
cookie_auth::cookie_auth(user_manager_ptr userManager,
                               const std::string& login,
                               const std::string& logout,
                               const std::string& redirect)
    : http::auth(userManager), m_login(login), m_logout(logout), m_redirect(redirect),
    m_random_gen(), m_random_range(0, 255), m_random_die(m_random_gen, m_random_range),
    m_cache_cleanup_time(boost::posix_time::second_clock::universal_time())
{
    // set logger for this class
    set_logger(PION_GET_LOGGER("pion.http.cookie_auth"));

    // Seed random number generator with current time as time_t int value, cast to the required type.
    // (Note that boost::mt19937::result_type is boost::uint32_t, and casting to an unsigned n-bit integer is
    // defined by the standard to keep the lower n bits.  Since ::time() returns seconds since Jan 1, 1970, 
    // it will be a long time before we lose any entropy here, even if time_t is a 64-bit int.)
    m_random_gen.seed(static_cast<boost::mt19937::result_type>(::time(NULL)));

    // generate some random numbers to increase entropy of the rng
    for (unsigned int n = 0; n < 100; ++n)
        m_random_die();
}
Пример #6
0
	/// constructs a new FilterReactor object
	FilterReactor(void) : Reactor(TYPE_PROCESSING) { setLogger(PION_GET_LOGGER("pion.FilterReactor")); }
Пример #7
0
 /**
  * protected constructor restricts creation of objects (use create())
  * 
  * @param tcp_conn TCP connection used to send the request
  * @param handler function called after the request has been sent
  */
 request_writer(tcp::connection_ptr& tcp_conn, finished_handler_t handler)
     : http::writer(tcp_conn, handler), m_http_request(new http::request)
 {
     set_logger(PION_GET_LOGGER("pion.http.request_writer"));
 }
Пример #8
0
HTTPBasicAuth::HTTPBasicAuth(PionUserManagerPtr userManager, const std::string& realm)
	: HTTPAuth(userManager), m_realm(realm),
	m_cache_cleanup_time(boost::posix_time::second_clock::universal_time())
{
	setLogger(PION_GET_LOGGER("pion.net.HTTPBasicAuth"));
}
Пример #9
0
 CometWriteService(ChannelManager& channel_manager) 
     : m_channel_manager(channel_manager),
       m_logger(PION_GET_LOGGER("lite_comet.CometWriteService"))
 {}
Пример #10
0
CodecFactory::CodecFactory(const VocabularyManager& vocab_mgr)
	: PluginConfig<Codec>(vocab_mgr, DEFAULT_CONFIG_FILE, CODEC_ELEMENT_NAME)
{
	setLogger(PION_GET_LOGGER("pion.platform.CodecFactory"));
}
Пример #11
0
ProtocolFactory::ProtocolFactory(const VocabularyManager& vocab_mgr)
	: PluginConfig<Protocol>(vocab_mgr, DEFAULT_CONFIG_FILE, PROTOCOL_ELEMENT_NAME)
{
	setLogger(PION_GET_LOGGER("pion.platform.ProtocolFactory"));
}
Пример #12
0
	/// constructs a new ConfigService object
	ConfigService(void) : PlatformService("pion.ConfigService"), m_config_logger(PION_GET_LOGGER("config")) {}