PPI: Implement IOEvent error handling
[senf.git] / PPI / IOEvent.hh
index 4e143b2..ad239b8 100644 (file)
@@ -27,8 +27,8 @@
 #define HH_IOEvent_ 1
 
 // Custom includes
-#include "Events.hh"
 #include "Scheduler/Scheduler.hh"
+#include "Events.hh"
 
 //#include "IOEvent.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 namespace senf {
 namespace ppi {
 
+    /** \brief IOEvent event information
+
+        Information passed to the IOEvent event handler
+     */
     struct IOEventInfo
     {
-        unsigned events;
+        unsigned events;                ///< Type of event signaled
+                                        /**< The value is a combination of the flags from
+                                             IOEvent::EventFlags */
     };
 
-    /** \brief
+    /** \brief FileHandle based I/O read/write event
+
+        An IOEvent is signaled, whenever the FileHandle \a handle becomes readable or writable. The
+        type of event is specified using the \a events mask with values from EventFlags.
+
+        \see IOEventInfo
+
+        \ingroup event_group
       */
     class IOEvent
         : public EventImplementation<IOEventInfo>
@@ -50,8 +63,14 @@ namespace ppi {
         ///////////////////////////////////////////////////////////////////////////
         // Types
 
+        // This is stupid, however there is no way to import the Scheduler::EventId enum together
+        // with the enumeration symbols
+
         enum EventFlags { Read  = Scheduler::EV_READ, 
-                          Write = Scheduler::EV_WRITE };
+                          Prio = Scheduler::EV_PRIO,
+                          Write = Scheduler::EV_WRITE,
+                          Hup = Scheduler::EV_HUP,
+                          Err = Scheduler::EV_ERR };
 
         ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
@@ -63,11 +82,21 @@ namespace ppi {
         ///@}
         ///////////////////////////////////////////////////////////////////////////
 
+        /** \brief Unhandled error condition */
+        struct ErrorException : public std::exception
+        { virtual char const * what() const throw() 
+                { return "senf::ppi::IOEvent::ErrorException"; } };
+
+        /** \brief Unhandled hangup condition */
+        struct HangupException : public std::exception
+        { virtual char const * what() const throw() 
+                { return "senf::ppi::IOEvent::HangupException"; } };
+
     protected:
 
     private:
         virtual void v_enable();
-        virtual void v_disable();
+         virtual void v_disable();
         
         void cb(int, Scheduler::EventId event);