1#ifndef MPDSERVER_H2#define MPDSERVER_H34#include <stdbool.h>56#include <sys/types.h>78typedef enum {9 MPD_VAL_INT,10 MPD_VAL_UINT,11 MPD_VAL_STR,12 MPD_VAL_FLOAT,13 MPD_VAL_BOOL,14 MPD_VAL_RANGE,15 MPD_VAL_EXPR,16 MPD_VAL_CMD,1718 MPD_VAL_EXPR_STR, /* only used internally */19} mpd_val_t;2021typedef enum {22 MPD_OP_NONE, /* base, modified-since, AND and NOT */23 MPD_OP_EQUAL, /* == */24 MPD_OP_NEQUAL, /* != */25 MPD_OP_CONTAINS, /* contains (tag only) */26 MPD_OP_MATCH, /* =~ */27 MPD_OP_NMATCH, /* !~ (tag only) */28} mpd_operation_t;2930typedef struct _mpd_argument_t mpd_argument_t;3132typedef struct {33 char *name;34 size_t argc;35 mpd_argument_t **argv;36} mpd_command_t;3738typedef struct _mpd_expression_t mpd_expression_t;3940/* This data structure is a bit clumsy and might change in the future */41struct _mpd_expression_t {42 char *name;43 mpd_operation_t op;4445 union {46 char *str;47 mpd_expression_t *expr;48 } o1;49 mpd_expression_t *next; /* only used by AND */50};5152typedef struct {53 size_t start;54 ssize_t end; /* -1 if end is omitted */55} mpd_range_t;5657struct _mpd_argument_t {58 mpd_val_t type;59 union {60 int ival;61 unsigned int uval;62 char *sval;63 float fval;64 bool bval;65 mpd_range_t rval;66 mpd_expression_t *eval;67 mpd_command_t *cmdval;68 } v;69};7071/* When reading mpd_parse() input from a stream it is insufficient to72 * simply read a single line since lists are mulitline commands. */7374mpd_command_t *mpd_parse(char *);75void mpd_free_command(mpd_command_t *);7677#endif