summaryrefslogtreecommitdiff
path: root/plugins/HTTPServer/src/MimeHandling.h
blob: 768221778f57ae0398bcbc4ca7130837d44139c3 (plain)
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
#pragma once

#define LINE_MAX_SIZE 512

#ifdef __cplusplus
extern "C" {
#endif

#define szMimeTypeConfigFile "HTTPMimeTypes"

	/* MIME DB Data structure

	         ----------                ----------
	        | mimeType |              | mimeType |
	        |----------|              |----------|
	    ----|   next -----------------|   next   |
	        |----------|              |----------|
	        | extList ---             | extList ---
	         ----------  |             ----------  |
	                   --|---                    --|---
	                  | ext  |                  | ext  |
	                  |------|                  |------|
	                  | next |                  | next |
	                   --|---                    ------
	                   --|---
	                  | ext  |
	                  |------|
	                  | next |
	                   ------
	*/

	typedef struct _ExtensionListCell {
		char* ext;
		struct _ExtensionListCell* next;
	} ExtensionListCell ;


	typedef struct _ContentType {
		char* mimeType;
		ExtensionListCell* extList;
		struct _ContentType* next;
	} ContentType ;

	typedef ContentType* ContentTypeDB;
	typedef ExtensionListCell* ExtensionList;



	extern int bInitMimeHandling();
	extern const char * pszGetMimeType(const char * pszFileName);

#ifdef __cplusplus
}
#endif