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
|
|
|
/* client.h
|
|
|
|
**
|
|
|
|
** client data structions and function definitions
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
#ifndef __CLIENT_H__
|
|
|
|
#define __CLIENT_H__
|
|
|
|
|
2002-12-30 02:55:56 -05:00
|
|
|
#include "connection.h"
|
2004-01-14 20:01:09 -05:00
|
|
|
#include "refbuf.h"
|
|
|
|
#include "httpp/httpp.h"
|
2002-12-30 02:55:56 -05:00
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
typedef struct _client_tag
|
|
|
|
{
|
2004-01-14 20:01:09 -05:00
|
|
|
/* the client's connection */
|
2003-03-14 21:10:19 -05:00
|
|
|
connection_t *con;
|
2004-01-14 20:01:09 -05:00
|
|
|
/* the client's http headers */
|
2003-03-14 21:10:19 -05:00
|
|
|
http_parser_t *parser;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
/* http response code for this client */
|
|
|
|
int respcode;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2005-06-03 11:35:52 -04:00
|
|
|
/* is client getting intro data */
|
|
|
|
long intro_offset;
|
|
|
|
|
2004-08-20 11:13:59 -04:00
|
|
|
/* where in the queue the client is */
|
|
|
|
refbuf_t *refbuf;
|
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
/* position in first buffer */
|
|
|
|
unsigned long pos;
|
2002-12-29 03:10:10 -05:00
|
|
|
|
2004-01-14 20:01:09 -05:00
|
|
|
/* Client username, if authenticated */
|
|
|
|
char *username;
|
|
|
|
|
2002-12-29 03:10:10 -05:00
|
|
|
/* Format-handler-specific data for this client */
|
|
|
|
void *format_data;
|
2004-02-29 09:38:15 -05:00
|
|
|
|
|
|
|
/* function to call to release format specific resources */
|
|
|
|
void (*free_client_data)(struct _client_tag *client);
|
2005-06-03 11:35:52 -04:00
|
|
|
|
|
|
|
/* function to check if refbuf needs updating */
|
|
|
|
int (*check_buffer)(struct source_tag *source, struct _client_tag *client);
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
} client_t;
|
|
|
|
|
|
|
|
client_t *client_create(connection_t *con, http_parser_t *parser);
|
|
|
|
void client_destroy(client_t *client);
|
2003-03-02 05:13:59 -05:00
|
|
|
void client_send_504(client_t *client, char *message);
|
2002-08-12 10:48:31 -04:00
|
|
|
void client_send_404(client_t *client, char *message);
|
2002-08-16 10:26:48 -04:00
|
|
|
void client_send_401(client_t *client);
|
2004-05-17 00:33:46 -04:00
|
|
|
void client_send_403(client_t *client);
|
2002-12-31 01:28:39 -05:00
|
|
|
void client_send_400(client_t *client, char *message);
|
2004-07-16 11:47:12 -04:00
|
|
|
int client_send_bytes (client_t *client, const void *buf, unsigned len);
|
2005-05-08 09:51:05 -04:00
|
|
|
int client_read_bytes (client_t *client, void *buf, unsigned len);
|
2004-08-20 11:13:59 -04:00
|
|
|
void client_set_queue (client_t *client, refbuf_t *refbuf);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#endif /* __CLIENT_H__ */
|