conexus logo

except_socket.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_SOCKET_H
00020 #define CONEXUSEXCEPT_SOCKET_H
00021 
00022 #include <conexus/except.h>
00023 #include <cstring>
00024 
00025 namespace Conexus
00026   {
00027 
00033     class socket_exception: public conexus_exception
00034       {
00035       public:
00036       socket_exception(int e=0): conexus_exception(::strerror(e), e,"socket")
00037         { }
00038       socket_exception(const std::string s, int e=0): conexus_exception(s, e,"socket")
00039         { }
00040       }
00041     ;
00042 
00043   namespace exception
00044   {
00045 
00046   namespace socket
00047       {
00048 
00055       class bad_fd: public socket_exception
00056         {
00057         public:
00058           bad_fd(): socket_exception("sockfd is not a valid descriptor.", EBADF)
00059           { }
00060         }
00061       ;
00062 
00069       class segfault: public socket_exception
00070       {
00071         public:
00072           segfault(): socket_exception("The address pointed to by optval is not in a valid part of the process address space.", EFAULT)
00073           { }
00074       }
00075       ;
00076 
00083       class optlen_invalid: public socket_exception
00084         {
00085         public:
00086           optlen_invalid(): socket_exception("Socket option optlen is invalid.", EINVAL)
00087           { }
00088         }
00089       ;
00090 
00097       class no_option: public socket_exception
00098       {
00099         public:
00100           no_option(): socket_exception("Socket option is unknown at the level indicated.", ENOPROTOOPT)
00101           { }
00102       }
00103       ;
00104 
00111       class not_socket: public socket_exception
00112         {
00113         public:
00114           not_socket(): socket_exception("Argument is a descriptor for a file, not a socket.", ENOTSOCK)
00115           { }
00116         }
00117       ;
00118 
00119       }
00120 
00121   }
00122 
00123 }
00124 
00125 #endif // CONEXUSBIND_ERROR_H

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