diff --git a/src/Makefile.am b/src/Makefile.am index b9ce208d..e2233d72 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,7 @@ SUBDIRS = common/avl common/net common/thread common/httpp common/log common/tim bin_PROGRAMS = icecast noinst_HEADERS = \ + icecasttypes.h \ admin.h \ main.h \ cfgfile.h \ diff --git a/src/acl.c b/src/acl.c index b8fa0393..80494572 100644 --- a/src/acl.c +++ b/src/acl.c @@ -16,6 +16,7 @@ #include "acl.h" #include "admin.h" +#include "util.h" #include diff --git a/src/acl.h b/src/acl.h index 03101a68..aec52c82 100644 --- a/src/acl.h +++ b/src/acl.h @@ -18,10 +18,7 @@ #include #include "common/httpp/httpp.h" -struct acl_tag; -typedef struct acl_tag acl_t; - -#include "admin.h" +#include "icecasttypes.h" typedef enum acl_policy_tag { /* Error on function call */ diff --git a/src/admin.c b/src/admin.c index b4edcf12..667ae59f 100644 --- a/src/admin.c +++ b/src/admin.c @@ -23,6 +23,8 @@ #include #include +#include "admin.h" +#include "compat.h" #include "cfgfile.h" #include "connection.h" #include "refbuf.h" @@ -30,16 +32,15 @@ #include "source.h" #include "global.h" #include "stats.h" -#include "compat.h" #include "xslt.h" #include "fserve.h" -#include "admin.h" #include "errors.h" #include "format.h" #include "logging.h" #include "auth.h" +#include "acl.h" #ifdef _WIN32 #define snprintf _snprintf #endif diff --git a/src/admin.h b/src/admin.h index d0770414..06945d2d 100644 --- a/src/admin.h +++ b/src/admin.h @@ -16,24 +16,9 @@ #include #include -#include - -/* 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 "refbuf.h" -#include "client.h" -#include "source.h" -#include "auth.h" /* types */ #define ADMINTYPE_ERROR (-1) diff --git a/src/auth.h b/src/auth.h index f0795ebb..12a0b17c 100644 --- a/src/auth.h +++ b/src/auth.h @@ -18,15 +18,14 @@ #include #endif -struct source_tag; -typedef struct auth_tag auth_t; - #include #include #include -#include "cfgfile.h" -#include "client.h" + #include "common/thread/thread.h" +#include "common/httpp/httpp.h" + +#include "icecasttypes.h" /* implemented */ #define AUTH_TYPE_ANONYMOUS "anonymous" @@ -58,7 +57,7 @@ typedef enum typedef struct auth_client_tag { 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_result)(client_t *client, void *userdata, auth_result result); void *userdata; @@ -89,11 +88,11 @@ struct auth_tag auth_result (*release_client)(auth_client *auth_user); /* 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 (*deleteuser)(struct auth_tag *auth, const char *username); - auth_result (*listuser)(struct auth_tag *auth, xmlNodePtr srcnode); + auth_result (*adduser)(auth_t *auth, const char *username, const char *password); + auth_result (*deleteuser)(auth_t *auth, const char *username); + auth_result (*listuser)(auth_t *auth, xmlNodePtr srcnode); mutex_t lock; int running; diff --git a/src/auth_static.c b/src/auth_static.c index 66528bfe..c5ca6880 100644 --- a/src/auth_static.c +++ b/src/auth_static.c @@ -18,6 +18,7 @@ #include #include "auth.h" +#include "cfgfile.h" #include "client.h" #include "logging.h" diff --git a/src/auth_url.c b/src/auth_url.c index 0b2bb86d..7ce87c24 100644 --- a/src/auth_url.c +++ b/src/auth_url.c @@ -72,6 +72,7 @@ #include "source.h" #include "client.h" #include "cfgfile.h" +#include "connection.h" #include "common/httpp/httpp.h" #include "logging.h" diff --git a/src/cfgfile.c b/src/cfgfile.c index fcf5b183..0b6c7b27 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -27,15 +27,13 @@ #include #include "common/thread/thread.h" + #include "cfgfile.h" #include "global.h" -#include "refbuf.h" -#include "client.h" #include "logging.h" #include "util.h" #include "auth.h" #include "event.h" -#include "tls.h" /* for config_reread_config() */ #include "yp.h" @@ -43,6 +41,7 @@ #include "stats.h" #include "connection.h" #include "main.h" +#include "slave.h" #define CATMODULE "CONFIG" #define CONFIG_DEFAULT_LOCATION "Earth" diff --git a/src/cfgfile.h b/src/cfgfile.h index cdeb4c92..9705bbb7 100644 --- a/src/cfgfile.h +++ b/src/cfgfile.h @@ -22,37 +22,13 @@ #define MAX_YP_DIRECTORIES 25 -struct _mount_proxy; - #include #include "common/thread/thread.h" #include "common/avl/avl.h" -#include "slave.h" -#include "connection.h" +#include "icecasttypes.h" #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 { /* static: headers are passed as is to the client. */ HTTP_HEADER_TYPE_STATIC @@ -79,12 +55,12 @@ typedef struct ice_config_dir_tag { struct ice_config_dir_tag *next; } ice_config_dir_t; -typedef struct _config_options { +struct _config_options { char *type; char *name; char *value; - struct _config_options *next; -} config_options_t; + config_options_t *next; +}; typedef enum _mount_type { MOUNT_TYPE_NORMAL, @@ -184,7 +160,7 @@ typedef struct _config_tls_context { char *cipher_list; } config_tls_context_t; -typedef struct ice_config_tag { +struct ice_config_tag { char *config_filename; char *location; @@ -260,7 +236,7 @@ typedef struct ice_config_tag { int yp_url_timeout[MAX_YP_DIRECTORIES]; int yp_touch_interval[MAX_YP_DIRECTORIES]; int num_yp_directories; -} ice_config_t; +}; typedef struct { rwlock_t config_lock; diff --git a/src/client.c b/src/client.c index a8863246..d80edcdf 100644 --- a/src/client.c +++ b/src/client.c @@ -42,6 +42,7 @@ #include "logging.h" #include "util.h" +#include "acl.h" /* for ADMIN_COMMAND_ERROR */ #include "admin.h" diff --git a/src/client.h b/src/client.h index c4bab286..aa9318b0 100644 --- a/src/client.h +++ b/src/client.h @@ -19,17 +19,13 @@ #ifndef __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/encoding.h" +#include "icecasttypes.h" +#include "errors.h" +#include "refbuf.h" + #define CLIENT_DEFAULT_ADMIN_FORMAT ADMIN_FORMAT_TRANSFORMED typedef enum _protocol_tag { @@ -96,19 +92,19 @@ struct _client_tag { unsigned int pos; /* auth used for this client */ - struct auth_tag *auth; + auth_t *auth; /* Format-handler-specific data for this client */ void *format_data; /* 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 */ - int (*write_to_client)(struct _client_tag *client); + int (*write_to_client)(client_t *client); /* 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); diff --git a/src/compat.h b/src/compat.h index c876601e..be12e2f2 100644 --- a/src/compat.h +++ b/src/compat.h @@ -20,6 +20,10 @@ * Solaris. */ +#ifdef HAVE_CONFIG_H +#include +#endif + #ifdef HAVE_UNISTD_H #include #endif diff --git a/src/connection.c b/src/connection.c index 734aeece..50b79aeb 100644 --- a/src/connection.c +++ b/src/connection.c @@ -33,34 +33,30 @@ #include #endif -#include "compat.h" - #include "common/thread/thread.h" #include "common/avl/avl.h" #include "common/net/sock.h" #include "common/httpp/httpp.h" +#include "compat.h" +#include "connection.h" #include "cfgfile.h" #include "global.h" #include "util.h" -#include "connection.h" #include "refbuf.h" #include "client.h" #include "errors.h" #include "stats.h" #include "logging.h" -#include "xslt.h" #include "fserve.h" -#include "sighandler.h" +#include "slave.h" -#include "yp.h" #include "source.h" -#include "format.h" -#include "format_mp3.h" #include "admin.h" #include "auth.h" #include "matchfile.h" #include "tls.h" +#include "acl.h" #define CATMODULE "connection" @@ -144,7 +140,7 @@ void connection_shutdown(void) _initialized = 0; } -void connection_reread_config(struct ice_config_tag *config) +void connection_reread_config(ice_config_t *config) { get_tls_certificate(config); } diff --git a/src/connection.h b/src/connection.h index 271b0dea..3a989d7e 100644 --- a/src/connection.h +++ b/src/connection.h @@ -19,30 +19,12 @@ #include "tls.h" +#include "icecasttypes.h" #include "compat.h" -#include "common/httpp/httpp.h" #include "common/thread/thread.h" #include "common/net/sock.h" -struct _client_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 -{ +struct connection_tag { unsigned long id; time_t con_time; @@ -55,20 +37,20 @@ typedef struct connection_tag tlsmode_t tlsmode; tls_t *tls; - int (*send)(struct connection_tag *handle, const void *buf, size_t len); - int (*read)(struct connection_tag *handle, void *buf, size_t len); + int (*send)(connection_t *handle, const void *buf, size_t len); + int (*read)(connection_t *handle, void *buf, size_t len); char *ip; -} connection_t; +}; void connection_initialize(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); -int connection_setup_sockets(struct ice_config_tag *config); +int connection_setup_sockets(ice_config_t *config); void connection_close(connection_t *con); 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_uses_tls(connection_t *con); diff --git a/src/curl.c b/src/curl.c index 95f2740e..7d44fc8d 100644 --- a/src/curl.c +++ b/src/curl.c @@ -11,6 +11,7 @@ #endif #include "curl.h" +#include "cfgfile.h" #include "logging.h" #define CATMODULE "curl" diff --git a/src/event.c b/src/event.c index 254998d9..17b1aae8 100644 --- a/src/event.c +++ b/src/event.c @@ -20,6 +20,9 @@ #include "event_url.h" #include "logging.h" #include "admin.h" +#include "connection.h" +#include "client.h" +#include "cfgfile.h" #define CATMODULE "event" diff --git a/src/event.h b/src/event.h index aafc9fc8..3ef2b497 100644 --- a/src/event.h +++ b/src/event.h @@ -9,18 +9,13 @@ #ifndef __EVENT_H__ #define __EVENT_H__ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include #include -#include "common/httpp/httpp.h" -#include "cfgfile.h" -#include "client.h" -#include "source.h" +#include "common/thread/thread.h" + +#include "icecasttypes.h" /* implemented */ #define EVENT_TYPE_LOG "log" diff --git a/src/event_exec.c b/src/event_exec.c index 488c88a9..43da2568 100644 --- a/src/event_exec.c +++ b/src/event_exec.c @@ -22,6 +22,7 @@ #include "event.h" #include "global.h" +#include "source.h" #include "logging.h" #define CATMODULE "event_exec" diff --git a/src/event_log.c b/src/event_log.c index 37905c76..36f194d2 100644 --- a/src/event_log.c +++ b/src/event_log.c @@ -13,6 +13,8 @@ #include #include "event.h" +#include "util.h" +#include "cfgfile.h" #include "logging.h" #define CATMODULE "event_log" diff --git a/src/event_url.c b/src/event_url.c index a8078dbd..7176209a 100644 --- a/src/event_url.c +++ b/src/event_url.c @@ -14,6 +14,8 @@ #include "curl.h" #include "event.h" +#include "cfgfile.h" +#include "util.h" #include "logging.h" #define CATMODULE "event_url" diff --git a/src/format.h b/src/format.h index a5733644..aa94aa68 100644 --- a/src/format.h +++ b/src/format.h @@ -20,13 +20,12 @@ #include +#include "icecasttypes.h" #include "client.h" #include "refbuf.h" +#include "cfgfile.h" #include "common/httpp/httpp.h" -struct source_tag; -struct _mount_proxy; - typedef enum _format_type_tag { FORMAT_ERROR, /* No format, source not processable */ @@ -47,13 +46,13 @@ typedef struct _format_plugin_tag uint64_t read_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); - void (*write_buf_to_file)(struct source_tag *source, refbuf_t *refbuf); - int (*create_client_data)(struct source_tag *source, client_t *client); + void (*write_buf_to_file)(source_t *source, refbuf_t *refbuf); + 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 (*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 */ vorbis_comment vc; @@ -64,16 +63,16 @@ typedef struct _format_plugin_tag format_type_t format_get_type(const char *contenttype); 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_advance_queue (struct source_tag *source, client_t *client); -int format_check_http_buffer (struct source_tag *source, client_t *client); -int format_check_file_buffer (struct source_tag *source, client_t *client); +int format_advance_queue (source_t *source, client_t *client); +int format_check_http_buffer (source_t *source, client_t *client); +int format_check_file_buffer (source_t *source, client_t *client); 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); diff --git a/src/format_mp3.c b/src/format_mp3.c index 4fa9fbd8..dae620c6 100644 --- a/src/format_mp3.c +++ b/src/format_mp3.c @@ -32,6 +32,7 @@ #include "refbuf.h" #include "source.h" #include "client.h" +#include "connection.h" #include "stats.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 void free_mp3_client_data (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 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) return; diff --git a/src/format_ogg.c b/src/format_ogg.c index d905bfce..605279f8 100644 --- a/src/format_ogg.c +++ b/src/format_ogg.c @@ -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 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 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; @@ -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; diff --git a/src/fserve.c b/src/fserve.c index 15b6a50a..75efe38c 100644 --- a/src/fserve.c +++ b/src/fserve.c @@ -47,6 +47,8 @@ #include "common/httpp/httpp.h" #include "common/net/sock.h" +#include "fserve.h" +#include "compat.h" #include "connection.h" #include "global.h" #include "refbuf.h" @@ -58,9 +60,6 @@ #include "cfgfile.h" #include "util.h" #include "admin.h" -#include "compat.h" - -#include "fserve.h" #undef CATMODULE #define CATMODULE "fserve" diff --git a/src/fserve.h b/src/fserve.h index a5035100..d2408955 100644 --- a/src/fserve.h +++ b/src/fserve.h @@ -14,7 +14,8 @@ #define __FSERVE_H__ #include -#include "cfgfile.h" + +#include "icecasttypes.h" typedef void (*fserve_callback_t)(client_t *, void *); diff --git a/src/global.h b/src/global.h index 12013a63..c7e6633a 100644 --- a/src/global.h +++ b/src/global.h @@ -22,8 +22,8 @@ #include "common/thread/thread.h" #include "common/avl/avl.h" -#include "slave.h" #include "common/net/sock.h" +#include "icecasttypes.h" typedef struct ice_global_tag { @@ -38,9 +38,9 @@ typedef struct ice_global_tag avl_tree *source_tree; /* for locally defined relays */ - struct _relay_server *relays; + relay_server *relays; /* relays retrieved from master */ - struct _relay_server *master_relays; + relay_server *master_relays; cond_t shutdown_cond; } ice_global_t; diff --git a/src/icecasttypes.h b/src/icecasttypes.h new file mode 100644 index 00000000..941c13f7 --- /dev/null +++ b/src/icecasttypes.h @@ -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 , + */ + +#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 diff --git a/src/logging.c b/src/logging.c index dd78cb9f..6ae0054a 100644 --- a/src/logging.c +++ b/src/logging.c @@ -22,13 +22,13 @@ #include "common/thread/thread.h" #include "common/httpp/httpp.h" +#include "logging.h" #include "connection.h" #include "refbuf.h" #include "client.h" #include "compat.h" #include "cfgfile.h" -#include "logging.h" #include "util.h" #ifdef _WIN32 diff --git a/src/logging.h b/src/logging.h index 3a9ebc2e..36dee18d 100644 --- a/src/logging.h +++ b/src/logging.h @@ -14,10 +14,10 @@ #ifndef __LOGGING_H__ #define __LOGGING_H__ -#include "cfgfile.h" -#include "client.h" #include "common/log/log.h" +#include "icecasttypes.h" + /* declare the global log descriptors */ extern int errorlog; diff --git a/src/main.c b/src/main.c index e8a6282e..ce8af228 100644 --- a/src/main.c +++ b/src/main.c @@ -45,7 +45,6 @@ #endif #include "common/thread/thread.h" -#include "common/avl/avl.h" #include "common/net/sock.h" #include "common/net/resolver.h" #include "common/httpp/httpp.h" diff --git a/src/matchfile.c b/src/matchfile.c index 387f7fab..5e3176a5 100644 --- a/src/matchfile.c +++ b/src/matchfile.c @@ -19,10 +19,11 @@ #include #include +#include "common/avl/avl.h" + #include "matchfile.h" #include "logging.h" #include "util.h" /* for MAX_LINE_LEN and get_line() */ -#include "common/avl/avl.h" #define CATMODULE "matchfile" struct matchfile_tag { diff --git a/src/slave.c b/src/slave.c index c42441e2..e5ede252 100644 --- a/src/slave.c +++ b/src/slave.c @@ -42,6 +42,7 @@ #include "common/net/sock.h" #include "common/httpp/httpp.h" +#include "slave.h" #include "cfgfile.h" #include "global.h" #include "util.h" diff --git a/src/slave.h b/src/slave.h index d8ff50de..b8df836d 100644 --- a/src/slave.h +++ b/src/slave.h @@ -14,8 +14,9 @@ #define __SLAVE_H__ #include "common/thread/thread.h" +#include "icecasttypes.h" -typedef struct _relay_server { +struct _relay_server { char *server; int port; char *mount; @@ -23,16 +24,15 @@ typedef struct _relay_server { char *password; char *localmount; char *bind; - struct source_tag *source; + source_t *source; int mp3metadata; int on_demand; int running; int cleanup; time_t start; thread_type *thread; - struct _relay_server *next; -} relay_server; - + relay_server *next; +}; void slave_initialize(void); void slave_shutdown(void); diff --git a/src/source.c b/src/source.c index b7ace96a..ef8aa347 100644 --- a/src/source.c +++ b/src/source.c @@ -42,8 +42,9 @@ #include "common/thread/thread.h" #include "common/avl/avl.h" #include "common/httpp/httpp.h" -#include "common/net/sock.h" +#include "source.h" +#include "compat.h" #include "connection.h" #include "global.h" #include "refbuf.h" @@ -53,12 +54,12 @@ #include "logging.h" #include "cfgfile.h" #include "util.h" -#include "source.h" #include "format.h" #include "fserve.h" #include "auth.h" #include "event.h" -#include "compat.h" +#include "slave.h" +#include "acl.h" #undef CATMODULE #define CATMODULE "source" diff --git a/src/source.h b/src/source.h index c34d99a3..adb5f835 100644 --- a/src/source.h +++ b/src/source.h @@ -14,16 +14,16 @@ #ifndef __SOURCE_H__ #define __SOURCE_H__ -typedef struct source_tag source_t; +#include -#include "cfgfile.h" +#include "common/thread/thread.h" +#include "common/httpp/httpp.h" + +#include "icecasttypes.h" #include "yp.h" #include "util.h" #include "format.h" #include "playlist.h" -#include "common/thread/thread.h" - -#include struct source_tag { mutex_t lock; diff --git a/src/stats.c b/src/stats.c index a77d82b1..79c82798 100644 --- a/src/stats.c +++ b/src/stats.c @@ -30,14 +30,13 @@ #include "common/httpp/httpp.h" #include "common/net/sock.h" +#include "stats.h" #include "connection.h" - #include "source.h" #include "global.h" #include "refbuf.h" #include "client.h" #include "admin.h" -#include "stats.h" #include "xslt.h" #include "util.h" #include "auth.h" diff --git a/src/stats.h b/src/stats.h index ae70318c..3ec72214 100644 --- a/src/stats.h +++ b/src/stats.h @@ -13,14 +13,13 @@ #ifndef __STATS_H__ #define __STATS_H__ -#include "cfgfile.h" -#include "connection.h" -#include "common/httpp/httpp.h" -#include "client.h" #include #include #include +#include "icecasttypes.h" +#include "cfgfile.h" +#include "refbuf.h" typedef struct _stats_node_tag { diff --git a/src/tls.c b/src/tls.c index 360e9280..94922f88 100644 --- a/src/tls.c +++ b/src/tls.c @@ -14,6 +14,11 @@ #include #endif +#ifdef HAVE_OPENSSL +#include +#include +#endif + #include #include diff --git a/src/tls.h b/src/tls.h index 50edf047..4ba505ac 100644 --- a/src/tls.h +++ b/src/tls.h @@ -9,11 +9,6 @@ #ifndef __TLS_H__ #define __TLS_H__ -#ifdef HAVE_OPENSSL -#include -#include -#endif - #include "common/net/sock.h" /* Do we have TLS Support? */ diff --git a/src/util.c b/src/util.c index abc2aaad..da1675c3 100644 --- a/src/util.c +++ b/src/util.c @@ -41,12 +41,12 @@ #include "common/net/sock.h" #include "common/thread/thread.h" -#include "cfgfile.h" +#include "util.h" #include "compat.h" +#include "cfgfile.h" #include "refbuf.h" #include "connection.h" #include "client.h" -#include "util.h" #include "source.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, const char * contenttype, const char * charset, const char * datablock, - struct source_tag * source, struct _client_tag * client) { + source_t * source, client_t * client) { const char * http_version = "1.0"; ice_config_t *config; time_t now; diff --git a/src/util.h b/src/util.h index cdc30fbe..299e0123 100644 --- a/src/util.h +++ b/src/util.h @@ -17,6 +17,9 @@ /* for FILE* */ #include +#include "common/net/sock.h" +#include "icecasttypes.h" + #define UNKNOWN_CONTENT 0 #define XSLT_CONTENT 1 #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. * Returns the number of bytes written or -1 on error. */ -struct source_tag; /* use forward decleration so we do not need to - * include that would cause other conflicts. */ ssize_t util_http_build_header(char * out, size_t len, ssize_t offset, int cache, int status, const char * statusmsg, const char * contenttype, const char * charset, const char * datablock, - struct source_tag * source, - struct _client_tag * client); + source_t * source, + client_t * client); const char *util_http_select_best(const char *input, const char *first, ...); diff --git a/src/xslt.c b/src/xslt.c index 09af35b4..8dd35969 100644 --- a/src/xslt.c +++ b/src/xslt.c @@ -46,13 +46,10 @@ #include "common/httpp/httpp.h" #include "common/net/sock.h" -#include "connection.h" - -#include "global.h" +#include "xslt.h" #include "refbuf.h" #include "client.h" #include "errors.h" -#include "config.h" #include "stats.h" #include "fserve.h" #include "util.h" diff --git a/src/xslt.h b/src/xslt.h index 841ceb20..97e771bd 100644 --- a/src/xslt.h +++ b/src/xslt.h @@ -11,28 +11,10 @@ */ #include -#include -#include -#include -#include -#include -#include -#include - - -#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 +#include +#include "icecasttypes.h" void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client); void xslt_initialize(void); diff --git a/src/yp.c b/src/yp.c index 3effbe9d..8954f5a5 100644 --- a/src/yp.c +++ b/src/yp.c @@ -21,13 +21,10 @@ #include "common/thread/thread.h" +#include "yp.h" #include "global.h" #include "curl.h" -#include "connection.h" -#include "refbuf.h" -#include "client.h" #include "logging.h" -#include "format.h" #include "source.h" #include "cfgfile.h" #include "stats.h" diff --git a/src/yp.h b/src/yp.h index 040ebc18..40d43844 100644 --- a/src/yp.h +++ b/src/yp.h @@ -14,6 +14,8 @@ #ifndef __YP_H__ #define __YP_H__ +#include "icecasttypes.h" + #define YP_SERVER_NAME 1 #define YP_SERVER_DESC 2 #define YP_SERVER_GENRE 3