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 __CONNECTION_H__
|
|
|
|
#define __CONNECTION_H__
|
|
|
|
|
2001-10-20 17:28:09 -04:00
|
|
|
#include <sys/types.h>
|
2004-01-14 20:01:09 -05:00
|
|
|
#include <time.h>
|
2001-10-20 17:28:09 -04:00
|
|
|
#include "compat.h"
|
2003-07-16 15:41:59 -04:00
|
|
|
#include "httpp/httpp.h"
|
|
|
|
#include "thread/thread.h"
|
|
|
|
#include "net/sock.h"
|
2001-10-20 02:51:29 -04:00
|
|
|
|
2002-08-16 10:26:48 -04:00
|
|
|
struct _client_tag;
|
2004-02-19 11:32:26 -05:00
|
|
|
struct source_tag;
|
2002-08-16 10:26:48 -04:00
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
typedef struct connection_tag
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
unsigned long id;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
time_t con_time;
|
|
|
|
uint64_t sent_bytes;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2004-01-14 20:01:09 -05:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
int sock;
|
2003-04-23 08:44:29 -04:00
|
|
|
int serversock;
|
2003-03-14 21:10:19 -05:00
|
|
|
int error;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
char *ip;
|
|
|
|
char *host;
|
2003-03-05 08:03:35 -05:00
|
|
|
|
|
|
|
/* For 'fake' connections */
|
|
|
|
int event_number;
|
|
|
|
void *event;
|
2001-09-09 22:21:46 -04:00
|
|
|
} connection_t;
|
|
|
|
|
|
|
|
void connection_initialize(void);
|
|
|
|
void connection_shutdown(void);
|
|
|
|
void connection_accept_loop(void);
|
|
|
|
void connection_close(connection_t *con);
|
2003-04-23 08:44:29 -04:00
|
|
|
connection_t *create_connection(sock_t sock, sock_t serversock, char *ip);
|
2004-02-19 11:32:26 -05:00
|
|
|
int connection_complete_source (struct source_tag *source);
|
2002-08-05 10:48:04 -04:00
|
|
|
|
2003-03-05 08:03:35 -05:00
|
|
|
void connection_inject_event(int eventnum, void *event_data);
|
|
|
|
|
2003-03-06 09:17:33 -05:00
|
|
|
int connection_check_source_pass(http_parser_t *parser, char *mount);
|
|
|
|
int connection_check_relay_pass(http_parser_t *parser);
|
|
|
|
int connection_check_admin_pass(http_parser_t *parser);
|
|
|
|
|
2002-08-05 10:48:04 -04:00
|
|
|
extern rwlock_t _source_shutdown_rwlock;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#endif /* __CONNECTION_H__ */
|