forked from avih/miniweb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmime.h
65 lines (45 loc) · 1.5 KB
/
mime.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*********************************************************************************************//**
* \file
*
*
* contains some functions for mimetype handling
*
*//*********************************************************************************************/
#ifndef MIME_h__0708305
#define MIME_h__0708305
#ifdef __cplusplus
extern "C" {
#endif
/**
* Internal enumeration of content types.
* Beside the some predefined constants there is no special or somehow fixed numbering of different types.
*/
typedef int HttpFileType;
// some predefined content types
#define MIMETYPE_UNKNOWN 0
#define MIMETYPE_HTML 1
#define MIMETYPE_OCTET 2
#define MIMETYPE_JS 3
#define MIMETYPE_TEXT 4
#define MIMETYPE_XML 5
/**
* sets up the some internals and have to be called before any other requests.
*/
void Mime_init();
/** returns content type for the given extension */
HttpFileType Mime_getTypeFromExt(const char* i_fileExt);
/**
* returns a mime type string (e.g application/octet-stream) for the intern type
* unknown will be handled like application/octet-stream
*/
const char* Mime_getMimeStringFromType(HttpFileType i_type);
/**
* returns the associated mime-type for a file-extension.
*/
static const char* Mime_getMimeStringFromExt(const char* i_fileExt) {
return Mime_getMimeStringFromType(Mime_getTypeFromExt(i_fileExt));
}
#ifdef __cplusplus
}
#endif
#endif /* MIME_h__0708305 */