00001
00014
00015
00016 #ifndef NETWORKEX_H_
00017 #define NETWORKEX_H_
00018
00019 #ifdef _MSC_VER
00020 #pragma once
00021 #endif // MSVC
00022
00023 #include <exception>
00024 #include <sstream>
00025
00027
00028
00029 class NetworkException : public std::exception
00030 {
00031 public:
00032 enum ExceptionCode
00033 {
00034 invalid_address = 0,
00035 invalid_host,
00036 invalid_network,
00037 invalid_service,
00038 read_failed,
00039 write_failed,
00040 socket_path_exceeded,
00041 eof_encountered,
00042 system_call_failure,
00043 system_call_timout
00044 };
00045
00046 NetworkException( ExceptionCode code, const char* note, long native = 0 );
00047
00048
00049 ExceptionCode getErrorCode() const throw();
00050
00051
00052 long getNativeErrorCode() const throw();
00053
00054
00055 virtual const char *what() const throw();
00056
00057
00058 static void throwNetworkException(ExceptionCode code, const char* message = "");
00059 static void throwNetworkException(ExceptionCode code, long nativeError);
00060
00061
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097