connection.h 726 Bytes
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3
#ifndef __CONNECTION_H__
#define __CONNECTION_H__

4 5
#include <sys/types.h>
#include "compat.h"
6 7 8
#include "httpp.h"
#include "thread.h"
#include "sock.h"
9

10 11
struct _client_tag;

Jack Moffitt's avatar
Jack Moffitt committed
12 13 14 15 16
typedef struct connection_tag
{
	unsigned long id;

	time_t con_time;
17
	uint64_t sent_bytes;
Jack Moffitt's avatar
Jack Moffitt committed
18 19 20 21 22 23 24 25 26 27 28 29

	int sock;
	int error;

	char *ip;
	char *host;
} connection_t;

void connection_initialize(void);
void connection_shutdown(void);
void connection_accept_loop(void);
void connection_close(connection_t *con);
30
connection_t *create_connection(sock_t sock, char *ip);
31 32
int connection_create_source(struct _client_tag *client, connection_t *con, 
        http_parser_t *parser, char *mount);
33 34

extern rwlock_t _source_shutdown_rwlock;
Jack Moffitt's avatar
Jack Moffitt committed
35 36

#endif  /* __CONNECTION_H__ */