/***** (C) Copyright, Shenzhen SUNWIN Intelligent Co.,Ltd. ******source file**** * File name : tcpEpoll.h * Author : ShengYin Li * Brief : ******************************************************************************** * modify * Version Date Author Described * V1.00 2021/04/2 ShengYin Li Created *******************************************************************************/ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include "sdc_common.h" #include #include #include #include #include #include "sdc.h" #include using namespace std; class tcpEpoll { private: std::mutex m_mutex; public: tcpEpoll(); ~tcpEpoll(); int _epoll_fd; int _type; int _domain; map _fdMap; char _err_msg[256]; const int MAXBUFFSIZE = 1024; const int MAXEVENTS = 500; const int FDSIZE = 1000; int getEpollFd(); void addEvent(int fd, int state); void delEvent(int fd, int state); void modEvent(int fd, int state); bool doRead(int fd, char *buf, int &buf_len); bool doWrite(int fd, const char *buf, int buf_len); char* getErrmsg(); void addIdNameFd(string idName,int fd); void delIdNameFd(int fd); void delIdNameFd(string idName); int find(string idName); void allDelIdNameFd(); virtual void allClose() = 0; virtual bool doEpoll() = 0; virtual void handleEvents(epoll_event * events, int num, char * buf, int &buf_len) = 0; virtual int lanch() = 0; protected: }; /******** (C) Copyright, Shenzhen SUNWIN Intelligent Co.,Ltd. ******** End *****/