代码拉取完成,页面将自动刷新
同步操作将从 leo/supervisor 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#ifndef __SUPERVISOR_H_INCLUDED__
#define __SUPERVISOR_H_INCLUDED__
#include "mongoose.h"
#include "command.h"
#include "json.h"
class Supervisor {
enum EMethod {
GET = 0,
POST
};
typedef void (Supervisor::*Proc)(mg_connection * pConn, const Json::Value & rParam);
typedef struct Processor {
EMethod emMethod;
Proc fProc;
} Processor;
public:
Supervisor() : _iMgr(), _iConf(), _pAuth(nullptr) {}
static void Dispatch(mg_connection * pConn, int nEvent, void * pData);
void Start(Command & rCmd);
void Breath();
bool CheckConnect(mg_connection * pConn);
bool CheckAuth(mg_connection * pConn, http_message * pMsg);
void ResponseClose(mg_connection * pConn);
void ResponseResource(mg_connection * pConn, const std::string & sPath);
void ResponseWebsocketOpened(mg_connection * pConn, const std::string & sUrl);
void ResponseApi(mg_connection * pConn, http_message * pMsg);
void ResponseNeedAuth(mg_connection * pConn);
void Reload(mg_connection * pConn, const Json::Value & rParam);
void AddWatcher(mg_connection * pConn, const Json::Value & rParam);
void EditWatcher(mg_connection * pConn, const Json::Value & rParam);
void StartWatcher(mg_connection * pConn, const Json::Value & rParam);
void StopWatcher(mg_connection * pConn, const Json::Value & rParam);
void DeleteWatcher(mg_connection * pConn, const Json::Value & rParam);
private:
bool LoadSetting();
void SaveSetting();
void Register(const std::string & sUrl, EMethod emMethod, Proc fProc);
Json::Value Url2Json(const char * pData, size_t nSize);
Json::Value GetWatcherInfo(const std::string & sName);
Json::Value GetConf(const std::string & sName);
void Response(mg_connection * pConn, int nHttpCode, const std::string & sHeader, const std::string & sContent);
void Broadcast(const std::string & sScope, const std::string & sJson);
private:
mg_mgr _iMgr;
Json::Value _iConf;
FILE * _pAuth;
std::vector<mg_connection *> _vSockets;
std::map<std::string, Processor> _mApis;
};
#endif//! __SUPERVISOR_H_INCLUDED__
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。