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;
|
2005-08-11 22:40:25 -04:00
|
|
|
time_t discon_time;
|
2003-03-14 21:10:19 -05:00
|
|
|
uint64_t sent_bytes;
|
2001-09-09 22:21:46 -04: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
|
|
|
|
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);
|
2005-08-11 19:29:58 -04:00
|
|
|
connection_t *connection_create (sock_t sock, sock_t serversock, char *ip);
|
2005-08-24 20:07:17 -04:00
|
|
|
int connection_complete_source (struct source_tag *source, int response);
|
2002-08-05 10:48:04 -04:00
|
|
|
|
2005-05-08 07:54:46 -04:00
|
|
|
int connection_check_source_pass(http_parser_t *parser, const char *mount);
|
2003-03-06 09:17:33 -05:00
|
|
|
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__ */
|