xref: /haiku/headers/os/drivers/mime_table.h (revision e189e3d7799e5886117315cf4561e3ff269bf436)
1*e189e3d7SFrançois Revol /*******************************************************************************
2*e189e3d7SFrançois Revol /
3*e189e3d7SFrançois Revol /	File:			mime_table.h
4*e189e3d7SFrançois Revol /
5*e189e3d7SFrançois Revol /	Description:	Kernel mime table and matcher module API
6*e189e3d7SFrançois Revol /
7*e189e3d7SFrançois Revol /	Copyright 2005, François Revol.
8*e189e3d7SFrançois Revol /
9*e189e3d7SFrançois Revol *******************************************************************************/
10*e189e3d7SFrançois Revol 
11*e189e3d7SFrançois Revol #ifndef _MIME_TABLE_MODULE_H_
12*e189e3d7SFrançois Revol #define _MIME_TABLE_MODULE_H_
13*e189e3d7SFrançois Revol 
14*e189e3d7SFrançois Revol #include <module.h>
15*e189e3d7SFrançois Revol 
16*e189e3d7SFrançois Revol struct ext_mime {
17*e189e3d7SFrançois Revol 	char *extension;
18*e189e3d7SFrançois Revol 	char *mime;
19*e189e3d7SFrançois Revol };
20*e189e3d7SFrançois Revol 
21*e189e3d7SFrançois Revol #ifdef __cplusplus
22*e189e3d7SFrançois Revol extern "C" {
23*e189e3d7SFrançois Revol #endif
24*e189e3d7SFrançois Revol 
25*e189e3d7SFrançois Revol /*
26*e189e3d7SFrançois Revol 	status_t get_table(struct ext_mime **table)
27*e189e3d7SFrançois Revol 		Returns the current kernel mime table.
28*e189e3d7SFrançois Revol 		You must call free_table() when finished with it.
29*e189e3d7SFrançois Revol 
30*e189e3d7SFrançois Revol 	void free_table(struct ext_mime *table)
31*e189e3d7SFrançois Revol 		Frees the given mime table;
32*e189e3d7SFrançois Revol 
33*e189e3d7SFrançois Revol 	const char * mime_for_ext(const char *ext)
34*e189e3d7SFrançois Revol 		Returns the known mime type for the given extension.
35*e189e3d7SFrançois Revol 
36*e189e3d7SFrançois Revol 	const char * ext_for_mime(const char *mime)
37*e189e3d7SFrançois Revol 		Returns the known extension for the given mime type.
38*e189e3d7SFrançois Revol 
39*e189e3d7SFrançois Revol */
40*e189e3d7SFrançois Revol 
41*e189e3d7SFrançois Revol #define B_MIME_TABLE_MODULE_NAME "generic/mime_table/v1"
42*e189e3d7SFrançois Revol 
43*e189e3d7SFrançois Revol typedef struct {
44*e189e3d7SFrançois Revol 	module_info		minfo;
45*e189e3d7SFrançois Revol 	status_t	(*get_table)(struct ext_mime **table);
46*e189e3d7SFrançois Revol 	void		(*free_table)(struct ext_mime *table);
47*e189e3d7SFrançois Revol 	const char *	(*mime_for_ext)(const char *ext);
48*e189e3d7SFrançois Revol 	const char *	(*ext_for_mime)(const char *mime);
49*e189e3d7SFrançois Revol } mime_table_module_info;
50*e189e3d7SFrançois Revol 
51*e189e3d7SFrançois Revol #ifdef __cplusplus
52*e189e3d7SFrançois Revol }
53*e189e3d7SFrançois Revol #endif
54*e189e3d7SFrançois Revol 
55*e189e3d7SFrançois Revol #endif
56*e189e3d7SFrançois Revol 
57