0
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-06-30 22:18:19 -04:00

Merge branch 'ph3-header-cleanup'

This commit is contained in:
Philipp Schafft 2018-06-17 12:52:35 +00:00
commit b3359a24ee
46 changed files with 223 additions and 209 deletions

View File

@ -5,6 +5,7 @@ SUBDIRS = common/avl common/net common/thread common/httpp common/log common/tim
bin_PROGRAMS = icecast bin_PROGRAMS = icecast
noinst_HEADERS = \ noinst_HEADERS = \
icecasttypes.h \
admin.h \ admin.h \
main.h \ main.h \
cfgfile.h \ cfgfile.h \

View File

@ -16,6 +16,7 @@
#include "acl.h" #include "acl.h"
#include "admin.h" #include "admin.h"
#include "util.h"
#include <stdio.h> #include <stdio.h>

View File

@ -18,10 +18,7 @@
#include <libxml/tree.h> #include <libxml/tree.h>
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
struct acl_tag; #include "icecasttypes.h"
typedef struct acl_tag acl_t;
#include "admin.h"
typedef enum acl_policy_tag { typedef enum acl_policy_tag {
/* Error on function call */ /* Error on function call */

View File

@ -23,6 +23,8 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include "admin.h"
#include "compat.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "connection.h" #include "connection.h"
#include "refbuf.h" #include "refbuf.h"
@ -30,16 +32,15 @@
#include "source.h" #include "source.h"
#include "global.h" #include "global.h"
#include "stats.h" #include "stats.h"
#include "compat.h"
#include "xslt.h" #include "xslt.h"
#include "fserve.h" #include "fserve.h"
#include "admin.h"
#include "errors.h" #include "errors.h"
#include "format.h" #include "format.h"
#include "logging.h" #include "logging.h"
#include "auth.h" #include "auth.h"
#include "acl.h"
#ifdef _WIN32 #ifdef _WIN32
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif

View File

@ -16,24 +16,9 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <stdint.h>
/* Command IDs */
typedef int32_t admin_command_id_t;
/* formats */
typedef enum {
ADMIN_FORMAT_AUTO,
ADMIN_FORMAT_RAW,
ADMIN_FORMAT_TRANSFORMED,
ADMIN_FORMAT_PLAINTEXT
} admin_format_t;
#include "icecasttypes.h"
#include "compat.h" #include "compat.h"
#include "refbuf.h"
#include "client.h"
#include "source.h"
#include "auth.h"
/* types */ /* types */
#define ADMINTYPE_ERROR (-1) #define ADMINTYPE_ERROR (-1)

View File

@ -18,15 +18,14 @@
#include <config.h> #include <config.h>
#endif #endif
struct source_tag;
typedef struct auth_tag auth_t;
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include "cfgfile.h"
#include "client.h"
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/httpp/httpp.h"
#include "icecasttypes.h"
/* implemented */ /* implemented */
#define AUTH_TYPE_ANONYMOUS "anonymous" #define AUTH_TYPE_ANONYMOUS "anonymous"
@ -58,7 +57,7 @@ typedef enum
typedef struct auth_client_tag typedef struct auth_client_tag
{ {
client_t *client; client_t *client;
auth_result (*process)(struct auth_tag *auth, struct auth_client_tag *auth_user); auth_result (*process)(auth_t *auth, struct auth_client_tag *auth_user);
void (*on_no_match)(client_t *client, void (*on_result)(client_t *client, void *userdata, auth_result result), void *userdata); void (*on_no_match)(client_t *client, void (*on_result)(client_t *client, void *userdata, auth_result result), void *userdata);
void (*on_result)(client_t *client, void *userdata, auth_result result); void (*on_result)(client_t *client, void *userdata, auth_result result);
void *userdata; void *userdata;
@ -89,11 +88,11 @@ struct auth_tag
auth_result (*release_client)(auth_client *auth_user); auth_result (*release_client)(auth_client *auth_user);
/* auth state-specific free call */ /* auth state-specific free call */
void (*free)(struct auth_tag *self); void (*free)(auth_t *self);
auth_result (*adduser)(struct auth_tag *auth, const char *username, const char *password); auth_result (*adduser)(auth_t *auth, const char *username, const char *password);
auth_result (*deleteuser)(struct auth_tag *auth, const char *username); auth_result (*deleteuser)(auth_t *auth, const char *username);
auth_result (*listuser)(struct auth_tag *auth, xmlNodePtr srcnode); auth_result (*listuser)(auth_t *auth, xmlNodePtr srcnode);
mutex_t lock; mutex_t lock;
int running; int running;

View File

@ -18,6 +18,7 @@
#include <string.h> #include <string.h>
#include "auth.h" #include "auth.h"
#include "cfgfile.h"
#include "client.h" #include "client.h"
#include "logging.h" #include "logging.h"

View File

@ -72,6 +72,7 @@
#include "source.h" #include "source.h"
#include "client.h" #include "client.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "connection.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "logging.h" #include "logging.h"

View File

@ -27,15 +27,13 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "global.h" #include "global.h"
#include "refbuf.h"
#include "client.h"
#include "logging.h" #include "logging.h"
#include "util.h" #include "util.h"
#include "auth.h" #include "auth.h"
#include "event.h" #include "event.h"
#include "tls.h"
/* for config_reread_config() */ /* for config_reread_config() */
#include "yp.h" #include "yp.h"
@ -43,6 +41,7 @@
#include "stats.h" #include "stats.h"
#include "connection.h" #include "connection.h"
#include "main.h" #include "main.h"
#include "slave.h"
#define CATMODULE "CONFIG" #define CATMODULE "CONFIG"
#define CONFIG_DEFAULT_LOCATION "Earth" #define CONFIG_DEFAULT_LOCATION "Earth"

View File

@ -22,37 +22,13 @@
#define MAX_YP_DIRECTORIES 25 #define MAX_YP_DIRECTORIES 25
struct _mount_proxy;
#include <libxml/tree.h> #include <libxml/tree.h>
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/avl/avl.h" #include "common/avl/avl.h"
#include "slave.h" #include "icecasttypes.h"
#include "connection.h"
#define XMLSTR(str) ((xmlChar *)(str)) #define XMLSTR(str) ((xmlChar *)(str))
typedef enum _operation_mode {
/* Default operation mode. may depend on context */
OMODE_DEFAULT = 0,
/* The normal mode. */
OMODE_NORMAL,
/* Mimic some of the behavior of older versions.
* This mode should only be used in transition to normal mode,
* e.g. to give some clients time to upgrade to new API.
*/
OMODE_LEGACY,
/* The struct mode includes some behavior for future versions
* that can for some reason not yet be used in the normal mode
* e.g. because it may break interfaces in some way.
* New applications should test against this mode and developer
* of software interacting with Icecast on an API level should
* have a look for strict mode behavior to avoid random breakage
* with newer versions of Icecast.
*/
OMODE_STRICT
} operation_mode;
typedef enum _http_header_type { typedef enum _http_header_type {
/* static: headers are passed as is to the client. */ /* static: headers are passed as is to the client. */
HTTP_HEADER_TYPE_STATIC HTTP_HEADER_TYPE_STATIC
@ -79,12 +55,12 @@ typedef struct ice_config_dir_tag {
struct ice_config_dir_tag *next; struct ice_config_dir_tag *next;
} ice_config_dir_t; } ice_config_dir_t;
typedef struct _config_options { struct _config_options {
char *type; char *type;
char *name; char *name;
char *value; char *value;
struct _config_options *next; config_options_t *next;
} config_options_t; };
typedef enum _mount_type { typedef enum _mount_type {
MOUNT_TYPE_NORMAL, MOUNT_TYPE_NORMAL,
@ -184,7 +160,7 @@ typedef struct _config_tls_context {
char *cipher_list; char *cipher_list;
} config_tls_context_t; } config_tls_context_t;
typedef struct ice_config_tag { struct ice_config_tag {
char *config_filename; char *config_filename;
char *location; char *location;
@ -260,7 +236,7 @@ typedef struct ice_config_tag {
int yp_url_timeout[MAX_YP_DIRECTORIES]; int yp_url_timeout[MAX_YP_DIRECTORIES];
int yp_touch_interval[MAX_YP_DIRECTORIES]; int yp_touch_interval[MAX_YP_DIRECTORIES];
int num_yp_directories; int num_yp_directories;
} ice_config_t; };
typedef struct { typedef struct {
rwlock_t config_lock; rwlock_t config_lock;

View File

@ -42,6 +42,7 @@
#include "logging.h" #include "logging.h"
#include "util.h" #include "util.h"
#include "acl.h"
/* for ADMIN_COMMAND_ERROR */ /* for ADMIN_COMMAND_ERROR */
#include "admin.h" #include "admin.h"

View File

@ -19,17 +19,13 @@
#ifndef __CLIENT_H__ #ifndef __CLIENT_H__
#define __CLIENT_H__ #define __CLIENT_H__
typedef struct _client_tag client_t;
#include "errors.h"
#include "connection.h"
#include "refbuf.h"
#include "acl.h"
#include "cfgfile.h"
#include "admin.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "common/httpp/encoding.h" #include "common/httpp/encoding.h"
#include "icecasttypes.h"
#include "errors.h"
#include "refbuf.h"
#define CLIENT_DEFAULT_ADMIN_FORMAT ADMIN_FORMAT_TRANSFORMED #define CLIENT_DEFAULT_ADMIN_FORMAT ADMIN_FORMAT_TRANSFORMED
typedef enum _protocol_tag { typedef enum _protocol_tag {
@ -96,19 +92,19 @@ struct _client_tag {
unsigned int pos; unsigned int pos;
/* auth used for this client */ /* auth used for this client */
struct auth_tag *auth; auth_t *auth;
/* Format-handler-specific data for this client */ /* Format-handler-specific data for this client */
void *format_data; void *format_data;
/* function to call to release format specific resources */ /* function to call to release format specific resources */
void (*free_client_data)(struct _client_tag *client); void (*free_client_data)(client_t *client);
/* write out data associated with client */ /* write out data associated with client */
int (*write_to_client)(struct _client_tag *client); int (*write_to_client)(client_t *client);
/* function to check if refbuf needs updating */ /* function to check if refbuf needs updating */
int (*check_buffer)(struct source_tag *source, struct _client_tag *client); int (*check_buffer)(source_t *source, client_t *client);
}; };
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser); int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);

View File

@ -20,6 +20,10 @@
* Solaris. * Solaris.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif

View File

@ -33,34 +33,30 @@
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#include "compat.h"
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/avl/avl.h" #include "common/avl/avl.h"
#include "common/net/sock.h" #include "common/net/sock.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "compat.h"
#include "connection.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "global.h" #include "global.h"
#include "util.h" #include "util.h"
#include "connection.h"
#include "refbuf.h" #include "refbuf.h"
#include "client.h" #include "client.h"
#include "errors.h" #include "errors.h"
#include "stats.h" #include "stats.h"
#include "logging.h" #include "logging.h"
#include "xslt.h"
#include "fserve.h" #include "fserve.h"
#include "sighandler.h" #include "slave.h"
#include "yp.h"
#include "source.h" #include "source.h"
#include "format.h"
#include "format_mp3.h"
#include "admin.h" #include "admin.h"
#include "auth.h" #include "auth.h"
#include "matchfile.h" #include "matchfile.h"
#include "tls.h" #include "tls.h"
#include "acl.h"
#define CATMODULE "connection" #define CATMODULE "connection"
@ -144,7 +140,7 @@ void connection_shutdown(void)
_initialized = 0; _initialized = 0;
} }
void connection_reread_config(struct ice_config_tag *config) void connection_reread_config(ice_config_t *config)
{ {
get_tls_certificate(config); get_tls_certificate(config);
} }

View File

@ -19,30 +19,12 @@
#include "tls.h" #include "tls.h"
#include "icecasttypes.h"
#include "compat.h" #include "compat.h"
#include "common/httpp/httpp.h"
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/net/sock.h" #include "common/net/sock.h"
struct _client_tag; struct connection_tag {
struct source_tag;
struct ice_config_tag;
typedef enum _tlsmode_tag {
/* no TLS is used at all */
ICECAST_TLSMODE_DISABLED = 0,
/* TLS mode is to be detected */
ICECAST_TLSMODE_AUTO,
/* Like ICECAST_TLSMODE_AUTO but enforces TLS */
ICECAST_TLSMODE_AUTO_NO_PLAIN,
/* TLS via HTTP Upgrade:-header [RFC2817] */
ICECAST_TLSMODE_RFC2817,
/* TLS for transport layer like HTTPS [RFC2818] does */
ICECAST_TLSMODE_RFC2818
} tlsmode_t;
typedef struct connection_tag
{
unsigned long id; unsigned long id;
time_t con_time; time_t con_time;
@ -55,20 +37,20 @@ typedef struct connection_tag
tlsmode_t tlsmode; tlsmode_t tlsmode;
tls_t *tls; tls_t *tls;
int (*send)(struct connection_tag *handle, const void *buf, size_t len); int (*send)(connection_t *handle, const void *buf, size_t len);
int (*read)(struct connection_tag *handle, void *buf, size_t len); int (*read)(connection_t *handle, void *buf, size_t len);
char *ip; char *ip;
} connection_t; };
void connection_initialize(void); void connection_initialize(void);
void connection_shutdown(void); void connection_shutdown(void);
void connection_reread_config(struct ice_config_tag *config); void connection_reread_config(ice_config_t *config);
void connection_accept_loop(void); void connection_accept_loop(void);
int connection_setup_sockets(struct ice_config_tag *config); int connection_setup_sockets(ice_config_t *config);
void connection_close(connection_t *con); void connection_close(connection_t *con);
connection_t *connection_create(sock_t sock, sock_t serversock, char *ip); connection_t *connection_create(sock_t sock, sock_t serversock, char *ip);
int connection_complete_source(struct source_tag *source, int response); int connection_complete_source(source_t *source, int response);
void connection_queue(connection_t *con); void connection_queue(connection_t *con);
void connection_uses_tls(connection_t *con); void connection_uses_tls(connection_t *con);

View File

@ -11,6 +11,7 @@
#endif #endif
#include "curl.h" #include "curl.h"
#include "cfgfile.h"
#include "logging.h" #include "logging.h"
#define CATMODULE "curl" #define CATMODULE "curl"

View File

@ -20,6 +20,9 @@
#include "event_url.h" #include "event_url.h"
#include "logging.h" #include "logging.h"
#include "admin.h" #include "admin.h"
#include "connection.h"
#include "client.h"
#include "cfgfile.h"
#define CATMODULE "event" #define CATMODULE "event"

View File

@ -9,18 +9,13 @@
#ifndef __EVENT_H__ #ifndef __EVENT_H__
#define __EVENT_H__ #define __EVENT_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include "common/httpp/httpp.h"
#include "cfgfile.h" #include "common/thread/thread.h"
#include "client.h"
#include "source.h" #include "icecasttypes.h"
/* implemented */ /* implemented */
#define EVENT_TYPE_LOG "log" #define EVENT_TYPE_LOG "log"

View File

@ -22,6 +22,7 @@
#include "event.h" #include "event.h"
#include "global.h" #include "global.h"
#include "source.h"
#include "logging.h" #include "logging.h"
#define CATMODULE "event_exec" #define CATMODULE "event_exec"

View File

@ -13,6 +13,8 @@
#include <string.h> #include <string.h>
#include "event.h" #include "event.h"
#include "util.h"
#include "cfgfile.h"
#include "logging.h" #include "logging.h"
#define CATMODULE "event_log" #define CATMODULE "event_log"

View File

@ -14,6 +14,8 @@
#include "curl.h" #include "curl.h"
#include "event.h" #include "event.h"
#include "cfgfile.h"
#include "util.h"
#include "logging.h" #include "logging.h"
#define CATMODULE "event_url" #define CATMODULE "event_url"

View File

@ -20,13 +20,12 @@
#include <vorbis/codec.h> #include <vorbis/codec.h>
#include "icecasttypes.h"
#include "client.h" #include "client.h"
#include "refbuf.h" #include "refbuf.h"
#include "cfgfile.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
struct source_tag;
struct _mount_proxy;
typedef enum _format_type_tag typedef enum _format_type_tag
{ {
FORMAT_ERROR, /* No format, source not processable */ FORMAT_ERROR, /* No format, source not processable */
@ -47,13 +46,13 @@ typedef struct _format_plugin_tag
uint64_t read_bytes; uint64_t read_bytes;
uint64_t sent_bytes; uint64_t sent_bytes;
refbuf_t *(*get_buffer)(struct source_tag *); refbuf_t *(*get_buffer)(source_t *);
int (*write_buf_to_client)(client_t *client); int (*write_buf_to_client)(client_t *client);
void (*write_buf_to_file)(struct source_tag *source, refbuf_t *refbuf); void (*write_buf_to_file)(source_t *source, refbuf_t *refbuf);
int (*create_client_data)(struct source_tag *source, client_t *client); int (*create_client_data)(source_t *source, client_t *client);
void (*set_tag)(struct _format_plugin_tag *plugin, const char *tag, const char *value, const char *charset); void (*set_tag)(struct _format_plugin_tag *plugin, const char *tag, const char *value, const char *charset);
void (*free_plugin)(struct _format_plugin_tag *self); void (*free_plugin)(struct _format_plugin_tag *self);
void (*apply_settings)(client_t *client, struct _format_plugin_tag *format, struct _mount_proxy *mount); void (*apply_settings)(client_t *client, struct _format_plugin_tag *format, mount_proxy *mount);
/* meta data */ /* meta data */
vorbis_comment vc; vorbis_comment vc;
@ -64,16 +63,16 @@ typedef struct _format_plugin_tag
format_type_t format_get_type(const char *contenttype); format_type_t format_get_type(const char *contenttype);
char *format_get_mimetype(format_type_t type); char *format_get_mimetype(format_type_t type);
int format_get_plugin(format_type_t type, struct source_tag *source); int format_get_plugin(format_type_t type, source_t *source);
int format_generic_write_to_client (client_t *client); int format_generic_write_to_client (client_t *client);
int format_advance_queue (struct source_tag *source, client_t *client); int format_advance_queue (source_t *source, client_t *client);
int format_check_http_buffer (struct source_tag *source, client_t *client); int format_check_http_buffer (source_t *source, client_t *client);
int format_check_file_buffer (struct source_tag *source, client_t *client); int format_check_file_buffer (source_t *source, client_t *client);
void format_send_general_headers(format_plugin_t *format, void format_send_general_headers(format_plugin_t *format,
struct source_tag *source, client_t *client); source_t *source, client_t *client);
void format_set_vorbiscomment(format_plugin_t *plugin, const char *tag, const char *value); void format_set_vorbiscomment(format_plugin_t *plugin, const char *tag, const char *value);

View File

@ -32,6 +32,7 @@
#include "refbuf.h" #include "refbuf.h"
#include "source.h" #include "source.h"
#include "client.h" #include "client.h"
#include "connection.h"
#include "stats.h" #include "stats.h"
#include "format.h" #include "format.h"
@ -55,7 +56,7 @@ static refbuf_t *mp3_get_no_meta (source_t *source);
static int format_mp3_create_client_data (source_t *source, client_t *client); static int format_mp3_create_client_data (source_t *source, client_t *client);
static void free_mp3_client_data (client_t *client); static void free_mp3_client_data (client_t *client);
static int format_mp3_write_buf_to_client(client_t *client); static int format_mp3_write_buf_to_client(client_t *client);
static void write_mp3_to_file (struct source_tag *source, refbuf_t *refbuf); static void write_mp3_to_file (source_t *source, refbuf_t *refbuf);
static void mp3_set_tag (format_plugin_t *plugin, const char *tag, const char *in_value, const char *charset); static void mp3_set_tag (format_plugin_t *plugin, const char *tag, const char *in_value, const char *charset);
static void format_mp3_apply_settings(client_t *client, format_plugin_t *format, mount_proxy *mount); static void format_mp3_apply_settings(client_t *client, format_plugin_t *format, mount_proxy *mount);
@ -715,7 +716,7 @@ static void free_mp3_client_data (client_t *client)
} }
static void write_mp3_to_file (struct source_tag *source, refbuf_t *refbuf) static void write_mp3_to_file (source_t *source, refbuf_t *refbuf)
{ {
if (refbuf->len == 0) if (refbuf->len == 0)
return; return;

View File

@ -60,7 +60,7 @@ static void format_ogg_free_plugin(format_plugin_t *plugin);
static int create_ogg_client_data(source_t *source, client_t *client); static int create_ogg_client_data(source_t *source, client_t *client);
static void free_ogg_client_data(client_t *client); static void free_ogg_client_data(client_t *client);
static void write_ogg_to_file(struct source_tag *source, refbuf_t *refbuf); static void write_ogg_to_file(source_t *source, refbuf_t *refbuf);
static refbuf_t *ogg_get_buffer(source_t *source); static refbuf_t *ogg_get_buffer(source_t *source);
static int write_buf_to_client(client_t *client); static int write_buf_to_client(client_t *client);
@ -563,7 +563,7 @@ static int write_buf_to_client(client_t *client)
} }
static int write_ogg_data (struct source_tag *source, refbuf_t *refbuf) static int write_ogg_data (source_t *source, refbuf_t *refbuf)
{ {
int ret = 1; int ret = 1;
@ -578,7 +578,7 @@ static int write_ogg_data (struct source_tag *source, refbuf_t *refbuf)
} }
static void write_ogg_to_file (struct source_tag *source, refbuf_t *refbuf) static void write_ogg_to_file (source_t *source, refbuf_t *refbuf)
{ {
ogg_state_t *ogg_info = source->format->_state; ogg_state_t *ogg_info = source->format->_state;

View File

@ -47,6 +47,8 @@
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "common/net/sock.h" #include "common/net/sock.h"
#include "fserve.h"
#include "compat.h"
#include "connection.h" #include "connection.h"
#include "global.h" #include "global.h"
#include "refbuf.h" #include "refbuf.h"
@ -58,9 +60,6 @@
#include "cfgfile.h" #include "cfgfile.h"
#include "util.h" #include "util.h"
#include "admin.h" #include "admin.h"
#include "compat.h"
#include "fserve.h"
#undef CATMODULE #undef CATMODULE
#define CATMODULE "fserve" #define CATMODULE "fserve"

View File

@ -14,7 +14,8 @@
#define __FSERVE_H__ #define __FSERVE_H__
#include <stdio.h> #include <stdio.h>
#include "cfgfile.h"
#include "icecasttypes.h"
typedef void (*fserve_callback_t)(client_t *, void *); typedef void (*fserve_callback_t)(client_t *, void *);

View File

@ -22,8 +22,8 @@
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/avl/avl.h" #include "common/avl/avl.h"
#include "slave.h"
#include "common/net/sock.h" #include "common/net/sock.h"
#include "icecasttypes.h"
typedef struct ice_global_tag typedef struct ice_global_tag
{ {
@ -38,9 +38,9 @@ typedef struct ice_global_tag
avl_tree *source_tree; avl_tree *source_tree;
/* for locally defined relays */ /* for locally defined relays */
struct _relay_server *relays; relay_server *relays;
/* relays retrieved from master */ /* relays retrieved from master */
struct _relay_server *master_relays; relay_server *master_relays;
cond_t shutdown_cond; cond_t shutdown_cond;
} ice_global_t; } ice_global_t;

91
src/icecasttypes.h Normal file
View File

@ -0,0 +1,91 @@
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
#ifndef __ICECASTTYPES_H__
#define __ICECASTTYPES_H__
#include "compat.h"
/* ---[ client.[ch] ]--- */
typedef struct _client_tag client_t;
/* ---[ source.[ch] ]--- */
typedef struct source_tag source_t;
/* ---[ admin.[ch] ]--- */
/* Command IDs */
typedef int32_t admin_command_id_t;
/* formats */
typedef enum {
ADMIN_FORMAT_AUTO,
ADMIN_FORMAT_RAW,
ADMIN_FORMAT_TRANSFORMED,
ADMIN_FORMAT_PLAINTEXT
} admin_format_t;
/* ---[ acl.[ch] ]--- */
typedef struct acl_tag acl_t;
/* ---[ auth.[ch] ]--- */
typedef struct auth_tag auth_t;
/* ---[ cfgfile.[ch] ]--- */
typedef struct ice_config_tag ice_config_t;
typedef struct _config_options config_options_t;
typedef enum _operation_mode {
/* Default operation mode. may depend on context */
OMODE_DEFAULT = 0,
/* The normal mode. */
OMODE_NORMAL,
/* Mimic some of the behavior of older versions.
* This mode should only be used in transition to normal mode,
* e.g. to give some clients time to upgrade to new API.
*/
OMODE_LEGACY,
/* The struct mode includes some behavior for future versions
* that can for some reason not yet be used in the normal mode
* e.g. because it may break interfaces in some way.
* New applications should test against this mode and developer
* of software interacting with Icecast on an API level should
* have a look for strict mode behavior to avoid random breakage
* with newer versions of Icecast.
*/
OMODE_STRICT
} operation_mode;
/* ---[ connection.[ch] ]--- */
typedef struct connection_tag connection_t;
typedef enum {
/* no TLS is used at all */
ICECAST_TLSMODE_DISABLED = 0,
/* TLS mode is to be detected */
ICECAST_TLSMODE_AUTO,
/* Like ICECAST_TLSMODE_AUTO but enforces TLS */
ICECAST_TLSMODE_AUTO_NO_PLAIN,
/* TLS via HTTP Upgrade:-header [RFC2817] */
ICECAST_TLSMODE_RFC2817,
/* TLS for transport layer like HTTPS [RFC2818] does */
ICECAST_TLSMODE_RFC2818
} tlsmode_t;
/* ---[ slave.[ch] ]--- */
typedef struct _relay_server relay_server;
#endif

View File

@ -22,13 +22,13 @@
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "logging.h"
#include "connection.h" #include "connection.h"
#include "refbuf.h" #include "refbuf.h"
#include "client.h" #include "client.h"
#include "compat.h" #include "compat.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "logging.h"
#include "util.h" #include "util.h"
#ifdef _WIN32 #ifdef _WIN32

View File

@ -14,10 +14,10 @@
#ifndef __LOGGING_H__ #ifndef __LOGGING_H__
#define __LOGGING_H__ #define __LOGGING_H__
#include "cfgfile.h"
#include "client.h"
#include "common/log/log.h" #include "common/log/log.h"
#include "icecasttypes.h"
/* declare the global log descriptors */ /* declare the global log descriptors */
extern int errorlog; extern int errorlog;

View File

@ -45,7 +45,6 @@
#endif #endif
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/avl/avl.h"
#include "common/net/sock.h" #include "common/net/sock.h"
#include "common/net/resolver.h" #include "common/net/resolver.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"

View File

@ -19,10 +19,11 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "common/avl/avl.h"
#include "matchfile.h" #include "matchfile.h"
#include "logging.h" #include "logging.h"
#include "util.h" /* for MAX_LINE_LEN and get_line() */ #include "util.h" /* for MAX_LINE_LEN and get_line() */
#include "common/avl/avl.h"
#define CATMODULE "matchfile" #define CATMODULE "matchfile"
struct matchfile_tag { struct matchfile_tag {

View File

@ -42,6 +42,7 @@
#include "common/net/sock.h" #include "common/net/sock.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "slave.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "global.h" #include "global.h"
#include "util.h" #include "util.h"

View File

@ -14,8 +14,9 @@
#define __SLAVE_H__ #define __SLAVE_H__
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "icecasttypes.h"
typedef struct _relay_server { struct _relay_server {
char *server; char *server;
int port; int port;
char *mount; char *mount;
@ -23,16 +24,15 @@ typedef struct _relay_server {
char *password; char *password;
char *localmount; char *localmount;
char *bind; char *bind;
struct source_tag *source; source_t *source;
int mp3metadata; int mp3metadata;
int on_demand; int on_demand;
int running; int running;
int cleanup; int cleanup;
time_t start; time_t start;
thread_type *thread; thread_type *thread;
struct _relay_server *next; relay_server *next;
} relay_server; };
void slave_initialize(void); void slave_initialize(void);
void slave_shutdown(void); void slave_shutdown(void);

View File

@ -42,8 +42,9 @@
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "common/avl/avl.h" #include "common/avl/avl.h"
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "common/net/sock.h"
#include "source.h"
#include "compat.h"
#include "connection.h" #include "connection.h"
#include "global.h" #include "global.h"
#include "refbuf.h" #include "refbuf.h"
@ -53,12 +54,12 @@
#include "logging.h" #include "logging.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "util.h" #include "util.h"
#include "source.h"
#include "format.h" #include "format.h"
#include "fserve.h" #include "fserve.h"
#include "auth.h" #include "auth.h"
#include "event.h" #include "event.h"
#include "compat.h" #include "slave.h"
#include "acl.h"
#undef CATMODULE #undef CATMODULE
#define CATMODULE "source" #define CATMODULE "source"

View File

@ -14,16 +14,16 @@
#ifndef __SOURCE_H__ #ifndef __SOURCE_H__
#define __SOURCE_H__ #define __SOURCE_H__
typedef struct source_tag source_t; #include <stdio.h>
#include "cfgfile.h" #include "common/thread/thread.h"
#include "common/httpp/httpp.h"
#include "icecasttypes.h"
#include "yp.h" #include "yp.h"
#include "util.h" #include "util.h"
#include "format.h" #include "format.h"
#include "playlist.h" #include "playlist.h"
#include "common/thread/thread.h"
#include <stdio.h>
struct source_tag { struct source_tag {
mutex_t lock; mutex_t lock;

View File

@ -30,14 +30,13 @@
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "common/net/sock.h" #include "common/net/sock.h"
#include "stats.h"
#include "connection.h" #include "connection.h"
#include "source.h" #include "source.h"
#include "global.h" #include "global.h"
#include "refbuf.h" #include "refbuf.h"
#include "client.h" #include "client.h"
#include "admin.h" #include "admin.h"
#include "stats.h"
#include "xslt.h" #include "xslt.h"
#include "util.h" #include "util.h"
#include "auth.h" #include "auth.h"

View File

@ -13,14 +13,13 @@
#ifndef __STATS_H__ #ifndef __STATS_H__
#define __STATS_H__ #define __STATS_H__
#include "cfgfile.h"
#include "connection.h"
#include "common/httpp/httpp.h"
#include "client.h"
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include "icecasttypes.h"
#include "cfgfile.h"
#include "refbuf.h"
typedef struct _stats_node_tag typedef struct _stats_node_tag
{ {

View File

@ -14,6 +14,11 @@
#include <config.h> #include <config.h>
#endif #endif
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <strings.h>

View File

@ -9,11 +9,6 @@
#ifndef __TLS_H__ #ifndef __TLS_H__
#define __TLS_H__ #define __TLS_H__
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#endif
#include "common/net/sock.h" #include "common/net/sock.h"
/* Do we have TLS Support? */ /* Do we have TLS Support? */

View File

@ -41,12 +41,12 @@
#include "common/net/sock.h" #include "common/net/sock.h"
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "cfgfile.h" #include "util.h"
#include "compat.h" #include "compat.h"
#include "cfgfile.h"
#include "refbuf.h" #include "refbuf.h"
#include "connection.h" #include "connection.h"
#include "client.h" #include "client.h"
#include "util.h"
#include "source.h" #include "source.h"
#include "admin.h" #include "admin.h"
@ -664,7 +664,7 @@ ssize_t util_http_build_header(char * out, size_t len, ssize_t offset,
int status, const char * statusmsg, int status, const char * statusmsg,
const char * contenttype, const char * charset, const char * contenttype, const char * charset,
const char * datablock, const char * datablock,
struct source_tag * source, struct _client_tag * client) { source_t * source, client_t * client) {
const char * http_version = "1.0"; const char * http_version = "1.0";
ice_config_t *config; ice_config_t *config;
time_t now; time_t now;

View File

@ -17,6 +17,9 @@
/* for FILE* */ /* for FILE* */
#include <stdio.h> #include <stdio.h>
#include "common/net/sock.h"
#include "icecasttypes.h"
#define UNKNOWN_CONTENT 0 #define UNKNOWN_CONTENT 0
#define XSLT_CONTENT 1 #define XSLT_CONTENT 1
#define HTML_CONTENT 2 #define HTML_CONTENT 2
@ -78,15 +81,13 @@ char *util_url_escape(const char *src);
* If datablock is NULL no end-of-header nor any data is appended. * If datablock is NULL no end-of-header nor any data is appended.
* Returns the number of bytes written or -1 on error. * Returns the number of bytes written or -1 on error.
*/ */
struct source_tag; /* use forward decleration so we do not need to
* include <source.h> that would cause other conflicts. */
ssize_t util_http_build_header(char * out, size_t len, ssize_t offset, ssize_t util_http_build_header(char * out, size_t len, ssize_t offset,
int cache, int cache,
int status, const char * statusmsg, int status, const char * statusmsg,
const char * contenttype, const char * charset, const char * contenttype, const char * charset,
const char * datablock, const char * datablock,
struct source_tag * source, source_t * source,
struct _client_tag * client); client_t * client);
const char *util_http_select_best(const char *input, const char *first, ...); const char *util_http_select_best(const char *input, const char *first, ...);

View File

@ -46,13 +46,10 @@
#include "common/httpp/httpp.h" #include "common/httpp/httpp.h"
#include "common/net/sock.h" #include "common/net/sock.h"
#include "connection.h" #include "xslt.h"
#include "global.h"
#include "refbuf.h" #include "refbuf.h"
#include "client.h" #include "client.h"
#include "errors.h" #include "errors.h"
#include "config.h"
#include "stats.h" #include "stats.h"
#include "fserve.h" #include "fserve.h"
#include "util.h" #include "util.h"

View File

@ -11,28 +11,10 @@
*/ */
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/debugXML.h> #include <libxml/parser.h>
#include <libxml/HTMLtree.h> #include <libxml/tree.h>
#include <libxml/xmlIO.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include "common/thread/thread.h"
#include "common/avl/avl.h"
#include "common/httpp/httpp.h"
#include "common/net/sock.h"
#include "connection.h"
#include "global.h"
#include "refbuf.h"
#include "client.h"
#include "stats.h"
#include "icecasttypes.h"
void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client); void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client);
void xslt_initialize(void); void xslt_initialize(void);

View File

@ -21,13 +21,10 @@
#include "common/thread/thread.h" #include "common/thread/thread.h"
#include "yp.h"
#include "global.h" #include "global.h"
#include "curl.h" #include "curl.h"
#include "connection.h"
#include "refbuf.h"
#include "client.h"
#include "logging.h" #include "logging.h"
#include "format.h"
#include "source.h" #include "source.h"
#include "cfgfile.h" #include "cfgfile.h"
#include "stats.h" #include "stats.h"

View File

@ -14,6 +14,8 @@
#ifndef __YP_H__ #ifndef __YP_H__
#define __YP_H__ #define __YP_H__
#include "icecasttypes.h"
#define YP_SERVER_NAME 1 #define YP_SERVER_NAME 1
#define YP_SERVER_DESC 2 #define YP_SERVER_DESC 2
#define YP_SERVER_GENRE 3 #define YP_SERVER_GENRE 3