added resource_api and rs-nogui-webui (requires libmicrohttpd, Html files are not included)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8047 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-03-18 18:48:43 +00:00
parent 97831d0667
commit ad1bc7f3b8
38 changed files with 5547 additions and 2 deletions
libresapi/src/api

View file

@ -0,0 +1,37 @@
#pragma once
#include <microhttpd.h>
#include <string>
#include "api/ApiServer.h"
namespace resource_api{
class ApiServerMHD
{
public:
ApiServerMHD(std::string root_dir, uint16_t port);
~ApiServerMHD();
bool start();
void stop();
ApiServer& getApiServer(){ return mApiServer; }
// internal helper
static void sendMessage(struct MHD_Connection* connection, unsigned int status, std::string message);
private:
// static callbacks for libmicrohttpd, they call the members below
static int static_acceptPolicyCallback(void* cls, const struct sockaddr * addr, socklen_t addrlen);
static int static_accessHandlerCallback(void* cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
static void static_requestCompletedCallback(void *cls, struct MHD_Connection* connection, void **con_cls, enum MHD_RequestTerminationCode toe);
int acceptPolicyCallback(const struct sockaddr * addr, socklen_t addrlen);
int accessHandlerCallback(struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);
void requestCompletedCallback(struct MHD_Connection *connection, void **con_cls, MHD_RequestTerminationCode toe);
std::string mRootDir;
uint16_t mPort;
MHD_Daemon* mDaemon;
ApiServer mApiServer;
};
} // namespace resource_api