Corvusoft / restbed

Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.
http://www.corvusoft.co.uk
Other
1.93k stars 379 forks source link

Ability to dependency inject application protocol layers. #80

Open ben-crowhurst opened 8 years ago

ben-crowhurst commented 8 years ago
   auto settings = make_shared< Settings >( );

    Service service;
    service.add_application_layer( http_10_instance );
    service.add_application_layer( http_11_instance );
    service.add_application_layer( http2_instance );
    service.add_application_layer( spdy_instance );
    service.start( settings );
ben-crowhurst commented 8 years ago

First attempt to draft out the Protocol interface given the current work being performed on the Socket encapsulation.

Protocol::to_bytes( Request );
Protocol::to_bytes( Response );
Protocol::is_open( Request );
Protocol::is_closed( Request );
Protocol::close( Request );
Protocol::sync( Request, success_handler = nullptr, error_handler = nullptr );
Protocol::async( Request, success_handler, error_handler );
Protocol::fetch( size_t length, Response );
Protocol::fetch( string delimiter, Response );
Protocol::fetch( Bytes delimiter, Response );
Protocol::make_request( ... );
Protocol::make_response( ... );