Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
f541cb5c
Commit
f541cb5c
authored
Aug 03, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: List loaded modules in stats XML
parent
3f224609
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
src/module.c
src/module.c
+28
-0
src/module.h
src/module.h
+3
-0
src/stats.c
src/stats.c
+4
-0
No files found.
src/module.c
View file @
f541cb5c
...
...
@@ -18,6 +18,7 @@
#include "refobject.h"
#include "module.h"
#include "cfgfile.h"
/* for XMLSTR() */
struct
module_tag
{
refobject_base_t
__base
;
...
...
@@ -118,6 +119,33 @@ module_t * module_container_get_module(module_container_t *self, co
return
ret
;
}
xmlNodePtr
module_container_get_modulelist_as_xml
(
module_container_t
*
self
)
{
xmlNodePtr
root
;
avl_node
*
avlnode
;
if
(
!
self
)
return
NULL
;
root
=
xmlNewNode
(
NULL
,
XMLSTR
(
"modules"
));
if
(
!
root
)
return
NULL
;
thread_mutex_lock
(
&
(
self
->
lock
));
avlnode
=
avl_get_first
(
self
->
module
);
while
(
avlnode
)
{
module_t
*
module
=
avlnode
->
key
;
xmlNodePtr
node
=
xmlNewChild
(
root
,
NULL
,
XMLSTR
(
"module"
),
NULL
);
xmlSetProp
(
node
,
XMLSTR
(
"name"
),
XMLSTR
(
refobject_get_name
(
module
)));
avlnode
=
avl_get_next
(
avlnode
);
}
thread_mutex_unlock
(
&
(
self
->
lock
));
return
root
;
}
static
void
__module_free
(
refobject_t
self
,
void
**
userdata
)
{
module_t
*
mod
=
REFOBJECT_TO_TYPE
(
self
,
module_t
*
);
...
...
src/module.h
View file @
f541cb5c
...
...
@@ -9,6 +9,8 @@
#ifndef __MODULE_H__
#define __MODULE_H__
#include <libxml/tree.h>
#include "icecasttypes.h"
typedef
void
(
*
module_client_handler_function_t
)(
module_t
*
self
,
client_t
*
client
,
const
char
*
uri
);
...
...
@@ -23,6 +25,7 @@ module_container_t * module_container_new(void);
int
module_container_add_module
(
module_container_t
*
self
,
module_t
*
module
);
int
module_container_delete_module
(
module_container_t
*
self
,
const
char
*
name
);
module_t
*
module_container_get_module
(
module_container_t
*
self
,
const
char
*
name
);
xmlNodePtr
module_container_get_modulelist_as_xml
(
module_container_t
*
self
);
module_t
*
module_new
(
const
char
*
name
,
module_setup_handler_t
newcb
,
module_setup_handler_t
freecb
,
void
*
userdata
);
...
...
src/stats.c
View file @
f541cb5c
...
...
@@ -1063,12 +1063,16 @@ xmlDocPtr stats_get_xml(int show_hidden, const char *show_mount, client_t *clien
{
xmlDocPtr
doc
;
xmlNodePtr
node
;
xmlNodePtr
modules
;
source_t
*
source
;
doc
=
xmlNewDoc
(
XMLSTR
(
"1.0"
));
node
=
xmlNewDocNode
(
doc
,
NULL
,
XMLSTR
(
"icestats"
),
NULL
);
xmlDocSetRootElement
(
doc
,
node
);
modules
=
module_container_get_modulelist_as_xml
(
global
.
modulecontainer
);
xmlAddChild
(
node
,
modules
);
node
=
_dump_stats_to_doc
(
node
,
show_mount
,
show_hidden
,
client
);
if
(
show_mount
&&
node
)
{
...
...
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