1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Feature: Report source's instance UUID when known

This commit is contained in:
Philipp Schafft 2023-04-18 13:28:26 +00:00
parent f188c5b1df
commit 0a7ae5073d
4 changed files with 10 additions and 4 deletions

View File

@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2. * This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source. * A copy of this license is included with this source.
* *
* Copyright 2014-2022, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>, * Copyright 2014-2023, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/ */
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
@ -94,6 +94,7 @@ const char * event_extra_key_name(event_extra_key_t key)
case EVENT_EXTRA_KEY_CLIENT_USERNAME: return "client-username"; break; case EVENT_EXTRA_KEY_CLIENT_USERNAME: return "client-username"; break;
case EVENT_EXTRA_KEY_CLIENT_USERAGENT: return "client-useragent"; break; case EVENT_EXTRA_KEY_CLIENT_USERAGENT: return "client-useragent"; break;
case EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE: return "source-media-type"; break; case EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE: return "source-media-type"; break;
case EVENT_EXTRA_KEY_SOURCE_INSTANCE_UUID: return "source-instance"; break;
case EVENT_EXTRA_KEY_DUMPFILE_FILENAME: return "dumpfile-filename"; break; case EVENT_EXTRA_KEY_DUMPFILE_FILENAME: return "dumpfile-filename"; break;
#ifndef DEVEL_LOGGING #ifndef DEVEL_LOGGING
default: break; default: break;
@ -108,6 +109,7 @@ igloo_error_t event_to_string_renderer(const event_t *event, string_renderer_t *
static const event_extra_key_t key_list[] = { static const event_extra_key_t key_list[] = {
EVENT_EXTRA_KEY_URI, EVENT_EXTRA_KEY_URI,
EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE, EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE,
EVENT_EXTRA_KEY_SOURCE_INSTANCE_UUID,
EVENT_EXTRA_KEY_CONNECTION_IP, EVENT_EXTRA_KEY_CONNECTION_IP,
EVENT_EXTRA_KEY_CLIENT_ROLE, EVENT_EXTRA_KEY_CLIENT_ROLE,
EVENT_EXTRA_KEY_CLIENT_USERNAME, EVENT_EXTRA_KEY_CLIENT_USERNAME,
@ -513,6 +515,7 @@ void event_emit_va(const char *trigger, ...) {
if (source->format && source->format->contenttype) { if (source->format && source->format->contenttype) {
extra_add(event, EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE, source->format->contenttype); extra_add(event, EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE, source->format->contenttype);
} }
extra_add(event, EVENT_EXTRA_KEY_SOURCE_INSTANCE_UUID, source->instance_uuid);
} }
if (client) { if (client) {

View File

@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2. * This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source. * A copy of this license is included with this source.
* *
* Copyright 2014-2022, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>, * Copyright 2014-2023, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/ */
#ifndef __EVENT_H__ #ifndef __EVENT_H__
@ -42,6 +42,7 @@ typedef enum {
EVENT_EXTRA_KEY_CLIENT_USERNAME, EVENT_EXTRA_KEY_CLIENT_USERNAME,
EVENT_EXTRA_KEY_CLIENT_USERAGENT, EVENT_EXTRA_KEY_CLIENT_USERAGENT,
EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE, EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE,
EVENT_EXTRA_KEY_SOURCE_INSTANCE_UUID,
EVENT_EXTRA_KEY_DUMPFILE_FILENAME, EVENT_EXTRA_KEY_DUMPFILE_FILENAME,
} event_extra_key_t; } event_extra_key_t;

View File

@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2. * This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source. * A copy of this license is included with this source.
* *
* Copyright 2014-2022, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>, * Copyright 2014-2023, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -154,6 +154,7 @@ static inline void __setup_environ(ice_config_t *config, event_exec_t *self, eve
__update_environ("SOURCE_ACTION", event->trigger); /* old name (deprecated) */ __update_environ("SOURCE_ACTION", event->trigger); /* old name (deprecated) */
__update_environ_with_key(event, "EVENT_URI", EVENT_EXTRA_KEY_URI); __update_environ_with_key(event, "EVENT_URI", EVENT_EXTRA_KEY_URI);
__update_environ_with_key(event, "SOURCE_MEDIA_TYPE", EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE); __update_environ_with_key(event, "SOURCE_MEDIA_TYPE", EVENT_EXTRA_KEY_SOURCE_MEDIA_TYPE);
__update_environ_with_key(event, "SOURCE_INSTANCE", EVENT_EXTRA_KEY_SOURCE_INSTANCE_UUID);
__update_environ_with_key(event, "CLIENT_IP", EVENT_EXTRA_KEY_CONNECTION_IP); __update_environ_with_key(event, "CLIENT_IP", EVENT_EXTRA_KEY_CONNECTION_IP);
__update_environ_with_key(event, "CLIENT_ROLE", EVENT_EXTRA_KEY_CLIENT_ROLE); __update_environ_with_key(event, "CLIENT_ROLE", EVENT_EXTRA_KEY_CLIENT_ROLE);
__update_environ_with_key(event, "CLIENT_USERNAME", EVENT_EXTRA_KEY_CLIENT_USERNAME); __update_environ_with_key(event, "CLIENT_USERNAME", EVENT_EXTRA_KEY_CLIENT_USERNAME);

View File

@ -3,7 +3,7 @@
* This program is distributed under the GNU General Public License, version 2. * This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source. * A copy of this license is included with this source.
* *
* Copyright 2014-2022, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>, * Copyright 2014-2023, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -59,6 +59,7 @@ static int event_url_emit(void *state, event_t *event) {
string_renderer_add_kv_with_options(renderer, "role", event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_ROLE), STRING_RENDERER_ENCODING_PLAIN, true, true); string_renderer_add_kv_with_options(renderer, "role", event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_ROLE), STRING_RENDERER_ENCODING_PLAIN, true, true);
string_renderer_add_kv_with_options(renderer, "username", event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_USERNAME), STRING_RENDERER_ENCODING_PLAIN, true, true); string_renderer_add_kv_with_options(renderer, "username", event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_USERNAME), STRING_RENDERER_ENCODING_PLAIN, true, true);
string_renderer_add_kv_with_options(renderer, "ip", event_extra_get(event, EVENT_EXTRA_KEY_CONNECTION_IP), STRING_RENDERER_ENCODING_PLAIN, true, true); string_renderer_add_kv_with_options(renderer, "ip", event_extra_get(event, EVENT_EXTRA_KEY_CONNECTION_IP), STRING_RENDERER_ENCODING_PLAIN, true, true);
string_renderer_add_kv_with_options(renderer, "source-instance", event_extra_get(event, EVENT_EXTRA_KEY_SOURCE_INSTANCE_UUID), STRING_RENDERER_ENCODING_PLAIN, true, true);
string_renderer_add_kv_with_options(renderer, "agent", event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_USERAGENT) ? event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_USERAGENT) : "-", STRING_RENDERER_ENCODING_PLAIN, true, true); string_renderer_add_kv_with_options(renderer, "agent", event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_USERAGENT) ? event_extra_get(event, EVENT_EXTRA_KEY_CLIENT_USERAGENT) : "-", STRING_RENDERER_ENCODING_PLAIN, true, true);
string_renderer_add_ki_with_options(renderer, "duration", duration, STRING_RENDERER_ENCODING_PLAIN, true, true); string_renderer_add_ki_with_options(renderer, "duration", duration, STRING_RENDERER_ENCODING_PLAIN, true, true);
string_renderer_add_ki_with_options(renderer, "admin", event->client_admin_command, STRING_RENDERER_ENCODING_PLAIN, true, true); string_renderer_add_ki_with_options(renderer, "admin", event->client_admin_command, STRING_RENDERER_ENCODING_PLAIN, true, true);