summaryrefslogtreecommitdiff
path: root/include/socketengine.h
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-04-15 23:45:12 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-04-15 23:45:12 +0200
commitdad754237bf28b9cb7733f7607e128569897eb10 (patch)
treec1c4bc48209ba6ea0c67f2e825c82bb87e3d30ea /include/socketengine.h
parent37de78450964b42741dffa51329251cdef28119f (diff)
parenta42246b2f19d429a01fc901b7f49893764676499 (diff)
Merge branch 'master+ehdispatch'
Diffstat (limited to 'include/socketengine.h')
-rw-r--r--include/socketengine.h39
1 files changed, 13 insertions, 26 deletions
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;
};