summaryrefslogtreecommitdiff
path: root/plugins/HTTPServer/src/MimeHandling.h
blob: 6a5b3dc61cb2500526fdbf17c9426ccc8c037d92 (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