Data Structures | Defines | Functions | Variables

# mime.c File Reference

`#include "wizard/studio.h"`
`#include "wizard/blob.h"`
`#include "wizard/client.h"`
`#include "wizard/configure.h"`
`#include "wizard/exception.h"`
`#include "wizard/exception-private.h"`
`#include "wizard/hashmap.h"`
`#include "wizard/memory_.h"`
`#include "wizard/mime.h"`
`#include "wizard/mime-private.h"`
`#include "wizard/option.h"`
`#include "wizard/semaphore.h"`
`#include "wizard/string_.h"`
`#include "wizard/token.h"`
`#include "wizard/utility.h"`
`#include "wizard/xml-tree.h"`

## Data Structures

struct | _MimeInfo

## Defines

#define | MimeFilename "mime.xml"

## Functions

static WizardBooleanType | InitializeMimeList (ExceptionInfo *)
WizardExport const MimeInfo * | GetMimeInfo (const char *filename, const unsigned char *magic, const size_t length, ExceptionInfo *exception)
static int | MimeInfoCompare (const void *x, const void *y)
WizardExport const MimeInfo ** | GetMimeInfoList (const char *pattern, size_t *number_aliases, ExceptionInfo *exception)
static int | MimeCompare (const void *x, const void *y)
WizardExport char ** | GetMimeList (const char *pattern, size_t *number_aliases, ExceptionInfo *exception)
WizardExport const char * | GetMimeDescription (const MimeInfo *mime_info)
WizardExport const char * | GetMimeType (const MimeInfo *mime_info)
WizardExport WizardBooleanType | ListMimeInfo (FILE *file, ExceptionInfo *exception)
static WizardBooleanType | LoadMimeList (const char *xml, const char *filename, const size_t depth, ExceptionInfo *exception)
WizardExport WizardBooleanType | LoadMimeLists (const char *filename, ExceptionInfo *exception)
WizardExport WizardBooleanType | MimeComponentGenesis (void)
static void * | DestroyMimeElement (void *mime_info)
WizardExport void | MimeComponentTerminus (void)
WizardExport char * | WizardToMime (const char *wizard)

## Variables

static const char * | MimeMap = "</mimemap>"
static LinkedListInfo * | mime_list = (LinkedListInfo *) NULL
static SemaphoreInfo * | mime_semaphore = (SemaphoreInfo *) NULL
static volatile WizardBooleanType | instantiate_mime = WizardFalse

## Define Documentation

#define MimeFilename "mime.xml"

Referenced by InitializeMimeList().

## Function Documentation

static void* DestroyMimeElement | ( | void * | mime_info | ) | `[static]`

References _MimeInfo::description, DestroyString(), _MimeInfo::magic, _MimeInfo::path, _MimeInfo::pattern, RelinquishWizardMemory(), and _MimeInfo::type.

Referenced by MimeComponentTerminus().

WizardExport const char* GetMimeDescription | ( | const MimeInfo * | mime_info | ) |

References _MimeInfo::description, GetWizardModule, LogWizardEvent(), _MimeInfo::signature, TraceEvent, and WizardSignature.

WizardExport const MimeInfo* GetMimeInfo | ( | const char * | filename,
|  | const unsigned char * | magic,
|  | const size_t | length,
|  | ExceptionInfo * | exception |
| ) |  |  |

References ByteData, _MimeInfo::data_type, _MimeInfo::endian, _MimeInfo::extent, GetNextValueInLinkedList(), GetValueFromLinkedList(), GlobExpression(), InitializeMimeList(), InsertValueInLinkedList(), instantiate_mime, IsLinkedListEmpty(), _MimeInfo::length, LockSemaphoreInfo(), LongData, LSBEndian, _MimeInfo::magic, _MimeInfo::mask, mime_list, mime_semaphore, _MimeInfo::offset, _MimeInfo::pattern, _MimeInfo::priority, RemoveElementByValueFromLinkedList(), ResetLinkedListIterator(), ShortData, StringData, UndefinedEndian, UnlockSemaphoreInfo(), _MimeInfo::value, and WizardFalse.

Referenced by GetMimeInfoList(), GetMimeList(), and WizardToMime().

WizardExport const MimeInfo** GetMimeInfoList | ( | const char * | pattern,
|  | size_t * | number_aliases,
|  | ExceptionInfo * | exception |
| ) |  |  |

References AcquireQuantumMemory(), GetMimeInfo(), GetNextValueInLinkedList(), GetNumberOfElementsInLinkedList(), GetWizardModule, GlobExpression(), LockSemaphoreInfo(), LogWizardEvent(), mime_list, mime_semaphore, MimeInfoCompare(), ResetLinkedListIterator(), _MimeInfo::stealth, TraceEvent, _MimeInfo::type, UnlockSemaphoreInfo(), and WizardFalse.

Referenced by ListMimeInfo().

WizardExport char** GetMimeList | ( | const char * | pattern,
|  | size_t * | number_aliases,
|  | ExceptionInfo * | exception |
| ) |  |  |

References AcquireQuantumMemory(), ConstantString(), GetMimeInfo(), GetNextValueInLinkedList(), GetNumberOfElementsInLinkedList(), GetWizardModule, GlobExpression(), LockSemaphoreInfo(), LogWizardEvent(), mime_list, mime_semaphore, MimeCompare(), ResetLinkedListIterator(), _MimeInfo::stealth, TraceEvent, _MimeInfo::type, UnlockSemaphoreInfo(), and WizardFalse.

WizardExport const char* GetMimeType | ( | const MimeInfo * | mime_info | ) |

References GetWizardModule, LogWizardEvent(), _MimeInfo::signature, TraceEvent, _MimeInfo::type, and WizardSignature.

Referenced by WizardToMime().

static WizardBooleanType InitializeMimeList | ( | ExceptionInfo * | exception | ) | `[static]`

References AcquireSemaphoreInfo(), instantiate_mime, LoadMimeLists(), LockSemaphoreInfo(), mime_list, mime_semaphore, MimeFilename, UnlockSemaphoreInfo(), WizardFalse, and WizardTrue.

Referenced by GetMimeInfo().

WizardExport WizardBooleanType ListMimeInfo | ( | FILE * | file,
|  | ExceptionInfo * | exception |
| ) |  |  |

References GetMimeInfoList(), _MimeInfo::path, RelinquishWizardMemory(), strcasecmp, WizardFalse, and WizardTrue.

static WizardBooleanType LoadMimeList | ( | const char * | xml,
|  | const char * | filename,
|  | const size_t | depth,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

References AcquireString(), AcquireWizardMemory(), AppendValueToLinkedList(), ConcatenateWizardString(), ConfigureEvent, ConstantString(), CopyWizardString(), _MimeInfo::data_type, _MimeInfo::description, DestroyString(), DestroyXMLTree(), DirectorySeparator, _MimeInfo::endian, _MimeInfo::extent, FileToString(), GetNextXMLTreeTag(), GetPathComponent(), GetWizardModule, GetXMLTreeAttribute(), GetXMLTreeChild(), HeadPath, IsWizardTrue(), _MimeInfo::length, LogWizardEvent(), _MimeInfo::magic, _MimeInfo::mask, MaxTextExtent, mime_list, NewLinkedList(), NewXMLTree(), _MimeInfo::offset, ParseWizardOption(), _MimeInfo::path, _MimeInfo::pattern, _MimeInfo::priority, ResetWizardMemory(), ResourceFatalError, _MimeInfo::signature, _MimeInfo::stealth, StringData, SubstituteString(), ThrowFatalException, ThrowWizardException(), _MimeInfo::type, _MimeInfo::value, WizardDataTypeOptions, WizardEndianOptions, WizardFalse, and WizardTrue.

Referenced by LoadMimeLists().

WizardExport WizardBooleanType LoadMimeLists | ( | const char * | filename,
|  | ExceptionInfo * | exception |
| ) |  |  |

References ClearWizardException(), DestroyConfigureOptions(), GetConfigureOptions(), GetNextValueInLinkedList(), GetStringInfoDatum(), GetStringInfoPath(), IsLinkedListEmpty(), LoadMimeList(), mime_list, MimeMap, WizardFalse, and WizardTrue.

Referenced by InitializeMimeList().

static int MimeCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

References strcasecmp.

Referenced by GetMimeList().

WizardExport WizardBooleanType MimeComponentGenesis | ( | void |  | ) |

References AcquireSemaphoreInfo(), mime_semaphore, and WizardTrue.

Referenced by WizardsToolkitGenesis().

WizardExport void MimeComponentTerminus | ( | void |  | ) |

References AcquireSemaphoreInfo(), DestroyLinkedList(), DestroyMimeElement(), DestroySemaphoreInfo(), instantiate_mime, LockSemaphoreInfo(), mime_list, mime_semaphore, and UnlockSemaphoreInfo().

Referenced by WizardsToolkitTerminus().

static int MimeInfoCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

References strcasecmp.

Referenced by GetMimeInfoList().

WizardExport char* WizardToMime | ( | const char * | wizard | ) |

References AcquireExceptionInfo(), ConstantString(), DestroyExceptionInfo(), FormatWizardString(), GetMimeInfo(), GetMimeType(), LocaleLower(), and MaxTextExtent.

## Variable Documentation

volatile WizardBooleanType instantiate_mime = WizardFalse`[static]`

Referenced by GetMimeInfo(), InitializeMimeList(), and MimeComponentTerminus().

LinkedListInfo* mime_list = (LinkedListInfo *) NULL`[static]`

Referenced by GetMimeInfo(), GetMimeInfoList(), GetMimeList(), InitializeMimeList(), LoadMimeList(), LoadMimeLists(), and MimeComponentTerminus().

SemaphoreInfo* mime_semaphore = (SemaphoreInfo *) NULL`[static]`

Referenced by GetMimeInfo(), GetMimeInfoList(), GetMimeList(), InitializeMimeList(), MimeComponentGenesis(), and MimeComponentTerminus().

const char* MimeMap = "</mimemap>"`[static]`

Referenced by LoadMimeLists().