MXS-1220: Use libmicrohttpd for the HTTP handling

The HTTP side of the REST API is better handled with an actual
library. The libmicrohttpd library provides a convenient way of handling
the HTTP traffic between the clients and MaxScale.
This commit is contained in:
Markus Mäkelä
2017-04-18 12:19:01 +03:00
committed by Markus Mäkelä
parent eb3ff1cc7b
commit d242203279
14 changed files with 136 additions and 1357 deletions

View File

@ -20,57 +20,6 @@
#include <maxscale/thread.h>
#include "http.hh"
#include "adminclient.hh"
using std::deque;
using std::string;
typedef deque<SAdminClient> ClientList;
/** The admin interface configuration */
struct AdminConfig
{
string host;
uint16_t port;
enum http_auth auth;
};
class AdminListener
{
public:
/**
* @brief Create a new admin interface instance
*
* @param sock Listener socket for the interface
*/
AdminListener(int sock);
~AdminListener();
/**
* Start the admin interface
*/
void start();
/**
* Stop the admin listener
*/
void stop();
/**
* Close timed out connections
*/
void check_timeouts();
private:
void handle_clients();
void handle_timeouts();
AdminClient* accept_client();
int m_socket; /**< The network socket we listen on */
int m_active; /**< Positive value if the admin is active */
int m_timeout; /**< Network timeout in seconds */
ClientList m_clients;
};
/**
* @brief Start the administrative interface
@ -83,10 +32,3 @@ bool mxs_admin_init();
* @brief Shutdown the administrative interface
*/
void mxs_admin_shutdown();
/**
* @brief Get the administative interface configuration
*
* @return A reference to the administrative interface configuration
*/
AdminConfig& mxs_admin_get_config();