Represents a single connection from a client. More...
#include <connection.h>
Public Member Functions | |
connection (boost::asio::io_service &io_service, EncoderManager &encoder_manager, const ServerConfiguration &default_server_conf) | |
Construct a connection with the given io_service. | |
boost::asio::ip::tcp::socket & | socket () |
Get the socket associated with the connection. | |
void | start () |
Start the first asynchronous operation for the connection. | |
virtual | ~connection () |
Private Member Functions | |
void | generateImageTopicHTML () |
void | generateVideoStreamHTML (const std::string &image_topic, const ServerConfiguration &config) |
void | getImageTopics () |
void | getStreamingParametersFromURL (const std::string url, ServerConfiguration &config) |
void | handleRead (const boost::system::error_code &e, std::size_t bytes_transferred) |
Handle completion of a read operation. | |
void | handleWrite (const boost::system::error_code &e) |
Handle completion of a write operation. | |
std::string | mimeExtensionToType (const std::string &extension) |
void | sendHTTPStreamingHeaders () |
void | streamingWorkerThread (const std::string &topic, const ServerConfiguration &config) |
Static Private Member Functions | |
static bool | urlDecode (const std::string &in, std::string &out) |
Private Attributes | |
boost::array< char, 8192 > | buffer_ |
Buffer for incoming data. | |
bool | do_streaming_ |
EncoderManager & | encoder_manager_ |
std::vector< std::string > | image_topics_ |
reply | reply_ |
The reply to be sent back to the client. | |
request | request_ |
The incoming request. | |
request_parser | request_parser_ |
The parser for the incoming request. | |
const ServerConfiguration & | server_conf_ |
boost::asio::ip::tcp::socket | socket_ |
Socket for the connection. | |
boost::asio::io_service::strand | strand_ |
Strand to ensure the connection's handlers are not called concurrently. | |
boost::shared_ptr< boost::thread > | streaming_thread_ |
Represents a single connection from a client.
Definition at line 64 of file connection.h.
ros_http_video_streamer::connection::connection | ( | boost::asio::io_service & | io_service, |
EncoderManager & | encoder_manager, | ||
const ServerConfiguration & | default_server_conf | ||
) | [explicit] |
Construct a connection with the given io_service.
Definition at line 97 of file connection.cpp.
ros_http_video_streamer::connection::~connection | ( | ) | [virtual] |
Definition at line 114 of file connection.cpp.
void ros_http_video_streamer::connection::generateImageTopicHTML | ( | ) | [private] |
Definition at line 299 of file connection.cpp.
void ros_http_video_streamer::connection::generateVideoStreamHTML | ( | const std::string & | image_topic, |
const ServerConfiguration & | config | ||
) | [private] |
Definition at line 325 of file connection.cpp.
void ros_http_video_streamer::connection::getImageTopics | ( | ) | [private] |
Definition at line 274 of file connection.cpp.
void ros_http_video_streamer::connection::getStreamingParametersFromURL | ( | const std::string | url, |
ServerConfiguration & | config | ||
) | [private] |
Definition at line 382 of file connection.cpp.
void ros_http_video_streamer::connection::handleRead | ( | const boost::system::error_code & | e, |
std::size_t | bytes_transferred | ||
) | [private] |
Handle completion of a read operation.
Definition at line 468 of file connection.cpp.
void ros_http_video_streamer::connection::handleWrite | ( | const boost::system::error_code & | e | ) | [private] |
Handle completion of a write operation.
Definition at line 634 of file connection.cpp.
std::string ros_http_video_streamer::connection::mimeExtensionToType | ( | const std::string & | extension | ) | [private] |
Definition at line 455 of file connection.cpp.
void ros_http_video_streamer::connection::sendHTTPStreamingHeaders | ( | ) | [private] |
Definition at line 132 of file connection.cpp.
boost::asio::ip::tcp::socket & ros_http_video_streamer::connection::socket | ( | ) |
Get the socket associated with the connection.
Definition at line 439 of file connection.cpp.
Start the first asynchronous operation for the connection.
Definition at line 444 of file connection.cpp.
void ros_http_video_streamer::connection::streamingWorkerThread | ( | const std::string & | topic, |
const ServerConfiguration & | config | ||
) | [private] |
Definition at line 205 of file connection.cpp.
bool ros_http_video_streamer::connection::urlDecode | ( | const std::string & | in, |
std::string & | out | ||
) | [static, private] |
Perform URL-decoding on a string. Returns false if the encoding was invalid.
Definition at line 649 of file connection.cpp.
boost::array<char, 8192> ros_http_video_streamer::connection::buffer_ [private] |
Buffer for incoming data.
Definition at line 129 of file connection.h.
bool ros_http_video_streamer::connection::do_streaming_ [private] |
Definition at line 147 of file connection.h.
Definition at line 141 of file connection.h.
std::vector<std::string> ros_http_video_streamer::connection::image_topics_ [private] |
Definition at line 120 of file connection.h.
The reply to be sent back to the client.
Definition at line 138 of file connection.h.
The incoming request.
Definition at line 132 of file connection.h.
The parser for the incoming request.
Definition at line 135 of file connection.h.
const ServerConfiguration& ros_http_video_streamer::connection::server_conf_ [private] |
Definition at line 117 of file connection.h.
boost::asio::ip::tcp::socket ros_http_video_streamer::connection::socket_ [private] |
Socket for the connection.
Definition at line 126 of file connection.h.
boost::asio::io_service::strand ros_http_video_streamer::connection::strand_ [private] |
Strand to ensure the connection's handlers are not called concurrently.
Definition at line 123 of file connection.h.
boost::shared_ptr<boost::thread> ros_http_video_streamer::connection::streaming_thread_ [private] |
Definition at line 144 of file connection.h.