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