Ejemplo n.º 1
0
    void setup (Journal journal)
    {
        if (! getConfig ().getRpcIP().empty () &&
              getConfig ().getRpcPort() != 0)
        {
            IPEndpoint ep (IPEndpoint::from_string (getConfig().getRpcIP()));
            if (! ep.empty())
            {
                HTTP::Port port;
                port.addr = ep.withPort(0);
                if (getConfig ().getRpcPort() != 0)
                    port.port = getConfig ().getRpcPort();
                else
                    port.port = ep.port();
                port.context = m_context;

                HTTP::Ports ports;
                ports.push_back (port);
                m_server.setPorts (ports);
            }
        }
        else
        {
            journal.info << "RPC interface: disabled";
        }
    }
Ejemplo n.º 2
0
    void setup (beast::Journal journal)
    {
        if (! getConfig ().getRpcIP().empty () &&
              getConfig ().getRpcPort() != 0)
        {
            beast::IP::Endpoint ep (beast::IP::Endpoint::from_string (getConfig().getRpcIP()));
            if (! is_unspecified (ep))
            {
                HTTP::Port port;
                port.addr = ep.at_port(0);
                if (getConfig ().getRpcPort() != 0)
                    port.port = getConfig ().getRpcPort();
                else
                    port.port = ep.port();
                port.context = m_context.get ();

                HTTP::Ports ports;
                ports.push_back (port);
                m_server.setPorts (ports);
            }
        }
        else
        {
            journal.info << "RPC interface: disabled";
        }
    }
Ejemplo n.º 3
0
void MainEntry( void* config )
{
   NetworkThread.Create( NetworkEntry, "Network", 1024, 10, config );

#ifdef _WIN32
   Sleep( 1000 );
#elif __linux__
   usleep( 1000000 );
#endif
   StartEvent.Wait( __FILE__, __LINE__ );

   WebServer.Initialize( 80 );
}
Ejemplo n.º 4
0
 void onStop (Journal)
 {
     m_server.stopAsync();
 }
Ejemplo n.º 5
0
 ~RPCHTTPServerImp ()
 {
     m_server.stop();
 }
Ejemplo n.º 6
0
 void onStop ()
 {
     m_server.stopAsync();
 }
Ejemplo n.º 7
0
RestController::RestController( http::Server& server, DisplayGroup& group )
    : _group( group )
    , _controller( new DisplayGroupController( group ))
{
    server.handlePUT( "tide/deselect-windows", http::PUTFunc{
                      std::bind( &RestController::_deselectWindows, this )});

    server.handlePUT( "tide/exit-fullscreen", http::PUTFunc{
                      std::bind( &RestController::_exitFullScreen, this )});

    server.handlePUT( "tide/focus-windows", http::PUTFunc{
                      std::bind( &RestController::_focusWindows, this )});

    server.handlePUT( "tide/unfocus-windows", http::PUTFunc{
                      std::bind( &RestController::_unfocusWindows, this )});

    server.handlePUT( "tide/move-window-to-front",
                      std::bind( &RestController::_moveWindowToFront, this,
                                 _1 ));

    server.handlePUT( "tide/move-window",
                      std::bind( &RestController::_moveWindow, this, _1 ));

    server.handlePUT( "tide/move-window-to-fullscreen",
                      std::bind( &RestController::_moveWindowToFullscreen, this,
                                 _1 ));

    server.handlePUT( "tide/resize-window",
                      std::bind( &RestController::_resizeWindow, this, _1 ));

    server.handlePUT( "tide/toggle-select-window",
                      std::bind( &RestController::_toggleSelectWindow, this,
                                 _1 ));

    server.handlePUT( "tide/unfocus-window",
                      std::bind( &RestController::_unfocusWindow, this, _1 ));

    server.handle( http::Method::DELETE, "tide/windows/",
                   [this]( const http::Request& request )
    {
        if( auto window = _group.getContentWindow( _toWindowId( request.path )))
        {
            _group.removeContentWindow( window );
            return make_ready_response( http::Code::OK );
        }
        return make_ready_response( http::Code::NO_CONTENT );
    });
}