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