source.h 984 Bytes
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3
#ifndef __SOURCE_H__
#define __SOURCE_H__

4 5
#include "config.h"
#include "yp.h"
Michael Smith's avatar
Michael Smith committed
6 7
#include "format.h"

Jack Moffitt's avatar
Jack Moffitt committed
8 9
typedef struct source_tag
{
10
    client_t *client;
Jack Moffitt's avatar
Jack Moffitt committed
11 12 13 14
	connection_t *con;
	http_parser_t *parser;
	
	char *mount;
Michael Smith's avatar
Michael Smith committed
15 16 17 18

    /* If this source drops, try to move all clients to this fallback */
    char *fallback_mount;

19 20 21 22
    /* set to zero to request the source to shutdown without causing a global
     * shutdown */
    int running;

Michael Smith's avatar
Michael Smith committed
23
	struct _format_plugin_tag *format;
Jack Moffitt's avatar
Jack Moffitt committed
24 25 26 27 28

	avl_tree *client_tree;
	avl_tree *pending_tree;

	rwlock_t *shutdown_rwlock;
29 30
	ypdata_t *ypdata[MAX_YP_DIRECTORIES];
	int	num_yp_directories;
31 32
	long listeners;
    long max_listeners;
33
    int send_return;
Jack Moffitt's avatar
Jack Moffitt committed
34 35
} source_t;

36
source_t *source_create(client_t *client, connection_t *con, http_parser_t *parser, const char *mount, format_type_t type);
Jack Moffitt's avatar
Jack Moffitt committed
37 38 39 40 41 42 43 44
source_t *source_find_mount(const char *mount);
int source_compare_sources(void *arg, void *a, void *b);
int source_free_source(void *key);
void *source_main(void *arg);

#endif