Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
422a942c
Commit
422a942c
authored
Aug 18, 2005
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix consistency of some function names
Improve documentation Enable build of modules documentation
parent
562e25d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
62 deletions
+69
-62
doc/Doxyfile
doc/Doxyfile
+1
-1
modules/control/http/http.h
modules/control/http/http.h
+33
-25
modules/control/http/macro.c
modules/control/http/macro.c
+31
-31
modules/control/http/util.c
modules/control/http/util.c
+4
-5
No files found.
doc/Doxyfile
View file @
422a942c
...
...
@@ -316,7 +316,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ../src ../include
INPUT = ../src ../include
../modules
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
...
...
modules/control/http/http.h
View file @
422a942c
...
...
@@ -100,7 +100,7 @@
/** 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 */
...
...
@@ -115,18 +115,18 @@ char *E_(ToUTF8)( intf_thread_t *p_intf, char *psz_local );
/** 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_
(
Handle
Seek
)(
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_v
alue
)(
char
*
psz_uri
,
const
char
*
psz_name
,
char
*
E_
(
ExtractURIV
alue
)(
char
*
psz_uri
,
const
char
*
psz_name
,
char
*
psz_value
,
int
i_value_max
);
/** \todo Describe this function */
int
E_
(
uri_test_p
aram
)(
char
*
psz_uri
,
const
char
*
psz_name
);
int
E_
(
TestURIP
aram
)(
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
);
...
...
@@ -142,22 +142,25 @@ char *E_(FirstWord)( char *psz, char *new );
/** \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
;
...
...
@@ -187,8 +190,11 @@ void mvar_AppendNewVar( mvar_t *vars, const char *name,
const
char
*
value
);
/** @} */
/** \defgroup http_sets Set
variable
s *
/** \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, ...)
* @{
*/
...
...
@@ -198,26 +204,26 @@ mvar_t *mvar_IntegerSetNew( const char *name, const char *arg );
/** 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
);
/**@}*/
...
...
@@ -267,20 +273,22 @@ int SSPopN ( rpn_stack_t *, mvar_t * );
/** \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 */
...
...
modules/control/http/macro.c
View file @
422a942c
...
...
@@ -173,7 +173,7 @@ void MacroDo( httpd_file_sys_t *p_args,
{
break
;
}
E_
(
uri_extract_v
alue
)(
p_request
,
"control"
,
control
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"control"
,
control
,
512
);
if
(
*
m
->
param1
&&
!
strstr
(
m
->
param1
,
control
)
)
{
msg_Warn
(
p_intf
,
"unauthorized control=%s"
,
control
);
...
...
@@ -186,7 +186,7 @@ void MacroDo( httpd_file_sys_t *p_args,
int
i_item
;
char
item
[
512
];
E_
(
uri_extract_v
alue
)(
p_request
,
"item"
,
item
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"item"
,
item
,
512
);
i_item
=
atoi
(
item
);
playlist_Control
(
p_sys
->
p_playlist
,
PLAYLIST_ITEMPLAY
,
playlist_ItemGetById
(
p_sys
->
p_playlist
,
...
...
@@ -228,9 +228,9 @@ void MacroDo( httpd_file_sys_t *p_args,
case
MVLC_SEEK
:
{
char
value
[
30
];
E_
(
uri_extract_v
alue
)(
p_request
,
"seek_value"
,
value
,
30
);
E_
(
uri_decode_url_encoded
)(
value
);
E_
(
Seek
)(
p_intf
,
value
);
E_
(
ExtractURIV
alue
)(
p_request
,
"seek_value"
,
value
,
30
);
E_
(
DecodeEncodedURI
)(
value
);
E_
(
Handle
Seek
)(
p_intf
,
value
);
break
;
}
case
MVLC_VOLUME
:
...
...
@@ -239,9 +239,9 @@ void MacroDo( httpd_file_sys_t *p_args,
audio_volume_t
i_volume
;
int
i_value
;
E_
(
uri_extract_v
alue
)(
p_request
,
"value"
,
vol
,
8
);
E_
(
ExtractURIV
alue
)(
p_request
,
"value"
,
vol
,
8
);
aout_VolumeGet
(
p_intf
,
&
i_volume
);
E_
(
uri_decode_url_encoded
)(
vol
);
E_
(
DecodeEncodedURI
)(
vol
);
if
(
vol
[
0
]
==
'+'
)
{
...
...
@@ -297,10 +297,10 @@ void MacroDo( httpd_file_sys_t *p_args,
char
mrl
[
1024
],
psz_name
[
1024
];
playlist_item_t
*
p_item
;
E_
(
uri_extract_v
alue
)(
p_request
,
"mrl"
,
mrl
,
1024
);
E_
(
uri_decode_url_encoded
)(
mrl
);
E_
(
uri_extract_v
alue
)(
p_request
,
"name"
,
psz_name
,
1024
);
E_
(
uri_decode_url_encoded
)(
psz_name
);
E_
(
ExtractURIV
alue
)(
p_request
,
"mrl"
,
mrl
,
1024
);
E_
(
DecodeEncodedURI
)(
mrl
);
E_
(
ExtractURIV
alue
)(
p_request
,
"name"
,
psz_name
,
1024
);
E_
(
DecodeEncodedURI
)(
psz_name
);
if
(
!*
psz_name
)
{
memcpy
(
psz_name
,
mrl
,
1024
);
...
...
@@ -328,7 +328,7 @@ void MacroDo( httpd_file_sys_t *p_args,
/* Get the list of items to delete */
while
(
(
p_parser
=
E_
(
uri_extract_v
alue
)(
p_parser
,
"item"
,
item
,
512
))
)
E_
(
ExtractURIV
alue
)(
p_parser
,
"item"
,
item
,
512
))
)
{
if
(
!*
item
)
continue
;
...
...
@@ -362,7 +362,7 @@ void MacroDo( httpd_file_sys_t *p_args,
/* Get the list of items to keep */
while
(
(
p_parser
=
E_
(
uri_extract_v
alue
)(
p_parser
,
"item"
,
item
,
512
))
)
E_
(
ExtractURIV
alue
)(
p_parser
,
"item"
,
item
,
512
))
)
{
if
(
!*
item
)
continue
;
...
...
@@ -406,9 +406,9 @@ void MacroDo( httpd_file_sys_t *p_args,
int
i_order
;
int
i_item
;
E_
(
uri_extract_v
alue
)(
p_request
,
"type"
,
type
,
12
);
E_
(
uri_extract_v
alue
)(
p_request
,
"order"
,
order
,
2
);
E_
(
uri_extract_v
alue
)(
p_request
,
"item"
,
item
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"type"
,
type
,
12
);
E_
(
ExtractURIV
alue
)(
p_request
,
"order"
,
order
,
2
);
E_
(
ExtractURIV
alue
)(
p_request
,
"item"
,
item
,
512
);
i_item
=
atoi
(
item
);
if
(
order
[
0
]
==
'0'
)
i_order
=
ORDER_NORMAL
;
...
...
@@ -447,8 +447,8 @@ void MacroDo( httpd_file_sys_t *p_args,
char
psz_newpos
[
6
];
int
i_pos
;
int
i_newpos
;
E_
(
uri_extract_v
alue
)(
p_request
,
"psz_pos"
,
psz_pos
,
6
);
E_
(
uri_extract_v
alue
)(
p_request
,
"psz_newpos"
,
psz_newpos
,
6
);
E_
(
ExtractURIV
alue
)(
p_request
,
"psz_pos"
,
psz_pos
,
6
);
E_
(
ExtractURIV
alue
)(
p_request
,
"psz_newpos"
,
psz_newpos
,
6
);
i_pos
=
atoi
(
psz_pos
);
i_newpos
=
atoi
(
psz_newpos
);
if
(
i_pos
<
i_newpos
)
...
...
@@ -467,7 +467,7 @@ void MacroDo( httpd_file_sys_t *p_args,
case
MVLC_CLOSE
:
{
char
id
[
512
];
E_
(
uri_extract_v
alue
)(
p_request
,
"id"
,
id
,
512
);
E_
(
ExtractURIV
alue
)(
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 ) )
...
...
@@ -506,11 +506,11 @@ void MacroDo( httpd_file_sys_t *p_args,
if
(
p_intf
->
p_sys
->
p_vlm
==
NULL
)
break
;
E_
(
uri_extract_v
alue
)(
p_request
,
"name"
,
name
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"name"
,
name
,
512
);
if
(
StrToMacroType
(
control
)
==
MVLC_VLM_NEW
)
{
char
type
[
20
];
E_
(
uri_extract_v
alue
)(
p_request
,
"type"
,
type
,
20
);
E_
(
ExtractURIV
alue
)(
p_request
,
"type"
,
type
,
20
);
p
+=
sprintf
(
psz
,
"new %s %s"
,
name
,
type
);
}
else
...
...
@@ -521,14 +521,14 @@ void MacroDo( httpd_file_sys_t *p_args,
for
(
i
=
0
;
i
<
11
;
i
++
)
{
char
val
[
512
];
E_
(
uri_extract_v
alue
)(
p_request
,
E_
(
ExtractURIV
alue
)(
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_p
aram
)(
p_request
,
vlm_properties
[
i
]
)
&&
i
<
4
)
else
if
(
E_
(
TestURIP
aram
)(
p_request
,
vlm_properties
[
i
]
)
&&
i
<
4
)
{
p
+=
sprintf
(
p
,
" %s"
,
vlm_properties
[
i
]
);
}
...
...
@@ -565,7 +565,7 @@ void MacroDo( httpd_file_sys_t *p_args,
if
(
p_intf
->
p_sys
->
p_vlm
==
NULL
)
break
;
E_
(
uri_extract_v
alue
)(
p_request
,
"name"
,
name
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"name"
,
name
,
512
);
sprintf
(
psz
,
"del %s"
,
name
);
vlm_ExecuteCommand
(
p_intf
->
p_sys
->
p_vlm
,
psz
,
&
vlm_answer
);
...
...
@@ -587,7 +587,7 @@ void MacroDo( httpd_file_sys_t *p_args,
if
(
p_intf
->
p_sys
->
p_vlm
==
NULL
)
break
;
E_
(
uri_extract_v
alue
)(
p_request
,
"name"
,
name
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"name"
,
name
,
512
);
if
(
StrToMacroType
(
control
)
==
MVLC_VLM_PLAY
)
sprintf
(
psz
,
"control %s play"
,
name
);
else
if
(
StrToMacroType
(
control
)
==
MVLC_VLM_PAUSE
)
...
...
@@ -597,7 +597,7 @@ void MacroDo( httpd_file_sys_t *p_args,
else
if
(
StrToMacroType
(
control
)
==
MVLC_VLM_SEEK
)
{
char
percent
[
20
];
E_
(
uri_extract_v
alue
)(
p_request
,
"percent"
,
percent
,
512
);
E_
(
ExtractURIV
alue
)(
p_request
,
"percent"
,
percent
,
512
);
sprintf
(
psz
,
"control %s seek %s"
,
name
,
percent
);
}
...
...
@@ -618,8 +618,8 @@ void MacroDo( httpd_file_sys_t *p_args,
if
(
p_intf
->
p_sys
->
p_vlm
==
NULL
)
break
;
E_
(
uri_extract_v
alue
)(
p_request
,
"file"
,
file
,
512
);
E_
(
uri_decode_url_encoded
)(
file
);
E_
(
ExtractURIV
alue
)(
p_request
,
"file"
,
file
,
512
);
E_
(
DecodeEncodedURI
)(
file
);
if
(
StrToMacroType
(
control
)
==
MVLC_VLM_LOAD
)
sprintf
(
psz
,
"load %s"
,
file
);
...
...
@@ -653,8 +653,8 @@ void MacroDo( httpd_file_sys_t *p_args,
{
break
;
}
E_
(
uri_extract_v
alue
)(
p_request
,
m
->
param1
,
value
,
512
);
E_
(
uri_decode_url_encoded
)(
value
);
E_
(
ExtractURIV
alue
)(
p_request
,
m
->
param1
,
value
,
512
);
E_
(
DecodeEncodedURI
)(
value
);
switch
(
StrToMacroType
(
m
->
param2
)
)
{
...
...
modules/control/http/util.c
View file @
422a942c
...
...
@@ -417,8 +417,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
/****************************************************************************
* Seek command parsing handling
****************************************************************************/
void
E_
(
Seek
)(
intf_thread_t
*
p_intf
,
char
*
p_value
)
void
E_
(
HandleSeek
)(
intf_thread_t
*
p_intf
,
char
*
p_value
)
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
vlc_value_t
val
;
...
...
@@ -600,7 +599,7 @@ void E_(Seek)( intf_thread_t *p_intf, char *p_value )
/****************************************************************************
* URI Parsing functions
****************************************************************************/
int
E_
(
uri_test_p
aram
)(
char
*
psz_uri
,
const
char
*
psz_name
)
int
E_
(
TestURIP
aram
)(
char
*
psz_uri
,
const
char
*
psz_name
)
{
char
*
p
=
psz_uri
;
...
...
@@ -617,7 +616,7 @@ int E_(uri_test_param)( char *psz_uri, const char *psz_name )
return
VLC_FALSE
;
}
char
*
E_
(
uri_extract_v
alue
)(
char
*
psz_uri
,
const
char
*
psz_name
,
char
*
E_
(
ExtractURIV
alue
)(
char
*
psz_uri
,
const
char
*
psz_name
,
char
*
psz_value
,
int
i_value_max
)
{
char
*
p
=
psz_uri
;
...
...
@@ -675,7 +674,7 @@ char *E_(uri_extract_value)( char *psz_uri, const char *psz_name,
return
p
;
}
void
E_
(
uri_decode_url_encoded
)(
char
*
psz
)
void
E_
(
DecodeEncodedURI
)(
char
*
psz
)
{
char
*
dup
=
strdup
(
psz
);
char
*
p
=
dup
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment