conexus logo

except_read.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef CONEXUSEXCEPT_READ_H
00020 #define CONEXUSEXCEPT_READ_H
00021 
00022 #include <conexus/except.h>
00023 
00024 namespace Conexus
00025 {
00026 
00032   class read_exception: public conexus_exception
00033   {
00034     public:
00035       read_exception ( ) : conexus_exception ( "Unknown exception, read failed.",0,"read" )
00036       { }
00037       read_exception ( int e ) : conexus_exception ( strerror ( e ),e,"read" )
00038       { }
00039       read_exception ( const std::string s ) : conexus_exception ( s,0,"read" )
00040       { }
00041   };
00042 
00043   namespace exception
00044   {
00045 
00046     namespace read
00047     {
00048 
00055       class retry: public read_exception
00056       {
00057         public:
00058           retry() : read_exception ( "Unknown exception, read failed but should be retried." )
00059           { }
00060           retry ( int e ) : read_exception ( e )
00061           { }
00062           retry ( const std::string s ) : read_exception ( s )
00063           { }
00064       };
00065 
00072       class bad_fd: public read_exception
00073       {
00074         public:
00075           bad_fd() : read_exception ( EBADF )
00076           { }
00077       };
00078 
00086       class connection_refused: public read_exception
00087       {
00088         public:
00089           connection_refused() : read_exception ( ECONNREFUSED )
00090           { }
00091       };
00092 
00100       class not_connected: public read_exception
00101       {
00102         public:
00103           not_connected() : read_exception ( ENOTCONN )
00104           { }
00105       };
00106 
00113       class not_socket: public read_exception
00114       {
00115         public:
00116           not_socket() : read_exception ( ENOTSOCK )
00117           { }
00118       };
00119 
00128       class would_block: public retry
00129       {
00130         public:
00131           would_block() : retry ( EAGAIN )
00132           { }
00133       };
00134 
00142       class interrupted: public retry
00143       {
00144         public:
00145           interrupted() : retry ( EINTR )
00146           { }
00147       };
00148 
00155       class invalid_user_space_address: public read_exception
00156       {
00157         public:
00158           invalid_user_space_address() : read_exception ( EFAULT )
00159           { }
00160       };
00161 
00168       class invalid_argument: public read_exception
00169       {
00170         public:
00171           invalid_argument() : read_exception ( EINVAL )
00172           { }
00173       };
00174 
00181       class no_memory: public read_exception
00182       {
00183         public:
00184           no_memory() : read_exception ( ENOMEM )
00185           { }
00186       };
00187 
00193       class not_opened: public read_exception
00194       {
00195         public:
00196           not_opened() : read_exception ( "Trying to read from a device that can't be opened." )
00197           { }
00198       };
00199 
00205       class not_bound: public read_exception
00206       {
00207         public:
00208           not_bound() : read_exception ( "Trying to read from a socket that can't be bound." )
00209           { }
00210       };
00211 
00219       class disconnected: public read_exception
00220       {
00221         public:
00222           disconnected() : read_exception ( "Trying to read from a socket where the peer has performed an orderly shutdown." )
00223           { }
00224       };
00225 
00233       class timeout: public retry
00234       {
00235         public:
00236           timeout() : retry ( ETIMEDOUT )
00237           { }
00238       };
00239 
00247       class eof: public read_exception
00248       {
00249         public:
00250           eof() : read_exception ( "End of file." )
00251           { }
00252       };
00253 
00254 
00255     }
00256 
00257   }
00258 
00259 }
00260 
00261 #endif // CONEXUSSEND_ERROR_H

Generated on Wed Jul 8 15:50:07 2009 for conexus by doxygen 1.5.8