00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSCONNECT_ERROR_H
00020 #define CONEXUSCONNECT_ERROR_H
00021
00022 #include <conexus/error.h>
00023
00024 namespace Conexus {
00025
00031 class connect_error: public conexus_error {
00032 public:
00033 connect_error(int e=0): conexus_error("Unknown error, socket not connected.",e,"connect") { }
00034 connect_error(const std::string s, int e=0): conexus_error(s,e,"connect") { }
00035 }
00036 ;
00037
00038 namespace error {
00039
00040
00041 namespace connect {
00042
00043
00051 class bad_fd: public connect_error {
00052 public:
00053 bad_fd(): connect_error("The file descriptor is not a valid index in the descriptor table.", EBADF) { }
00054 }
00055 ;
00056
00064 class segfault: public connect_error {
00065 public:
00066 segfault(): connect_error("The socket structure address is outside the user’s address space.", EFAULT) { }
00067 }
00068 ;
00069
00077 class not_socket: public connect_error {
00078 public:
00079 not_socket(): connect_error("The file descriptor is not associated with a socket.", ENOTSOCK) { }
00080 }
00081 ;
00082
00090 class connected_socket: public connect_error {
00091 public:
00092 connected_socket(): connect_error("The socket is already connected.", EISCONN) { }
00093 }
00094 ;
00095
00103 class connection_refused: public connect_error {
00104 public:
00105 connection_refused(): connect_error("No one listening on the remote address.", ECONNREFUSED) { }
00106 }
00107 ;
00108
00116 class timeout: public connect_error {
00117 public:
00118 timeout(): connect_error("Timeout while attempting connection.", ETIMEDOUT) { }
00119 }
00120 ;
00121
00129 class network_unreachable: public connect_error {
00130 public:
00131 network_unreachable(): connect_error("Network is unreachable.", ENETUNREACH) { }
00132 }
00133 ;
00134
00142 class address_in_use: public connect_error {
00143 public:
00144 address_in_use(): connect_error("Local address is already in use.", EADDRINUSE) { }
00145 }
00146 ;
00147
00155 class not_immediate: public connect_error {
00156 public:
00157 not_immediate(): connect_error("The socket is non-blocking and the connection cannot be completed immediately.", EINPROGRESS) { }
00158 }
00159 ;
00160
00168 class in_progress: public connect_error {
00169 public:
00170 in_progress(): connect_error("The socket is non-blocking and a previous connection attempt has not yet been completed.", EALREADY) { }
00171 }
00172 ;
00173
00181 class try_again: public connect_error {
00182 public:
00183 try_again(): connect_error("No more free local ports or insufficient entries in the routing cache.", EAGAIN) { }
00184 }
00185 ;
00186
00194 class af_not_supported: public connect_error {
00195 public:
00196 af_not_supported(): connect_error("The passed address didn’t have the correct address family in its sa_family field.", EAFNOSUPPORT) { }
00197 }
00198 ;
00199
00207 class access: public connect_error {
00208 public:
00209 access(): connect_error("The user tried to connect to a broadcast address without having the socket broadcast flag enabled or the connection request failed because of a local firewall rule.", EACCES) { }
00210 }
00211 ;
00212
00219 class no_remote_address: public connect_error {
00220 public:
00221 no_remote_address(): connect_error("Socket cannot auto connect because a default remote address has not been set.", -1) { }
00222 };
00223
00229 class no_socket_connect: public connect_error
00230 {
00231 public:
00232 no_socket_connect(): connect_error("The Socket class connect() method cannot be called without an address.", -1)
00233 { }
00234 };
00235
00241 class not_open: public connect_error
00242 {
00243 public:
00244 not_open(): connect_error("Socket could not be opened for connect() method.", -1)
00245 { }
00246 };
00247
00253 class no_udpposet_connect: public connect_error
00254 {
00255 public:
00256 no_udpposet_connect(): connect_error("The UDPPoset class connect() method cannot be called.", -1)
00257 { }
00258 };
00259
00260
00261
00262 }
00263 }
00264 }
00265
00266 #endif // CONEXUSCONNECT_ERROR_H