00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSREAD_ERROR_H
00020 #define CONEXUSREAD_ERROR_H
00021
00022 #include <conexus/error.h>
00023
00024 namespace Conexus
00025 {
00026
00032 class read_error: public conexus_error
00033 {
00034 public:
00035 read_error(int e=0): conexus_error("Unknown error, socket receive failed.",e,"read")
00036 { }
00037 read_error(const std::string s, int e=0): conexus_error(s,e,"read")
00038 { }
00039 }
00040 ;
00041
00042 namespace error
00043 {
00044
00045 namespace read
00046 {
00047
00054 class bad_fd: public read_error
00055 {
00056 public:
00057 bad_fd(): read_error("sockfd is not a valid descriptor.", EBADF)
00058 { }
00059 }
00060 ;
00061
00069 class connection_refused: public read_error
00070 {
00071 public:
00072 connection_refused(): read_error("A remote host refused to allow the network connection.", ECONNREFUSED)
00073 { }
00074 }
00075 ;
00076
00084 class not_connected: public read_error
00085 {
00086 public:
00087 not_connected(): read_error("The socket is associated with a connection-oriented protocol and has not been connected", ENOTCONN)
00088 { }
00089 }
00090 ;
00091
00098 class not_socket: public read_error
00099 {
00100 public:
00101 not_socket(): read_error("The argument s is not a socket.", ENOTSOCK)
00102 { }
00103 }
00104 ;
00105
00114 class would_block: public read_error
00115 {
00116 public:
00117 would_block(): read_error("The socket is marked non-blocking and the requested operation would block.", EAGAIN)
00118 { }
00119 }
00120 ;
00121
00129 class interrupted: public read_error
00130 {
00131 public:
00132 interrupted(): read_error("The receive was interrupted by delivery of a signal before any data were available.", EINTR)
00133 { }
00134 }
00135 ;
00136
00143 class invalid_user_space_address: public read_error
00144 {
00145 public:
00146 invalid_user_space_address(): read_error("An invalid user space address was specified for a parameter.", EFAULT)
00147 { }
00148 }
00149 ;
00150
00157 class invalid_argument: public read_error
00158 {
00159 public:
00160 invalid_argument(): read_error("Invalid argument passed.", EINVAL)
00161 { }
00162 }
00163 ;
00164
00171 class no_memory: public read_error
00172 {
00173 public:
00174 no_memory(): read_error("No memory available.", ENOMEM)
00175 { }
00176 }
00177 ;
00178
00184 class not_opened: public read_error
00185 {
00186 public:
00187 not_opened(): read_error("Trying to read from a device that can't be opened.", -1)
00188 { }
00189 }
00190 ;
00191
00197 class not_bound: public read_error
00198 {
00199 public:
00200 not_bound(): read_error("Trying to read from a socket that can't be bound.", -1)
00201 { }
00202 }
00203 ;
00204
00212 class disconnected: public read_error
00213 {
00214 public:
00215 disconnected(): read_error("Trying to read from a socket where the peer has performed an orderly shutdown.", -1)
00216 { }
00217 }
00218 ;
00219
00220
00221 }
00222
00223 }
00224
00225 }
00226
00227 #endif // CONEXUSSEND_ERROR_H