/usr/include/happycoders/socket/socketexception.hh is in happycoders-libsocket-dev 1.6-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /*
** socketexception.hh
** Login : Julien Lemoine <speedblue@happycoders.org>
** Started on Mon May 12 22:50:50 2003 Julien Lemoine
** $Id: socketexception.hh,v 1.6 2004/06/06 14:13:56 speedblue Exp $
**
** Copyright (C) 2003,2004 Julien Lemoine
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SOCKETEXCEPTION_HH_
# define SOCKETEXCEPTION_HH_
#define HERE __FILE__, __LINE__
#include <iostream>
#include <string>
#define NEW_EXCEPTION(Name) \
class Name : public Exception \
{ \
public: \
Name(const std::string& desc, const char * file, int line) : \
Exception(desc, file, line) \
{} \
Name() : Exception() {} \
Name(const char *file, int line) : Exception(file, line) {} \
};
namespace Network
{
/// @author Julien Lemoine <speedblue at happycoders dot org>
/// @brief This class is the top exception class used in libsocket
class Exception
{
public:
Exception() :
_error("Exception Occured"), _file(0x0), _line(0)
{}
Exception(const char *file, int line) :
_error("Exception Occured"), _file(file), _line(line)
{}
Exception(const std::string& err, const char* file, int line) :
_file(file), _line(line)
{
_error = "Exception: " + err;
}
void print(std::ostream& stream) const;
const std::string& get_error() const;
const char* get_file() const;
int get_line() const;
protected:
std::string _error;
const char* _file;
int _line;
};
std::ostream& operator<<(std::ostream& stream, Exception& e);
/// @brief exception launched when a hostname is incorrect
NEW_EXCEPTION(HostnameError);
/// @brief exception launched when user want ipv6, but lib is not
/// compiled with
NEW_EXCEPTION(Ipv6SupportError);
/// @brief exception launched when error is received during TLS
/// initialization
NEW_EXCEPTION(TLSError);
/// @brief exception launched when a file does not exist
NEW_EXCEPTION(InvalidFile);
/// @brief exception launched when user want TLS, but lib is not
/// compiled with
NEW_EXCEPTION(TLSSupportError);
/// @brief exception launched when a addr is invalid pour inet_pton
NEW_EXCEPTION(InetptonError);
/// @brief exception launched when the addr is not valid for inet_ntop
NEW_EXCEPTION(InetntopError);
/// @brief exception launched when connection is closed
NEW_EXCEPTION(ConnectionClosed);
/// @brief exception launched when there is no active connection
NEW_EXCEPTION(NoConnection);
/// @brief exception launched when there is a timeout
NEW_EXCEPTION(Timeout);
/// @brief exception launched when bind libc function return an error
NEW_EXCEPTION(BindError);
/// @brief exception launched when socket libc function return an error
NEW_EXCEPTION(SocketError);
/// @brief exception launched when listen libc function return an error
NEW_EXCEPTION(ListenError);
/// @brief exception launched when setsockopt libc function return an error
NEW_EXCEPTION(SetsockoptError);
/// @brief exception launched when close libc function return an error
NEW_EXCEPTION(CloseError);
/// @brief exception launched when select libc function return an error
NEW_EXCEPTION(SelectError);
/// @brief exception launched when connect libc function return an error
NEW_EXCEPTION(ConnectError);
/// @brief exception launched when accept libc function return an error
NEW_EXCEPTION(AcceptError);
/// @brief exception launched when getpeername libc function return an error
NEW_EXCEPTION(GetpeernameError);
/// @brief exception launched when WSAStartup windows function
/// return an error
NEW_EXCEPTION(WSAStartupError);
}
#endif /* !SOCKETEXCEPTION_HH_ */
|