00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSEXCEPT_WRITE_H
00020 #define CONEXUSEXCEPT_WRITE_H
00021
00022 #include <conexus/except.h>
00023
00024 namespace Conexus
00025 {
00026
00032 class write_exception: public conexus_exception
00033 {
00034 public:
00035 write_exception(int e=0): conexus_exception("Unknown exception, write failed.",e,"write")
00036 { }
00037 write_exception(const std::string s, int e=0): conexus_exception(s,e,"write")
00038 { }
00039 }
00040 ;
00041
00042 namespace exception
00043 {
00044
00045 namespace write
00046 {
00047
00055 class would_block: public write_exception
00056 {
00057 public:
00058 would_block(): write_exception("The socket is marked non-blocking and the requested operation would block.", EWOULDBLOCK)
00059 { }
00060 }
00061 ;
00062
00069 class bad_fd: public write_exception
00070 {
00071 public:
00072 bad_fd(): write_exception("sockfd is not a valid descriptor.", EBADF)
00073 { }
00074 }
00075 ;
00076
00083 class connection_reset: public write_exception
00084 {
00085 public:
00086 connection_reset(): write_exception("Connection reset by peer.", ECONNRESET)
00087 { }
00088 }
00089 ;
00090
00097 class destination_address_required: public write_exception
00098 {
00099 public:
00100 destination_address_required(): write_exception("The socket is not connection-mode, and no peer address is set.", EDESTADDRREQ)
00101 { }
00102 }
00103 ;
00104
00105
00112 class invalid_user_space_address: public write_exception
00113 {
00114 public:
00115 invalid_user_space_address(): write_exception("An invalid user space address was specified for a parameter.", EFAULT)
00116 { }
00117 }
00118 ;
00119
00126 class interrupted: public write_exception
00127 {
00128 public:
00129 interrupted(): write_exception("A signal occurred before any data was transmitted.", EINTR)
00130 { }
00131 }
00132 ;
00133
00134
00141 class invalid_argument: public write_exception
00142 {
00143 public:
00144 invalid_argument(): write_exception("Invalid argument passed.", EINVAL)
00145 { }
00146 }
00147 ;
00148
00157 class is_connected: public write_exception
00158 {
00159 public:
00160 is_connected(): write_exception("The connection-mode socket was connected already but a recipient was specified.", EISCONN)
00161 { }
00162 }
00163 ;
00164
00165
00173 class message_size: public write_exception
00174 {
00175 public:
00176 message_size(): write_exception("The socket type requires that message be sent atomically, and the size of the message to be sent made this impossible.", EMSGSIZE)
00177 { }
00178 }
00179 ;
00180
00181
00192 class no_buffers: public write_exception
00193 {
00194 public:
00195 no_buffers(): write_exception("The output queue for a network interface was full.", ENOBUFS)
00196 { }
00197 }
00198 ;
00199
00200
00207 class no_memory: public write_exception
00208 {
00209 public:
00210 no_memory(): write_exception("No memory available.", ENOMEM)
00211 { }
00212 }
00213 ;
00214
00221 class permission_denied: public write_exception
00222 {
00223 public:
00224 permission_denied(): write_exception("Permission denied.", EACCES)
00225 { }
00226 }
00227 ;
00228
00235 class not_connected: public write_exception
00236 {
00237 public:
00238 not_connected(): write_exception("The socket is not connected, and no target has been given.", ENOTCONN)
00239 { }
00240 }
00241 ;
00242
00249 class not_socket: public write_exception
00250 {
00251 public:
00252 not_socket(): write_exception("The argument s is not a socket.", ENOTSOCK)
00253 { }
00254 }
00255 ;
00256
00257
00265 class operation_not_supported: public write_exception
00266 {
00267 public:
00268 operation_not_supported(): write_exception("Some bit in the flags argument is inappropriate for the socket type.", EOPNOTSUPP)
00269 { }
00270 }
00271 ;
00272
00273
00282 class pipe: public write_exception
00283 {
00284 public:
00285 pipe(): write_exception("The local end has been shut down on a connection oriented socket.", EPIPE)
00286 { }
00287 }
00288 ;
00289
00298 class connection_refused: public write_exception
00299 {
00300 public:
00301 connection_refused(): write_exception("The connection has been refused. This is probably the result of an ICMP UNREACHABLE message, so the first few transmissions may have actually gone out before the ICMP UNREACHABLE message was processed. This probably means that the destination (host or port) doesn't exist or isn't active.", ECONNREFUSED)
00302 { }
00303 }
00304 ;
00305
00311 class no_default_remote_address: public write_exception
00312 {
00313 public:
00314 no_default_remote_address(): write_exception("Socket cannot send because a default remote address has not been set.", -1)
00315 { }
00316 }
00317 ;
00318
00324 class no_sendto_without_address: public write_exception
00325 {
00326 public:
00327 no_sendto_without_address(): write_exception("Socket is not capable of sendto without an address.", -1)
00328 { }
00329 }
00330 ;
00331
00337 class not_opened: public write_exception
00338 {
00339 public:
00340 not_opened(): write_exception("Trying to write on I/O that cannot open.", -1)
00341 { }
00342 }
00343 ;
00344
00350 class read_only: public write_exception
00351 {
00352 public:
00353 read_only(): write_exception("Trying to write to a read only I/O.", -1)
00354 { }
00355 }
00356 ;
00357
00365 class timeout: public write_exception
00366 {
00367 public:
00368 timeout(): write_exception("The write operation timed out.", -1)
00369 { }
00370 }
00371 ;
00372
00373
00374
00375 }
00376
00377 }
00378
00379 }
00380
00381 #endif // CONEXUSSEND_ERROR_H