myMPD
Internal API documentation
Loading...
Searching...
No Matches
util.h File Reference

Script thread utility functions. More...

#include "dist/rax/rax.h"
#include "dist/sds/sds.h"
#include "src/lib/list.h"
#include "src/scripts/events.h"
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  t_scripts_state
 
struct  t_script_list_data
 
struct  t_script_thread_arg
 

Functions

void list_free_cb_script_list_user_data (struct t_list_node *current)
 
void scripts_state_save (struct t_scripts_state *scripts_state, bool free_data)
 
void scripts_state_default (struct t_scripts_state *scripts_state, struct t_config *config)
 
void scripts_state_free (struct t_scripts_state *scripts_state)
 
void send_script_raw_response (unsigned long conn_id, const char *partition, sds data)
 
void send_script_raw_error (unsigned long conn_id, const char *partition, const char *data)
 
sds script_get_result (lua_State *lua_vm, int rc)
 
void free_t_script_thread_arg (struct t_script_thread_arg *script_thread_arg)
 

Detailed Description

Script thread utility functions.

Function Documentation

◆ free_t_script_thread_arg()

void free_t_script_thread_arg ( struct t_script_thread_arg script_thread_arg)

Frees the t_script_thread_arg struct

Parameters
script_thread_argpointer to the struct to free

◆ list_free_cb_script_list_user_data()

void list_free_cb_script_list_user_data ( struct t_list_node current)

Callback function to free script_list user_data.

Parameters
currentlist node

◆ script_get_result()

sds script_get_result ( lua_State *  lua_vm,
int  rc 
)

Gets the result from script loading or execution

Parameters
lua_vmlua instance
rcreturn code
Returns
newly allocated sds string with script return value or error string

◆ scripts_state_default()

void scripts_state_default ( struct t_scripts_state scripts_state,
struct t_config config 
)

Sets scripts_state defaults.

Parameters
scripts_statepointer to central scripts state
configpointer to static config

◆ scripts_state_free()

void scripts_state_free ( struct t_scripts_state scripts_state)

Frees the scripts_state.

Parameters
scripts_statepointer to central scripts state

◆ scripts_state_save()

void scripts_state_save ( struct t_scripts_state scripts_state,
bool  free_data 
)

Saves in-memory states to disc. This is done on shutdown and on SIGHUP.

Parameters
scripts_statepointer to central scripts state
free_datatrue=free the struct, else not

◆ send_script_raw_error()

void send_script_raw_error ( unsigned long  conn_id,
const char *  partition,
const char *  data 
)

Sends the scripts raw error to the webserver queue

Parameters
conn_idmongoose connection id
partitionMPD partition
dataraw http response to send

◆ send_script_raw_response()

void send_script_raw_response ( unsigned long  conn_id,
const char *  partition,
sds  data 
)

Sends the scripts raw response to the webserver queue

Parameters
conn_idmongoose connection id
partitionMPD partition
dataraw http response to send