myMPD
Internal API documentation
Loading...
Searching...
No Matches
mg_user_data.c File Reference

Webserver utility functions. More...

#include "compile_time.h"
#include "src/webserver/mg_user_data.h"
#include "dist/mongoose/mongoose.h"
#include "src/lib/config/cert.h"
#include "src/lib/mem.h"
#include "src/lib/sds/sds_extras.h"
#include "src/lib/sds/sds_file.h"
Include dependency graph for mg_user_data.c:

Functions

static void add_file (struct t_mg_user_data *mg_user_data, const char *uri, const char *mimetype, bool compressed, bool cache, const unsigned char *data, unsigned size)
static bool read_certs (struct t_mg_user_data *mg_user_data, struct t_config *config)
struct t_mg_user_datawebserver_init_mg_user_data (struct t_config *config)
void mg_user_data_free (struct t_mg_user_data *mg_user_data)
void mg_user_data_free_void (void *mg_user_data)

Detailed Description

Webserver utility functions.

Function Documentation

◆ add_file()

void add_file ( struct t_mg_user_data * mg_user_data,
const char * uri,
const char * mimetype,
bool compressed,
bool cache,
const unsigned char * data,
unsigned size )
static

Private functions Adds a file to the

Parameters
mg_user_data
uri
mimetype
compressed
cache
data
size

◆ mg_user_data_free()

void mg_user_data_free ( struct t_mg_user_data * mg_user_data)

Frees the members of mg_user_data struct and the struct itself

Parameters
mg_user_datapointer to mg_user_data struct

◆ mg_user_data_free_void()

void mg_user_data_free_void ( void * mg_user_data)

Frees the members of mg_user_data struct and the struct itself

Parameters
mg_user_datapointer to mg_user_data struct

◆ read_certs()

bool read_certs ( struct t_mg_user_data * mg_user_data,
struct t_config * config )
static

Reads the ssl key and certificate from disc

Parameters
mg_user_datapointer to mongoose user data
configpointer to myMPD config
Returns
true on success, else false

◆ webserver_init_mg_user_data()

struct t_mg_user_data * webserver_init_mg_user_data ( struct t_config * config)

Mallocs and initializes the mg_user_data struct for the webserver

Parameters
configpointer to myMPD config
Returns
struct t_mg_user_data* or NULL on error