Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
94
Issues
94
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
0d40f034
Commit
0d40f034
authored
Mar 09, 2003
by
Michael Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listing of current mountpoints in admin interface.
svn path=/trunk/icecast/; revision=4455
parent
eba22526
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
14 deletions
+62
-14
src/admin.c
src/admin.c
+62
-14
No files found.
src/admin.c
View file @
0d40f034
...
...
@@ -19,24 +19,31 @@
#define CATMODULE "admin"
#define COMMAND_ERROR (-1)
#define COMMAND_FALLBACK 1
#define COMMAND_RAW_STATS 2
#define COMMAND_METADATA_UPDATE 3
#define COMMAND_SHOW_LISTENERS 4
#define COMMAND_ERROR (-1)
/* Mount-specific commands */
#define COMMAND_FALLBACK 1
#define COMMAND_METADATA_UPDATE 2
#define COMMAND_SHOW_LISTENERS 3
/* Global commands */
#define COMMAND_LIST_MOUNTS 101
#define COMMAND_RAW_STATS 102
int
admin_get_command
(
char
*
command
)
{
if
(
!
strcmp
(
command
,
"fallbacks"
))
return
COMMAND_FALLBACK
;
else
if
(
!
strcmp
(
command
,
"rawstats"
))
return
COMMAND_RAW_STATS
;
else
if
(
!
strcmp
(
command
,
"stats.xml"
))
/* The old way */
return
COMMAND_RAW_STATS
;
else
if
(
!
strcmp
(
command
,
"metadata"
))
return
COMMAND_METADATA_UPDATE
;
else
if
(
!
strcmp
(
command
,
"listclients"
))
return
COMMAND_SHOW_LISTENERS
;
else
if
(
!
strcmp
(
command
,
"rawstats"
))
return
COMMAND_RAW_STATS
;
else
if
(
!
strcmp
(
command
,
"stats.xml"
))
/* The old way */
return
COMMAND_RAW_STATS
;
else
if
(
!
strcmp
(
command
,
"listmounts"
))
return
COMMAND_LIST_MOUNTS
;
else
return
COMMAND_ERROR
;
}
...
...
@@ -46,6 +53,7 @@ static void command_metadata(client_t *client, source_t *source);
static
void
command_show_listeners
(
client_t
*
client
,
source_t
*
source
);
static
void
command_raw_stats
(
client_t
*
client
);
static
void
command_list_mounts
(
client_t
*
client
);
static
void
admin_handle_mount_request
(
client_t
*
client
,
source_t
*
source
,
int
command
);
...
...
@@ -79,11 +87,13 @@ void admin_handle_request(client_t *client, char *uri)
source_t
*
source
;
/* This is a mount request, handle it as such */
if
(
!
connection_check_source_pass
(
client
->
parser
,
mount
))
{
INFO1
(
"Bad or missing password on mount modification admin "
"request (command: %s)"
,
command_string
);
client_send_401
(
client
);
return
;
if
(
!
connection_check_admin_pass
(
client
->
parser
))
{
if
(
!
connection_check_source_pass
(
client
->
parser
,
mount
))
{
INFO1
(
"Bad or missing password on mount modification admin "
"request (command: %s)"
,
command_string
);
client_send_401
(
client
);
return
;
}
}
avl_tree_rlock
(
global
.
source_tree
);
...
...
@@ -121,6 +131,9 @@ static void admin_handle_general_request(client_t *client, int command)
case
COMMAND_RAW_STATS
:
command_raw_stats
(
client
);
break
;
case
COMMAND_LIST_MOUNTS
:
command_list_mounts
(
client
);
break
;
default:
WARN0
(
"General admin request not recognised"
);
client_send_400
(
client
,
"Unknown admin request"
);
...
...
@@ -287,3 +300,38 @@ static void command_raw_stats(client_t *client) {
return
;
}
static
void
command_list_mounts
(
client_t
*
client
)
{
avl_node
*
node
;
source_t
*
source
;
DEBUG0
(
"List mounts request"
);
html_head
(
client
);
html_write
(
client
,
"<table><tr><td>Mountpoint</td><td>Fallback</td>"
"<td>Format</td><td>Listeners</td></tr>"
);
avl_tree_rlock
(
global
.
source_tree
);
node
=
avl_get_first
(
global
.
source_tree
);
while
(
node
)
{
source
=
(
source_t
*
)
node
->
key
;
html_write
(
client
,
"<tr><td>%s</td><td>%s</td><td>%s</td><td>%ld</td></tr>"
,
source
->
mount
,
(
source
->
fallback_mount
!=
NULL
)
?
source
->
fallback_mount
:
""
,
source
->
format
->
format_description
,
source
->
listeners
);
node
=
avl_get_next
(
node
);
}
avl_tree_unlock
(
global
.
source_tree
);
html_write
(
client
,
"</table></body></html>"
);
client_destroy
(
client
);
return
;
}
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