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).
|
2012-10-11 18:54:53 -04:00
|
|
|
* Copyright 2011-2012, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
2004-01-28 20:02:12 -05:00
|
|
|
*/
|
|
|
|
|
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-08-07 19:01:04 -04:00
|
|
|
/* auth completed, 0 not yet, 1 passed */
|
|
|
|
int authenticated;
|
|
|
|
|
2005-08-07 10:50:59 -04:00
|
|
|
/* is client getting intro data */
|
|
|
|
long intro_offset;
|
2005-06-03 11:35:52 -04:00
|
|
|
|
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 */
|
2007-12-15 12:02:16 -05:00
|
|
|
unsigned int pos;
|
2002-12-29 03:10:10 -05:00
|
|
|
|
2005-08-07 19:01:04 -04:00
|
|
|
/* auth used for this client */
|
|
|
|
struct auth_tag *auth;
|
|
|
|
|
2004-01-14 20:01:09 -05:00
|
|
|
/* Client username, if authenticated */
|
|
|
|
char *username;
|
|
|
|
|
2005-08-07 19:01:04 -04:00
|
|
|
/* Client password, if authenticated */
|
|
|
|
char *password;
|
|
|
|
|
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
|
|
|
|
2005-06-07 21:36:51 -04:00
|
|
|
/* write out data associated with client */
|
|
|
|
int (*write_to_client)(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;
|
|
|
|
|
2005-08-11 19:29:58 -04:00
|
|
|
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
|
2001-09-09 22:21:46 -04:00
|
|
|
void client_destroy(client_t *client);
|
2014-11-21 13:05:17 -05:00
|
|
|
void client_send_error(client_t *client, int status, int plain, const char *message);
|
2014-01-12 07:29:27 -05:00
|
|
|
void client_send_100(client_t *client);
|
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);
|
2009-01-13 20:18:22 -05:00
|
|
|
int client_check_source_auth (client_t *client, const char *mount);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#endif /* __CLIENT_H__ */
|