From 88d4126e0aba6de50f428402dfbfde898d41af2a Mon Sep 17 00:00:00 2001 From: "F. Duncanh" Date: Sun, 15 Dec 2024 08:47:11 -0500 Subject: [PATCH] httpd: provide name of connection type --- lib/httpd.c | 7 +++++-- lib/httpd.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/httpd.c b/lib/httpd.c index 6147928..28f3d3c 100644 --- a/lib/httpd.c +++ b/lib/httpd.c @@ -29,7 +29,6 @@ #include "logger.h" #include "utils.h" - static const char *typename[] = { [CONNECTION_TYPE_UNKNOWN] = "Unknown", [CONNECTION_TYPE_RAOP] = "RAOP", @@ -38,7 +37,6 @@ static const char *typename[] = { [CONNECTION_TYPE_HLS] = "HLS" }; - struct http_connection_s { int connected; @@ -69,6 +67,11 @@ struct httpd_s { int server_fd6; }; +const char * +httpd_get_connection_typename (connection_type_t type) { + return typename[type]; +} + int httpd_get_connection_socket (httpd_t *httpd, void *user_data) { for (int i = 0; i < httpd->max_connections; i++) { diff --git a/lib/httpd.h b/lib/httpd.h index e00a950..1df0e6b 100644 --- a/lib/httpd.h +++ b/lib/httpd.h @@ -44,6 +44,7 @@ int httpd_set_connection_type (httpd_t *http, void *user_data, connection_type_t int httpd_count_connection_type (httpd_t *http, connection_type_t type); int httpd_get_connection_socket (httpd_t *httpd, void *user_data); int httpd_get_connection_socket_by_type (httpd_t *httpd, connection_type_t type, int instance); +const char *httpd_get_connection_typename (connection_type_t type); void *httpd_get_connection_by_type (httpd_t *httpd, connection_type_t type, int instance); httpd_t *httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int nohold);