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).
|
2018-04-28 09:49:36 -04:00
|
|
|
* Copyright 2011-2018, 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
|
2014-11-30 15:32:30 -05:00
|
|
|
**
|
|
|
|
** client data structions and function definitions
|
|
|
|
**
|
|
|
|
*/
|
2001-09-09 22:21:46 -04:00
|
|
|
#ifndef __CLIENT_H__
|
|
|
|
#define __CLIENT_H__
|
|
|
|
|
2018-06-17 08:28:38 -04:00
|
|
|
#include "common/httpp/httpp.h"
|
|
|
|
#include "common/httpp/encoding.h"
|
|
|
|
|
2018-06-17 06:12:15 -04:00
|
|
|
#include "icecasttypes.h"
|
2018-05-26 02:29:10 -04:00
|
|
|
#include "errors.h"
|
2004-01-14 20:01:09 -05:00
|
|
|
#include "refbuf.h"
|
2018-05-28 10:04:07 -04:00
|
|
|
#include "module.h"
|
2002-12-30 02:55:56 -05:00
|
|
|
|
2018-06-29 11:25:12 -04:00
|
|
|
#define CLIENT_DEFAULT_REPORT_XSL_HTML "report-html.xsl"
|
2018-06-27 08:45:27 -04:00
|
|
|
#define CLIENT_DEFAULT_REPORT_XSL_PLAINTEXT "report-plaintext.xsl"
|
2018-06-29 11:25:12 -04:00
|
|
|
#define CLIENT_DEFAULT_ERROR_XSL_HTML "error-html.xsl"
|
2018-06-27 12:07:21 -04:00
|
|
|
#define CLIENT_DEFAULT_ERROR_XSL_PLAINTEXT "error-plaintext.xsl"
|
2018-06-29 11:25:12 -04:00
|
|
|
#define CLIENT_DEFAULT_ADMIN_FORMAT ADMIN_FORMAT_HTML
|
2018-06-09 05:54:38 -04:00
|
|
|
|
2018-06-27 08:45:27 -04:00
|
|
|
typedef enum _document_domain_tag {
|
|
|
|
DOCUMENT_DOMAIN_WEB,
|
|
|
|
DOCUMENT_DOMAIN_ADMIN
|
|
|
|
} document_domain_t;
|
|
|
|
|
Wow. Mega patch!
This patch *replaces* the authentication system completly.
What is new:
- <authentication> in mount section is now a container object.
- <authentication> in root and mount section may hold any number of <role>-Tags.
- <role> tags:
Those tags define a 'role' and it's ACL rules.
A role is a instance of an authentication module (see below).
<role> takes the following options. All but type are optional.
- authentication related:
- type: Type of the authentication module (values: anonymous, static, legacy-password, url or htpasswd;
symbolic constants in auth.h)
- name: Name for the role. For later matching. (values: any string; default: (none))
- method: This rule is only active on the given list of HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- ACL related:
- allow-method: Allowed HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: get)
- deny-method: Rejected HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- allow-admin: Allowed admin commands. (list of enum values: admin command; default: buildm3u)
- deny-admin: Rejected admin commands. (list of enum values: admin command; default: *)
- allow-web: Allowed web pages. (values: empty or *; default: *)
- deny-web: Rejected web pages. (values: empty or *; default: (empty))
- connections-per-user: maximum number of simultaneous connections per role and username.
This is only active on active sources. (values: unlimited or number of connections; default: unlimited)
- connection-duration: maximum time of a connection. This is only active on active sources.
(values: unlimited or number of secounds; default: unlimited)
<role> takes <option> child tags. <option> tags contain a name and a value option.
Meaning of <option> tags is up to the authentication module.
- <role>s are considered to build a stack. If a role returns with AUTH_NOMATCH the next one will be tried.
- <role>s are tested in this order: mount specific, default mount specific, global, internal fallback.
Internal fallback is set to allow web/ access via GET, POST and HEAD (only GET supported by this time)
and rejects all other requests.
- New authentication module: anonymous
This module matches all requests. No options taken.
- New authentication module: static
This module matches with a static username and password.
It takes two <option>s. One with name="username" and one with name="password" to set username and password.
This replaces old style <*-username> and <*-password> tags.
- New authentication module: legacy-password
This module matches with a statich password.
It takes one <option> with name="password" to set password.
This replaces old ICE and ICY (shoutcast compat mode) authentication.
- Parsing <authentication> in <mount> with a type set in a special way to allow 100% backward compatibility.
- Parsing of <source-password>, <admin-password>, <admin-user>, <relay-password> and <relay-user> in global
<authentication> for 100% backward compatibility.
- <alias> is now proccessed very early. This enables them to be used for all kinds of requests.
To Do List & What does not yet work:
- type="url" auth: mount_add and mount_remove.
This should be replaced by an unique feature I would call '<event>'.
- Admin commands manageauth and manageauth.xsl are disabled as they need more review:
This code needs to be ported to support multiple <role>s per <mount>.
- url authentication module can not yet return AUTH_NOMATCH.
This needs to be reviewed and discussed on how to handle this case best way.
- Default config files needs to be updated to reflect the changes.
As this is quite some political act it should be done in dicussion with the whole team
and permission of the release manager.
- Docs need to be updated to reflect the changes.
How does it work:
Code has been changed so that authentification is done early for all clients.
This allows accessing the ACL data (client->acl) from nearly everywhere in the code.
After accept() and initial client setup the request is parsed. In the next step
all <alias>es are resolved. After this the client is passed for authentication.
After authentication it is passed to the corresponding subsystem depending on kind of request.
All authentication instances have a thread running for doing the authentication.
This thread works on a queue of clients.
Hints for testers:
- Test with default config.
- Test with diffrent authentication modules in <mount>.
- Test shoutcast compatibility mode.
- Test with new style <authentication> and any amount of <role> (zero to quite some).
- Test <alias> lookup on all kinds of objects.
- Test source level credential login into the admin interface.
- Test shoucast style meta data updates.
- Test playlist generation.
Thank you for reading this long commit message. Have fun reading the full patch!
svn path=/icecast/trunk/icecast/; revision=19358
2014-11-28 18:46:08 -05:00
|
|
|
typedef enum _protocol_tag {
|
|
|
|
ICECAST_PROTOCOL_HTTP = 0,
|
|
|
|
ICECAST_PROTOCOL_SHOUTCAST
|
|
|
|
} protocol_t;
|
|
|
|
|
2015-02-01 18:04:54 -05:00
|
|
|
typedef enum _reuse_tag {
|
|
|
|
/* do not reuse */
|
|
|
|
ICECAST_REUSE_CLOSE = 0,
|
|
|
|
/* reuse */
|
2015-02-01 19:34:45 -05:00
|
|
|
ICECAST_REUSE_KEEPALIVE,
|
|
|
|
/* Upgrade to TLS */
|
|
|
|
ICECAST_REUSE_UPGRADETLS
|
2015-02-01 18:04:54 -05:00
|
|
|
} reuse_t;
|
|
|
|
|
2018-06-18 07:05:23 -04:00
|
|
|
typedef enum {
|
|
|
|
CLIENT_SLURP_ERROR,
|
|
|
|
CLIENT_SLURP_NEEDS_MORE_DATA,
|
|
|
|
CLIENT_SLURP_BUFFER_TO_SMALL,
|
|
|
|
CLIENT_SLURP_SUCCESS
|
|
|
|
} client_slurp_result_t;
|
|
|
|
|
2018-05-25 07:42:08 -04:00
|
|
|
struct _client_tag {
|
2014-12-18 04:56:54 -05:00
|
|
|
/* mode of operation for this client */
|
|
|
|
operation_mode mode;
|
|
|
|
|
2004-01-14 20:01:09 -05:00
|
|
|
/* the client's connection */
|
2003-03-14 21:10:19 -05:00
|
|
|
connection_t *con;
|
2015-02-01 18:04:54 -05:00
|
|
|
|
|
|
|
/* Reuse this connection ... */
|
|
|
|
reuse_t reuse;
|
|
|
|
|
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
|
|
|
|
2015-02-10 16:18:52 -05:00
|
|
|
/* Transfer Encoding if any */
|
|
|
|
httpp_encoding_t *encoding;
|
|
|
|
|
Wow. Mega patch!
This patch *replaces* the authentication system completly.
What is new:
- <authentication> in mount section is now a container object.
- <authentication> in root and mount section may hold any number of <role>-Tags.
- <role> tags:
Those tags define a 'role' and it's ACL rules.
A role is a instance of an authentication module (see below).
<role> takes the following options. All but type are optional.
- authentication related:
- type: Type of the authentication module (values: anonymous, static, legacy-password, url or htpasswd;
symbolic constants in auth.h)
- name: Name for the role. For later matching. (values: any string; default: (none))
- method: This rule is only active on the given list of HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- ACL related:
- allow-method: Allowed HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: get)
- deny-method: Rejected HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- allow-admin: Allowed admin commands. (list of enum values: admin command; default: buildm3u)
- deny-admin: Rejected admin commands. (list of enum values: admin command; default: *)
- allow-web: Allowed web pages. (values: empty or *; default: *)
- deny-web: Rejected web pages. (values: empty or *; default: (empty))
- connections-per-user: maximum number of simultaneous connections per role and username.
This is only active on active sources. (values: unlimited or number of connections; default: unlimited)
- connection-duration: maximum time of a connection. This is only active on active sources.
(values: unlimited or number of secounds; default: unlimited)
<role> takes <option> child tags. <option> tags contain a name and a value option.
Meaning of <option> tags is up to the authentication module.
- <role>s are considered to build a stack. If a role returns with AUTH_NOMATCH the next one will be tried.
- <role>s are tested in this order: mount specific, default mount specific, global, internal fallback.
Internal fallback is set to allow web/ access via GET, POST and HEAD (only GET supported by this time)
and rejects all other requests.
- New authentication module: anonymous
This module matches all requests. No options taken.
- New authentication module: static
This module matches with a static username and password.
It takes two <option>s. One with name="username" and one with name="password" to set username and password.
This replaces old style <*-username> and <*-password> tags.
- New authentication module: legacy-password
This module matches with a statich password.
It takes one <option> with name="password" to set password.
This replaces old ICE and ICY (shoutcast compat mode) authentication.
- Parsing <authentication> in <mount> with a type set in a special way to allow 100% backward compatibility.
- Parsing of <source-password>, <admin-password>, <admin-user>, <relay-password> and <relay-user> in global
<authentication> for 100% backward compatibility.
- <alias> is now proccessed very early. This enables them to be used for all kinds of requests.
To Do List & What does not yet work:
- type="url" auth: mount_add and mount_remove.
This should be replaced by an unique feature I would call '<event>'.
- Admin commands manageauth and manageauth.xsl are disabled as they need more review:
This code needs to be ported to support multiple <role>s per <mount>.
- url authentication module can not yet return AUTH_NOMATCH.
This needs to be reviewed and discussed on how to handle this case best way.
- Default config files needs to be updated to reflect the changes.
As this is quite some political act it should be done in dicussion with the whole team
and permission of the release manager.
- Docs need to be updated to reflect the changes.
How does it work:
Code has been changed so that authentification is done early for all clients.
This allows accessing the ACL data (client->acl) from nearly everywhere in the code.
After accept() and initial client setup the request is parsed. In the next step
all <alias>es are resolved. After this the client is passed for authentication.
After authentication it is passed to the corresponding subsystem depending on kind of request.
All authentication instances have a thread running for doing the authentication.
This thread works on a queue of clients.
Hints for testers:
- Test with default config.
- Test with diffrent authentication modules in <mount>.
- Test shoutcast compatibility mode.
- Test with new style <authentication> and any amount of <role> (zero to quite some).
- Test <alias> lookup on all kinds of objects.
- Test source level credential login into the admin interface.
- Test shoucast style meta data updates.
- Test playlist generation.
Thank you for reading this long commit message. Have fun reading the full patch!
svn path=/icecast/trunk/icecast/; revision=19358
2014-11-28 18:46:08 -05:00
|
|
|
/* protocol client uses */
|
|
|
|
protocol_t protocol;
|
|
|
|
|
2018-06-18 05:48:57 -04:00
|
|
|
/* http request body length
|
|
|
|
* -1 for streaming (e.g. chunked), 0 for no body, >0 for NNN bytes
|
|
|
|
*/
|
|
|
|
ssize_t request_body_length;
|
|
|
|
|
|
|
|
/* http request body length read so far */
|
|
|
|
size_t request_body_read;
|
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
/* http response code for this client */
|
|
|
|
int respcode;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
Wow. Mega patch!
This patch *replaces* the authentication system completly.
What is new:
- <authentication> in mount section is now a container object.
- <authentication> in root and mount section may hold any number of <role>-Tags.
- <role> tags:
Those tags define a 'role' and it's ACL rules.
A role is a instance of an authentication module (see below).
<role> takes the following options. All but type are optional.
- authentication related:
- type: Type of the authentication module (values: anonymous, static, legacy-password, url or htpasswd;
symbolic constants in auth.h)
- name: Name for the role. For later matching. (values: any string; default: (none))
- method: This rule is only active on the given list of HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- ACL related:
- allow-method: Allowed HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: get)
- deny-method: Rejected HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- allow-admin: Allowed admin commands. (list of enum values: admin command; default: buildm3u)
- deny-admin: Rejected admin commands. (list of enum values: admin command; default: *)
- allow-web: Allowed web pages. (values: empty or *; default: *)
- deny-web: Rejected web pages. (values: empty or *; default: (empty))
- connections-per-user: maximum number of simultaneous connections per role and username.
This is only active on active sources. (values: unlimited or number of connections; default: unlimited)
- connection-duration: maximum time of a connection. This is only active on active sources.
(values: unlimited or number of secounds; default: unlimited)
<role> takes <option> child tags. <option> tags contain a name and a value option.
Meaning of <option> tags is up to the authentication module.
- <role>s are considered to build a stack. If a role returns with AUTH_NOMATCH the next one will be tried.
- <role>s are tested in this order: mount specific, default mount specific, global, internal fallback.
Internal fallback is set to allow web/ access via GET, POST and HEAD (only GET supported by this time)
and rejects all other requests.
- New authentication module: anonymous
This module matches all requests. No options taken.
- New authentication module: static
This module matches with a static username and password.
It takes two <option>s. One with name="username" and one with name="password" to set username and password.
This replaces old style <*-username> and <*-password> tags.
- New authentication module: legacy-password
This module matches with a statich password.
It takes one <option> with name="password" to set password.
This replaces old ICE and ICY (shoutcast compat mode) authentication.
- Parsing <authentication> in <mount> with a type set in a special way to allow 100% backward compatibility.
- Parsing of <source-password>, <admin-password>, <admin-user>, <relay-password> and <relay-user> in global
<authentication> for 100% backward compatibility.
- <alias> is now proccessed very early. This enables them to be used for all kinds of requests.
To Do List & What does not yet work:
- type="url" auth: mount_add and mount_remove.
This should be replaced by an unique feature I would call '<event>'.
- Admin commands manageauth and manageauth.xsl are disabled as they need more review:
This code needs to be ported to support multiple <role>s per <mount>.
- url authentication module can not yet return AUTH_NOMATCH.
This needs to be reviewed and discussed on how to handle this case best way.
- Default config files needs to be updated to reflect the changes.
As this is quite some political act it should be done in dicussion with the whole team
and permission of the release manager.
- Docs need to be updated to reflect the changes.
How does it work:
Code has been changed so that authentification is done early for all clients.
This allows accessing the ACL data (client->acl) from nearly everywhere in the code.
After accept() and initial client setup the request is parsed. In the next step
all <alias>es are resolved. After this the client is passed for authentication.
After authentication it is passed to the corresponding subsystem depending on kind of request.
All authentication instances have a thread running for doing the authentication.
This thread works on a queue of clients.
Hints for testers:
- Test with default config.
- Test with diffrent authentication modules in <mount>.
- Test shoutcast compatibility mode.
- Test with new style <authentication> and any amount of <role> (zero to quite some).
- Test <alias> lookup on all kinds of objects.
- Test source level credential login into the admin interface.
- Test shoucast style meta data updates.
- Test playlist generation.
Thank you for reading this long commit message. Have fun reading the full patch!
svn path=/icecast/trunk/icecast/; revision=19358
2014-11-28 18:46:08 -05:00
|
|
|
/* admin command if any. ADMIN_COMMAND_ERROR if not an admin command. */
|
2018-05-25 07:42:08 -04:00
|
|
|
admin_command_id_t admin_command;
|
Wow. Mega patch!
This patch *replaces* the authentication system completly.
What is new:
- <authentication> in mount section is now a container object.
- <authentication> in root and mount section may hold any number of <role>-Tags.
- <role> tags:
Those tags define a 'role' and it's ACL rules.
A role is a instance of an authentication module (see below).
<role> takes the following options. All but type are optional.
- authentication related:
- type: Type of the authentication module (values: anonymous, static, legacy-password, url or htpasswd;
symbolic constants in auth.h)
- name: Name for the role. For later matching. (values: any string; default: (none))
- method: This rule is only active on the given list of HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- ACL related:
- allow-method: Allowed HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: get)
- deny-method: Rejected HTTP methods.
(list of enum values: methods as recognized by httpp/ (e.g: get,post); default: *)
- allow-admin: Allowed admin commands. (list of enum values: admin command; default: buildm3u)
- deny-admin: Rejected admin commands. (list of enum values: admin command; default: *)
- allow-web: Allowed web pages. (values: empty or *; default: *)
- deny-web: Rejected web pages. (values: empty or *; default: (empty))
- connections-per-user: maximum number of simultaneous connections per role and username.
This is only active on active sources. (values: unlimited or number of connections; default: unlimited)
- connection-duration: maximum time of a connection. This is only active on active sources.
(values: unlimited or number of secounds; default: unlimited)
<role> takes <option> child tags. <option> tags contain a name and a value option.
Meaning of <option> tags is up to the authentication module.
- <role>s are considered to build a stack. If a role returns with AUTH_NOMATCH the next one will be tried.
- <role>s are tested in this order: mount specific, default mount specific, global, internal fallback.
Internal fallback is set to allow web/ access via GET, POST and HEAD (only GET supported by this time)
and rejects all other requests.
- New authentication module: anonymous
This module matches all requests. No options taken.
- New authentication module: static
This module matches with a static username and password.
It takes two <option>s. One with name="username" and one with name="password" to set username and password.
This replaces old style <*-username> and <*-password> tags.
- New authentication module: legacy-password
This module matches with a statich password.
It takes one <option> with name="password" to set password.
This replaces old ICE and ICY (shoutcast compat mode) authentication.
- Parsing <authentication> in <mount> with a type set in a special way to allow 100% backward compatibility.
- Parsing of <source-password>, <admin-password>, <admin-user>, <relay-password> and <relay-user> in global
<authentication> for 100% backward compatibility.
- <alias> is now proccessed very early. This enables them to be used for all kinds of requests.
To Do List & What does not yet work:
- type="url" auth: mount_add and mount_remove.
This should be replaced by an unique feature I would call '<event>'.
- Admin commands manageauth and manageauth.xsl are disabled as they need more review:
This code needs to be ported to support multiple <role>s per <mount>.
- url authentication module can not yet return AUTH_NOMATCH.
This needs to be reviewed and discussed on how to handle this case best way.
- Default config files needs to be updated to reflect the changes.
As this is quite some political act it should be done in dicussion with the whole team
and permission of the release manager.
- Docs need to be updated to reflect the changes.
How does it work:
Code has been changed so that authentification is done early for all clients.
This allows accessing the ACL data (client->acl) from nearly everywhere in the code.
After accept() and initial client setup the request is parsed. In the next step
all <alias>es are resolved. After this the client is passed for authentication.
After authentication it is passed to the corresponding subsystem depending on kind of request.
All authentication instances have a thread running for doing the authentication.
This thread works on a queue of clients.
Hints for testers:
- Test with default config.
- Test with diffrent authentication modules in <mount>.
- Test shoutcast compatibility mode.
- Test with new style <authentication> and any amount of <role> (zero to quite some).
- Test <alias> lookup on all kinds of objects.
- Test source level credential login into the admin interface.
- Test shoucast style meta data updates.
- Test playlist generation.
Thank you for reading this long commit message. Have fun reading the full patch!
svn path=/icecast/trunk/icecast/; revision=19358
2014-11-28 18:46:08 -05:00
|
|
|
|
|
|
|
/* authentication instances we still need to go thru */
|
|
|
|
struct auth_stack_tag *authstack;
|
|
|
|
|
|
|
|
/* Client username */
|
|
|
|
char *username;
|
|
|
|
|
|
|
|
/* Client password */
|
|
|
|
char *password;
|
|
|
|
|
|
|
|
/* Client role */
|
|
|
|
char *role;
|
|
|
|
|
|
|
|
/* active ACL, set as soon as the client is authenticated */
|
|
|
|
acl_t *acl;
|
2005-08-07 19:01:04 -04:00
|
|
|
|
2018-09-13 08:42:46 -04:00
|
|
|
/* URI */
|
|
|
|
char *uri;
|
|
|
|
|
2018-05-28 10:04:07 -04:00
|
|
|
/* Handler module and function */
|
|
|
|
module_t *handler_module;
|
|
|
|
char *handler_function;
|
|
|
|
|
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 */
|
2018-06-17 06:33:10 -04:00
|
|
|
auth_t *auth;
|
2005-08-07 19:01:04 -04:00
|
|
|
|
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 */
|
2018-06-17 06:33:10 -04:00
|
|
|
void (*free_client_data)(client_t *client);
|
2005-06-03 11:35:52 -04:00
|
|
|
|
2005-06-07 21:36:51 -04:00
|
|
|
/* write out data associated with client */
|
2018-06-17 06:33:10 -04:00
|
|
|
int (*write_to_client)(client_t *client);
|
2005-06-07 21:36:51 -04:00
|
|
|
|
2005-06-03 11:35:52 -04:00
|
|
|
/* function to check if refbuf needs updating */
|
2018-06-17 06:33:10 -04:00
|
|
|
int (*check_buffer)(source_t *source, client_t *client);
|
2018-06-09 05:54:38 -04:00
|
|
|
};
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2018-06-10 06:18:07 -04:00
|
|
|
protocol_t client_protocol_from_string(const char *str);
|
|
|
|
const char * client_protocol_to_string(protocol_t protocol);
|
|
|
|
|
2005-08-11 19:29:58 -04:00
|
|
|
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
|
2018-07-20 07:12:13 -04:00
|
|
|
void client_complete(client_t *client);
|
2001-09-09 22:21:46 -04:00
|
|
|
void client_destroy(client_t *client);
|
2018-05-26 02:29:10 -04:00
|
|
|
void client_send_error_by_id(client_t *client, icecast_error_id_t id);
|
2018-09-14 09:39:50 -04:00
|
|
|
void client_send_error_by_uuid(client_t *client, const char *uuid);
|
2015-02-01 19:34:45 -05:00
|
|
|
void client_send_101(client_t *client, reuse_t reuse);
|
2018-06-15 14:53:43 -04:00
|
|
|
void client_send_204(client_t *client);
|
2015-02-01 19:34:45 -05:00
|
|
|
void client_send_426(client_t *client, reuse_t reuse);
|
2018-09-14 09:39:50 -04:00
|
|
|
void client_send_redirect(client_t *client, const char *uuid, int status, const char *location);
|
|
|
|
void client_send_reportxml(client_t *client, reportxml_t *report, document_domain_t domain, const char *xsl, admin_format_t admin_format_hint, int status, const char *location);
|
2020-10-12 14:23:11 -04:00
|
|
|
void client_send_buffer(client_t *client, int status, const char *mediatype, const char *charset, const char *buffer, ssize_t len, const char *extra_headers);
|
2018-08-08 08:17:00 -04:00
|
|
|
reportxml_t *client_get_reportxml(const char *state_definition, const char *state_akindof, const char *state_text);
|
2018-06-09 05:54:38 -04:00
|
|
|
admin_format_t client_get_admin_format_by_content_negotiation(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);
|
2018-04-17 03:29:49 -04:00
|
|
|
ssize_t client_body_read(client_t *client, void *buf, size_t len);
|
|
|
|
int client_body_eof(client_t *client);
|
2018-06-18 07:05:23 -04:00
|
|
|
client_slurp_result_t client_body_slurp(client_t *client, void *buf, size_t *len);
|
|
|
|
client_slurp_result_t client_body_skip(client_t *client);
|
2018-05-19 03:41:45 -04:00
|
|
|
ssize_t client_get_baseurl(client_t *client, listensocket_t *listensocket, char *buf, size_t len, const char *user, const char *pw, const char *prefix, const char *suffix0, const char *suffix1);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#endif /* __CLIENT_H__ */
|