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

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