EVE 1.0
instance.h
1 #ifndef EVE_HTTP_INSTANCE_H_INCLUDED
2 #define EVE_HTTP_INSTANCE_H_INCLUDED
3 
4 /*
5  * Instantiate StaticResourceCount based on toc-file-gen.h
6  */
8 
9 /*
10  * Instantiate user-devined request types.
11  */
12 #define GENERATOR(id) HTTP_REQ_ ## id,
13 #define RESOURCE(id, name, ctype, flags)
14 #define HTTP_FILE(id, name, url, ctype, flags) GENERATOR(id)
15 
16 enum
17 {
18  HTTP_REQ__USER_START = HTTP_REQ__SYSTEM_END,
19  #include EVE_HTTP_TOC_FILE_GEN_H
20  HTTP_REQ__COUNT,
21 };
22 
23 #undef GENERATOR
24 #undef RESOURCE
25 #undef HTTP_FILE
26 
27 /*
28  * Instantiate RequestCount based on toc-file-gen.h
29  */
30 const uint8_t HttpRequestCount = HTTP_REQ__COUNT;
31 
32 /*
33  * Instantiate ContentTypeTable based on toc-file-gen.h
34  */
35 #define GENERATOR(id, ctype, flags) [HTTP_RESOURCE_ ## id] = {CSTRING(ctype), flags},
36 #define RESOURCE(id, name, ctype, flags) GENERATOR(id, ctype, flags)
37 #define HTTP_FILE(id, name, url, ctype, flags) GENERATOR(id, ctype, flags)
38 
40 {
41  #include EVE_HTTP_TOC_FILE_GEN_H
42 };
43 
44 #undef GENERATOR
45 #undef RESOURCE
46 #undef HTTP_FILE
47 
48 /*
49  * Instantiate HTTP resource table based on toc-file-gen.h
50  */
51 #define GENERATOR(id, name) ENUM_CVT_ENTRY(HTTP_RESOURCE_ ## id, name),
52 #define RESOURCE(id, name, ctype, flags) GENERATOR(id, name)
53 #define HTTP_FILE(id, name, url, ctype, flags) GENERATOR(id, name)
54 
56 {
57  #include EVE_HTTP_TOC_FILE_GEN_H
58 };
59 
60 #undef GENERATOR
61 #undef RESOURCE
62 #undef HTTP_FILE
63 
64 /*
65  * Instantiate HTTP request table based on toc-file-gen.h
66  */
67 #define GENERATOR(id, url) [HTTP_REQ_ ## id] = ENUM_CVT_ENTRY((HTTP_RESOURCE_ ## id << 8) | HTTP_REQ_ ## id, url),
68 #define RESOURCE(id, name, ctype, flags)
69 #define HTTP_FILE(id, name, url, ctype, flags) GENERATOR(id, url)
70 
71 const struct http_enum_cvt_t HttpReqTypeTable[HTTP_REQ__COUNT] =
72 {
73  [HTTP_REQ_TOC] = ENUM_CVT_ENTRY(0xFF00 | HTTP_REQ_TOC, "/json/toc.json"),
74  [HTTP_REQ_GET] = ENUM_CVT_ENTRY(0xFF00 | HTTP_REQ_GET, "/json/get.json"),
75  [HTTP_REQ_SET] = ENUM_CVT_ENTRY(0xFF00 | HTTP_REQ_SET, "/json/set.json"),
76  [HTTP_REQ_PULL] = ENUM_CVT_ENTRY(0xFF00 | HTTP_REQ_PULL, "/json/pull.json"),
77  [HTTP_REQ_PUSH] = ENUM_CVT_ENTRY(0xFF00 | HTTP_REQ_PUSH, "/json/push.json"),
78  [HTTP_REQ_STREAM] = ENUM_CVT_ENTRY(0xFF00 | HTTP_REQ_STREAM, "/json/stream.json"),
79  #include EVE_HTTP_TOC_FILE_GEN_H
80 };
81 
82 #undef GENERATOR
83 #undef RESOURCE
84 #undef HTTP_FILE
85 
86 /*
87  * Instantiate size of command segment
88  */
89 const uint16_t TocSegmentCommandSize = sizeof(TocCommand);
90 
91 #endif /* EVE_HTTP_INSTANCE_H_INCLUDED */
const struct http_content_type_t HttpContentTypeTable[HTTP_RESOURCE__COUNT]
Definition: instance.h:39
#define ENUM_CVT_ENTRY(v, s)
Definition: types.h:28
const uint8_t HttpRequestCount
Definition: instance.h:30
const struct http_enum_cvt_t HttpReqTypeTable[HTTP_REQ__COUNT]
Definition: instance.h:71
const struct http_enum_cvt_t HttpResourceTable[HTTP_RESOURCE__COUNT]
Definition: instance.h:55
union toc_command_t TocCommand
const uint8_t HttpStaticResourceCount
Definition: instance.h:7