12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #pragma once
- #ifdef AUTOTEST_EXPORTS
- #define AUTOTEST_API __declspec(dllexport)
- #else
- #define AUTOTEST_API __declspec(dllimport)
- #endif
- #include <string>
- class IRequestHandler;
- class IWebsocketHandler;
- class IRequestHandler
- {
- public:
- virtual std::string GetResponse(void *connection, const std::string &url, const std::string &body) = 0;
- };
- class IWebsocketHandler
- {
- public:
- virtual std::string OnWebsocketFrame(unsigned char *framedata, size_t datalen) = 0;
- };
- class AUTOTEST_API IAutoTestServer
- {
- public:
- IAutoTestServer(){}
- virtual ~IAutoTestServer(){}
- virtual void Init(const std::string& port) = 0;
- virtual bool Start() = 0;
- virtual bool StartAsync() = 0;
- virtual bool Close() = 0;
- virtual void AddHandler(const std::string& url, IRequestHandler* req_handler) = 0;
- virtual void AddWebsocketHandler(IWebsocketHandler *handler) = 0;
- virtual void RemoveWebsocketHandler() = 0;
- virtual void RemoveHandler(const std::string& url) = 0;
- virtual void Response(void* connection, const std::string& resp) = 0;
- };
- AUTOTEST_API IAutoTestServer *GetAutoTestServer();
|