X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FIOEvent.hh;h=4399c5c8def267ca45040801156826fc6fb3816c;hb=ed0e2329281a50f80be8425938c17515fa70661b;hp=f750530a8d9142bff6e50f4a5fa2f1b63e473998;hpb=7231c220a7332754de3d16e4e8aacd5dbd31c501;p=senf.git diff --git a/PPI/IOEvent.hh b/PPI/IOEvent.hh index f750530..4399c5c 100644 --- a/PPI/IOEvent.hh +++ b/PPI/IOEvent.hh @@ -1,8 +1,8 @@ // $Id$ // // Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ #define HH_IOEvent_ 1 // Custom includes -#include "Scheduler/Scheduler.hh" +#include "../Scheduler/Scheduler.hh" #include "Events.hh" //#include "IOEvent.mpp" @@ -52,7 +52,18 @@ namespace ppi { 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. - \fixme Implement error/EOF handling + There are two types of flags: + + \li Event flags (\ref Read, \ref Prio, \ref Write) specify the type of event. The + callback will be called whenever one of the specified events occurs on the filehandle + \li Error flags (\ref Hup, \ref Err) specify some type of error condition on the + filehandle. If you specify an error flag when registering the event, the error condition + will be passed to the callback, otherwise an ErrorException or HangupException will be + thrown. + + \see IOEventInfo + + \ingroup event_group */ class IOEvent : public EventImplementation @@ -61,8 +72,16 @@ namespace ppi { /////////////////////////////////////////////////////////////////////////// // Types - enum EventFlags { Read = Scheduler::EV_READ, - Write = Scheduler::EV_WRITE }; + // 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 /**< FileHandle is readable */ + , Prio = Scheduler::EV_PRIO /**< FileHandle priority data is readable */ + , Write = Scheduler::EV_WRITE /**< FileHandle is writable */ + , Hup = Scheduler::EV_HUP /**< Hangup condition on FileHandle */ + , Err = Scheduler::EV_ERR /**< Some other error condition on FileHandle */ + }; /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members @@ -74,13 +93,23 @@ 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); + void cb(Scheduler::EventId event); int fd_; unsigned events_;