conexus/except_connect.h

00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef CONEXUSEXCEPT_CONNECT_H
00020 #define CONEXUSEXCEPT_CONNECT_H
00021 
00022 #include <conexus/except.h>
00023 
00024 namespace Conexus {
00025 
00031 class connect_exception: public conexus_exception {
00032 public:
00033 connect_exception(int e=0): conexus_exception("Unknown exception, socket not connected.",e,"connect") { }
00034 connect_exception(const std::string s, int e=0): conexus_exception(s,e,"connect") { }
00035 }
00036 ;
00037 
00038 namespace exception {
00039 
00040 
00041 namespace connect {
00042 
00043 
00051 class bad_fd: public connect_exception {
00052 public:
00053   bad_fd(): connect_exception("The file descriptor is not a valid index in the descriptor table.", EBADF) { }
00054 }
00055 ;
00056 
00064 class segfault: public connect_exception {
00065 public:
00066   segfault(): connect_exception("The socket structure  address  is  outside  the  user’s  address space.", EFAULT) { }
00067 }
00068 ;
00069 
00077 class not_socket: public connect_exception {
00078 public:
00079   not_socket(): connect_exception("The file descriptor is not associated with a socket.", ENOTSOCK) { }
00080 }
00081 ;
00082 
00090 class connected_socket: public connect_exception {
00091 public:
00092   connected_socket(): connect_exception("The socket is already connected.", EISCONN) { }
00093 }
00094 ;
00095 
00103 class connection_refused: public connect_exception {
00104 public:
00105   connection_refused(): connect_exception("No one listening on the remote address.", ECONNREFUSED) { }
00106 }
00107 ;
00108 
00116 class timeout: public connect_exception {
00117 public:
00118   timeout(): connect_exception("Timeout while attempting connection.", ETIMEDOUT) { }
00119 }
00120 ;
00121 
00129 class network_unreachable: public connect_exception {
00130 public:
00131   network_unreachable(): connect_exception("Network is unreachable.", ENETUNREACH) { }
00132 }
00133 ;
00134 
00142 class address_in_use: public connect_exception {
00143 public:
00144   address_in_use(): connect_exception("Local address is already in use.", EADDRINUSE) { }
00145 }
00146 ;
00147 
00155 class not_immediate: public connect_exception {
00156 public:
00157   not_immediate(): connect_exception("The socket is non-blocking and the connection cannot be completed immediately.", EINPROGRESS) { }
00158 }
00159 ;
00160 
00168 class in_progress: public connect_exception {
00169 public:
00170   in_progress(): connect_exception("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_exception {
00182 public:
00183   try_again(): connect_exception("No more free local ports or insufficient entries in the routing cache.", EAGAIN) { }
00184 }
00185 ;
00186 
00194 class af_not_supported: public connect_exception {
00195 public:
00196   af_not_supported(): connect_exception("The passed address didn’t have the correct address family in its sa_family field.", EAFNOSUPPORT) { }
00197 }
00198 ;
00199 
00207 class access: public connect_exception {
00208 public:
00209   access(): connect_exception("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_exception {
00220 public:
00221   no_remote_address(): connect_exception("Socket cannot auto connect because a default remote address has not been set.", -1) { }
00222 };
00223 
00229 class no_socket_connect: public connect_exception
00230 {
00231 public:
00232   no_socket_connect(): connect_exception("The Socket class connect() method cannot be called without an address.", -1)
00233   { }
00234 };
00235 
00241 class not_open: public connect_exception
00242 {
00243 public:
00244   not_open(): connect_exception("Socket could not be opened for connect() method.", -1)
00245   { }
00246 };
00247 
00253 class no_udpposet_connect: public connect_exception
00254 {
00255   public:
00256     no_udpposet_connect(): connect_exception("The UDPPoset class connect() method cannot be called.", -1)
00257     { }
00258 };
00259 
00260 
00261 
00262 }
00263 }
00264 }
00265 
00266 #endif // CONEXUSCONNECT_ERROR_H

Generated on Tue Mar 13 19:54:43 2007 by  doxygen 1.5.1