A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / apps / mplayerc / WebServer.h
blob9518f498ce5727657db53e746a960bfc59bc6cae
1 #pragma once
3 #include <afxsock.h>
4 #include <atlcoll.h>
6 #define UTF8(str) UTF16To8(TToW(str))
7 #define UTF8Arg(str) UrlEncode(UTF8(str))
9 #define CMD_SETPOS "-1"
10 #define CMD_SETVOLUME "-2"
13 class CWebServerSocket;
14 class CWebClientSocket;
15 class CMainFrame;
17 class CWebServer
19 CMainFrame* m_pMainFrame;
20 int m_nPort;
22 DWORD ThreadProc();
23 static DWORD WINAPI StaticThreadProc(LPVOID lpParam);
24 DWORD m_ThreadId;
25 HANDLE m_hThread;
27 CAutoPtrList<CWebClientSocket> m_clients;
29 typedef bool (CWebClientSocket::*RequestHandler)(CStringA& hdr, CStringA& body, CStringA& mime);
30 static CAtlStringMap<RequestHandler> m_internalpages;
31 static CAtlStringMap<UINT> m_downloads;
32 static CAtlStringMap<CStringA, CStringA> m_mimes;
33 CPath m_webroot;
35 CAtlStringMap<> m_cgi;
36 bool CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& body, CStringA& mime);
38 public:
39 CWebServer(CMainFrame* pMainFrame, int nPort = 13579);
40 virtual ~CWebServer();
42 static void Deploy(CString dir);
44 bool ToLocalPath(CString& path, CString& redir);
45 bool LoadPage(UINT resid, CStringA& str, CString path = _T(""));
47 void OnAccept(CWebServerSocket* pServer);
48 void OnClose(CWebClientSocket* pClient);
49 void OnRequest(CWebClientSocket* pClient, CStringA& reshdr, CStringA& resbody);