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

Variables API functions. More...

#include "compile_time.h"
#include "src/scripts/api_tmp.h"
#include "src/lib/json/json_print.h"
#include "src/lib/json/json_rpc.h"
#include "src/lib/mem.h"
#include "src/lib/sds_extras.h"
#include "src/scripts/util.h"
#include <errno.h>
#include <time.h>
Include dependency graph for api_tmp.c:

Functions

void scripts_tmp_delete (rax *scripts_tmp_list, sds key)
 
bool scripts_tmp_set (rax *scripts_tmp_list, sds key, sds value, int lifetime)
 
sds scripts_tmp_get (rax *scripts_tmp_list, sds buffer, unsigned request_id, sds key)
 
sds scripts_tmp_list (rax *scripts_tmp_list, sds buffer, unsigned request_id)
 
void script_tmp_list_should_expire (struct t_scripts_state *scripts_state)
 
void scripts_tmp_list_expire (rax *scripts_tmp_list, bool cleanup)
 

Detailed Description

Variables API functions.

Function Documentation

◆ script_tmp_list_should_expire()

void script_tmp_list_should_expire ( struct t_scripts_state scripts_state)

Checks if the tmp var list should be expired

Parameters
scripts_statePointer to scripts_state

◆ scripts_tmp_delete()

void scripts_tmp_delete ( rax *  scripts_tmp_list,
sds  key 
)

Deletes a tmp variable in the tree, ignores not existing keys

Parameters
scripts_tmp_listpointer to script tmp list
keykey to remove

◆ scripts_tmp_get()

sds scripts_tmp_get ( rax *  scripts_tmp_list,
sds  buffer,
unsigned  request_id,
sds  key 
)

Returns a jsonrpc response with the value of a tmp variable or an empty string if not found

Parameters
scripts_tmp_listpointer to script tmp list
bufferbuffer to append the response
request_idjsonrpc request id
keyKey to get
Returns
pointer to buffer

◆ scripts_tmp_list()

sds scripts_tmp_list ( rax *  scripts_tmp_list,
sds  buffer,
unsigned  request_id 
)

Returns a jsonrpc response with all script tmp variables

Parameters
scripts_tmp_listpointer to script tmp list
bufferbuffer to append the response
request_idjsonrpc request id
Returns
pointer to buffer

◆ scripts_tmp_list_expire()

void scripts_tmp_list_expire ( rax *  scripts_tmp_list,
bool  cleanup 
)

Expires the script tmp var list

Parameters
scripts_tmp_listPointer to script tmp list
cleanupExpire all entries and free the radix tree?

◆ scripts_tmp_set()

bool scripts_tmp_set ( rax *  scripts_tmp_list,
sds  key,
sds  value,
int  lifetime 
)

Adds/modifies a tmp variable in the tree

Parameters
scripts_tmp_listpointer to script tmp list
keyname of the variable
valuevalue of the variable
lifetimelifetime of the tmp variable
Returns
true on success, else false