2004-01-29 01:02:12 +00: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-10 02:21:46 +00:00
|
|
|
#ifndef __CONNECTION_H__
|
|
|
|
#define __CONNECTION_H__
|
|
|
|
|
2001-10-20 21:28:09 +00:00
|
|
|
#include <sys/types.h>
|
2004-01-15 01:01:09 +00:00
|
|
|
#include <time.h>
|
2007-08-29 03:51:22 +00:00
|
|
|
#ifdef HAVE_OPENSSL
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
#endif
|
|
|
|
|
2001-10-20 21:28:09 +00:00
|
|
|
#include "compat.h"
|
2003-07-16 19:41:59 +00:00
|
|
|
#include "httpp/httpp.h"
|
|
|
|
#include "thread/thread.h"
|
|
|
|
#include "net/sock.h"
|
2001-10-20 06:51:29 +00:00
|
|
|
|
2002-08-16 14:26:48 +00:00
|
|
|
struct _client_tag;
|
2004-02-19 16:32:26 +00:00
|
|
|
struct source_tag;
|
2007-10-16 01:53:06 +00:00
|
|
|
struct ice_config_tag;
|
2002-08-16 14:26:48 +00:00
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
typedef struct connection_tag
|
|
|
|
{
|
2003-03-15 02:10:19 +00:00
|
|
|
unsigned long id;
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2003-03-15 02:10:19 +00:00
|
|
|
time_t con_time;
|
2005-08-12 02:40:25 +00:00
|
|
|
time_t discon_time;
|
2003-03-15 02:10:19 +00:00
|
|
|
uint64_t sent_bytes;
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2003-03-15 02:10:19 +00:00
|
|
|
int sock;
|
2003-04-23 12:44:29 +00:00
|
|
|
int serversock;
|
2003-03-15 02:10:19 +00:00
|
|
|
int error;
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2007-08-29 03:51:22 +00:00
|
|
|
#ifdef HAVE_OPENSSL
|
|
|
|
SSL *ssl; /* SSL handler */
|
|
|
|
#endif
|
|
|
|
int (*send)(struct connection_tag *handle, const void *buf, size_t len);
|
|
|
|
int (*read)(struct connection_tag *handle, void *buf, size_t len);
|
|
|
|
|
2003-03-15 02:10:19 +00:00
|
|
|
char *ip;
|
|
|
|
char *host;
|
2003-03-05 13:03:35 +00:00
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
} connection_t;
|
|
|
|
|
|
|
|
void connection_initialize(void);
|
|
|
|
void connection_shutdown(void);
|
|
|
|
void connection_accept_loop(void);
|
2007-10-16 01:53:06 +00:00
|
|
|
int connection_setup_sockets (struct ice_config_tag *config);
|
2001-09-10 02:21:46 +00:00
|
|
|
void connection_close(connection_t *con);
|
2005-08-11 23:29:58 +00:00
|
|
|
connection_t *connection_create (sock_t sock, sock_t serversock, char *ip);
|
2005-08-25 00:07:17 +00:00
|
|
|
int connection_complete_source (struct source_tag *source, int response);
|
2002-08-05 14:48:04 +00:00
|
|
|
|
2005-05-08 11:54:46 +00:00
|
|
|
int connection_check_source_pass(http_parser_t *parser, const char *mount);
|
2003-03-06 14:17:33 +00:00
|
|
|
int connection_check_relay_pass(http_parser_t *parser);
|
|
|
|
int connection_check_admin_pass(http_parser_t *parser);
|
|
|
|
|
2002-08-05 14:48:04 +00:00
|
|
|
extern rwlock_t _source_shutdown_rwlock;
|
2001-09-10 02:21:46 +00:00
|
|
|
|
|
|
|
#endif /* __CONNECTION_H__ */
|