diff options
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r-- | src/daemon/daemon.c | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index f70ca34d..e8101a23 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -27,3 +27,240 @@ | |||
27 | #include "config.h" | 27 | #include "config.h" |
28 | #include "microhttpd.h" | 28 | #include "microhttpd.h" |
29 | 29 | ||
30 | |||
31 | /** | ||
32 | * Start a webserver on the given port. | ||
33 | * @param port port to bind to | ||
34 | * @param apc callback to call to check which clients | ||
35 | * will be allowed to connect | ||
36 | * @param apc_cls extra argument to apc | ||
37 | * @param dh default handler for all URIs | ||
38 | * @param dh_cls extra argument to dh | ||
39 | * @return NULL on error, handle to daemon on success | ||
40 | */ | ||
41 | struct MHD_Daemon * | ||
42 | MHD_start_daemon(unsigned int options, | ||
43 | unsigned short port, | ||
44 | MHD_AcceptPolicyCallback apc, | ||
45 | void * apc_cls, | ||
46 | MHD_AccessHandlerCallback dh, | ||
47 | void * dh_cls) { | ||
48 | return NULL; | ||
49 | } | ||
50 | |||
51 | |||
52 | |||
53 | /** | ||
54 | * Shutdown an http daemon. | ||
55 | */ | ||
56 | void | ||
57 | MHD_stop_daemon(struct MHD_Daemon * daemon) { | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * Obtain the select sets for this daemon. | ||
62 | * | ||
63 | * @return MHD_YES on success, MHD_NO if this | ||
64 | * daemon was not started with the right | ||
65 | * options for this call. | ||
66 | */ | ||
67 | int | ||
68 | MHD_get_fdset(struct MHD_Daemon * daemon, | ||
69 | fd_set * read_fd_set, | ||
70 | fd_set * write_fd_set, | ||
71 | fd_set * except_fd_set, | ||
72 | int * max_fd) { | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Run webserver operations (without blocking unless | ||
78 | * in client callbacks). This method should be called | ||
79 | * by clients in combination with MHD_get_fdset | ||
80 | * if the client-controlled select method is used. | ||
81 | * | ||
82 | * @return MHD_YES on success, MHD_NO if this | ||
83 | * daemon was not started with the right | ||
84 | * options for this call. | ||
85 | */ | ||
86 | int | ||
87 | MHD_run(struct MHD_Daemon * daemon) { | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | |||
92 | /** | ||
93 | * Register an access handler for all URIs beginning with uri_prefix. | ||
94 | * | ||
95 | * @param uri_prefix | ||
96 | * @return MRI_NO if a handler for this exact prefix | ||
97 | * already exists | ||
98 | */ | ||
99 | int | ||
100 | MHD_register_handler(struct MHD_Daemon * daemon, | ||
101 | const char * uri_prefix, | ||
102 | MHD_AccessHandlerCallback dh, | ||
103 | void * dh_cls) { | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | /** | ||
108 | * Unregister an access handler for the URIs beginning with | ||
109 | * uri_prefix. | ||
110 | * | ||
111 | * @param uri_prefix | ||
112 | * @return MHD_NO if a handler for this exact prefix | ||
113 | * is not known for this daemon | ||
114 | */ | ||
115 | int | ||
116 | MHD_unregister_handler(struct MHD_Daemon * daemon, | ||
117 | const char * uri_prefix, | ||
118 | MHD_AccessHandlerCallback dh, | ||
119 | void * dh_cls) { | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * Get all of the headers from the request. | ||
125 | * | ||
126 | * @param iterator callback to call on each header; | ||
127 | * maybe NULL (then just count headers) | ||
128 | * @param iterator_cls extra argument to iterator | ||
129 | * @return number of entries iterated over | ||
130 | */ | ||
131 | int | ||
132 | MHD_get_session_values(struct MHD_Session * session, | ||
133 | enum MHD_ValueKind kind, | ||
134 | MHD_KeyValueIterator * iterator, | ||
135 | void * iterator_cls); | ||
136 | |||
137 | /** | ||
138 | * Get a particular header value. If multiple | ||
139 | * values match the kind, return any one of them. | ||
140 | * | ||
141 | * @param key the header to look for | ||
142 | * @return NULL if no such item was found | ||
143 | */ | ||
144 | const char * | ||
145 | MHD_lookup_session_value(struct MHD_Session * session, | ||
146 | enum MHD_ValueKind kind, | ||
147 | const char * key) { | ||
148 | return NULL; | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * Queue a response to be transmitted to the client (as soon as | ||
153 | * possible). | ||
154 | * | ||
155 | * @param session the session identifying the client | ||
156 | * @param status_code HTTP status code (i.e. 200 for OK) | ||
157 | * @param response response to transmit | ||
158 | * @return MHD_NO on error (i.e. reply already sent), | ||
159 | * MHD_YES on success or if message has been queued | ||
160 | */ | ||
161 | int | ||
162 | MHD_queue_response(struct MHD_Session * session, | ||
163 | unsigned int status_code, | ||
164 | struct MHD_Response * response) { | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | |||
169 | /** | ||
170 | * Create a response object. The response object can be extended with | ||
171 | * header information and then be used any number of times. | ||
172 | * | ||
173 | * @param size size of the data portion of the response, -1 for unknown | ||
174 | * @param crc callback to use to obtain response data | ||
175 | * @param crc_cls extra argument to crc | ||
176 | * @param crfc callback to call to free crc_cls resources | ||
177 | * @return NULL on error (i.e. invalid arguments, out of memory) | ||
178 | */ | ||
179 | struct MHD_Response * | ||
180 | MHD_create_response_from_callback(size_t size, | ||
181 | MHD_ContentReaderCallback crc, | ||
182 | void * crc_cls, | ||
183 | MHD_ContentReaderFreeCallback crfc) { | ||
184 | return NULL; | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * Create a response object. The response object can be extended with | ||
189 | * header information and then be used any number of times. | ||
190 | * | ||
191 | * @param size size of the data portion of the response | ||
192 | * @param data the data itself | ||
193 | * @param must_free libmicrohttpd should free data when done | ||
194 | * @param must_copy libmicrohttpd must make a copy of data | ||
195 | * right away, the data maybe released anytime after | ||
196 | * this call returns | ||
197 | * @return NULL on error (i.e. invalid arguments, out of memory) | ||
198 | */ | ||
199 | struct MHD_Response * | ||
200 | MHD_create_response_from_data(size_t size, | ||
201 | void * data, | ||
202 | int must_free, | ||
203 | int must_copy) { | ||
204 | return NULL; | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * Destroy a response object and associated resources. Note that | ||
209 | * libmicrohttpd may keep some of the resources around if the response | ||
210 | * is still in the queue for some clients, so the memory may not | ||
211 | * necessarily be freed immediatley. | ||
212 | */ | ||
213 | void | ||
214 | MHD_destroy_response(struct MHD_Response * response) { | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * Add a header line to the response. | ||
219 | * | ||
220 | * @return MHD_NO on error (i.e. invalid header or content format). | ||
221 | */ | ||
222 | int | ||
223 | MHD_add_response_header(struct MHD_Response * response, | ||
224 | const char * header, | ||
225 | const char * content) { | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * Delete a header line from the response. | ||
231 | * | ||
232 | * @return MHD_NO on error (no such header known) | ||
233 | */ | ||
234 | int | ||
235 | MHD_del_response_header(struct MHD_Response * response, | ||
236 | const char * header, | ||
237 | const char * content) { | ||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * Get all of the headers added to a response. | ||
243 | * | ||
244 | * @param iterator callback to call on each header; | ||
245 | * maybe NULL (then just count headers) | ||
246 | * @param iterator_cls extra argument to iterator | ||
247 | * @return number of entries iterated over | ||
248 | */ | ||
249 | int | ||
250 | MHD_get_response_headers(struct MHD_Response * response, | ||
251 | MHD_KeyValueIterator * iterator, | ||
252 | void * iterator_cls) { | ||
253 | return -1; | ||
254 | } | ||
255 | |||
256 | /** | ||
257 | * @return -1 if no data uploaded; otherwise number of bytes | ||
258 | * read into buf; 0 for end of transmission | ||
259 | */ | ||
260 | int | ||
261 | MHD_read_file_upload(struct MHD_Session * session, | ||
262 | void * buf, | ||
263 | size_t len) { | ||
264 | return -1; | ||
265 | } | ||
266 | |||