1
0
Fork 0

Update: Convert stats_get_xml() to take flags

This commit is contained in:
Philipp Schafft 2020-10-09 15:43:57 +00:00
parent 1a5359025c
commit 5eb09ca5de
4 changed files with 9 additions and 6 deletions

View File

@ -1191,7 +1191,7 @@ static void command_stats(client_t *client, source_t *source, admin_format_t res
ICECAST_LOG_DEBUG("Stats request, sending xml stats");
doc = stats_get_xml(1, mount, client);
doc = stats_get_xml(STATS_XML_FLAG_SHOW_HIDDEN, mount, client);
admin_send_response(doc, client, response, STATS_HTML_REQUEST);
xmlFreeDoc(doc);
return;

View File

@ -480,7 +480,7 @@ int fserve_client_create (client_t *httpclient)
char *eol = strrchr (reference, '.');
if (eol)
*eol = '\0';
doc = stats_get_xml (0, reference, httpclient);
doc = stats_get_xml(STATS_XML_FLAG_NONE, reference, httpclient);
free (reference);
admin_send_response (doc, httpclient, ADMIN_FORMAT_HTML, xslt_playlist_requested);
xmlFreeDoc(doc);

View File

@ -1051,7 +1051,7 @@ void stats_transform_xslt(client_t *client)
char *xslpath = util_get_path_from_normalised_uri(client->uri);
const char *mount = httpp_get_param(client->parser, "mount");
doc = stats_get_xml(0, mount, client);
doc = stats_get_xml(STATS_XML_FLAG_NONE, mount, client);
xslt_transform(doc, xslpath, client, 200, NULL, NULL);
@ -1082,7 +1082,7 @@ static void __add_metadata(xmlNodePtr node, const char *tag) {
free(name);
}
xmlDocPtr stats_get_xml(int show_hidden, const char *show_mount, client_t *client)
xmlDocPtr stats_get_xml(unsigned int flags, const char *show_mount, client_t *client)
{
xmlDocPtr doc;
xmlNodePtr node;
@ -1096,7 +1096,7 @@ xmlDocPtr stats_get_xml(int show_hidden, const char *show_mount, client_t *clien
modules = module_container_get_modulelist_as_xml(global.modulecontainer);
xmlAddChild(node, modules);
node = _dump_stats_to_doc(node, show_mount, show_hidden, client);
node = _dump_stats_to_doc(node, show_mount, flags & STATS_XML_FLAG_SHOW_HIDDEN ? 1 : 0, client);
if (show_mount && node) {
avl_tree_rlock(global.source_tree);

View File

@ -21,6 +21,9 @@
#include "icecasttypes.h"
#include "refbuf.h"
#define STATS_XML_FLAG_NONE 0x0000U
#define STATS_XML_FLAG_SHOW_HIDDEN 0x0001U
typedef struct _stats_node_tag
{
char *name;
@ -95,7 +98,7 @@ void stats_callback (client_t *client, void *notused);
void stats_transform_xslt(client_t *client);
void stats_sendxml(client_t *client);
xmlDocPtr stats_get_xml(int show_hidden, const char *show_mount, client_t *client);
xmlDocPtr stats_get_xml(unsigned int flags, const char *show_mount, client_t *client);
char *stats_get_value(const char *source, const char *name);
#endif /* __STATS_H__ */