⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpsocketmgr.h

📁 跨操作系统的微型中间件
💻 H
字号:
#ifndef		__HTTP_SOCKET_MGR__
#define		__HTTP_SOCKET_MGR__

#ifndef __Win32__
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/uio.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include <fcntl.h>
#endif

#include "HashTable.h"
#include "BasicHashTable.h"
//#include "ClientSession.h"

typedef struct _httpsession{
		UInt32		infd;
		UInt32		outfd;
		CClientSession *  pClient;
} CHTTPSession;

class HTTPSocketMgr
{
public:
	static HTTPSocketMgr * GetInstance();

	static void DelInstance();

	virtual ~HTTPSocketMgr(){
		while(true){
			if(m_httpsessionTable->IsEmpty()) break;
			CHTTPSession *pHttpSession = (CHTTPSession *)m_httpsessionTable->RemoveNext();			
			delete pHttpSession;
		}
		
		delete m_httpsessionTable;
	}

	void Initialize(){
		m_httpsessionTable = HashTable::create(STRING_HASH_KEYS);
	}

	void		PutInFD(int inFD, char * v_sessionID);
	void		PutOutFD(int outFD, char * v_sessionID);
	void		PutClientSession(CClientSession * pClient, char * v_sessionID);

	OS_Error	Get(int &outFD, CClientSession ** ppClient, char * v_sessionID);

	OS_Error	Remove(CClientSession * pClient);
	
private:
	HTTPSocketMgr(){}

private:


	static HTTPSocketMgr * mgr;

	HashTable *		m_httpsessionTable;

};

#endif



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -