2004-01-28 20:02:12 -05:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
#ifndef __SOURCE_H__
|
|
|
|
#define __SOURCE_H__
|
|
|
|
|
2003-07-20 21:58:54 -04:00
|
|
|
#include "cfgfile.h"
|
2003-02-02 09:33:17 -05:00
|
|
|
#include "yp.h"
|
2003-02-26 18:52:23 -05:00
|
|
|
#include "util.h"
|
2002-12-30 02:55:56 -05:00
|
|
|
#include "format.h"
|
|
|
|
|
2003-03-02 05:13:59 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2004-01-14 20:01:09 -05:00
|
|
|
struct auth_tag;
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
typedef struct source_tag
|
|
|
|
{
|
2002-08-16 10:26:48 -04:00
|
|
|
client_t *client;
|
2003-03-14 21:10:19 -05:00
|
|
|
connection_t *con;
|
|
|
|
http_parser_t *parser;
|
|
|
|
|
|
|
|
char *mount;
|
2002-12-30 10:19:46 -05:00
|
|
|
|
|
|
|
/* If this source drops, try to move all clients to this fallback */
|
|
|
|
char *fallback_mount;
|
|
|
|
|
2003-02-06 08:10:48 -05:00
|
|
|
/* set to zero to request the source to shutdown without causing a global
|
|
|
|
* shutdown */
|
|
|
|
int running;
|
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
struct _format_plugin_tag *format;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
avl_tree *client_tree;
|
|
|
|
avl_tree *pending_tree;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
rwlock_t *shutdown_rwlock;
|
2003-02-26 18:52:23 -05:00
|
|
|
util_dict *audio_info;
|
2003-03-02 05:13:59 -05:00
|
|
|
|
|
|
|
char *dumpfilename; /* Name of a file to dump incoming stream to */
|
|
|
|
FILE *dumpfile;
|
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
long listeners;
|
2003-02-11 09:23:34 -05:00
|
|
|
long max_listeners;
|
2003-06-26 09:32:04 -04:00
|
|
|
int yp_public;
|
2004-11-21 10:51:49 -05:00
|
|
|
int yp_prevent;
|
2004-01-14 20:01:09 -05:00
|
|
|
struct auth_tag *authenticator;
|
|
|
|
int fallback_override;
|
|
|
|
int no_mount;
|
2004-11-11 10:47:33 -05:00
|
|
|
int shoutcast_compat;
|
2004-08-20 11:13:59 -04:00
|
|
|
|
|
|
|
/* per source burst handling for connecting clients */
|
|
|
|
unsigned int burst_size; /* trigger level for burst on connect */
|
|
|
|
unsigned int burst_offset;
|
|
|
|
refbuf_t *burst_point;
|
|
|
|
|
|
|
|
unsigned int queue_size;
|
|
|
|
unsigned int queue_size_limit;
|
|
|
|
|
2004-02-26 06:56:48 -05:00
|
|
|
unsigned timeout; /* source timeout in seconds */
|
2004-11-22 13:21:48 -05:00
|
|
|
int hidden;
|
2004-08-20 11:13:59 -04:00
|
|
|
time_t last_read;
|
|
|
|
int short_delay;
|
|
|
|
|
|
|
|
refbuf_t *stream_data;
|
|
|
|
refbuf_t *stream_data_tail;
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
} source_t;
|
|
|
|
|
2004-02-19 11:32:26 -05:00
|
|
|
source_t *source_reserve (const char *mount);
|
|
|
|
void *source_client_thread (void *arg);
|
|
|
|
void source_apply_mount (source_t *source, mount_proxy *mountinfo);
|
|
|
|
void source_clear_source (source_t *source);
|
2001-09-09 22:21:46 -04:00
|
|
|
source_t *source_find_mount(const char *mount);
|
2004-01-14 20:01:09 -05:00
|
|
|
source_t *source_find_mount_raw(const char *mount);
|
2003-03-30 08:52:27 -05:00
|
|
|
client_t *source_find_client(source_t *source, int id);
|
2001-09-09 22:21:46 -04:00
|
|
|
int source_compare_sources(void *arg, void *a, void *b);
|
2004-02-27 10:15:40 -05:00
|
|
|
void source_free_source(source_t *source);
|
2004-01-29 11:46:54 -05:00
|
|
|
void source_move_clients (source_t *source, source_t *dest);
|
2003-03-14 02:59:58 -05:00
|
|
|
int source_remove_client(void *key);
|
2004-02-26 11:51:43 -05:00
|
|
|
void source_main(source_t *source);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2004-01-29 11:46:54 -05:00
|
|
|
extern mutex_t move_clients_mutex;
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|