mod_musicindex  1.4.1
mod_musicindex.h File Reference
#include <httpd.h>
#include <http_config.h>
#include <http_request.h>
#include <http_protocol.h>
#include <http_log.h>
#include "mod_musicindex_config.h"
#include <libintl.h>

Go to the source code of this file.

Data Structures

struct  mu_ent
 Music entry. More...
struct  mu_pack
 Pack of music entries. More...
struct  cache_backend
 Cache backend structure, defining a standard set of operations that all cache backends may implement. More...
struct  mu_config
 Configuration handling structure. More...

Macros

#define MUSIC_VERSION_STRING   PACKAGE_VERSION
 Version string.
#define MUSIC_AUTHORS_STRING   "R. Boudin & T. Varene"
 Authors.
#define MUSIC_HEADER_STRING   "mod_musicindex/" MUSIC_VERSION_STRING
#define FALSE   0
#define TRUE   !FALSE
#define __attribute__(x)   /* NOTHING */
#define likely(x)   (x)
#define unlikely(x)   (x)
#define STRUCTTV   int
#define ARRAY_SIZE(x)   (sizeof(x) / sizeof(x[0]))
#define SB_DEFAULT   SB_URI
 Default sort order (used in search results)
#define MI_ACTIVE   (1 << 0)
 Music indexing is enabled.
#define MI_ALLOWSTREAM   (1 << 1)
 Stream is permitted.
#define MI_ALLOWDWNLD   (1 << 2)
 Download is permitted.
#define MI_ALLOWSEARCH   (1 << 3)
 Search is permitted.
#define MI_ALLOWTARBALL   (1 << 4)
 Tarball generation is permitted.
#define MI_ALLOWFETCH   (MI_ALLOWSTREAM | MI_ALLOWDWNLD | MI_ALLOWTARBALL)
 One of stream, download or tarball is allowed.
#define MI_STREAM   (1 << 5)
 Stream request.
#define MI_ALL   (1 << 6)
 Request for all files.
#define MI_RECURSIVE   (1 << 7)
 Recursive action.
#define MI_RSS   (1 << 8)
 RSS feed.
#define MI_PODCAST   (1 << 9)
 Podcast.
#define MI_RANDOMDIR   (1 << 10)
 Random directory redirection.
#define MI_TARBALL   (1 << 11)
 Tarball creation.
#define MI_STREAMLST   (MI_STREAM)
#define MI_STREAMALL   (MI_STREAM | MI_ALL)
#define MI_STREAMCOOKIE   (MI_STREAM | MI_COOKIEOP)
#define MI_STREAMRQ   (MI_STREAMLST | MI_STREAMALL | MI_STREAMCOOKIE)
#define MI_DWNLDLST   (MI_TARBALL)
#define MI_DWNLDALL   (MI_TARBALL | MI_ALL)
#define MI_DWNLDCOOKIE   (MI_TARBALL | MI_COOKIEOP)
#define MI_DWNLDRQ   (MI_DWNLDLST | MI_DWNLDALL | MI_DWNLDCOOKIE)
#define MI_COOKIEOP   (1 << 12)
 Any cookie operation.
#define MI_COOKIEADD   (1 << 13)
 Add a file to the playlist.
#define MI_COOKIEDEL   (1 << 14)
 Remove a file from the playlist.
#define MI_COOKIEADDLST   (MI_COOKIEOP | MI_COOKIEADD)
#define MI_COOKIEDELLST   (MI_COOKIEOP | MI_COOKIEDEL)
#define MI_COOKIEADDALL   (MI_COOKIEOP | MI_COOKIEADD | MI_ALL)
#define MI_COOKIEPURGE   (MI_COOKIEOP | MI_COOKIEDEL | MI_ALL)
#define MI_COOKIESTREAM   (MI_COOKIEOP | MI_STREAM)
#define MI_COOKIEDWNLD   (MI_COOKIEOP | MI_TARBALL)
#define MI_ALLOPS
#define MI_QUICKPL   (1 << 15)
 "Quick Play" (disable bitrate/length)
#define MI_CUSTOM   (1 << 16)
 Used to deal with custom playlist in make_music_entry.
#define MI_ALLOWRSS   (1 << 17)
 Used within make_music_entry to flag permitted RSS on directories.
#define EF_VBR   (1 << 0)
 File is VBR.
#define EF_INCACHE   (1 << 1)
 File is already in cache.
#define EF_ALLOWSTREAM   (1 << 2)
 Stream is permitted.
#define EF_ALLOWDWNLD   (1 << 3)
 Download is permitted.
#define EF_ALLOWTARBALL   (1 << 4)
 Tarball is permitted (used for directories)
#define EF_ALLOWRSS   (1 << 5)
 gross workaround for directories
#define EF_FLAGSTOSAVE   (EF_VBR)
 defines which flags will actually be saved in cache
#define MAX_STRING   1024
 Common reference for maximum string size.
#define MAX_GENRE   64
 max length for genre string.
#define MAX_FNAME   255
 max length for filenames.
#define MAX_PATHNAME   4096
 max length for pathnames.
#define MI_LOG_PREFIX   "[mod_musicindex] "
 String used to prefix log messages.
#define apr_pool_t   pool
 type name is different in apache 1.3 and 2
#define AP_INIT_NO_ARGS(directive, func, mconfig, where, help)   { directive, func, mconfig, where, NO_ARGS, help }
#define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help)   { directive, func, mconfig, where, RAW_ARGS, help }
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)   { directive, func, mconfig, where, TAKE1, help }
#define AP_INIT_FLAG(directive, func, mconfig, where, help)   { directive, func, mconfig, where, FLAG, help }
#define ap_is_directory(pool, name)   ap_is_directory(name)
 function changed in apache2
#define ap_set_content_type(r, string)   (r->content_type = string)
#define apr_pool_create(child, parent)   ((*(child)) = ap_make_sub_pool(parent))
#define ap_sub_req_lookup_uri(p, r, ptr)   ap_sub_req_lookup_uri(p, r)
#define REQUEST_USER(rec)   (rec->connection->user)
#define apr_pool_destroy   ap_destroy_pool
#define apr_table_get   ap_table_get
#define apr_table_set   ap_table_set
#define apr_table_setn   ap_table_setn
#define apr_palloc   ap_palloc
#define apr_pcalloc   ap_pcalloc
#define apr_pstrdup   ap_pstrdup
#define apr_pstrndup   ap_pstrndup
#define apr_pstrcat   ap_pstrcat
#define apr_psprintf   ap_psprintf
#define apr_base64_encode_len   ap_base64encode_len
#define apr_base64_encode   ap_base64encode
#define apr_base64_decode_len   ap_base64decode_len
#define apr_base64_decode   ap_base64decode
#define _(String)   String
#define mi_rerror(format,...)   ap_log_rerror(APLOG_MARK, APLOG_ERR, r, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)
#define mi_serror(format,...)   ap_log_error(APLOG_MARK, APLOG_ERR, s, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)
#define mi_rdebug(format,...)   /* nothing */

Typedefs

typedef struct mu_ent mu_ent
 Music entry.
typedef struct mu_config mu_config

Enumerations

enum  {
  SB_NULL, SB_ALBUM, SB_POSN, SB_TRACK,
  SB_ARTIST, SB_TITLE, SB_LENGTH, SB_BITRATE,
  SB_FREQ, SB_FILETYPE, SB_FILENAME, SB_URI,
  SB_GENRE, SB_DATE, SB_SIZE, SB_MTIME,
  SB_RANDOM, SB_DIR, SB_MAX
}
 Enumerates sort options in a more elegant way than using dozens of defines. More...

Variables

module MODULE_VAR_EXPORT musicindex_module

Macro Definition Documentation

#define _ (   String)    String
#define __attribute__ (   x)    /* NOTHING */

Definition at line 72 of file mod_musicindex.h.

#define AP_INIT_FLAG (   directive,
  func,
  mconfig,
  where,
  help 
)    { directive, func, mconfig, where, FLAG, help }

Definition at line 237 of file mod_musicindex.h.

#define AP_INIT_NO_ARGS (   directive,
  func,
  mconfig,
  where,
  help 
)    { directive, func, mconfig, where, NO_ARGS, help }

Definition at line 231 of file mod_musicindex.h.

#define AP_INIT_RAW_ARGS (   directive,
  func,
  mconfig,
  where,
  help 
)    { directive, func, mconfig, where, RAW_ARGS, help }

Definition at line 233 of file mod_musicindex.h.

#define AP_INIT_TAKE1 (   directive,
  func,
  mconfig,
  where,
  help 
)    { directive, func, mconfig, where, TAKE1, help }

Definition at line 235 of file mod_musicindex.h.

#define ap_is_directory (   pool,
  name 
)    ap_is_directory(name)

function changed in apache2

Definition at line 240 of file mod_musicindex.h.

Referenced by make_music_entry(), and send_randomdir().

#define ap_set_content_type (   r,
  string 
)    (r->content_type = string)

Definition at line 241 of file mod_musicindex.h.

Referenced by handle_musicfile(), and handle_musicindex().

#define ap_sub_req_lookup_uri (   p,
  r,
  ptr 
)    ap_sub_req_lookup_uri(p, r)

Definition at line 243 of file mod_musicindex.h.

Referenced by build_custom_list(), make_music_entry(), send_foot(), and send_head().

#define apr_base64_decode   ap_base64decode

Definition at line 260 of file mod_musicindex.h.

Referenced by build_custom_list(), and send_url().

#define apr_base64_decode_len   ap_base64decode_len

Definition at line 259 of file mod_musicindex.h.

Referenced by build_custom_list(), and send_url().

#define apr_base64_encode   ap_base64encode

Definition at line 258 of file mod_musicindex.h.

Referenced by cookie_addall(), and list_songs().

#define apr_base64_encode_len   ap_base64encode_len

Definition at line 257 of file mod_musicindex.h.

Referenced by cookie_addall(), and list_songs().

#define apr_palloc   ap_palloc
#define apr_pcalloc   ap_pcalloc
#define apr_pool_create (   child,
  parent 
)    ((*(child)) = ap_make_sub_pool(parent))

Definition at line 242 of file mod_musicindex.h.

Referenced by cookie_and_stream_work().

#define apr_pool_destroy   ap_destroy_pool

Definition at line 246 of file mod_musicindex.h.

Referenced by cookie_and_stream_work().

#define apr_pool_t   pool

type name is different in apache 1.3 and 2

Definition at line 229 of file mod_musicindex.h.

Referenced by cookie_and_stream_work().

#define apr_pstrndup   ap_pstrndup

Definition at line 254 of file mod_musicindex.h.

Referenced by make_flac_entry(), and make_music_entry().

#define apr_table_get   ap_table_get

Definition at line 248 of file mod_musicindex.h.

Referenced by find_playlist(), is_msie_user_agent(), and send_url().

#define apr_table_set   ap_table_set

Definition at line 249 of file mod_musicindex.h.

Referenced by handle_musicindex().

#define apr_table_setn   ap_table_setn

Definition at line 250 of file mod_musicindex.h.

Referenced by handle_musicfile(), handle_musicindex(), and send_randomdir().

#define ARRAY_SIZE (   x)    (sizeof(x) / sizeof(x[0]))

Definition at line 101 of file mod_musicindex.h.

#define EF_ALLOWDWNLD   (1 << 3)

Download is permitted.

Definition at line 209 of file mod_musicindex.h.

Referenced by list_songs().

#define EF_ALLOWRSS   (1 << 5)

gross workaround for directories

Definition at line 211 of file mod_musicindex.h.

Referenced by send_directories().

#define EF_ALLOWSTREAM   (1 << 2)

Stream is permitted.

Definition at line 208 of file mod_musicindex.h.

Referenced by list_songs(), send_directories(), and send_playlist().

#define EF_ALLOWTARBALL   (1 << 4)

Tarball is permitted (used for directories)

Definition at line 210 of file mod_musicindex.h.

Referenced by list_songs(), and send_directories().

#define EF_FLAGSTOSAVE   (EF_VBR)

defines which flags will actually be saved in cache

Definition at line 214 of file mod_musicindex.h.

Referenced by cache_file_write(), and mysql_cache_write().

#define EF_INCACHE   (1 << 1)

File is already in cache.

Definition at line 207 of file mod_musicindex.h.

Referenced by make_cache_entry(), make_music_entry(), and mysql_cache_dircontents().

#define EF_VBR   (1 << 0)

File is VBR.

Definition at line 205 of file mod_musicindex.h.

Referenced by list_songs(), make_flac_entry(), make_mp3_entry(), make_mp4_entry(), make_ogg_entry(), and send_rss().

#define MAX_FNAME   255

max length for filenames.

according to http://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits 255 bytes/chars seems a common limit

Definition at line 220 of file mod_musicindex.h.

Referenced by mysql_cache_init().

#define MAX_GENRE   64

max length for genre string.

longest seen so far: 37

Definition at line 219 of file mod_musicindex.h.

Referenced by mysql_cache_init().

#define MAX_PATHNAME   4096

max length for pathnames.

according to http://en.wikipedia.org/wiki/Comparison_of_file_systems#cite_note-note-12-9 Linux has a limit of 4,096, which looks sensible

Definition at line 221 of file mod_musicindex.h.

Referenced by mysql_cache_init().

#define MAX_STRING   1024

Common reference for maximum string size.

Definition at line 218 of file mod_musicindex.h.

Referenced by make_music_entry(), and treat_post_args().

#define MI_ACTIVE   (1 << 0)

Music indexing is enabled.

Definition at line 139 of file mod_musicindex.h.

Referenced by basic_config(), go_through_directory(), handle_musicfile(), handle_musicindex(), and send_head().

#define MI_ALL   (1 << 6)

Request for all files.

Definition at line 152 of file mod_musicindex.h.

#define MI_ALLOPS
Value:
MI_COOKIEADD | \
MI_COOKIEDEL | \
MI_STREAM | \
MI_TARBALL | \
MI_ALL)

Definition at line 181 of file mod_musicindex.h.

Referenced by cookie_and_stream_work().

#define MI_ALLOWDWNLD   (1 << 2)

Download is permitted.

Definition at line 142 of file mod_musicindex.h.

Referenced by basic_config(), handle_musicfile(), list_songs(), and send_rss().

#define MI_ALLOWFETCH   (MI_ALLOWSTREAM | MI_ALLOWDWNLD | MI_ALLOWTARBALL)

One of stream, download or tarball is allowed.

Definition at line 147 of file mod_musicindex.h.

Referenced by build_custom_list(), and make_music_entry().

#define MI_ALLOWRSS   (1 << 17)

Used within make_music_entry to flag permitted RSS on directories.

Definition at line 194 of file mod_musicindex.h.

Referenced by make_music_entry().

#define MI_ALLOWSEARCH   (1 << 3)

Search is permitted.

Definition at line 143 of file mod_musicindex.h.

Referenced by basic_config(), go_through_directory(), send_head(), and treat_post_args().

#define MI_ALLOWSTREAM   (1 << 1)
#define MI_ALLOWTARBALL   (1 << 4)

Tarball generation is permitted.

Definition at line 144 of file mod_musicindex.h.

Referenced by basic_config(), list_songs(), send_head(), send_tracks(), treat_get_args(), and treat_post_args().

#define MI_COOKIEADD   (1 << 13)

Add a file to the playlist.

Definition at line 171 of file mod_musicindex.h.

#define MI_COOKIEADDALL   (MI_COOKIEOP | MI_COOKIEADD | MI_ALL)

Definition at line 176 of file mod_musicindex.h.

Referenced by cookie_and_stream_work(), and treat_post_args().

#define MI_COOKIEADDLST   (MI_COOKIEOP | MI_COOKIEADD)

Definition at line 174 of file mod_musicindex.h.

Referenced by cookie_and_stream_work(), and treat_post_args().

#define MI_COOKIEDEL   (1 << 14)

Remove a file from the playlist.

Definition at line 172 of file mod_musicindex.h.

#define MI_COOKIEDELLST   (MI_COOKIEOP | MI_COOKIEDEL)

Definition at line 175 of file mod_musicindex.h.

Referenced by cookie_and_stream_work(), and treat_post_args().

#define MI_COOKIEDWNLD   (MI_COOKIEOP | MI_TARBALL)

Definition at line 179 of file mod_musicindex.h.

Referenced by handle_musicindex(), and treat_post_args().

#define MI_COOKIEOP   (1 << 12)

Any cookie operation.

Definition at line 170 of file mod_musicindex.h.

Referenced by treat_post_args().

#define MI_COOKIEPURGE   (MI_COOKIEOP | MI_COOKIEDEL | MI_ALL)

Definition at line 177 of file mod_musicindex.h.

Referenced by cookie_and_stream_work(), and treat_post_args().

#define MI_COOKIESTREAM   (MI_COOKIEOP | MI_STREAM)

Definition at line 178 of file mod_musicindex.h.

Referenced by cookie_and_stream_work(), handle_musicindex(), and treat_post_args().

#define MI_CUSTOM   (1 << 16)

Used to deal with custom playlist in make_music_entry.

Definition at line 193 of file mod_musicindex.h.

Referenced by build_custom_list(), make_music_entry(), and mysql_cache_dircontents().

#define MI_DWNLDALL   (MI_TARBALL | MI_ALL)

Definition at line 165 of file mod_musicindex.h.

Referenced by treat_get_args(), and treat_post_args().

#define MI_DWNLDCOOKIE   (MI_TARBALL | MI_COOKIEOP)

Definition at line 166 of file mod_musicindex.h.

Referenced by handle_musicindex().

#define MI_DWNLDLST   (MI_TARBALL)

Definition at line 164 of file mod_musicindex.h.

Referenced by handle_musicindex(), and treat_post_args().

#define MI_DWNLDRQ   (MI_DWNLDLST | MI_DWNLDALL | MI_DWNLDCOOKIE)

Definition at line 167 of file mod_musicindex.h.

Referenced by handle_musicindex().

#define MI_LOG_PREFIX   "[mod_musicindex] "

String used to prefix log messages.

Definition at line 223 of file mod_musicindex.h.

#define MI_PODCAST   (1 << 9)

Podcast.

Definition at line 155 of file mod_musicindex.h.

Referenced by send_rss(), and treat_get_args().

#define MI_QUICKPL   (1 << 15)
#define MI_RANDOMDIR   (1 << 10)

Random directory redirection.

Definition at line 156 of file mod_musicindex.h.

Referenced by handle_musicindex(), and treat_get_args().

#define mi_rdebug (   format,
  ... 
)    /* nothing */

Definition at line 434 of file mod_musicindex.h.

Referenced by make_mp3_entry(), mysql_cache_dircontents(), and mysql_cache_opendir().

#define MI_RECURSIVE   (1 << 7)
#define mi_rerror (   format,
  ... 
)    ap_log_rerror(APLOG_MARK, APLOG_ERR, r, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)
#define MI_RSS   (1 << 8)

RSS feed.

Definition at line 154 of file mod_musicindex.h.

Referenced by handle_musicindex(), make_music_entry(), send_url(), set_display(), and treat_get_args().

#define mi_serror (   format,
  ... 
)    ap_log_error(APLOG_MARK, APLOG_ERR, s, MI_LOG_PREFIX "(%s) " format, __func__, ## __VA_ARGS__)

Definition at line 426 of file mod_musicindex.h.

Referenced by cache_file_setup(), and mysql_cache_init().

#define MI_STREAM   (1 << 5)

Stream request.

Definition at line 151 of file mod_musicindex.h.

Referenced by handle_musicindex(), and make_music_entry().

#define MI_STREAMALL   (MI_STREAM | MI_ALL)

Definition at line 160 of file mod_musicindex.h.

Referenced by go_through_directory(), treat_get_args(), and treat_post_args().

#define MI_STREAMCOOKIE   (MI_STREAM | MI_COOKIEOP)

Definition at line 161 of file mod_musicindex.h.

Referenced by handle_musicindex().

#define MI_STREAMLST   (MI_STREAM)

Definition at line 159 of file mod_musicindex.h.

Referenced by handle_musicindex(), and treat_post_args().

#define MI_STREAMRQ   (MI_STREAMLST | MI_STREAMALL | MI_STREAMCOOKIE)

Definition at line 162 of file mod_musicindex.h.

Referenced by handle_musicindex().

#define MI_TARBALL   (1 << 11)

Tarball creation.

Definition at line 157 of file mod_musicindex.h.

Referenced by handle_musicindex(), make_music_entry(), and mysql_cache_dircontents().

#define MUSIC_AUTHORS_STRING   "R. Boudin & T. Varene"

Authors.

Definition at line 52 of file mod_musicindex.h.

Referenced by send_foot().

#define MUSIC_HEADER_STRING   "mod_musicindex/" MUSIC_VERSION_STRING

Definition at line 53 of file mod_musicindex.h.

Referenced by musicindex_init(), send_head(), and send_rss().

#define MUSIC_VERSION_STRING   PACKAGE_VERSION

Version string.

Definition at line 51 of file mod_musicindex.h.

Referenced by send_foot().

#define REQUEST_USER (   rec)    (rec->connection->user)

Definition at line 244 of file mod_musicindex.h.

Referenced by send_url().

#define SB_DEFAULT   SB_URI

Default sort order (used in search results)

Definition at line 131 of file mod_musicindex.h.

Referenced by treat_get_args(), and treat_post_args().

#define STRUCTTV   int

Definition at line 97 of file mod_musicindex.h.

Referenced by handle_musicindex().

#define TRUE   !FALSE

Typedef Documentation

typedef struct mu_config mu_config

Definition at line 339 of file mod_musicindex.h.

typedef struct mu_ent mu_ent

Music entry.

Contains various data about an associated file. Special care has been taken toward typing to avoid memory waste.

Enumeration Type Documentation

anonymous enum

Enumerates sort options in a more elegant way than using dozens of defines.

This enum should be kept in sync with the sort_order_functions[] array in sort.c, otherwise it's all about games.

Enumerator:
SB_NULL 

Avoid 0 value which has all sorts of nasty side effects.

SB_ALBUM 

Sort by album.

SB_POSN 

Sort by Part Of Set nb.

SB_TRACK 

Sort by track.

SB_ARTIST 

Sort by artist.

SB_TITLE 

Sort by title.

SB_LENGTH 

Sort by length.

SB_BITRATE 

Sort by bitrate.

SB_FREQ 

Sort by frequency (samplerate)

SB_FILETYPE 

Sort by filetype.

SB_FILENAME 

Sort by filename.

SB_URI 

Sort by URI.

SB_GENRE 

Sort by genre.

SB_DATE 

Sort by date.

SB_SIZE 

Sort by filesize.

SB_MTIME 

Sort by modification time.

SB_RANDOM 

Sort randomly.

SB_DIR 

Sort by directory.

SB_MAX 

Number of elements in this enum.

Definition at line 108 of file mod_musicindex.h.

Variable Documentation