00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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