123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /***** (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 <arpa/inet.h>
- #include <fcntl.h>
- #include <stdio.h>
- #include <errno.h>
- #include <iostream>
- #include <stdlib.h>
- #include <malloc.h>
- #include <sys/types.h>
- #include <sys/un.h>
- #include <sys/epoll.h>
- #include <sys/uio.h>
- #include <string.h>
- #include <unistd.h>
- #include "sdc_common.h"
- #include <map>
- #include <set>
- #include <string.h>
- #include <iostream>
- #include <pthread.h>
- #include "sdc.h"
- #include <mutex>
- using namespace std;
- class tcpEpoll
- {
- private:
- std::mutex m_mutex;
- public:
- tcpEpoll();
- ~tcpEpoll();
- int _epoll_fd;
- int _type;
- int _domain;
- map <string,int>_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 *****/
|