本文整理汇总了C++中config_release_config函数的典型用法代码示例。如果您正苦于以下问题:C++ config_release_config函数的具体用法?C++ config_release_config怎么用?C++ config_release_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_release_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: command_list_log
static int command_list_log (client_t *client, int response)
{
refbuf_t *content;
const char *logname = httpp_get_query_param (client->parser, "log");
int log = -1;
ice_config_t *config;
if (logname == NULL)
return client_send_400 (client, "No log specified");
config = config_get_config ();
if (strcmp (logname, "errorlog") == 0)
log = config->error_log.logid;
else if (strcmp (logname, "accesslog") == 0)
log = config->access_log.logid;
else if (strcmp (logname, "playlistlog") == 0)
log = config->playlist_log.logid;
if (log < 0)
{
config_release_config();
WARN1 ("request to show unknown log \"%s\"", logname);
return client_send_400 (client, "unknown");
}
content = refbuf_new (0);
log_contents (log, &content->data, &content->len);
config_release_config();
if (response == XSLT)
{
xmlNodePtr xmlnode;
xmlDocPtr doc;
doc = xmlNewDoc(XMLSTR("1.0"));
xmlnode = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
xmlDocSetRootElement(doc, xmlnode);
xmlNewTextChild (xmlnode, NULL, XMLSTR("log"), XMLSTR(content->data));
refbuf_release (content);
return admin_send_response (doc, client, XSLT, "showlog.xsl");
}
else
{
refbuf_t *http = refbuf_new (100);
int len = snprintf (http->data, 100, "%s",
"HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n");
http->len = len;
http->next = content;
client->respcode = 200;
client_set_queue (client, http);
return fserve_setup_client (client);
}
}
开发者ID:GitLaboratory,项目名称:icecast-kh,代码行数:53,代码来源:admin.c
示例2: url_stream_end
static void url_stream_end (auth_client *auth_user)
{
char *mount, *server;
ice_config_t *config = config_get_config ();
mount_proxy *mountinfo = config_find_mount (config, auth_user->mount, MOUNT_TYPE_NORMAL);
auth_t *auth = mountinfo->auth;
auth_url *url = auth->state;
char *stream_end_url;
int port;
char post [4096];
if (url->stream_end == NULL)
{
config_release_config ();
return;
}
server = util_url_escape (config->hostname);
port = config->port;
stream_end_url = strdup (url->stream_end);
/* we don't want this auth disappearing from under us while
* the connection is in progress */
mountinfo->auth->refcount++;
config_release_config ();
mount = util_url_escape (auth_user->mount);
snprintf (post, sizeof (post),
"action=mount_remove&mount=%s&server=%s&port=%d", mount, server, port);
free (server);
free (mount);
if (strchr (url->stream_end, '@') == NULL)
{
if (url->userpwd)
curl_easy_setopt (url->handle, CURLOPT_USERPWD, url->userpwd);
else
curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
}
else
curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
curl_easy_setopt (url->handle, CURLOPT_URL, url->stream_end);
curl_easy_setopt (url->handle, CURLOPT_POSTFIELDS, post);
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
if (curl_easy_perform (url->handle))
ICECAST_LOG_WARN("auth to server %s failed with %s", stream_end_url, url->errormsg);
auth_release (auth);
free (stream_end_url);
return;
}
开发者ID:TeddyRilliot,项目名称:icecast,代码行数:50,代码来源:auth_url.c
示例3: command_buildm3u
static void command_buildm3u(client_t *client, source_t *source,
int response)
{
char *username = NULL;
char *password = NULL;
char *host = NULL;
int port = 0;
ice_config_t *config;
COMMAND_REQUIRE(client, "username", username);
COMMAND_REQUIRE(client, "password", password);
config = config_get_config();
host = strdup(config->hostname);
port = config->port;
config_release_config();
client->respcode = 200;
sock_write(client->con->sock,
"HTTP/1.0 200 OK\r\n"
"Content-Type: audio/x-mpegurl\r\n"
"Content-Disposition = attachment; filename=listen.m3u\r\n\r\n"
"http://%s:%[email protected]%s:%d%s\r\n",
username,
password,
host,
port,
source->mount
);
free(host);
client_destroy(client);
}
开发者ID:kitsune-dsu,项目名称:kitsune-icecast,代码行数:33,代码来源:admin.c
示例4: client_create
/* create a client_t with the provided connection and parser details. Return
* 0 on success, -1 if server limit has been reached. In either case a
* client_t is returned just in case a message needs to be returned. Should
* be called with global lock held.
*/
int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser)
{
ice_config_t *config;
client_t *client = (client_t *)calloc(1, sizeof(client_t));
int ret = -1;
if (client == NULL)
abort();
config = config_get_config ();
global.clients++;
if (config->client_limit < global.clients)
WARN2 ("server client limit reached (%d/%d)", config->client_limit, global.clients);
else
ret = 0;
config_release_config ();
stats_event_args (NULL, "clients", "%d", global.clients);
client->con = con;
client->parser = parser;
client->refbuf = refbuf_new (PER_CLIENT_REFBUF_SIZE);
client->refbuf->len = 0; /* force reader code to ignore buffer contents */
client->pos = 0;
client->write_to_client = format_generic_write_to_client;
*c_ptr = client;
return ret;
}
开发者ID:dcorbe,项目名称:icecast,代码行数:35,代码来源:client.c
示例5: command_buildm3u
static void command_buildm3u(client_t *client, const char *mount)
{
const char *username = NULL;
const char *password = NULL;
ice_config_t *config;
COMMAND_REQUIRE(client, "username", username);
COMMAND_REQUIRE(client, "password", password);
client->respcode = 200;
config = config_get_config();
snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
"HTTP/1.0 200 OK\r\n"
"Content-Type: audio/x-mpegurl\r\n"
"Content-Disposition = attachment; filename=listen.m3u\r\n\r\n"
"http://%s:%[email protected]%s:%d%s\r\n",
username,
password,
config->hostname,
config->port,
mount
);
config_release_config();
client->refbuf->len = strlen (client->refbuf->data);
fserve_add_client (client, NULL);
}
开发者ID:krattai,项目名称:AEBL,代码行数:27,代码来源:admin.c
示例6: file_release
static void file_release (client_t *client)
{
fh_node *fh = client->shared_data;
int ret = -1;
if (fh->finfo.flags & FS_FALLBACK)
stats_event_dec (NULL, "listeners");
remove_from_fh (fh, client);
client_set_queue (client, NULL);
if (client->flags & CLIENT_AUTHENTICATED && client->parser->req_type == httpp_req_get)
{
const char *mount = httpp_getvar (client->parser, HTTPP_VAR_URI);
ice_config_t *config = config_get_config ();
mount_proxy *mountinfo = config_find_mount (config, mount);
if (mountinfo && mountinfo->access_log.name)
logging_access_id (&mountinfo->access_log, client);
ret = auth_release_listener (client, mount, mountinfo);
config_release_config();
}
if (ret < 0)
{
client->flags &= ~CLIENT_AUTHENTICATED;
client_destroy (client);
}
global_reduce_bitrate_sampling (global.out_bitrate);
}
开发者ID:roderickm,项目名称:icecast-kh,代码行数:28,代码来源:fserve.c
示例7: auth_postprocess_listener
static int auth_postprocess_listener (auth_client *auth_user)
{
int ret;
client_t *client = auth_user->client;
auth_t *auth = auth_user->auth;
ice_config_t *config;
mount_proxy *mountinfo;
const char *mount = auth_user->mount;
if (client == NULL)
return 0;
if ((client->flags & CLIENT_AUTHENTICATED) == 0)
{
/* auth failed so do we place the listener elsewhere */
auth_user->client = NULL;
if (auth->rejected_mount)
mount = auth->rejected_mount;
else
{
client_send_401 (client, auth_user->auth->realm);
return -1;
}
}
config = config_get_config();
mountinfo = config_find_mount (config, mount);
ret = add_authenticated_listener (mount, mountinfo, client);
config_release_config();
auth_user->client = NULL;
return ret;
}
开发者ID:balbinus,项目名称:icecast-kh,代码行数:32,代码来源:auth.c
示例8: fserve_initialize
void fserve_initialize(void)
{
if (fserve_running) return;
ice_config_t *config = config_get_config();
mimetypes = NULL;
thread_spin_create (&pending_lock);
#ifndef HAVE_PREAD
thread_mutex_create (&seekread_lock);
#endif
fh_cache = avl_tree_new (_compare_fh, NULL);
fserve_recheck_mime_types (config);
config_release_config();
stats_event_flags (NULL, "file_connections", "0", STATS_COUNTERS);
fserve_running = 1;
memset (&no_file, 0, sizeof (no_file));
thread_mutex_create (&no_file.lock);
no_file.clients = avl_tree_new (client_compare, NULL);
no_file.refcount = 1;
no_file.expire = (time_t)-1;
no_file.f = -1;
avl_insert (fh_cache, &no_file);
INFO0("file serving started");
}
开发者ID:onitake,项目名称:icecast-kh,代码行数:27,代码来源:fserve.c
示例9: client_check_source_auth
/* return -1 for failed, 0 for authenticated, 1 for pending
*/
int client_check_source_auth (client_t *client, const char *mount)
{
ice_config_t *config = config_get_config();
char *pass = config->source_password;
char *user = "source";
int ret = -1;
mount_proxy *mountinfo = config_find_mount (config, mount, MOUNT_TYPE_NORMAL);
do
{
if (mountinfo)
{
ret = 1;
if (auth_stream_authenticate (client, mount, mountinfo) > 0)
break;
ret = -1;
if (mountinfo->password)
pass = mountinfo->password;
if (mountinfo->username)
user = mountinfo->username;
}
if (connection_check_pass (client->parser, user, pass) > 0)
ret = 0;
} while (0);
config_release_config();
return ret;
}
开发者ID:dcorbe,项目名称:icecast,代码行数:29,代码来源:client.c
示例10: config_get_config
/* Search for mount, if the mount is there but not currently running then
* check the fallback, and so on. Must have a global source lock to call
* this function.
*/
source_t *source_find_mount (const char *mount)
{
source_t *source = NULL;
ice_config_t *config;
mount_proxy *mountinfo;
int depth = 0;
config = config_get_config();
while (mount && depth < MAX_FALLBACK_DEPTH)
{
source = source_find_mount_raw(mount);
if (source)
{
if (source->running || source->on_demand)
break;
}
/* we either have a source which is not active (relay) or no source
* at all. Check the mounts list for fallback settings
*/
mountinfo = config_find_mount (config, mount);
source = NULL;
if (mountinfo == NULL)
break;
mount = mountinfo->fallback_mount;
depth++;
}
config_release_config();
return source;
}
开发者ID:asepsutiawan,项目名称:icecast,代码行数:37,代码来源:source.c
示例11: connection_check_relay_pass
int connection_check_relay_pass(http_parser_t *parser)
{
int ret;
ice_config_t *config = config_get_config();
char *pass = config->relay_password;
char *user = config->relay_username;
if(!pass || !user) {
config_release_config();
return 0;
}
ret = _check_pass_http(parser, user, pass);
config_release_config();
return ret;
}
开发者ID:miksago,项目名称:icecast,代码行数:16,代码来源:connection.c
示例12: connection_check_source_pass
int connection_check_source_pass(http_parser_t *parser, char *mount)
{
ice_config_t *config = config_get_config();
char *pass = config->source_password;
char *user = "source";
int ret;
int ice_login = config->ice_login;
char *protocol;
mount_proxy *mountinfo = config->mounts;
thread_mutex_lock(&(config_locks()->mounts_lock));
while(mountinfo) {
if(!strcmp(mountinfo->mountname, mount)) {
if(mountinfo->password)
pass = mountinfo->password;
if(mountinfo->username)
user = mountinfo->username;
break;
}
mountinfo = mountinfo->next;
}
thread_mutex_unlock(&(config_locks()->mounts_lock));
if(!pass) {
WARN0("No source password set, rejecting source");
config_release_config();
return 0;
}
protocol = httpp_getvar(parser, HTTPP_VAR_PROTOCOL);
if(protocol != NULL && !strcmp(protocol, "ICY")) {
ret = _check_pass_icy(parser, pass);
}
else {
ret = _check_pass_http(parser, user, pass);
if(!ret && ice_login)
{
ret = _check_pass_ice(parser, pass);
if(ret)
WARN0("Source is using deprecated icecast login");
}
}
config_release_config();
return ret;
}
开发者ID:miksago,项目名称:icecast,代码行数:47,代码来源:connection.c
示例13: json_stats_stop
void json_stats_stop(const char *mount)
{
ice_config_t *config = config_get_config();
if (config->json_stats_dir) {
unlink(json_filename(config->json_stats_dir, mount));
}
config_release_config();
}
开发者ID:creativeprogramming,项目名称:icecast-ra,代码行数:8,代码来源:stats.c
示例14: calloc
static ypdata_t *create_yp_entry (const char *mount)
{
ypdata_t *yp;
char *s;
yp = calloc (1, sizeof (ypdata_t));
do
{
unsigned len = 512;
int ret;
char *url;
mount_proxy *mountproxy = NULL;
ice_config_t *config;
if (yp == NULL)
break;
yp->mount = strdup (mount);
yp->server_name = strdup ("");
yp->server_desc = strdup ("");
yp->server_genre = strdup ("");
yp->bitrate = strdup ("");
yp->server_type = strdup ("");
yp->cluster_password = strdup ("");
yp->url = strdup ("");
yp->current_song = strdup ("");
yp->audio_info = strdup ("");
yp->subtype = strdup ("");
yp->process = do_yp_add;
url = malloc (len);
if (url == NULL)
break;
config = config_get_config();
ret = snprintf (url, len, "http://%s:%d%s", config->hostname, config->port, mount);
if (ret >= (signed)len)
{
s = realloc (url, ++ret);
if (s) url = s;
snprintf (url, ret, "http://%s:%d%s", config->hostname, config->port, mount);
}
mountproxy = config_find_mount (config, mount);
if (mountproxy && mountproxy->cluster_password)
add_yp_info (yp, mountproxy->cluster_password, YP_CLUSTER_PASSWORD);
config_release_config();
yp->listen_url = util_url_escape (url);
free (url);
if (yp->listen_url == NULL)
break;
yp_schedule (yp, 0);
return yp;
} while (0);
yp_destroy_ypdata (yp);
return NULL;
}
开发者ID:cmelendez,项目名称:icecast-kh,代码行数:58,代码来源:yp.c
示例15: yp_initialize
void yp_initialize()
{
ice_config_t *config = config_get_config();
thread_rwlock_create (&yp_lock);
thread_mutex_create (&yp_pending_lock);
yp_recheck_config (config);
config_release_config ();
yp_thread = thread_create("YP Touch Thread", yp_update_thread,
(void *)NULL, THREAD_ATTACHED);
}
开发者ID:kitsune-dsu,项目名称:kitsune-icecast,代码行数:10,代码来源:yp.c
示例16: source_recheck_mounts
/* rescan the mount list, so that xsl files are updated to show
* unconnected but active fallback mountpoints
*/
void source_recheck_mounts (int update_all)
{
ice_config_t *config;
mount_proxy *mount;
avl_tree_rlock (global.source_tree);
config = config_get_config();
mount = config->mounts;
if (update_all)
stats_clear_virtual_mounts ();
while (mount)
{
source_t *source = source_find_mount (mount->mountname);
if (source)
{
source = source_find_mount_raw (mount->mountname);
if (source)
{
mount_proxy *mountinfo = config_find_mount (config, source->mount);
source_update_settings (config, source, mountinfo);
}
else if (update_all)
{
stats_event_hidden (mount->mountname, NULL, mount->hidden);
stats_event_args (mount->mountname, "listenurl", "http://%s:%d%s",
config->hostname, config->port, mount->mountname);
stats_event (mount->mountname, "listeners", "0");
if (mount->max_listeners < 0)
stats_event (mount->mountname, "max_listeners", "unlimited");
else
stats_event_args (mount->mountname, "max_listeners", "%d", mount->max_listeners);
}
}
else
stats_event (mount->mountname, NULL, NULL);
/* check for fallback to file */
if (global.running == ICE_RUNNING && mount->fallback_mount)
{
source_t *fallback = source_find_mount (mount->fallback_mount);
if (fallback == NULL)
{
thread_create ("Fallback file thread", source_fallback_file,
strdup (mount->fallback_mount), THREAD_DETACHED);
}
}
mount = mount->next;
}
avl_tree_unlock (global.source_tree);
config_release_config();
}
开发者ID:asepsutiawan,项目名称:icecast,代码行数:58,代码来源:source.c
示例17: url_stream_auth
static void url_stream_auth (auth_client *auth_user)
{
ice_config_t *config;
int port;
client_t *client = auth_user->client;
auth_url *url = client->auth->state;
char *mount, *host, *user, *pass, *ipaddr, *admin="";
char post [4096];
if (strchr (url->stream_auth, '@') == NULL)
{
if (url->userpwd)
curl_easy_setopt (url->handle, CURLOPT_USERPWD, url->userpwd);
else
curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
}
else
curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
curl_easy_setopt (url->handle, CURLOPT_URL, url->stream_auth);
curl_easy_setopt (url->handle, CURLOPT_POSTFIELDS, post);
curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
if (strcmp (auth_user->mount, httpp_getvar (client->parser, HTTPP_VAR_URI)) != 0)
admin = "&admin=1";
mount = util_url_escape (auth_user->mount);
config = config_get_config ();
host = util_url_escape (config->hostname);
port = config->port;
config_release_config ();
ipaddr = util_url_escape (client->con->ip);
if (client->username) {
user = util_url_escape(client->username);
} else {
user = strdup("");
}
if (client->password) {
pass = util_url_escape(client->password);
} else {
pass = strdup("");
}
snprintf (post, sizeof (post),
"action=stream_auth&mount=%s&ip=%s&server=%s&port=%d&user=%s&pass=%s%s",
mount, ipaddr, host, port, user, pass, admin);
free (ipaddr);
free (user);
free (pass);
free (mount);
free (host);
client->authenticated = 0;
if (curl_easy_perform (url->handle))
ICECAST_LOG_WARN("auth to server %s failed with %s", url->stream_auth, url->errormsg);
}
开发者ID:TeddyRilliot,项目名称:icecast,代码行数:55,代码来源:auth_url.c
示例18: event_config_read
void event_config_read(void *arg)
{
int ret;
ice_config_t *config;
ice_config_t new_config;
/* reread config file */
config = config_grab_config(); /* Both to get the lock, and to be able
to find out the config filename */
xmlSetGenericErrorFunc ("config", log_parse_failure);
ret = config_parse_file(config->config_filename, &new_config);
if(ret < 0) {
ICECAST_LOG_ERROR("Error parsing config, not replacing existing config");
switch(ret) {
case CONFIG_EINSANE:
ICECAST_LOG_ERROR("Config filename null or blank");
break;
case CONFIG_ENOROOT:
ICECAST_LOG_ERROR("Root element not found in %s", config->config_filename);
break;
case CONFIG_EBADROOT:
ICECAST_LOG_ERROR("Not an icecast2 config file: %s",
config->config_filename);
break;
default:
ICECAST_LOG_ERROR("Parse error in reading %s", config->config_filename);
break;
}
config_release_config();
}
else {
config_clear(config);
config_set_config(&new_config);
config = config_get_config_unlocked();
restart_logging (config);
yp_recheck_config (config);
fserve_recheck_mime_types (config);
stats_global (config);
config_release_config();
slave_update_all_mounts();
}
}
开发者ID:TeddyRilliot,项目名称:icecast,代码行数:42,代码来源:event.c
示例19: fserve_client_create
int fserve_client_create(client_t *httpclient, char *path)
{
fserve_t *client = calloc(1, sizeof(fserve_t));
int bytes;
int client_limit;
ice_config_t *config = config_get_config();
client_limit = config->client_limit;
config_release_config();
client->file = fopen(path, "rb");
if(!client->file) {
client_send_404(httpclient, "File not readable");
return -1;
}
client->client = httpclient;
client->offset = 0;
client->datasize = 0;
client->ready = 0;
client->buf = malloc(BUFSIZE);
global_lock();
if(global.clients >= client_limit) {
httpclient->respcode = 504;
bytes = sock_write(httpclient->con->sock,
"HTTP/1.0 504 Server Full\r\n"
"Content-Type: text/html\r\n\r\n"
"<b>Server is full, try again later.</b>\r\n");
if(bytes > 0) httpclient->con->sent_bytes = bytes;
fserve_client_destroy(client);
global_unlock();
return -1;
}
global.clients++;
global_unlock();
httpclient->respcode = 200;
bytes = sock_write(httpclient->con->sock,
"HTTP/1.0 200 OK\r\n"
"Content-Type: %s\r\n\r\n",
fserve_content_type(path));
if(bytes > 0) httpclient->con->sent_bytes = bytes;
sock_set_blocking(client->client->con->sock, SOCK_NONBLOCK);
sock_set_nodelay(client->client->con->sock);
thread_mutex_lock (&pending_lock);
client->next = (fserve_t *)pending_list;
pending_list = client;
thread_mutex_unlock (&pending_lock);
return 0;
}
开发者ID:miksago,项目名称:icecast,代码行数:54,代码来源:fserve.c
示例20: _handle_get_request
static void _handle_get_request (client_t *client, char *passed_uri)
{
int port;
char *serverhost = NULL;
int serverport = 0;
aliases *alias;
ice_config_t *config;
char *uri = passed_uri;
listener_t *listen_sock;
config = config_get_config();
port = config->port;
listen_sock = config_get_listen_sock (config, client->con);
if (listen_sock)
{
serverhost = listen_sock->bind_address;
serverport = listen_sock->port;
}
alias = config->aliases;
/* there are several types of HTTP GET clients
** media clients, which are looking for a source (eg, URI = /stream.ogg)
** stats clients, which are looking for /admin/stats.xml
** and directory server authorizers, which are looking for /GUID-xxxxxxxx
** (where xxxxxx is the GUID in question) - this isn't implemented yet.
** we need to handle the latter two before the former, as the latter two
** aren't subject to the limits.
*/
/* TODO: add GUID-xxxxxx */
/* Handle aliases */
while(alias) {
if(strcmp(uri, alias->source) == 0 && (alias->port == -1 || alias->port == serverport) && (alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0))) {
uri = strdup (alias->destination);
DEBUG2 ("alias has made %s into %s", passed_uri, uri);
break;
}
alias = alias->next;
}
config_release_config();
stats_event_inc(NULL, "client_connections");
/* Dispatch all admin requests */
if ((strcmp(uri, "/admin.cgi") == 0) ||
(strncmp(uri, "/admin/", 7) == 0)) {
admin_handle_request(client, uri);
if (uri != passed_uri) free (uri);
return;
}
auth_add_listener (uri, client);
if (uri != passed_uri) free (uri);
}
开发者ID:miksago,项目名称:icecast,代码行数:54,代码来源:connection.c
注:本文中的config_release_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论