mod_musicindex  1.4.1
mod_musicindex.c File Reference

Core file. More...

#include "mod_musicindex.h"
#include "playlist.h"
#include "config.h"
#include "html.h"
#include "http.h"
#include "sort.h"
#include <http_core.h>
#include <http_main.h>

Go to the source code of this file.

Functions

static int is_msie_user_agent (request_rec *r)
 Check whether we're serving MS IE.
static int handle_musicindex (request_rec *r)
 This is where the magic happens.
static int handle_musicfile (request_rec *r)
 Handler for requests on music files.
static void musicindex_init (server_rec *s, apr_pool_t *p)
 Adds the mod signature into Apache's headers.

Variables

static const handler_rec musicindex_handlers []
module MODULE_VAR_EXPORT musicindex_module

Detailed Description

Core file.

This file is the core of the module. It contains Apache's mandatory stuff.

Author
Regis Boudin
Version
Revision:
1012
Date
2002-2008
2010-2012

http://httpd.apache.org/docs-2.0/developer/API.html http://httpd.apache.org/dev/apidoc/ http://www.apachetutor.org/dev/pools

Warning
Use it at your own risks!
sub requests are EXTREMELY cpu expensive
Todo:

Complete code documentation.

(low pri whishlist) On the fly tag rewriting or metadata support.

prepare the possibility to generate ices/mpd playlists.

enforce strict type policy.

get rid of str*cmp() whenever possible.

review the randomdir implementation.

Todo:
Check how much overhead a DAAP implementation would bring. The protocol works on top of HTTP (where we are) and could make use of the cache.
Todo:
Audit the code: in many places we are using a lot of arguments passed to functions that could easily be gotten otherwise by dereferencing a few pointers. Passing too many args increases stack usage.
Todo:
Decide how long we want to support Apache 1.3. APR provides lots of useful features, and the API compatibility between 1.3 and 2.2 is not certain.
Todo:
Check whether it'd make sense to abstract Apache's primitives so as to make the module portable to other webservers.

Definition in file mod_musicindex.c.

Function Documentation

static int handle_musicfile ( request_rec *  r)
static

Handler for requests on music files.

At the moment it can only forbid acces to files if neither streaming nor download is allowed.

Parameters
rApache request_rec to get and send data
Returns
Standard HTTP code (see httpd.h for more infos)

Definition at line 419 of file mod_musicindex.c.

References ap_set_content_type, apr_psprintf, apr_table_setn, mu_config::cache, cache_backend::epilogue, mu_pack::fhead, mu_pack::head, mu_config::iceserver, mu_ent::length, make_music_entry(), MI_ACTIVE, MI_ALLOWDWNLD, MI_ALLOWSTREAM, musicindex_module, mu_config::options, cache_backend::prologue, and send_playlist().

static int is_msie_user_agent ( request_rec *  r)
static

Check whether we're serving MS IE.

Parameters
rApache request_rec
Returns
1 if client is MSIE, 0 otherwise

Definition at line 216 of file mod_musicindex.c.

References apr_table_get.

Referenced by handle_musicindex().

static void musicindex_init ( server_rec *  s,
apr_pool_t p 
)
static

Adds the mod signature into Apache's headers.

Parameters
sserver_rec
ppool

Definition at line 515 of file mod_musicindex.c.

References MUSIC_HEADER_STRING.

Variable Documentation

const handler_rec musicindex_handlers[]
static
Initial value:
{
{DIR_MAGIC_TYPE, handle_musicindex},
{"audio/mpeg", handle_musicfile},
{"audio/ogg", handle_musicfile},
{"audio/x-ogg", handle_musicfile},
{"application/ogg", handle_musicfile},
{"audio/flac", handle_musicfile},
{"audio/x-flac", handle_musicfile},
{"application/x-flac", handle_musicfile},
{"audio/mp4", handle_musicfile},
{NULL}
}

Definition at line 529 of file mod_musicindex.c.