Ardour  9.2-266-g5d535d4cb7
ArdourSurface::MCPHttpServer Class Reference

#include <mcp_http_server.h>

Classes

struct  ClientContext
 

Public Member Functions

 MCPHttpServer (ARDOUR::Session &, uint16_t port, int debug_level, PBD::EventLoop *event_loop)
 
 ~MCPHttpServer ()
 
int start ()
 
int stop ()
 
void set_debug_level (int)
 
int debug_level () const
 

Private Types

typedef std::unordered_map< struct lws *, ClientContextClientMap
 

Private Member Functions

void run ()
 
ClientContextclient (struct lws *)
 
void erase_client (struct lws *)
 
int callback (struct lws *, enum lws_callback_reasons, void *, void *, size_t)
 
int handle_http (struct lws *, ClientContext &)
 
int handle_http_body (struct lws *, ClientContext &, void *, size_t)
 
int handle_http_body_completion (struct lws *, ClientContext &)
 
int handle_http_writeable (struct lws *, ClientContext &)
 
int send_json_headers (struct lws *)
 
int send_http_status (struct lws *, unsigned int)
 
int write_json_response (struct lws *, ClientContext &)
 
std::string dispatch_jsonrpc (const std::string &) const
 

Static Private Member Functions

static int lws_callback (struct lws *, enum lws_callback_reasons, void *, void *, size_t)
 

Private Attributes

ARDOUR::Session_session
 
uint16_t _port
 
std::atomic< int > _debug_level
 
PBD::EventLoop_event_loop
 
struct lws_context * _context
 
struct lws_protocols _protocols [2]
 
struct lws_context_creation_info _info
 
ClientMap _clients
 
std::thread _service_thread
 
bool _running
 

Detailed Description

Definition at line 43 of file mcp_http_server.h.

Member Typedef Documentation

◆ ClientMap

typedef std::unordered_map<struct lws*, ClientContext> ArdourSurface::MCPHttpServer::ClientMap
private

Definition at line 62 of file mcp_http_server.h.

Constructor & Destructor Documentation

◆ MCPHttpServer()

ArdourSurface::MCPHttpServer::MCPHttpServer ( ARDOUR::Session ,
uint16_t  port,
int  debug_level,
PBD::EventLoop event_loop 
)

◆ ~MCPHttpServer()

ArdourSurface::MCPHttpServer::~MCPHttpServer ( )

Member Function Documentation

◆ callback()

int ArdourSurface::MCPHttpServer::callback ( struct lws *  ,
enum  lws_callback_reasons,
void *  ,
void *  ,
size_t   
)
private

◆ client()

ClientContext& ArdourSurface::MCPHttpServer::client ( struct lws *  )
private

◆ debug_level()

int ArdourSurface::MCPHttpServer::debug_level ( ) const

◆ dispatch_jsonrpc()

std::string ArdourSurface::MCPHttpServer::dispatch_jsonrpc ( const std::string &  ) const
private

◆ erase_client()

void ArdourSurface::MCPHttpServer::erase_client ( struct lws *  )
private

◆ handle_http()

int ArdourSurface::MCPHttpServer::handle_http ( struct lws *  ,
ClientContext  
)
private

◆ handle_http_body()

int ArdourSurface::MCPHttpServer::handle_http_body ( struct lws *  ,
ClientContext ,
void *  ,
size_t   
)
private

◆ handle_http_body_completion()

int ArdourSurface::MCPHttpServer::handle_http_body_completion ( struct lws *  ,
ClientContext  
)
private

◆ handle_http_writeable()

int ArdourSurface::MCPHttpServer::handle_http_writeable ( struct lws *  ,
ClientContext  
)
private

◆ lws_callback()

static int ArdourSurface::MCPHttpServer::lws_callback ( struct lws *  ,
enum  lws_callback_reasons,
void *  ,
void *  ,
size_t   
)
staticprivate

◆ run()

void ArdourSurface::MCPHttpServer::run ( )
private

◆ send_http_status()

int ArdourSurface::MCPHttpServer::send_http_status ( struct lws *  ,
unsigned int   
)
private

◆ send_json_headers()

int ArdourSurface::MCPHttpServer::send_json_headers ( struct lws *  )
private

◆ set_debug_level()

void ArdourSurface::MCPHttpServer::set_debug_level ( int  )

◆ start()

int ArdourSurface::MCPHttpServer::start ( )

◆ stop()

int ArdourSurface::MCPHttpServer::stop ( )

◆ write_json_response()

int ArdourSurface::MCPHttpServer::write_json_response ( struct lws *  ,
ClientContext  
)
private

Member Data Documentation

◆ _clients

ClientMap ArdourSurface::MCPHttpServer::_clients
private

Definition at line 71 of file mcp_http_server.h.

◆ _context

struct lws_context* ArdourSurface::MCPHttpServer::_context
private

Definition at line 68 of file mcp_http_server.h.

◆ _debug_level

std::atomic<int> ArdourSurface::MCPHttpServer::_debug_level
private

Definition at line 66 of file mcp_http_server.h.

◆ _event_loop

PBD::EventLoop* ArdourSurface::MCPHttpServer::_event_loop
private

Definition at line 67 of file mcp_http_server.h.

◆ _info

struct lws_context_creation_info ArdourSurface::MCPHttpServer::_info
private

Definition at line 68 of file mcp_http_server.h.

◆ _port

uint16_t ArdourSurface::MCPHttpServer::_port
private

Definition at line 65 of file mcp_http_server.h.

◆ _protocols

struct lws_protocols ArdourSurface::MCPHttpServer::_protocols[2]
private

Definition at line 68 of file mcp_http_server.h.

◆ _running

bool ArdourSurface::MCPHttpServer::_running
private

Definition at line 73 of file mcp_http_server.h.

◆ _service_thread

std::thread ArdourSurface::MCPHttpServer::_service_thread
private

Definition at line 72 of file mcp_http_server.h.

◆ _session

ARDOUR::Session& ArdourSurface::MCPHttpServer::_session
private

Definition at line 64 of file mcp_http_server.h.


The documentation for this class was generated from the following file: