Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
request_dispatcher.h
1 
2 /***************************************************************************
3  * request_dispatcher.h - Web request dispatcher
4  *
5  * Created: Mon Oct 13 22:44:33 2008
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __LIBS_WEBVIEW_REQUEST_DISPATCHER_H_
24 #define __LIBS_WEBVIEW_REQUEST_DISPATCHER_H_
25 
26 #include <string>
27 #include <map>
28 #include <stdint.h>
29 
30 struct MHD_Connection;
31 struct MHD_Response;
32 
33 namespace fawkes {
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
38 class WebRequestProcessor;
39 class WebUrlManager;
40 class WebPageHeaderGenerator;
41 class WebPageFooterGenerator;
42 class StaticWebReply;
43 class WebUserVerifier;
44 
46 {
47  public:
49  WebPageHeaderGenerator *headergen = 0,
50  WebPageFooterGenerator *footergen = 0);
52 
53  static int process_request_cb(void *callback_data,
54  struct MHD_Connection * connection,
55  const char *url,
56  const char *method,
57  const char *version,
58  const char *upload_data,
59  size_t *upload_data_size,
60  void **session_data);
61 
62  void setup_basic_auth(const char *realm, WebUserVerifier *verifier);
63 
64  private:
65  struct MHD_Response * prepare_static_response(StaticWebReply *sreply);
66  int queue_static_reply(struct MHD_Connection * connection,
67  StaticWebReply *sreply);
68  int queue_basic_auth_fail(struct MHD_Connection * connection);
69  int process_request(struct MHD_Connection * connection,
70  const char *url,
71  const char *method,
72  const char *version,
73  const char *upload_data,
74  size_t *upload_data_size,
75  void **session_data);
76 
77  private:
78  WebUrlManager *__url_manager;
79 
80  std::string __active_baseurl;
81  WebPageHeaderGenerator *__page_header_generator;
82  WebPageFooterGenerator *__page_footer_generator;
83 
84  char *__realm;
85  WebUserVerifier *__user_verifier;
86 };
87 
88 } // end namespace fawkes
89 
90 #endif
Web request dispatcher.
Interface for user verification.
Definition: user_verifier.h:31
Interface for HTML header generator.
Manage URL mappings.
Definition: url_manager.h:37
Interface for HTML footer generator.
Static web reply.
Definition: reply.h:125