...
 
Commits (12)
[submodule "m4"]
path = m4
url = ../icecast-m4.git
[submodule "src/common"]
path = src/common
url = ../icecast-common.git
......@@ -5,13 +5,10 @@ set -e
srcdir=$(dirname "$0")
test -n "$srcdir" && cd "$srcdir"
if ! {
# Test for any file in the m4 submodule
test -e "$srcdir/m4/ax_check_compile_flag.m4" &&
# Test for any file in the common submodule
test -e "$srcdir/src/common/log/log.c"; };
if ! test -e "$srcdir/m4/ax_check_compile_flag.m4"
then
echo "ERROR: Submodules missing! Ensure you git cloned with '--recursive' or run:"
echo "ERROR: Submodule missing! Ensure you git cloned with '--recursive' or run:"
echo " git submodule update --init"
exit 1
fi
......
......@@ -8,6 +8,8 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_PROG_CC
LT_INIT
AX_CHECK_COMPILE_FLAG([-std=c99], [
AX_APPEND_FLAG([-std=c99])
], [
......@@ -44,9 +46,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE([enable])
LT_INIT
dnl Sanitizer flags
AC_ARG_WITH([sanitizer],
......@@ -100,8 +99,6 @@ AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([pwd.h grp.h])
XIPH_NET
dnl Check for functions
AC_FUNC_FORK
AC_FUNC_CHOWN
......@@ -109,24 +106,17 @@ AC_FUNC_CHOWN
AC_CHECK_FUNCS([setuid])
AC_CHECK_FUNCS([chroot])
AC_CHECK_FUNCS([strcasestr])
AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([uname])
AC_CHECK_FUNCS([setenv])
AC_CHECK_FUNCS([setresuid])
AC_CHECK_FUNCS([setresgid])
AC_CHECK_FUNCS([localtime_r])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([ftime])
dnl Do not check for poll on Darwin, it is broken in some versions
AS_IF([test "${SYS}" != "darwin"], [
AC_CHECK_FUNCS([poll])
])
AC_SEARCH_LIBS([nanosleep], [rt posix4], [
AC_DEFINE([HAVE_NANOSLEEP], [1], [Define if you have nanosleep])
])
dnl Checks for types and typedefs
AC_TYPE_OFF_T
AC_TYPE_PID_T
......@@ -136,6 +126,16 @@ AC_TYPE_UID_T
dnl Checks for required libraries
dnl
dnl igloo
dnl
PKG_CHECK_MODULES([IGLOO], [igloo], [], [
AC_MSG_ERROR([${IGLOO_PKG_ERRORS}. igloo is required.])
])
CFLAGS="${CFLAGS} ${IGLOO_CFLAGS}"
LIBS="${LIBS} ${IGLOO_LIBS}"
dnl
dnl libxml2
dnl
......@@ -274,24 +274,12 @@ AS_IF([test "$with_default_config" != "no"], [
])
dnl Make substitutions
AC_SUBST(XIPH_LIBS)
AC_SUBST(XIPH_CPPFLAGS)
AC_SUBST(XIPH_CFLAGS)
AC_SUBST(XIPH_LDFLAGS)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
conf/Makefile
src/Makefile
src/common/avl/Makefile
src/common/httpp/Makefile
src/common/thread/Makefile
src/common/log/Makefile
src/common/net/Makefile
src/common/timing/Makefile
doc/Makefile
web/Makefile
admin/Makefile
......
## Process this with automake to create Makefile.in
SUBDIRS = common/avl common/net common/thread common/httpp common/log common/timing
bin_PROGRAMS = icecast
noinst_HEADERS = \
......@@ -30,10 +28,7 @@ noinst_HEADERS = \
md5.h \
matchfile.h \
tls.h \
refobject.h \
buffer.h \
module.h \
reportxml.h \
listensocket.h \
fastevent.h \
event.h \
......@@ -76,10 +71,7 @@ icecast_SOURCES = \
md5.c \
matchfile.c \
tls.c \
refobject.c \
buffer.c \
module.c \
reportxml.c \
listensocket.c \
fastevent.c \
format.c \
......@@ -132,15 +124,4 @@ EXTRA_icecast_SOURCES = \
format_theora.c \
format_speex.c
icecast_DEPENDENCIES = \
common/net/libicenet.la \
common/thread/libicethread.la \
common/httpp/libicehttpp.la \
common/log/libicelog.la \
common/avl/libiceavl.la \
common/timing/libicetiming.la
icecast_LDADD = $(icecast_DEPENDENCIES)
icecast_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/common
include $(srcdir)/tests/Makefile.am
......@@ -28,7 +28,7 @@ struct acl_tag {
size_t refcount;
/* allowed methods */
acl_policy_t method[httpp_req_unknown+1];
acl_policy_t method[igloo_httpp_req_unknown+1];
/* admin/ interface */
struct {
......@@ -242,15 +242,15 @@ int acl_set_method_str__callback(acl_t *acl,
acl_policy_t policy,
const char *str)
{
httpp_request_type_e method;
igloo_httpp_request_type_e method;
size_t i;
if (strcmp(str, "*") == 0) {
for (i = 0; i < (sizeof(acl->method)/sizeof(*acl->method)); i++)
acl->method[i] = policy;
} else {
method = httpp_str_to_method(str);
if (method == httpp_req_unknown)
method = igloo_httpp_str_to_method(str);
if (method == igloo_httpp_req_unknown)
return -1;
acl->method[method] = policy;
......@@ -259,9 +259,9 @@ int acl_set_method_str__callback(acl_t *acl,
return 0;
}
acl_policy_t acl_test_method(acl_t * acl, httpp_request_type_e method)
acl_policy_t acl_test_method(acl_t * acl, igloo_httpp_request_type_e method)
{
if (!acl || method < httpp_req_none || method > httpp_req_unknown)
if (!acl || method < igloo_httpp_req_none || method > igloo_httpp_req_unknown)
return ACL_POLICY_ERROR;
return acl->method[method];
......
......@@ -16,7 +16,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include "common/httpp/httpp.h"
#include <igloo/httpp.h>
#include "icecasttypes.h"
#include "cfgfile.h"
......@@ -44,7 +44,7 @@ int acl_set_ANY_str(acl_t * acl, acl_policy_t policy, const char * str, int (*ca
/* HTTP Method specific functions */
int acl_set_method_str__callback(acl_t * acl, acl_policy_t policy, const char * str);
#define acl_set_method_str(acl,policy,str) acl_set_ANY_str((acl), (policy), (str), acl_set_method_str__callback)
acl_policy_t acl_test_method(acl_t * acl, httpp_request_type_e method);
acl_policy_t acl_test_method(acl_t * acl, igloo_httpp_request_type_e method);
/* admin/ interface specific functions */
int acl_set_admin_str__callbck(acl_t * acl, acl_policy_t policy, const char * str);
......
......@@ -52,7 +52,7 @@
/* Helper macros */
#define COMMAND_REQUIRE(client,name,var) \
do { \
(var) = httpp_get_param((client)->parser, (name)); \
(var) = igloo_httpp_get_param((client)->parser, (name)); \
if((var) == NULL) { \
client_send_error_by_id(client, ICECAST_ERROR_ADMIN_MISSING_PARAMETER); \
return; \
......@@ -60,7 +60,7 @@
} while(0);
#define COMMAND_OPTIONAL(client,name,var) \
(var) = httpp_get_param((client)->parser, (name))
(var) = igloo_httpp_get_param((client)->parser, (name))
#define FALLBACK_RAW_REQUEST "fallbacks"
#define FALLBACK_HTML_REQUEST "fallbacks.xsl"
......@@ -329,7 +329,7 @@ xmlNodePtr admin_build_rootnode(xmlDocPtr doc, const char *name)
* doc even if the source is running */
xmlDocPtr admin_build_sourcelist(const char *mount)
{
avl_node *node;
igloo_avl_node *node;
source_t *source;
xmlNodePtr xmlnode, srcnode;
xmlDocPtr doc;
......@@ -344,12 +344,12 @@ xmlDocPtr admin_build_sourcelist(const char *mount)
xmlNewTextChild (xmlnode, NULL, XMLSTR("current_source"), XMLSTR(mount));
}
node = avl_get_first(global.source_tree);
node = igloo_avl_get_first(global.source_tree);
while(node) {
source = (source_t *)node->key;
if (mount && strcmp (mount, source->mount) == 0)
{
node = avl_get_next (node);
node = igloo_avl_get_next (node);
continue;
}
......@@ -371,9 +371,9 @@ xmlDocPtr admin_build_sourcelist(const char *mount)
config = config_get_config();
mountinfo = config_find_mount(config, source->mount, MOUNT_TYPE_NORMAL);
if (mountinfo)
acl = auth_stack_get_anonymous_acl(mountinfo->authstack, httpp_req_get);
acl = auth_stack_get_anonymous_acl(mountinfo->authstack, igloo_httpp_req_get);
if (!acl)
acl = auth_stack_get_anonymous_acl(config->authstack, httpp_req_get);
acl = auth_stack_get_anonymous_acl(config->authstack, igloo_httpp_req_get);
if (acl && acl_test_web(acl) == ACL_POLICY_DENY) {
xmlNewTextChild(srcnode, NULL, XMLSTR("authenticator"), XMLSTR("(dummy)"));
}
......@@ -390,7 +390,7 @@ xmlDocPtr admin_build_sourcelist(const char *mount)
XMLSTR(source->format->contenttype));
}
}
node = avl_get_next(node);
node = igloo_avl_get_next(node);
}
return(doc);
}
......@@ -499,8 +499,8 @@ void admin_handle_request(client_t *client, const char *uri)
/* ACL disallows, check exceptions */
if ((handler->function == command_metadata && handler->format == ADMIN_FORMAT_RAW) &&
(acl_test_method(client->acl, httpp_req_source) == ACL_POLICY_ALLOW ||
acl_test_method(client->acl, httpp_req_put) == ACL_POLICY_ALLOW)) {
(acl_test_method(client->acl, igloo_httpp_req_source) == ACL_POLICY_ALLOW ||
acl_test_method(client->acl, igloo_httpp_req_put) == ACL_POLICY_ALLOW)) {
ICECAST_LOG_DEBUG("Granted right to call COMMAND_RAW_METADATA_UPDATE to "
"client because it is allowed to do SOURCE or PUT.");
} else {
......@@ -516,19 +516,19 @@ void admin_handle_request(client_t *client, const char *uri)
if(mount != NULL) {
/* This is a mount request, handle it as such */
avl_tree_rlock(global.source_tree);
igloo_avl_tree_rlock(global.source_tree);
source = source_find_mount_raw(mount);
/* No Source found */
if (source == NULL) {
avl_tree_unlock(global.source_tree);
igloo_avl_tree_unlock(global.source_tree);
ICECAST_LOG_WARN("Admin command \"%H\" on non-existent source \"%H\"",
uri, mount);
client_send_error_by_id(client, ICECAST_ERROR_ADMIN_SOURCE_DOES_NOT_EXIST);
return;
} /* No Source running */
else if (source->running == 0 && source->on_demand == 0) {
avl_tree_unlock(global.source_tree);
igloo_avl_tree_unlock(global.source_tree);
ICECAST_LOG_INFO("Received admin command \"%H\" on unavailable mount \"%H\"",
uri, mount);
client_send_error_by_id(client, ICECAST_ERROR_ADMIN_SOURCE_IS_NOT_AVAILABLE);
......@@ -550,8 +550,8 @@ void admin_handle_request(client_t *client, const char *uri)
}
switch (client->parser->req_type) {
case httpp_req_get:
case httpp_req_post:
case igloo_httpp_req_get:
case igloo_httpp_req_post:
if (handler->function) {
handler->function(client, source, format);
} else {
......@@ -572,7 +572,7 @@ void admin_handle_request(client_t *client, const char *uri)
}
}
break;
case httpp_req_options:
case igloo_httpp_req_options:
client_send_204(client);
break;
default:
......@@ -582,7 +582,7 @@ void admin_handle_request(client_t *client, const char *uri)
}
if (source) {
avl_tree_unlock(global.source_tree);
igloo_avl_tree_unlock(global.source_tree);
}
return;
}
......@@ -695,15 +695,15 @@ static inline xmlNodePtr __add_listener(client_t *client,
xmlNewTextChild(node, NULL, XMLSTR(mode == OMODE_LEGACY ? "IP" : "ip"), XMLSTR(client->con->ip));
tmp = httpp_getvar(client->parser, "user-agent");
tmp = igloo_httpp_getvar(client->parser, "user-agent");
if (tmp)
xmlNewTextChild(node, NULL, XMLSTR(mode == OMODE_LEGACY ? "UserAgent" : "useragent"), XMLSTR(tmp));
tmp = httpp_getvar(client->parser, "referer");
tmp = igloo_httpp_getvar(client->parser, "referer");
if (tmp)
xmlNewTextChild(node, NULL, XMLSTR("referer"), XMLSTR(tmp));
tmp = httpp_getvar(client->parser, "host");
tmp = igloo_httpp_getvar(client->parser, "host");
if (tmp)
xmlNewTextChild(node, NULL, XMLSTR("host"), XMLSTR(tmp));
......@@ -735,15 +735,15 @@ void admin_add_listeners_to_mount(source_t *source,
operation_mode mode)
{
time_t now = time(NULL);
avl_node *client_node;
igloo_avl_node *client_node;
avl_tree_rlock(source->client_tree);
client_node = avl_get_first(source->client_tree);
igloo_avl_tree_rlock(source->client_tree);
client_node = igloo_avl_get_first(source->client_tree);
while(client_node) {
__add_listener((client_t *)client_node->key, parent, now, mode);
client_node = avl_get_next(client_node);
client_node = igloo_avl_get_next(client_node);
}
avl_tree_unlock(source->client_tree);
igloo_avl_tree_unlock(source->client_tree);
}
static void command_show_listeners(client_t *client,
......@@ -1044,7 +1044,7 @@ static void command_metadata(client_t *client,
ICECAST_LOG_DEBUG("Got metadata update request");
if (source->parser && source->parser->req_type == httpp_req_put) {
if (source->parser && source->parser->req_type == igloo_httpp_req_put) {
ICECAST_LOG_ERROR("Got legacy SOURCE-style metadata update command on "
"source connected with PUT at mountpoint %s", source->mount);
}
......@@ -1115,7 +1115,7 @@ static void command_shoutcast_metadata(client_t *client,
return;
}
if (source->parser->req_type == httpp_req_put) {
if (source->parser->req_type == igloo_httpp_req_put) {
ICECAST_LOG_ERROR("Got legacy shoutcast-style metadata update command "
"on source connected with PUT at mountpoint %s", source->mount);
}
......@@ -1200,9 +1200,9 @@ static void command_list_mounts(client_t *client, source_t *source, admin_format
fserve_add_client (client, NULL);
} else {
xmlDocPtr doc;
avl_tree_rlock(global.source_tree);
igloo_avl_tree_rlock(global.source_tree);
doc = admin_build_sourcelist(NULL);
avl_tree_unlock(global.source_tree);
igloo_avl_tree_unlock(global.source_tree);
admin_send_response(doc, client, response,
LISTMOUNTS_HTML_REQUEST);
......
This diff is collapsed.
......@@ -22,8 +22,8 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
#include "common/thread/thread.h"
#include "common/httpp/httpp.h"
#include <igloo/thread.h>
#include <igloo/httpp.h>
#include "icecasttypes.h"
#include "cfgfile.h"
......@@ -108,7 +108,7 @@ struct auth_tag
char *mount;
/* filters */
auth_matchtype_t filter_method[httpp_req_unknown+1];
auth_matchtype_t filter_method[igloo_httpp_req_unknown+1];
auth_matchtype_t filter_web_policy;
auth_matchtype_t filter_admin_policy;
struct {
......@@ -142,11 +142,11 @@ struct auth_tag
auth_result (*deleteuser)(auth_t *auth, const char *username);
auth_result (*listuser)(auth_t *auth, xmlNodePtr srcnode);
mutex_t lock;
igloo_mutex_t lock;
int running;
size_t refcount;
thread_type *thread;
igloo_thread_type *thread;
/* per-auth queue for clients */
auth_client *head, **tailp;
......@@ -200,6 +200,6 @@ int auth_stack_push(auth_stack_t **stack, auth_t *auth);
int auth_stack_append(auth_stack_t *stack, auth_stack_t *tail);
auth_t *auth_stack_get(auth_stack_t *stack);
auth_t *auth_stack_getbyid(auth_stack_t *stack, unsigned long id);
acl_t *auth_stack_get_anonymous_acl(auth_stack_t *stack, httpp_request_type_e method);
acl_t *auth_stack_get_anonymous_acl(auth_stack_t *stack, igloo_httpp_request_type_e method);
#endif
......@@ -26,11 +26,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <igloo/httpp.h>
#include "auth.h"
#include "source.h"
#include "client.h"
#include "cfgfile.h"
#include "common/httpp/httpp.h"
#include "md5.h"
#include "logging.h"
......@@ -52,8 +53,8 @@ typedef struct {
typedef struct {
char *filename;
rwlock_t file_rwlock;
avl_tree *users;
igloo_rwlock_t file_rwlock;
igloo_avl_tree *users;
time_t mtime;
} htpasswd_auth_state;
......@@ -62,8 +63,8 @@ static void htpasswd_clear(auth_t *self)
htpasswd_auth_state *state = self->state;
free(state->filename);
if (state->users)
avl_tree_free (state->users, _free_user);
thread_rwlock_destroy(&state->file_rwlock);
igloo_avl_tree_free (state->users, _free_user);
igloo_thread_rwlock_destroy(&state->file_rwlock);
free(state);
}
......@@ -108,7 +109,7 @@ static int _free_user(void *key)
static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
{
FILE *passwdfile;
avl_tree *new_users;
igloo_avl_tree *new_users;
int num = 0;
struct stat file_stat;
char *sep;
......@@ -120,10 +121,10 @@ static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
ICECAST_LOG_WARN("failed to check status of %s", htpasswd->filename);
/* Create a dummy users tree for things to use later */
thread_rwlock_wlock (&htpasswd->file_rwlock);
igloo_thread_rwlock_wlock (&htpasswd->file_rwlock);
if(!htpasswd->users)
htpasswd->users = avl_tree_new(compare_users, NULL);
thread_rwlock_unlock (&htpasswd->file_rwlock);
htpasswd->users = igloo_avl_tree_new(compare_users, NULL);
igloo_thread_rwlock_unlock (&htpasswd->file_rwlock);
return;
}
......@@ -141,7 +142,7 @@ static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
}
htpasswd->mtime = file_stat.st_mtime;
new_users = avl_tree_new (compare_users, NULL);
new_users = igloo_avl_tree_new (compare_users, NULL);
while (get_line(passwdfile, line, MAX_LINE_LEN)) {
int len;
......@@ -162,15 +163,15 @@ static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
*sep = 0;
memcpy (entry->name, line, len);
entry->pass = entry->name + (sep-line) + 1;
avl_insert (new_users, entry);
igloo_avl_insert (new_users, entry);
}
fclose (passwdfile);
thread_rwlock_wlock (&htpasswd->file_rwlock);
igloo_thread_rwlock_wlock (&htpasswd->file_rwlock);
if (htpasswd->users)
avl_tree_free (htpasswd->users, _free_user);
igloo_avl_tree_free (htpasswd->users, _free_user);
htpasswd->users = new_users;
thread_rwlock_unlock (&htpasswd->file_rwlock);
igloo_thread_rwlock_unlock (&htpasswd->file_rwlock);
}
......@@ -196,13 +197,13 @@ static auth_result htpasswd_auth (auth_client *auth_user)
return AUTH_NOMATCH;
}
thread_rwlock_rlock (&htpasswd->file_rwlock);
igloo_thread_rwlock_rlock (&htpasswd->file_rwlock);
entry.name = client->username;
if (avl_get_by_key (htpasswd->users, &entry, &result) == 0) {
if (igloo_avl_get_by_key (htpasswd->users, &entry, &result) == 0) {
htpasswd_user *found = result;
char *hashed_pw;
thread_rwlock_unlock (&htpasswd->file_rwlock);
igloo_thread_rwlock_unlock (&htpasswd->file_rwlock);
hashed_pw = get_hash (client->password, strlen (client->password));
if (strcmp (found->pass, hashed_pw) == 0) {
free (hashed_pw);
......@@ -213,7 +214,7 @@ static auth_result htpasswd_auth (auth_client *auth_user)
return AUTH_FAILED;
}
ICECAST_LOG_DEBUG("no such username: %s", client->username);
thread_rwlock_unlock (&htpasswd->file_rwlock);
igloo_thread_rwlock_unlock (&htpasswd->file_rwlock);
return AUTH_NOMATCH;
}
......@@ -247,7 +248,7 @@ int auth_get_htpasswd_auth (auth_t *authenticator, config_options_t *options)
authenticator->state = state;
thread_rwlock_create(&state->file_rwlock);
igloo_thread_rwlock_create(&state->file_rwlock);
htpasswd_recheckfile(state);
return 0;
......@@ -274,18 +275,18 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
return AUTH_FAILED;
}
thread_rwlock_wlock (&state->file_rwlock);
igloo_thread_rwlock_wlock (&state->file_rwlock);
entry.name = (char*)username;
if (avl_get_by_key (state->users, &entry, &result) == 0) {
thread_rwlock_unlock (&state->file_rwlock);
if (igloo_avl_get_by_key (state->users, &entry, &result) == 0) {
igloo_thread_rwlock_unlock (&state->file_rwlock);
return AUTH_USEREXISTS;
}
passwdfile = fopen(state->filename, "ab");
if (passwdfile == NULL) {
thread_rwlock_unlock (&state->file_rwlock);
igloo_thread_rwlock_unlock (&state->file_rwlock);
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
state->filename, strerror(errno));
return AUTH_FAILED;
......@@ -298,7 +299,7 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
}
fclose(passwdfile);
thread_rwlock_unlock (&state->file_rwlock);
igloo_thread_rwlock_unlock (&state->file_rwlock);
return AUTH_USERADDED;
}
......@@ -327,13 +328,13 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
return AUTH_FAILED;
}
thread_rwlock_wlock (&state->file_rwlock);
igloo_thread_rwlock_wlock (&state->file_rwlock);
passwdfile = fopen(state->filename, "rb");
if(passwdfile == NULL) {
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
state->filename, strerror(errno));
thread_rwlock_unlock (&state->file_rwlock);
igloo_thread_rwlock_unlock (&state->file_rwlock);
return AUTH_FAILED;
}
tmpfile_len = strlen(state->filename) + 6;
......@@ -343,7 +344,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
ICECAST_LOG_WARN("temp file \"%s\" exists, rejecting operation", tmpfile);
free (tmpfile);
fclose (passwdfile);
thread_rwlock_unlock (&state->file_rwlock);
igloo_thread_rwlock_unlock (&state->file_rwlock);
return AUTH_FAILED;
}
......@@ -354,7 +355,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
tmpfile, strerror(errno));
fclose(passwdfile);
free(tmpfile);
thread_rwlock_unlock (&state->file_rwlock);
igloo_thread_rwlock_unlock (&state->file_rwlock);
return AUTH_FAILED;
}
......@@ -394,7 +395,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
}
}
free(tmpfile);
thread_rwlock_unlock(&state->file_rwlock);
igloo_thread_rwlock_unlock(&state->file_rwlock);
htpasswd_recheckfile(state);
return AUTH_USERDELETED;
......@@ -405,7 +406,7 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
{
htpasswd_auth_state *state;
xmlNodePtr newnode;
avl_node *node;
igloo_avl_node *node;
state = auth->state;
......@@ -421,15 +422,15 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
return AUTH_FAILED;
}
thread_rwlock_rlock(&state->file_rwlock);
node = avl_get_first(state->users);
igloo_thread_rwlock_rlock(&state->file_rwlock);
node = igloo_avl_get_first(state->users);
while (node) {
htpasswd_user *user = (htpasswd_user *)node->key;
newnode = xmlNewChild(srcnode, NULL, XMLSTR("user"), NULL);
xmlNewTextChild(newnode, NULL, XMLSTR("username"), XMLSTR(user->name));
node = avl_get_next(node);
node = igloo_avl_get_next(node);
}
thread_rwlock_unlock(&state->file_rwlock);
igloo_thread_rwlock_unlock(&state->file_rwlock);
return AUTH_OK;
}
......@@ -74,7 +74,8 @@
#include "client.h"
#include "cfgfile.h"
#include "connection.h"
#include "common/httpp/httpp.h"
#include <igloo/httpp.h>
#include "logging.h"
#define CATMODULE "auth_url"
......@@ -120,7 +121,7 @@ typedef struct {
typedef struct {
char *all_headers;
size_t all_headers_len;
http_parser_t *parser;
igloo_http_parser_t *parser;
} auth_user_url_t;
static inline const char * __str_or_default(const char *str, const char *def)
......@@ -166,7 +167,7 @@ static void auth_user_url_clear(auth_client *auth_user)
free(au_url->all_headers);
if (au_url->parser)
httpp_destroy(au_url->parser);
igloo_httpp_destroy(au_url->parser);
free(au_url);
auth_user->authbackend_userdata = NULL;
......@@ -186,34 +187,34 @@ static void handle_returned_header__complete(auth_client *auth_user)
if (au_url->parser)
return;
au_url->parser = httpp_create_parser();
httpp_initialize(au_url->parser, NULL);
au_url->parser = igloo_httpp_create_parser();
igloo_httpp_initialize(au_url->parser, NULL);
if (!httpp_parse_response(au_url->parser, au_url->all_headers, au_url->all_headers_len, NULL)) {
if (!igloo_httpp_parse_response(au_url->parser, au_url->all_headers, au_url->all_headers_len, NULL)) {
ICECAST_LOG_ERROR("Can not parse auth backend reply.");
return;
}
tmp = httpp_getvar(au_url->parser, HTTPP_VAR_ERROR_CODE);
tmp = igloo_httpp_getvar(au_url->parser, igloo_HTTPP_VAR_ERROR_CODE);
if (tmp[0] == '2') {
ICECAST_LOG_DEBUG("Got final status: %#H", tmp);
} else {
ICECAST_LOG_DEBUG("Got non-final status: %#H", tmp);
httpp_destroy(au_url->parser);
igloo_httpp_destroy(au_url->parser);
au_url->parser = NULL;
au_url->all_headers_len = 0;
return;
}
if (url->header_auth) {
tmp = httpp_getvar(au_url->parser, url->header_auth);
tmp = igloo_httpp_getvar(au_url->parser, url->header_auth);
if (tmp) {
url->result = auth_str2result(tmp);
}
}
if (url->header_timelimit) {
tmp = httpp_getvar(au_url->parser, url->header_timelimit);
tmp = igloo_httpp_getvar(au_url->parser, url->header_timelimit);
if (tmp) {
long long int ret;
char *endptr;
......@@ -228,8 +229,8 @@ static void handle_returned_header__complete(auth_client *auth_user)
}
}
action = httpp_getvar(au_url->parser, __str_or_default(url->header_alter_action, DEFAULT_HEADER_NEW_ALTER_ACTION));
argument = httpp_getvar(au_url->parser, __str_or_default(url->header_alter_argument, DEFAULT_HEADER_NEW_ALTER_ARGUMENT));
action = igloo_httpp_getvar(au_url->parser, __str_or_default(url->header_alter_action, DEFAULT_HEADER_NEW_ALTER_ACTION));
argument = igloo_httpp_getvar(au_url->parser, __str_or_default(url->header_alter_argument, DEFAULT_HEADER_NEW_ALTER_ARGUMENT));
if (action && argument) {
if (auth_alter_client(auth_user->client->auth, auth_user, auth_str2alter(action), argument) != 0) {
......@@ -240,11 +241,11 @@ static void handle_returned_header__complete(auth_client *auth_user)
}
if (url->header_message) {
tmp = httpp_getvar(au_url->parser, url->header_message);
tmp = igloo_httpp_getvar(au_url->parser, url->header_message);
} else {
tmp = httpp_getvar(au_url->parser, DEFAULT_HEADER_NEW_MESSAGE);
tmp = igloo_httpp_getvar(au_url->parser, DEFAULT_HEADER_NEW_MESSAGE);
if (!tmp)
tmp = httpp_getvar(au_url->parser, DEFAULT_HEADER_OLD_MESSAGE);
tmp = igloo_httpp_getvar(au_url->parser, DEFAULT_HEADER_OLD_MESSAGE);
}
if (tmp) {
snprintf(url->errormsg, sizeof(url->errormsg), "%s", tmp);
......@@ -353,7 +354,7 @@ static auth_result url_remove_client(auth_client *auth_user)
port = config->port;
config_release_config();
agent = httpp_getvar(client->parser, "user-agent");
agent = igloo_httpp_getvar(client->parser, "user-agent");
if (agent) {
user_agent = util_url_escape(agent);
} else {
......@@ -373,9 +374,9 @@ static auth_result url_remove_client(auth_client *auth_user)
}
/* get the full uri (with query params if available) */
mountreq = httpp_getvar(client->parser, HTTPP_VAR_RAWURI);
mountreq = igloo_httpp_getvar(client->parser, igloo_HTTPP_VAR_RAWURI);
if (mountreq == NULL)
mountreq = httpp_getvar(client->parser, HTTPP_VAR_URI);
mountreq = igloo_httpp_getvar(client->parser, igloo_HTTPP_VAR_URI);
mount = util_url_escape(mountreq);
ipaddr = util_url_escape(client->con->ip);
......@@ -466,7 +467,7 @@ static auth_result url_add_client(auth_client *auth_user)
port = config->port;
config_release_config();
agent = httpp_getvar(client->parser, "user-agent");
agent = igloo_httpp_getvar(client->parser, "user-agent");
if (agent) {
user_agent = util_url_escape(agent);
} else {
......@@ -486,9 +487,9 @@ static auth_result url_add_client(auth_client *auth_user)
}
/* get the full uri (with query params if available) */
mountreq = httpp_getvar(client->parser, HTTPP_VAR_RAWURI);
mountreq = igloo_httpp_getvar(client->parser, igloo_HTTPP_VAR_RAWURI);
if (mountreq == NULL)
mountreq = httpp_getvar(client->parser, HTTPP_VAR_URI);
mountreq = igloo_httpp_getvar(client->parser, igloo_HTTPP_VAR_URI);
mount = util_url_escape(mountreq);
ipaddr = util_url_escape(client->con->ip);
......@@ -525,7 +526,7 @@ static auth_result url_add_client(auth_client *auth_user)
next_header++;
}
header_val = httpp_getvar (client->parser, cur_header);
header_val = igloo_httpp_getvar (client->parser, cur_header);
if (header_val) {
size_t left = sizeof(post) - post_offset;
int ret;
......
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "buffer.h"
#include "refobject.h"
struct buffer_tag {
refobject_base_t __base;
/* Buffer itself */
void *buffer;
/* Length in bytes of buffer */
size_t length;
/* Amount of bytes in use of the buffer. This includes offset bytes */
size_t fill;
/* Bytes of offset at the start of the buffer */
size_t offset;
};
static void __free(refobject_t self, void **userdata)
{
buffer_t *buffer = REFOBJECT_TO_TYPE(self, buffer_t*);
free(buffer->buffer);
}
REFOBJECT_DEFINE_TYPE(buffer_t,
REFOBJECT_DEFINE_TYPE_FREE(__free),
REFOBJECT_DEFINE_TYPE_NEW_NOOP()
);
buffer_t * buffer_new(ssize_t preallocation, void *userdata, const char *name, refobject_t associated)
{
buffer_t *buffer = refobject_new_ext(buffer_t, userdata, name, associated);
if (!buffer)
return NULL;
if (preallocation > 0)
buffer_preallocate(buffer, preallocation);
return buffer;
}
buffer_t * buffer_new_simple(void)
{
return refobject_new(buffer_t);
}
void buffer_preallocate(buffer_t *buffer, size_t request)
{
void *n;
size_t newlen;
if (!buffer)
return;
/* Remove the offset if it makes sense to do so. */
if (buffer->offset == buffer->fill) {
buffer->offset = 0;
buffer->fill = 0;
} else if ((2*buffer->offset) < buffer->fill || buffer->offset >= 512 || (buffer->offset > 128 && buffer->offset >= request)) {
buffer->fill -= buffer->offset;
memmove(buffer->buffer, buffer->buffer + buffer->offset, buffer->fill);
buffer->offset = 0;
}
if (!request)
return;
newlen = buffer->fill + request;
if (buffer->length >= newlen)
return;
/* Make sure we at least add 64 bytes and are 64 byte aligned */
newlen = newlen + 64 - (newlen % 64);
n = realloc(buffer->buffer, newlen);
/* Just return if this failed */
if (!n)
return;
buffer->buffer = n;
buffer->length = newlen;
}
int buffer_get_data(buffer_t *buffer, const void **data, size_t *length)
{
if (!buffer)
return -1;
if (data) {
*data = buffer->buffer + buffer->offset;
}
if (length) {
*length = buffer->fill - buffer->offset;
}
return 0;
}
int buffer_get_string(buffer_t *buffer, const char **string)
{
char *ret;
if (!buffer || !string)
return -1;
/* Ensure we have space for one additional byte ('\0'-termination). */
if (buffer->length == buffer->fill) {
buffer_preallocate(buffer, 1);
if (buffer->length == buffer->fill)
return -1;
}
/* Actually add a '\0'-termination. */
ret = buffer->buffer;
ret[buffer->fill] = 0;
*string = ret + buffer->offset;
return 0;
}
int buffer_set_length(buffer_t *buffer, size_t length)
{
if (!buffer)
return -1;
if (length > (buffer->fill - buffer->offset))
return -1;
buffer->fill = length + buffer->offset;
return 0;
}
int buffer_shift(buffer_t *buffer, size_t amount)
{
if (!buffer)
return -1;
if (amount > (buffer->fill - buffer->offset))
return -1;
buffer->offset += amount;
/* run cleanup */
buffer_preallocate(buffer, 0);
return 0;
}
int buffer_push_data(buffer_t *buffer, const void *data, size_t length)
{
void *buf;
int ret;
if (!buffer)
return -1;
if (!length)
return 0;
if (!data)
return -1;
ret = buffer_zerocopy_push_request(buffer, &buf, length);
if (ret != 0)
return ret;
memcpy(buf, data, length);
ret = buffer_zerocopy_push_complete(buffer, length);
return ret;
}
int buffer_push_string(buffer_t *buffer, const char *string)
{
if (!buffer || !string)
return -1;
return buffer_push_data(buffer, string, strlen(string));
}
int buffer_push_printf(buffer_t *buffer, const char *format, ...)
{
int ret;
va_list ap;
if (!buffer || !format)
return -1;
if (!*format)
return 0;
va_start(ap, format);
ret = buffer_push_vprintf(buffer, format, ap);
va_end(ap);
return ret;
}
int buffer_push_vprintf(buffer_t *buffer, const char *format, va_list ap)
{
void *buf;
int ret;
size_t length = 1024;
if (!buffer || !format)
return -1;
if (!*format)
return 0;
ret = buffer_zerocopy_push_request(buffer, &buf, length);
if (ret != 0)
return ret;
ret = vsnprintf(buf, length, format, ap);
if (ret >= 0 && (size_t)ret < length) {
return buffer_zerocopy_push_complete(buffer, ret);
} else if (ret < 0) {
/* This vsnprintf() likely does not follow POSIX.
* We don't know what length we need to asume. So asume a big one and hope for the best. */
length = 8192;
} else {
/* Reallocate the buffer to the size reported plus one for '\0'-termination */
length = ret + 1;
}
/* We have not written any data yet. */
ret = buffer_zerocopy_push_complete(buffer, 0);
if (ret != 0)
return ret;
/* Now let's try again. */
ret = buffer_zerocopy_push_request(buffer, &buf, length);
if (ret != 0)
return ret;
ret = vsnprintf(buf, length, format, ap);
if (ret < 0 || (size_t)ret >= length) {
/* This still didn't work. Giving up. */
buffer_zerocopy_push_complete(buffer, 0);
return -1;
}
return buffer_zerocopy_push_complete(buffer, ret);
}
int buffer_push_buffer(buffer_t *buffer, buffer_t *source)
{
const void *data;
size_t length;
int ret;
if (!buffer || !source)
return -1;
ret = buffer_get_data(source, &data, &length);
if (ret != 0)
return ret;
return buffer_push_data(buffer, data, length);
}
int buffer_zerocopy_push_request(buffer_t *buffer, void **data, size_t request)
{
if (!buffer || !data)
return -1;
buffer_preallocate(buffer, request);
if (request > (buffer->length - buffer->fill))
return -1;
*data = buffer->buffer + buffer->fill;
return 0;
}
int buffer_zerocopy_push_complete(buffer_t *buffer, size_t done)
{
if (!buffer)
return -1;
if (done > (buffer->length - buffer->fill))
return -1;
buffer->fill += done;
return 0;
}
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
/*
* This file contains the API for a refobject based buffer object.
* It can be used to store data and allows on the fly re-allocation.
*/
#ifndef __BUFFER_H__
#define __BUFFER_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include "icecasttypes.h"
#include "compat.h"
#include "refobject.h"
/* About thread safety:
* This set of functions is intentinally not thread safe.
*/
REFOBJECT_FORWARD_TYPE(buffer_t);
/* This creates a new buffer object.
* Parameters:
* preallocation
* The number of bytes to allocate for use later on. See buffer_preallocate() for details.
* userdata, name, associated
* See refobject_new().
*/
buffer_t * buffer_new(ssize_t preallocation, void *userdata, const char *name, refobject_t associated);
/* Depreciated: This creates a new buffer with defaults.
* Do NOT use this. Use refobject_new(buffer_t)
*
* This is the same as:
* buffer_new(-1, NULL, NULL, REFOBJECT_NULL)
*/
buffer_t * buffer_new_simple(void);
/* This function preallocates space for later use.
* Parameters:
* buffer
* The buffer to operate on.
* request
* Number of bytes to additionally allocate.
* Notes:
* This function is very usedful when adding a large number of smaller buffers to avoid
* internal reallocation calls happening to often. However it is not required to call
* this function before adding data to the buffer.
*/
void buffer_preallocate(buffer_t *buffer, size_t request);
/* Gets data and length of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* data
* Pointer to the stored data. If NULL the pointer is not returned.
* length
* Pointer to the length of how many bytes are in the buffer. If NULL
* length is not returned.
*/
int buffer_get_data(buffer_t *buffer, const void **data, size_t *length);
/* Gets data as a string. The string is '\0'-terminated.
* Parameters:
* buffery
* The buffer to operate on.
* string
* The string representing the data hold by the buffer.
*/
int buffer_get_string(buffer_t *buffer, const char **string);
/* Sets the length of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* length
* New length of the buffer.
* Notes:
* This can only be used to reduce the size of the buffer. To add data to
* the buffer use buffer_push_*().
*
* Calling this with length set to 0 clears the buffer but does not deallocate it.
*/
int buffer_set_length(buffer_t *buffer, size_t length);
/* Shifts data out of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* amount
* The amount of bytes to be removed from the begin of the buffer.
* Notes:
* This function can be useful for skipping some small header. However this
* must not be used to implement a kind of ring buffer as it will result in
* poor performance caused by massive reallocations and memory copies.
*/
int buffer_shift(buffer_t *buffer, size_t amount);
/* This pushes data to the end of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* data
* The data to push.
* length
* The length of the data to push in byte.
* Notes:
* Consider using buffer_zerocopy_*().
*/
int buffer_push_data(buffer_t *buffer, const void *data, size_t length);
/* This pushes a string to the end of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* string
* The string to be pushed. The tailing '\0'-termination will not be
* part of the buffer.
* Notes:
* Consider using buffer_zerocopy_*().
*/
int buffer_push_string(buffer_t *buffer, const char *string);
/* This pushes a formated string to the end of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* format
* The format string as for printf() family functions.
* ...
* The parameters according to the format string.
*/
int buffer_push_printf(buffer_t *buffer, const char *format, ...);
/* This pushes a formated string to the end of the buffer using a va_list.
* Parameters:
* buffer
* The buffer to operate on.
* format
* The format string as for printf() family functions.
* ap
* The parameters according to the format string as va_list.
* See also:
* vprintf(3).
*/
int buffer_push_vprintf(buffer_t *buffer, const char *format, va_list ap);
/* This pushes the content of another buffer to the end of the buffer.
* Parameters:
* buffer
* The buffer to operate on.
* source
* The buffer which's content is to be copied.
*/
int buffer_push_buffer(buffer_t *buffer, buffer_t *source);
/* This requests for a memory buffer that can be pushed to without the need for copy.
* Parameters:
* buffer
* The buffer to operate on.
* data
* Pointer to memory that can be written and will become part of the buffer object.
* request
* Size of the memory area that is returned by data in bytes.
* Notes:
* This is the first step of the zero copy push. After the memory returned by data has been
* written (e.g. used in a call to read(2)) buffer_zerocopy_push_complete() must be called.
*/
int buffer_zerocopy_push_request(buffer_t *buffer, void **data, size_t request);
/* This is the final step of a zero copy push.
* Parameters:
* buffer
* The buffer to operate on.
* done
* Amount of data in bytes that has actually been written into the memory area.
* May be zero to what has been requested with request.
*/
int buffer_zerocopy_push_complete(buffer_t *buffer, size_t done);
#endif
......@@ -26,7 +26,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include "common/thread/thread.h"
#include <igloo/thread.h>
#include "cfgfile.h"
#include "global.h"
......@@ -34,8 +34,7 @@
#include "util.h"
#include "auth.h"
#include "event.h"
#include "refobject.h"
#include "reportxml.h"
#include <igloo/ro.h>
/* for config_reread_config() */
#include "yp.h"
......@@ -231,14 +230,14 @@ char * config_href_to_id(const char *href)
static void create_locks(void)
{
thread_mutex_create(&_locks.relay_lock);
thread_rwlock_create(&_locks.config_lock);
igloo_thread_mutex_create(&_locks.relay_lock);
igloo_thread_rwlock_create(&_locks.config_lock);
}
static void release_locks(void)
{
thread_mutex_destroy(&_locks.relay_lock);
thread_rwlock_destroy(&_locks.config_lock);
igloo_thread_mutex_destroy(&_locks.relay_lock);
igloo_thread_rwlock_destroy(&_locks.config_lock);
}
void config_initialize(void)
......@@ -258,7 +257,7 @@ void config_init_configuration(ice_config_t *configuration)
{
memset(configuration, 0, sizeof(ice_config_t));
_set_defaults(configuration);
configuration->reportxml_db = refobject_new(reportxml_database_t);
configuration->reportxml_db = igloo_ro_new(igloo_reportxml_database_t);
}
static inline void __read_int(xmlDocPtr doc, xmlNodePtr node, int *val, const char *warning)
......@@ -692,12 +691,12 @@ void config_clear(ice_config_t *c)
while ((c->listen_sock = config_clear_listener(c->listen_sock)));
thread_mutex_lock(&(_locks.relay_lock));
igloo_thread_mutex_lock(&(_locks.relay_lock));
for (i = 0; i < c->relay_length; i++) {
relay_config_free(c->relay[i]);
}
free(c->relay);
thread_mutex_unlock(&(_locks.relay_lock));
igloo_thread_mutex_unlock(&(_locks.relay_lock));
mount = c->mounts;
while (mount) {
......@@ -723,7 +722,7 @@ void config_clear(ice_config_t *c)
config_clear_http_header(c->http_headers);
refobject_unref(c->reportxml_db);
igloo_ro_unref(c->reportxml_db);
memset(c, 0, sizeof(ice_config_t));
}
......@@ -821,18 +820,18 @@ ice_config_locks *config_locks(void)
void config_release_config(void)
{
thread_rwlock_unlock(&(_locks.config_lock));
igloo_thread_rwlock_unlock(&(_locks.config_lock));
}
ice_config_t *config_get_config(void)
{
thread_rwlock_rlock(&(_locks.config_lock));
igloo_thread_rwlock_rlock(&(_locks.config_lock));
return &_current_configuration;
}
ice_config_t *config_grab_config(void)
{
thread_rwlock_wlock(&(_locks.config_lock));
igloo_thread_rwlock_wlock(&(_locks.config_lock));
return &_current_configuration;
}
......@@ -2248,7 +2247,7 @@ static void _parse_paths(xmlDocPtr doc,
if (configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] == '/')
configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] = 0;
} else if (xmlStrcmp(node->name, XMLSTR("reportxmldb")) == 0) {
reportxml_t *report;
igloo_reportxml_t *report;
xmlDocPtr dbdoc;
if (!(temp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1))) {
......@@ -2259,13 +2258,13 @@ static void _parse_paths(xmlDocPtr doc,
if (!doc) {
ICECAST_LOG_ERROR("Can not read report xml database \"%H\" as XML", temp);
} else {
report = reportxml_parse_xmldoc(dbdoc);
report = igloo_reportxml_parse_xmldoc(dbdoc);
xmlFreeDoc(dbdoc);
if (!report) {
ICECAST_LOG_ERROR("Can not parse report xml database \"%H\"", temp);
} else {
reportxml_database_add_report(configuration->reportxml_db, report);
refobject_unref(report);
igloo_reportxml_database_add_report(configuration->reportxml_db, report);
igloo_ro_unref(report);
ICECAST_LOG_INFO("File \"%H\" added to report xml database", temp);
}
}
......
......@@ -23,8 +23,10 @@
#define MAX_YP_DIRECTORIES 25
#include <libxml/tree.h>
#include "common/thread/thread.h"
#include "common/avl/avl.h"
#include <igloo/thread.h>
#include <igloo/avl.h>
#include <igloo/reportxml.h>
#include "icecasttypes.h"
#include "compat.h"
......@@ -256,7 +258,7 @@ struct ice_config_tag {
char *webroot_dir;
char *adminroot_dir;
resource_t *resources;
reportxml_database_t *reportxml_db;
igloo_reportxml_database_t *reportxml_db;
char *access_log;
char *error_log;
......@@ -278,8 +280,8 @@ struct ice_config_tag {
};
typedef struct {
rwlock_t config_lock;
mutex_t relay_lock;
igloo_rwlock_t config_lock;
igloo_mutex_t relay_lock;
} ice_config_locks;
void config_initialize(void);
......
This diff is collapsed.
......@@ -19,8 +19,9 @@
#ifndef __CLIENT_H__
#define __CLIENT_H__
#include "common/httpp/httpp.h"
#include "common/httpp/encoding.h"
#include <igloo/httpp.h>
#include <igloo/encoding.h>
#include <igloo/reportxml.h>
#include "icecasttypes.h"
#include "errors.h"
......@@ -70,10 +71,10 @@ struct _client_tag {
reuse_t reuse;
/* the client's http headers */
http_parser_t *parser;
igloo_http_parser_t *parser;
/* Transfer Encoding if any */
httpp_encoding_t *encoding;
igloo_httpp_encoding_t *encoding;
/* protocol client uses */
protocol_t protocol;
......@@ -139,7 +140,7 @@ struct _client_tag {
int (*check_buffer)(source_t *source, client_t *client);
};
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
int client_create (client_t **c_ptr, connection_t *con, igloo_http_parser_t *parser);
void client_complete(client_t *client);
void client_destroy(client_t *client);
void client_send_error_by_id(client_t *client, icecast_error_id_t id);
......@@ -148,8 +149,8 @@ void client_send_101(client_t *client, reuse_t reuse);
void client_send_204(client_t *client);
void client_send_426(client_t *client, reuse_t reuse);
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);
reportxml_t *client_get_reportxml(const char *state_definition, const char *state_akindof, const char *state_text);
void client_send_reportxml(client_t *client, igloo_reportxml_t *report, document_domain_t domain, const char *xsl, admin_format_t admin_format_hint, int status, const char *location);
igloo_reportxml_t *client_get_reportxml(const char *state_definition, const char *state_akindof, const char *state_text);
admin_format_t client_get_admin_format_by_content_negotiation(client_t *client);
int client_send_bytes (client_t *client, const void *buf, unsigned len);
int client_read_bytes (client_t *client, void *buf, unsigned len);
......
Subproject commit ad5fc1006122f42abd34ade3f42bf2779297140d
This diff is collapsed.
......@@ -21,8 +21,9 @@
#include "icecasttypes.h"
#include "compat.h"
#include "common/thread/thread.h"
#include "common/net/sock.h"
#include <igloo/thread.h>
</