00001 /* BEGIN_COPYRIGHT */ 00002 /* */ 00003 /* Open Diameter: Open-source software for the Diameter and */ 00004 /* Diameter related protocols */ 00005 /* */ 00006 /* Copyright (C) 2002-2004 Open Diameter Project */ 00007 /* */ 00008 /* This library is free software; you can redistribute it and/or modify */ 00009 /* it under the terms of the GNU Lesser General Public License as */ 00010 /* published by the Free Software Foundation; either version 2.1 of the */ 00011 /* License, or (at your option) any later version. */ 00012 /* */ 00013 /* This library is distributed in the hope that it will be useful, */ 00014 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 00015 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ 00016 /* Lesser General Public License for more details. */ 00017 /* */ 00018 /* You should have received a copy of the GNU Lesser General Public */ 00019 /* License along with this library; if not, write to the Free Software */ 00020 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */ 00021 /* USA. */ 00022 /* */ 00023 /* In addition, when you copy and redistribute some or the entire part of */ 00024 /* the source code of this software with or without modification, you */ 00025 /* MUST include this copyright notice in each copy. */ 00026 /* */ 00027 /* If you make any changes that are appeared to be useful, please send */ 00028 /* sources that include the changed part to */ 00029 /* diameter-developers@lists.sourceforge.net so that we can reflect your */ 00030 /* changes to one unified version of this software. */ 00031 /* */ 00032 /* END_COPYRIGHT */ 00033 00038 #ifndef __PANA_EXCEPTIONS_H__ 00039 #define __PANA_EXCEPTIONS_H__ 00040 00041 #include <string> 00042 00047 class PANA_Exception 00048 { 00049 public: 00054 typedef enum { 00055 SUCCESS = 0, 00056 FAILED, 00057 NO_MEMORY, 00058 THREAD_FAILED, 00059 ENQUEUE_FAILED, 00060 TRANSPORT_FAILED, 00061 MESSAGE_PARSING_ERROR, 00062 AVP_FACTORY_ERROR, 00063 STATIC_GUARD_TRIGGER, 00064 DATABASE_ERROR, 00065 PARSING_ERROR, 00066 SESSIONID_ERROR, 00067 ENTRY_NOT_FOUND, 00068 CONFIG_ERROR, 00069 INVALID_MESSAGE, 00070 } CODE; 00071 00072 public: 00079 PANA_Exception(CODE code, std::string &description) : 00080 code_(code), 00081 description_(description) { } 00082 00089 PANA_Exception(CODE code, const char *description) : 00090 code_(code), 00091 description_(description) { } 00092 00097 CODE code() { return code_; } 00098 00105 void code(CODE code) { code_ = code; } 00106 00110 std::string &description() { return description_; } 00111 00117 void description(std::string &description) { description_ = description; } 00118 00119 private: 00120 CODE code_; /*<< Current exception code */ 00121 00122 std::string description_; /*<< Description of current error */ 00123 }; 00124 00125 #endif /* __PANA_EXCEPTIONS_H__ */ 00126