X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fsocketengine.h;fp=include%2Fsocketengine.h;h=ddc48f94d159a359ae8d8f27bfc5534a515aa314;hb=612384b3d46d06eea6fd71ee6dc60471d0f9e3d1;hp=f30289913b8b929008c08281e02c57cc12759e11;hpb=e3303330f8cc04121907715d789370f492878646;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/socketengine.h b/include/socketengine.h index f30289913..ddc48f94d 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -37,23 +37,6 @@ #define IOV_MAX 1024 #endif -/** Types of event an EventHandler may receive. - * EVENT_READ is a readable file descriptor, - * and EVENT_WRITE is a writeable file descriptor. - * EVENT_ERROR can always occur, and indicates - * a write error or read error on the socket, - * e.g. EOF condition or broken pipe. - */ -enum EventType -{ - /** Read event */ - EVENT_READ = 0, - /** Write event */ - EVENT_WRITE = 1, - /** Error event */ - EVENT_ERROR = 2 -}; - /** * Event mask for SocketEngine events */ @@ -207,16 +190,20 @@ class CoreExport EventHandler : public classbase */ virtual ~EventHandler() {} - /** Process an I/O event. - * You MUST implement this function in your derived - * class, and it will be called whenever read or write - * events are received. - * @param et either one of EVENT_READ for read events, - * EVENT_WRITE for write events and EVENT_ERROR for - * error events. - * @param errornum The error code which goes with an EVENT_ERROR. + /** Called by the socket engine in case of a read event + */ + virtual void OnEventHandlerRead() = 0; + + /** Called by the socket engine in case of a write event. + * The default implementation does nothing. + */ + virtual void OnEventHandlerWrite(); + + /** Called by the socket engine in case of an error event. + * The default implementation does nothing. + * @param errornum Error code */ - virtual void HandleEvent(EventType et, int errornum = 0) = 0; + virtual void OnEventHandlerError(int errornum); friend class SocketEngine; };