IBR-DTNSuite  0.8
ibrdtn/ibrdtn/data/Exceptions.h
Go to the documentation of this file.
00001 #ifndef EXCEPTIONS_H_
00002 #define EXCEPTIONS_H_
00003 
00004 #include "ibrcommon/Exceptions.h"
00005 
00006 #include <stdexcept>
00007 #include <string>
00008 
00009 
00010 using namespace std;
00011 
00012 namespace dtn
00013 {
00017                 class InvalidDataException : public ibrcommon::Exception
00018                 {
00019                         public:
00020                                 InvalidDataException(string what = "Invalid input data.") throw() : Exception(what)
00021                                 {
00022                                 };
00023                 };
00024 
00025                 class InvalidProtocolException : public dtn::InvalidDataException
00026                 {
00027                 public:
00028                         InvalidProtocolException(string what = "The received data does not match the protocol.") throw() : dtn::InvalidDataException(what)
00029                         {
00030                         };
00031                 };
00032 
00033                 class SerializationFailedException : public dtn::InvalidDataException
00034                 {
00035                 public:
00036                         SerializationFailedException(string what = "The serialization failed.") throw() : dtn::InvalidDataException(what)
00037                         {
00038                         };
00039                 };
00040 
00041                 class PayloadReceptionInterrupted : public dtn::SerializationFailedException
00042                 {
00043                 public:
00044                         const size_t length;
00045                         PayloadReceptionInterrupted(const size_t l, string what = "The payload reception has been interrupted.") throw() : dtn::SerializationFailedException(what), length(l)
00046                         {
00047                         };
00048                 };
00049 
00050                 class MissingObjectException : public ibrcommon::Exception
00051                 {
00052                 public:
00053                         MissingObjectException(string what = "Object not available.") throw() : Exception(what)
00054                         {
00055                         };
00056                 };
00057 
00058                 class ConnectionInterruptedException : public ibrcommon::IOException
00059                 {
00060                 public:
00061                         ConnectionInterruptedException() : ibrcommon::IOException("The connection has been interrupted.")
00062                         {
00063                         }
00064                 };
00065 }
00066 
00067 #endif /*EXCEPTIONS_H_*/