mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 23:15:41 -04:00
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:
parent
97831d0667
commit
ad1bc7f3b8
38 changed files with 5547 additions and 2 deletions
libresapi/src/api
37
libresapi/src/api/ApiServerMHD.h
Normal file
37
libresapi/src/api/ApiServerMHD.h
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue