/** This function recursively parses a directory and adds all files */
int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root,
- char *psz_dir );
+ char *psz_dir );
/** This function loads a file into a buffer */
int E_(FileLoad)( FILE *f, char **pp_data, int *pi_data );
/** This function creates a suitable URL for a filename */
/** This command parses the "seek" command for the HTTP interface
* and performs the requested action */
-void E_(Seek)( intf_thread_t *p_intf, char *p_value );
+void E_(HandleSeek)( intf_thread_t *p_intf, char *p_value );
/* URI Handling functions */
/** This function extracts the value for a given argument name
* from an HTTP request */
-char *E_(uri_extract_value)( char *psz_uri, const char *psz_name,
+char *E_(ExtractURIValue)( char *psz_uri, const char *psz_name,
char *psz_value, int i_value_max );
/** \todo Describe this function */
-int E_(uri_test_param)( char *psz_uri, const char *psz_name );
+int E_(TestURIParam)( char *psz_uri, const char *psz_name );
/** This function extracts the original value from an URL-encoded string */
-void E_(uri_decode_url_encoded)( char *psz );
+void E_(DecodeEncodedURI)( char *psz );
/** This function parses a MRL */
playlist_item_t *E_(MRLParse)( intf_thread_t *, char *psz, char *psz_name );
/** \defgroup http_vars Macro variables
* \ingroup http_intf
- * These variables are used in macros
+ * These variables can be used in the <vlc> macros and in the RPN evaluator.
+ * The variables make a tree: each variable can have an arbitrary
+ * number of "children" variables.
+ * A number of helper functions are provided to manipulate the main variable
+ * structure
* @{
*/
/**
* \struct mvar_t
- * This structure defines a macro variable as used by the HTTP interface.
- * These variables can be used in the <vlc> macros
+ * This structure defines a macro variable
*/
typedef struct mvar_s
{
- char *name;
- char *value;
+ char *name; ///< Variable name
+ char *value; ///< Variable value
- int i_field;
- struct mvar_s **field;
+ int i_field; ///< Number of children variables
+ struct mvar_s **field; ///< Children variables array
} mvar_t;
const char *value );
/** @} */
-/** \defgroup http_sets Set variables *
+/** \defgroup http_sets Sets *
* \ingroup http_intf
+ * Sets are an application of the macro variables. There are a number of
+ * predefined functions that will give you variables whose children represent
+ * VLC internal data (playlist, stream info, ...)
* @{
*/
/** This function creates a set variable with the contents of the playlist */
mvar_t *mvar_PlaylistSetNew( intf_thread_t *p_intf, char *name,
- playlist_t *p_pl );
+ playlist_t *p_pl );
/** This function creates a set variable with the contents of the Stream
* and media info box */
mvar_t *mvar_InfoSetNew( intf_thread_t *p_intf, char *name,
- input_thread_t *p_input );
+ input_thread_t *p_input );
/** This function creates a set variable with the input parameters */
mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name,
- input_thread_t *p_input,
- const char *psz_variable );
+ input_thread_t *p_input,
+ const char *psz_variable );
/** This function creates a set variable representing the files of the psz_dir
* directory */
mvar_t *mvar_FileSetNew( intf_thread_t *p_intf, char *name,
- char *psz_dir );
+ char *psz_dir );
/** This function creates a set variable representing the VLM streams */
mvar_t *mvar_VlmSetNew( char *name, vlm_t *vlm );
/** This function converts the listing of a playlist node into a mvar set */
void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
- playlist_item_t *p_node, char *name, mvar_t *s,
- int i_depth );
+ playlist_item_t *p_node, char *name, mvar_t *s,
+ int i_depth );
/**@}*/
/** \defgroup http_macros <vlc> Macros Handling
* \ingroup http_intf
+ * A macro is a code snippet in the HTML page looking like
+ * <vlc id="macro_id" param1="value1" param2="value2">
+ * Macros string ids are mapped to macro types, and specific handling code
+ * must be written for each macro type
* @{
*/
/** \struct macro_t
* This structure represents a HTTP Interface macro.
- * A macro is a code snippet in the HTML page looking like
- * <vlc id="macro_id" param1="value1" param2="value2"
*/
typedef struct
{
- char *id;
- char *param1;
- char *param2;
+ char *id; ///< Macro ID string
+ char *param1; ///< First parameter
+ char *param2; ///< Second parameter
} macro_t;
/** This function creates a macro from a <vlc ....> tag */
{
break;
}
- E_(uri_extract_value)( p_request, "control", control, 512 );
+ E_(ExtractURIValue)( p_request, "control", control, 512 );
if( *m->param1 && !strstr( m->param1, control ) )
{
msg_Warn( p_intf, "unauthorized control=%s", control );
int i_item;
char item[512];
- E_(uri_extract_value)( p_request, "item", item, 512 );
+ E_(ExtractURIValue)( p_request, "item", item, 512 );
i_item = atoi( item );
playlist_Control( p_sys->p_playlist, PLAYLIST_ITEMPLAY,
playlist_ItemGetById( p_sys->p_playlist,
case MVLC_SEEK:
{
char value[30];
- E_(uri_extract_value)( p_request, "seek_value", value, 30 );
- E_(uri_decode_url_encoded)( value );
- E_(Seek)( p_intf, value );
+ E_(ExtractURIValue)( p_request, "seek_value", value, 30 );
+ E_(DecodeEncodedURI)( value );
+ E_(HandleSeek)( p_intf, value );
break;
}
case MVLC_VOLUME:
audio_volume_t i_volume;
int i_value;
- E_(uri_extract_value)( p_request, "value", vol, 8 );
+ E_(ExtractURIValue)( p_request, "value", vol, 8 );
aout_VolumeGet( p_intf, &i_volume );
- E_(uri_decode_url_encoded)( vol );
+ E_(DecodeEncodedURI)( vol );
if( vol[0] == '+' )
{
char mrl[1024], psz_name[1024];
playlist_item_t *p_item;
- E_(uri_extract_value)( p_request, "mrl", mrl, 1024 );
- E_(uri_decode_url_encoded)( mrl );
- E_(uri_extract_value)( p_request, "name", psz_name, 1024 );
- E_(uri_decode_url_encoded)( psz_name );
+ E_(ExtractURIValue)( p_request, "mrl", mrl, 1024 );
+ E_(DecodeEncodedURI)( mrl );
+ E_(ExtractURIValue)( p_request, "name", psz_name, 1024 );
+ E_(DecodeEncodedURI)( psz_name );
if( !*psz_name )
{
memcpy( psz_name, mrl, 1024 );
/* Get the list of items to delete */
while( (p_parser =
- E_(uri_extract_value)( p_parser, "item", item, 512 )) )
+ E_(ExtractURIValue)( p_parser, "item", item, 512 )) )
{
if( !*item ) continue;
/* Get the list of items to keep */
while( (p_parser =
- E_(uri_extract_value)( p_parser, "item", item, 512 )) )
+ E_(ExtractURIValue)( p_parser, "item", item, 512 )) )
{
if( !*item ) continue;
int i_order;
int i_item;
- E_(uri_extract_value)( p_request, "type", type, 12 );
- E_(uri_extract_value)( p_request, "order", order, 2 );
- E_(uri_extract_value)( p_request, "item", item, 512 );
+ E_(ExtractURIValue)( p_request, "type", type, 12 );
+ E_(ExtractURIValue)( p_request, "order", order, 2 );
+ E_(ExtractURIValue)( p_request, "item", item, 512 );
i_item = atoi( item );
if( order[0] == '0' ) i_order = ORDER_NORMAL;
char psz_newpos[6];
int i_pos;
int i_newpos;
- E_(uri_extract_value)( p_request, "psz_pos", psz_pos, 6 );
- E_(uri_extract_value)( p_request, "psz_newpos", psz_newpos, 6 );
+ E_(ExtractURIValue)( p_request, "psz_pos", psz_pos, 6 );
+ E_(ExtractURIValue)( p_request, "psz_newpos", psz_newpos, 6 );
i_pos = atoi( psz_pos );
i_newpos = atoi( psz_newpos );
if ( i_pos < i_newpos )
case MVLC_CLOSE:
{
char id[512];
- E_(uri_extract_value)( p_request, "id", id, 512 );
+ E_(ExtractURIValue)( p_request, "id", id, 512 );
msg_Dbg( p_intf, "requested close id=%s", id );
#if 0
if( p_sys->p_httpd->pf_control( p_sys->p_httpd, HTTPD_SET_CLOSE, id, NULL ) )
if( p_intf->p_sys->p_vlm == NULL ) break;
- E_(uri_extract_value)( p_request, "name", name, 512 );
+ E_(ExtractURIValue)( p_request, "name", name, 512 );
if( StrToMacroType( control ) == MVLC_VLM_NEW )
{
char type[20];
- E_(uri_extract_value)( p_request, "type", type, 20 );
+ E_(ExtractURIValue)( p_request, "type", type, 20 );
p += sprintf( psz, "new %s %s", name, type );
}
else
for( i = 0; i < 11; i++ )
{
char val[512];
- E_(uri_extract_value)( p_request,
+ E_(ExtractURIValue)( p_request,
vlm_properties[i], val, 512 );
- E_(uri_decode_url_encoded)( val );
+ E_(DecodeEncodedURI)( val );
if( strlen( val ) > 0 && i >= 4 )
{
p += sprintf( p, " %s %s", vlm_properties[i], val );
}
- else if( E_(uri_test_param)( p_request, vlm_properties[i] ) && i < 4 )
+ else if( E_(TestURIParam)( p_request, vlm_properties[i] ) && i < 4 )
{
p += sprintf( p, " %s", vlm_properties[i] );
}
if( p_intf->p_sys->p_vlm == NULL ) break;
- E_(uri_extract_value)( p_request, "name", name, 512 );
+ E_(ExtractURIValue)( p_request, "name", name, 512 );
sprintf( psz, "del %s", name );
vlm_ExecuteCommand( p_intf->p_sys->p_vlm, psz, &vlm_answer );
if( p_intf->p_sys->p_vlm == NULL ) break;
- E_(uri_extract_value)( p_request, "name", name, 512 );
+ E_(ExtractURIValue)( p_request, "name", name, 512 );
if( StrToMacroType( control ) == MVLC_VLM_PLAY )
sprintf( psz, "control %s play", name );
else if( StrToMacroType( control ) == MVLC_VLM_PAUSE )
else if( StrToMacroType( control ) == MVLC_VLM_SEEK )
{
char percent[20];
- E_(uri_extract_value)( p_request, "percent", percent, 512 );
+ E_(ExtractURIValue)( p_request, "percent", percent, 512 );
sprintf( psz, "control %s seek %s", name, percent );
}
if( p_intf->p_sys->p_vlm == NULL ) break;
- E_(uri_extract_value)( p_request, "file", file, 512 );
- E_(uri_decode_url_encoded)( file );
+ E_(ExtractURIValue)( p_request, "file", file, 512 );
+ E_(DecodeEncodedURI)( file );
if( StrToMacroType( control ) == MVLC_VLM_LOAD )
sprintf( psz, "load %s", file );
{
break;
}
- E_(uri_extract_value)( p_request, m->param1, value, 512 );
- E_(uri_decode_url_encoded)( value );
+ E_(ExtractURIValue)( p_request, m->param1, value, 512 );
+ E_(DecodeEncodedURI)( value );
switch( StrToMacroType( m->param2 ) )
{