exception.h

00001 /***************************************************************************
00002 *   Copyright (C) 2005 by                                                 *
00003 *   Pedro J. Fernandez Ruiz    pedroj.fernandez@dif.um.es                 *
00004 *   Alejandro Perez Mendez     alejandro_perez@dif.um.es                  *
00005 *                                                                         *
00006 *   This library is free software; you can redistribute it and/or         *
00007 *   modify it under the terms of the GNU Lesser General Public            *
00008 *   License as published by the Free Software Foundation; either          *
00009 *   version 2.1 of the License, or (at your option) any later version.    *
00010 *                                                                         *
00011 *   This library is distributed in the hope that it will be useful,       *
00012 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014 *   Lesser General Public License for more details.                       *
00015 *                                                                         *
00016 *   You should have received a copy of the GNU Lesser General Public      *
00017 *   License along with this library; if not, write to the Free Software   *
00018 *   Foundation, Inc., 51 Franklin St, Fifth Floor,                        *
00019 *   Boston, MA  02110-1301  USA                                           *
00020 ***************************************************************************/
00021 #ifndef EXCEPTION_H
00022 #define EXCEPTION_H
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include "config.h"
00026 #endif
00027 
00028 #include <exception>
00029 #include <iostream>
00030 #include <cstdlib>
00031 #include <stdint.h>
00032 #include <sstream>
00033 
00034 #include "payload.h"
00035 
00036 using namespace std;
00037 
00038 namespace openikev2 {
00039 
00040     class Exception : public exception{
00041         protected:            
00042             string message;         
00043         public:
00044             Exception( string m ) { message = "Exception: " + m; }
00045             virtual const char* what() const throw() {return message.c_str();};
00046             virtual ~Exception() throw() {};
00047     };
00048     
00049     class NoConfigurationFound : public Exception {
00050         public:
00051             NoConfigurationFound( string m ) : Exception( "NoConfigurationFound: " + m ) {}
00052     };
00053 
00054     class FileSystemException : public Exception {
00055         public:
00056             FileSystemException( string m ) : Exception( "FileSystemException: " + m ) {}
00057     };
00058     
00059     class NetworkException : public Exception {
00060         public:
00061             NetworkException( string m ) : Exception( "NetworkException: " + m ) {}
00062     };
00063 
00064     class IpsecException : public Exception {
00065         public:
00066             IpsecException( string m ) : Exception( "IpsecException: " + m ) {}
00067     };
00068 
00069     class CipherException : public Exception {
00070         public:
00071             CipherException( string m ) : Exception( "CipherException: " + m ) {}
00072     };
00073 
00074     class BufferExceededException : public Exception {
00075         public:
00076             BufferExceededException( string m ) : Exception( "BufferExceededException: " + m ) {}
00077     };
00078 
00079     class MessageException : public Exception {
00080         public:
00081             MessageException( string m ) : Exception( "MessageException: " + m ) {}
00082     };
00083 
00084     class ParsingException : public MessageException {
00085         public:
00086             ParsingException( string m ) : MessageException( "ParsingException: " + m ) {}
00087     };
00088 
00089     class ProposalException : public MessageException {
00090         public:
00091             ProposalException( string m ) : MessageException( "ProposalException: " + m ) {}
00092     };
00093 
00094     class UnknownPayloadException : public MessageException {
00095         public:
00096             Payload::PAYLOAD_TYPE payload_type;
00097         public:
00098             UnknownPayloadException( string m, Payload::PAYLOAD_TYPE payload_type) : MessageException( "UnknownPayloadException: " + m ), payload_type(payload_type) {}
00099     };
00100 };
00101 #endif

Generated on Fri Jul 27 11:04:44 2007 for libopenikev2 by  doxygen 1.5.1