conexus logo

except_bind.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_BIND_H
00020 #define CONEXUSEXCEPT_BIND_H
00021 
00022 #include <conexus/except.h>
00023 #include <cstring>
00024 
00025 namespace Conexus
00026   {
00027 
00033     class bind_exception: public conexus_exception
00034       {
00035       public:
00036       bind_exception(int e=0): conexus_exception(::strerror(e), e,"bind")
00037         { }
00038       bind_exception(const std::string s, int e=0): conexus_exception(s, e,"bind")
00039         { }
00040       }
00041     ;
00042 
00043   namespace exception
00044   {
00045 
00046   namespace bind
00047       {
00048 
00055       class bad_fd: public bind_exception
00056         {
00057         public:
00058           bad_fd(): bind_exception("sockfd is not a valid descriptor.", EBADF)
00059           { }
00060         }
00061       ;
00062 
00069       class bound_socket: public bind_exception
00070         {
00071         public:
00072           bound_socket(): bind_exception("The socket is already bound to an address.", EINVAL)
00073           { }
00074         }
00075       ;
00076 
00083       class access: public bind_exception
00084         {
00085         public:
00086           access(): bind_exception("The address is protected, and the user is not the super-user.", EACCES)
00087           { }
00088         }
00089       ;
00090 
00097       class not_socket: public bind_exception
00098         {
00099         public:
00100           not_socket(): bind_exception("Argument is a descriptor for a file, not a socket.", ENOTSOCK)
00101           { }
00102         }
00103       ;
00104 
00111       class invalid_address: public bind_exception
00112         {
00113         public:
00114           invalid_address(): bind_exception("The addrlen is wrong, or the socket was not in the AF_UNIX family.", EINVAL)
00115           { }
00116         }
00117       ;
00118 
00125       class read_only_filesystem: public bind_exception
00126         {
00127         public:
00128           read_only_filesystem(): bind_exception("The socket inode would reside on a read-only file system.", EROFS)
00129           { }
00130         }
00131       ;
00132 
00139       class segfault: public bind_exception
00140         {
00141         public:
00142           segfault(): bind_exception("addr points outside the user’s accessible address space.", EFAULT)
00143           { }
00144         }
00145       ;
00146 
00153       class name_too_long: public bind_exception
00154         {
00155         public:
00156           name_too_long(): bind_exception("addr is too long.", ENAMETOOLONG)
00157           { }
00158         }
00159       ;
00160 
00167       class not_exist: public bind_exception
00168         {
00169         public:
00170           not_exist(): bind_exception("The file does not exist.", ENOENT)
00171           { }
00172         }
00173       ;
00174 
00181       class no_kernel_memory: public bind_exception
00182         {
00183         public:
00184           no_kernel_memory(): bind_exception("Insufficient kernel memory was available.", ENOMEM)
00185           { }
00186         }
00187       ;
00188 
00195       class not_directory: public bind_exception
00196         {
00197         public:
00198           not_directory(): bind_exception("A component of the path prefix is not a directory.", ENOTDIR)
00199           { }
00200         }
00201       ;
00202 
00209       class loop: public bind_exception
00210         {
00211         public:
00212           loop(): bind_exception("Too many symbolic links were encountered in resolving addr.", ELOOP)
00213           { }
00214         }
00215       ;
00216 
00222       class no_address: public bind_exception
00223         {
00224         public:
00225           no_address(): bind_exception("cannot bind socket without an address.", -1)
00226           { }
00227         };
00228 
00234       class no_socket_bind: public bind_exception
00235       {
00236       public:
00237       no_socket_bind(): bind_exception("The Socket class bind method cannot be called without an address.", -1)
00238         { }
00239       };
00240 
00246       class not_open: public bind_exception
00247       {
00248       public:
00249       not_open(): bind_exception("Socket could not be opened for bind method.", -1)
00250         { }
00251       };
00252 
00253       }
00254 
00255   }
00256 
00257 }
00258 
00259 #endif // CONEXUSBIND_ERROR_H

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