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