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

String validation functions. More...

#include "dist/sds/sds.h"
#include <stdbool.h>
Include dependency graph for validate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef bool(* validate_callback) (sds)

Functions

bool validate_json_object (sds data)
bool validate_json_array (sds data)
bool vcb_isalnum (sds data)
bool vcb_isdigit (sds data)
bool vcb_isprint (sds data)
bool vcb_ishexcolor (sds data)
bool vcb_isname (sds data)
bool vcb_isstickername (sds data)
bool vcb_istext (sds data)
bool vcb_isfilename_silent (sds data)
bool vcb_isfilename (sds data)
bool vcb_isfilepath (sds data)
bool vcb_ispathfilename (sds data)
bool vcb_isuri (sds data)
bool vcb_isstreamuri (sds data)
bool vcb_isfield (sds data)
bool vcb_istaglist (sds data)
bool vcb_ismpdtag (sds data)
bool vcb_ismpdtag_or_any (sds data)
bool vcb_ismpdstickertype (sds data)
bool vcb_ismpdsort (sds data)
bool vcb_isplaylistsort (sds data)
bool vcb_iswebradiosort (sds data)
bool vcb_issearchexpression_song (sds data)
bool vcb_issearchexpression_webradio (sds data)
bool vcb_issearchexpression_mympd (sds data)
bool vcb_isstickersort (sds data)
bool vcb_isstickerop (sds data)
bool vcb_ismpd_sticker_sort (sds data)
bool check_dir_traversal (const char *str)
bool path_in_folder (const char *parent, const char *child)

Detailed Description

String validation functions.

Typedef Documentation

◆ validate_callback

typedef bool(* validate_callback) (sds)

Definition for the validation callback used by the jsonrpc functions

Function Documentation

◆ check_dir_traversal()

bool check_dir_traversal ( const char * str)

Checks for dir traversal attempts in string

Parameters
strstring to check
Returns
true if filepath is sane, else false

◆ path_in_folder()

bool path_in_folder ( const char * parent,
const char * child )

Checks if a child path is within a parent folder

Parameters
parentparent folder path
childchild path to check
Returns
true if child is within parent, else false

◆ validate_json_array()

bool validate_json_array ( sds data)

Checks if string is a json array

Parameters
datasds string to check
Returns
true on success else false

◆ validate_json_object()

bool validate_json_object ( sds data)

Public functions Checks if string is a json object

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isalnum()

bool vcb_isalnum ( sds data)

Checks if string is alphanumeric, including chars "_-"

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isdigit()

bool vcb_isdigit ( sds data)

Checks if string is a number

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isfield()

bool vcb_isfield ( sds data)

Checks if string is a valid column name

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isfilename()

bool vcb_isfilename ( sds data)

Checks if string is a valid filename

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isfilename_silent()

bool vcb_isfilename_silent ( sds data)

Checks if string is a valid filename Does not emit a warning

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isfilepath()

bool vcb_isfilepath ( sds data)

Checks if string is a valid filename with path or path only

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_ishexcolor()

bool vcb_ishexcolor ( sds data)

Checks if string is a hexcolor starting with #

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_ismpd_sticker_sort()

bool vcb_ismpd_sticker_sort ( sds data)

Checks if string is valid sticker or mpd sort type

Parameters
datasds string to check
Returns
bool true on success else false

◆ vcb_ismpdsort()

bool vcb_ismpdsort ( sds data)

Checks if string is a valid sort tag for mpd

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_ismpdstickertype()

bool vcb_ismpdstickertype ( sds data)

Checks if string is a valid MPD sticker type

Parameters
datasds string to check
Returns
true on success, else false

◆ vcb_ismpdtag()

bool vcb_ismpdtag ( sds data)

Checks if string is a valid MPD tag

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_ismpdtag_or_any()

bool vcb_ismpdtag_or_any ( sds data)

Checks if string is a valid MPD tag or special value "any"

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isname()

bool vcb_isname ( sds data)

Checks if string contains invalid chars Invalid chars are "\a\b\f\n\r\t\v"

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_ispathfilename()

bool vcb_ispathfilename ( sds data)

Checks if string is a valid path + filename

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isplaylistsort()

bool vcb_isplaylistsort ( sds data)

Checks if string is a valid sort tag for mpd

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isprint()

bool vcb_isprint ( sds data)

Checks if string is printable

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_issearchexpression_mympd()

bool vcb_issearchexpression_mympd ( sds data)

Checks if string is a valid song search expression supported by myMPD

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_issearchexpression_song()

bool vcb_issearchexpression_song ( sds data)

Checks if string is a valid song search expression

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_issearchexpression_webradio()

bool vcb_issearchexpression_webradio ( sds data)

Checks if string is a valid song search expression

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isstickername()

bool vcb_isstickername ( sds data)

Checks if string is a valid sticker name

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isstickerop()

bool vcb_isstickerop ( sds data)

Checks if string is a compare operator

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isstickersort()

bool vcb_isstickersort ( sds data)

Checks if string is a valid sticker sort type

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isstreamuri()

bool vcb_isstreamuri ( sds data)

Checks if string is a valid stream uri

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_istaglist()

bool vcb_istaglist ( sds data)

Checks if string is a valid comma separated list of tags

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_istext()

bool vcb_istext ( sds data)

Checks if string contains invalid chars Invalid chars are "\a\b\f\r\v"

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_isuri()

bool vcb_isuri ( sds data)

Checks if string is a valid uri or filepath

Parameters
datasds string to check
Returns
true on success else false

◆ vcb_iswebradiosort()

bool vcb_iswebradiosort ( sds data)

Checks if string is a valid sort tag for webradios

Parameters
datasds string to check
Returns
true on success else false