httpd: provide name of connection type

This commit is contained in:
F. Duncanh
2024-12-15 08:47:11 -05:00
parent 26640d91fe
commit 88d4126e0a
2 changed files with 6 additions and 2 deletions

View File

@@ -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++) {

View File

@@ -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);