|
myMPD
Internal API documentation
|
Webserver implementation. More...
#include "compile_time.h"#include "src/webserver/webserver.h"#include "src/lib/api.h"#include "src/lib/http_client.h"#include "src/lib/json/json_rpc.h"#include "src/lib/log.h"#include "src/lib/mem.h"#include "src/lib/msg_queue.h"#include "src/lib/sds_extras.h"#include "src/lib/signal.h"#include "src/lib/thread.h"#include "src/webserver/albumart.h"#include "src/webserver/folderart.h"#include "src/webserver/placeholder.h"#include "src/webserver/playlistart.h"#include "src/webserver/proxy.h"#include "src/webserver/request_handler.h"#include "src/webserver/response.h"#include "src/webserver/tagart.h"#include "src/webserver/websocket.h"#include <inttypes.h>#include <libgen.h>
Functions | |
| static void | read_queue (struct mg_mgr *mgr) |
| static bool | parse_internal_message (struct t_work_response *response, struct t_mg_user_data *mg_user_data) |
| static void | ev_handler (struct mg_connection *nc, int ev, void *ev_data) |
| static void | ev_handler_redirect (struct mg_connection *nc_http, int ev, void *ev_data) |
| static void | mongoose_log (char ch, void *param) |
| struct mg_mgr * | webserver_init_mgr (struct t_config *config, struct t_mg_user_data *mg_user_data) |
| void | webserver_free (struct mg_mgr *mgr) |
| void * | webserver_loop (void *arg_mgr) |
| static void | handle_wakeup (struct mg_connection *nc, struct mg_str *data) |
Webserver implementation.
|
static |
Central webserver event handler nc->label usage 0 - connection type: F = frontend connection, B = backend connection 1 - http method: G = GET, H = HEAD, P = POST 2 - connection header: C = close, K = keepalive
| nc | mongoose connection |
| ev | connection event |
| ev_data | event data (http / websocket message) |
|
static |
Redirects the client to https if ssl is enabled. Only requests to /browse/webradios are not redirected.
| nc | mongoose connection |
| ev | connection event |
| ev_data | event data (http / websocket message) |
|
static |
Handles the data from the MG_EV_WAKEUP event
| nc | Mongoose connection |
| data | Received data |
|
static |
Mongoose logging function
| ch | character to log |
| param |
|
static |
Sets the mg_user_data values from set_mg_user_data_request. Message is sent from the mympd_api thread.
| response | Response with the data to set |
| mg_user_data | t_mg_user_data to configure |
|
static |
Private definitions
Private functions Reads and processes all messages from the webserver queue. This function does not block and returns immediately if the queue is empty.
| mgr | pointer to mongoose mgr |
| void webserver_free | ( | struct mg_mgr * | mgr | ) |
Frees the mongoose mgr
| mgr | mongoose mgr to free |
| struct mg_mgr * webserver_init_mgr | ( | struct t_config * | config, |
| struct t_mg_user_data * | mg_user_data | ||
| ) |
Public functions Initializes the webserver
| config | pointer to myMPD config |
| mg_user_data | already allocated t_mg_user_data to populate |
| void * webserver_loop | ( | void * | arg_mgr | ) |
Main function for the webserver thread
| arg_mgr | void pointer to mongoose mgr |