eID middleware |

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# eidlibException.h

Go to the documentation of this file.

    00001 /* ****************************************************************************
    00002  * eID Middleware Project.
    00003  * Copyright (C) 2008-2009 FedICT.
    00004  *
    00005  * This is free software; you can redistribute it and/or modify it
    00006  * under the terms of the GNU Lesser General Public License version
    00007  * 3.0 as published by the Free Software Foundation.
    00008  *
    00009  * This software is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00012  * Lesser General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Lesser General Public
    00015  * License along with this software; if not, see
    00016  * http://www.gnu.org/licenses/.
    00017 **************************************************************************** */
    00018 #pragma once
    00019
    00020 #ifndef __EIDLIB_EXCEPTION_H__
    00021 #define __EIDLIB_EXCEPTION_H__
    00022
    00023 #include "eidlibdefines.h"
    00024
    00025 namespace eIDMW
    00026 {
    00027
    00028 class CMWException;
    00029
    00030 /******************************************************************************//**
    00031   * Base class for the PTEID SDK Exceptions
    00032   *********************************************************************************/
    00033 class PTEID_Exception
    00034 {
    00035 public:
    00036     PTEIDSDK_API PTEID_Exception(long lError);    /**< Constructor - Need error code that comes from eidErrors.h */
    00037         PTEIDSDK_API virtual ~PTEID_Exception();          /**< Destructor */
    00038
    00039     PTEIDSDK_API long GetError() const;                  /**< Return the error code */
    00040
    00041         NOEXPORT_PTEIDSDK static PTEID_Exception THROWException(CMWException &e);
    00042
    00043 private:
    00044         long m_lError;                                  /**< Error code of the exception (see eidErrors.h)*/
    00045 };
    00046
    00047 /******************************************************************************//**
    00048   * Exception class Release Needed (error code = EIDMW_ERR_RELEASE_NEEDED)
    00049   *
    00050   *     Throw when the application close without calling the PTEID_RealeaseSDK
    00051   *********************************************************************************/
    00052 class PTEID_ExReleaseNeeded: public PTEID_Exception
    00053 {
    00054 public:
    00055         PTEIDSDK_API PTEID_ExReleaseNeeded();                             /**< Constructor */
    00056         PTEIDSDK_API virtual ~PTEID_ExReleaseNeeded();    /**< Destructor */
    00057 };
    00058
    00059 /******************************************************************************//**
    00060   * Exception class Release Needed (error code = EIDMW_ERR_UNKNOWN)
    00061   *********************************************************************************/
    00062 class PTEID_ExUnknown: public PTEID_Exception
    00063 {
    00064 public:
    00065         PTEIDSDK_API PTEID_ExUnknown();                           /**< Constructor */
    00066         PTEIDSDK_API virtual ~PTEID_ExUnknown();          /**< Destructor */
    00067 };
    00068
    00069 /******************************************************************************//**
    00070   * Exception class Document Type Unknown (error code = EIDMW_ERR_DOCTYPE_UNKNOWN)
    00071   *
    00072   *     Throw when the document type doesn't exist for this card
    00073   * Used in : - PTEID_Card::getDocument(PTEID_DocumentType type)
    00074   *********************************************************************************/
    00075 class PTEID_ExDocTypeUnknown: public PTEID_Exception
    00076 {
    00077 public:
    00078         PTEIDSDK_API PTEID_ExDocTypeUnknown();                    /**< Constructor */
    00079         PTEIDSDK_API virtual ~PTEID_ExDocTypeUnknown();   /**< Destructor */
    00080 };
    00081
    00082 /******************************************************************************//**
    00083   * Exception class File Type Unknown (error code = EIDMW_ERR_FILETYPE_UNKNOWN)
    00084   *
    00085   *     Throw when the Raw Data type doesn't exist for this card
    00086   * Used in : - PTEID_Card::getRawData(PTEID_RawDataType type)
    00087   *********************************************************************************/
    00088 class PTEID_ExFileTypeUnknown: public PTEID_Exception
    00089 {
    00090 public:
    00091         PTEIDSDK_API PTEID_ExFileTypeUnknown();                   /**< Constructor */
    00092         PTEIDSDK_API virtual ~PTEID_ExFileTypeUnknown();  /**< Destructor */
    00093 };
    00094
    00095 /******************************************************************************//**
    00096   * Exception class Bad Parameter Range (error code = EIDMW_ERR_PARAM_RANGE)
    00097   *
    00098   *     Throw when the element ask is out of range
    00099   * Used in : - PTEID_ReaderSet::getReaderName(unsigned long ulIndex)
    00100   *           - PTEID_ReaderSet::getReaderByNum(unsigned long ulIndex)
    00101   *           - PTEID_Certificate::getChildren(unsigned long ulIndex)
    00102   *           - PTEID_Certificates::getCertByNumber(unsigned long ulIndex)
    00103   *           - PTEID_Pins::getPinByNumber(unsigned long ulIndex)
    00104   *********************************************************************************/
    00105 class PTEID_ExParamRange: public PTEID_Exception
    00106 {
    00107 public:
    00108         PTEIDSDK_API PTEID_ExParamRange();                                /**< Constructor */
    00109         PTEIDSDK_API virtual ~PTEID_ExParamRange();               /**< Destructor */
    00110 };
    00111
    00112 /******************************************************************************//**
    00113   * Exception class Command Not Allowed (error code = EIDMW_ERR_CMD_NOT_ALLOWED)
    00114   *
    00115   *     Throw when the command asked is not allowed
    00116   * Used in : - PTEID_SmartCard::writeFile(const char *fileID,const PTEID_ByteArray &out,PTEID_Pin *pin,const char *csPinCode)
    00117   *********************************************************************************/
    00118 class PTEID_ExCmdNotAllowed: public PTEID_Exception
    00119 {
    00120 public:
    00121         PTEIDSDK_API PTEID_ExCmdNotAllowed();                             /**< Constructor */
    00122         PTEIDSDK_API virtual ~PTEID_ExCmdNotAllowed();    /**< Destructor */
    00123 };
    00124
    00125 /******************************************************************************//**
    00126   * Exception class Command Not Supported (error code = EIDMW_ERR_NOT_SUPPORTED)
    00127   *
    00128   *     Throw when the command asked is not supported by the card
    00129   *********************************************************************************/
    00130 class PTEID_ExCmdNotSupported: public PTEID_Exception
    00131 {
    00132 public:
    00133         PTEIDSDK_API PTEID_ExCmdNotSupported();                           /**< Constructor */
    00134         PTEIDSDK_API virtual ~PTEID_ExCmdNotSupported();          /**< Destructor */
    00135 };
    00136
    00137 /******************************************************************************//**
    00138   * Exception class No Card Present (error code = EIDMW_ERR_NO_CARD)
    00139   *
    00140   *     Throw when no card is present
    00141   * Used in : - PTEID_ReaderContext::getCardType()
    00142   *           - PTEID_ReaderContext::getCard()
    00143   *           - PTEID_ReaderContext::getEIDCard()
    00144   *           - PTEID_ReaderContext::getKidsCard()
    00145   *           - PTEID_ReaderContext::getForeignerCard()
    00146   *           - PTEID_ReaderContext::getSISCard()
    00147   *********************************************************************************/
    00148 class PTEID_ExNoCardPresent: public PTEID_Exception
    00149 {
    00150 public:
    00151         PTEIDSDK_API PTEID_ExNoCardPresent();                             /**< Constructor */
    00152         PTEIDSDK_API virtual ~PTEID_ExNoCardPresent();    /**< Destructor */
    00153 };
    00154
    00155 /******************************************************************************//**
    00156   * Exception class Bad Card Type (error code = EIDMW_ERR_CARDTYPE_BAD)
    00157   *
    00158   *     Throw when the card type doesn't correspond to what is asked
    00159   * Used in : - PTEID_ReaderContext::getEIDCard()
    00160   *           - PTEID_ReaderContext::getKidsCard()
    00161   *           - PTEID_ReaderContext::getForeignerCard()
    00162   *           - PTEID_ReaderContext::getSISCard()
    00163   *********************************************************************************/
    00164 class PTEID_ExCardBadType: public PTEID_Exception
    00165 {
    00166 public:
    00167         PTEIDSDK_API PTEID_ExCardBadType();                               /**< Constructor */
    00168         PTEIDSDK_API virtual ~PTEID_ExCardBadType();              /**< Destructor */
    00169 };
    00170
    00171 /******************************************************************************//**
    00172   * Exception class Card Type Unknown (error code = EIDMW_ERR_CARDTYPE_UNKNOWN)
    00173   *
    00174   *     Throw when the card type is not supported
    00175   * Used in : - PTEID_ReaderContext::getCard()
    00176   *********************************************************************************/
    00177 class PTEID_ExCardTypeUnknown: public PTEID_Exception
    00178 {
    00179 public:
    00180         PTEIDSDK_API PTEID_ExCardTypeUnknown();                   /**< Constructor */
    00181         PTEIDSDK_API virtual ~PTEID_ExCardTypeUnknown();  /**< Destructor */
    00182 };
    00183
    00184 /******************************************************************************//**
    00185   * Exception class Certificate No Issuer (error code = EIDMW_ERR_CERT_NOISSUER)
    00186   *
    00187   *     Throw when ask for the issuer of a root certificate
    00188   * Used in : - PTEID_Certificate::getIssuer()
    00189   *********************************************************************************/
    00190 class PTEID_ExCertNoIssuer: public PTEID_Exception
    00191 {
    00192 public:
    00193         PTEIDSDK_API PTEID_ExCertNoIssuer();                              /**< Constructor */
    00194         PTEIDSDK_API virtual ~PTEID_ExCertNoIssuer();             /**< Destructor */
    00195 };
    00196
    00197 /******************************************************************************//**
    00198   * Exception class Certificate No CRL (error code = EIDMW_ERR_CERT_NOCRL)
    00199   *
    00200   *     Throw when ask for the CRL when the certificate contains no CDP
    00201   * Used in : - PTEID_Certificate::getCrl()
    00202   *********************************************************************************/
    00203 class PTEID_ExCertNoCrl: public PTEID_Exception
    00204 {
    00205 public:
    00206         PTEIDSDK_API PTEID_ExCertNoCrl();                                 /**< Constructor */
    00207         PTEIDSDK_API virtual ~PTEID_ExCertNoCrl();                /**< Destructor */
    00208 };
    00209
    00210 /******************************************************************************//**
    00211   * Exception class Certificate No OCSP responder (error code = EIDMW_ERR_CERT_NOOCSP)
    00212   *
    00213   *     Throw when ask for the OCSP response when there is no responder
    00214   * Used in : - PTEID_Certificate::getOcspResponse()
    00215   *********************************************************************************/
    00216 class PTEID_ExCertNoOcsp: public PTEID_Exception
    00217 {
    00218 public:
    00219         PTEIDSDK_API PTEID_ExCertNoOcsp();                                        /**< Constructor */
    00220         PTEIDSDK_API virtual ~PTEID_ExCertNoOcsp();               /**< Destructor */
    00221 };
    00222
    00223 /******************************************************************************//**
    00224   * Exception class Certificate No OCSP responder (error code = EIDMW_ERR_CERT_NOROOT)
    00225   *
    00226   *     Throw when ask for the Root
    00227   * Used in : - PTEID_Certificate::getRoot()
    00228   *********************************************************************************/
    00229 class PTEID_ExCertNoRoot: public PTEID_Exception
    00230 {
    00231 public:
    00232         PTEIDSDK_API PTEID_ExCertNoRoot();                                        /**< Constructor */
    00233         PTEIDSDK_API virtual ~PTEID_ExCertNoRoot();                       /**< Destructor */
    00234 };
    00235
    00236 /******************************************************************************//**
    00237   * Exception class Bad Usage (error code = EIDMW_ERR_BAD_USAGE)
    00238   *
    00239   *     Throw when a class/function is not used correctly
    00240   * Used in : - PTEID_Crl class
    00241   *********************************************************************************/
    00242 class PTEID_ExBadUsage: public PTEID_Exception
    00243 {
    00244 public:
    00245         PTEIDSDK_API PTEID_ExBadUsage();                          /**< Constructor */
    00246         PTEIDSDK_API virtual ~PTEID_ExBadUsage();         /**< Destructor */
    00247 };
    00248
    00249 /******************************************************************************//**
    00250   * Exception class Bad Transaction (error code = EIDMW_ERR_BAD_TRANSACTION)
    00251   *
    00252   *     Throw when a class/function is not used correctly
    00253   * Used in : - PTEID_ReaderContext::Lock()
    00254   *                       - PTEID_ReaderContext::Unlock()
    00255   *********************************************************************************/
    00256 class PTEID_ExBadTransaction: public PTEID_Exception
    00257 {
    00258 public:
    00259         PTEIDSDK_API PTEID_ExBadTransaction();                            /**< Constructor */
    00260         PTEIDSDK_API virtual ~PTEID_ExBadTransaction();           /**< Destructor */
    00261 };
    00262
    00263 /******************************************************************************//**
    00264   * Exception class Card changed (error code = EIDMW_ERR_CARD_CHANGED)
    00265   *
    00266   *     Throw when accessing to a card object but the card has been changed
    00267   * Used in : - PTEID_Object::checkContextStillOk()
    00268   *********************************************************************************/
    00269 class PTEID_ExCardChanged: public PTEID_Exception
    00270 {
    00271 public:
    00272         PTEIDSDK_API PTEID_ExCardChanged();                               /**< Constructor */
    00273         PTEIDSDK_API virtual ~PTEID_ExCardChanged();              /**< Destructor */
    00274 };
    00275
    00276 /******************************************************************************//**
    00277   * Exception class Readerset changed (error code = EIDMW_ERR_READERSET_CHANGED)
    00278   *
    00279   *     Throw when accessing to a card object but the readerset has been changed
    00280   * Used in : - PTEID_Object::checkContextStillOk()
    00281   *********************************************************************************/
    00282 class PTEID_ExReaderSetChanged: public PTEID_Exception
    00283 {
    00284 public:
    00285         PTEIDSDK_API PTEID_ExReaderSetChanged();                          /**< Constructor */
    00286         PTEIDSDK_API virtual ~PTEID_ExReaderSetChanged();         /**< Destructor */
    00287 };
    00288
    00289 /******************************************************************************//**
    00290   * Exception class No reader (error code = EIDMW_ERR_NO_READER)
    00291   *
    00292   *     Throw when the reader set is empty
    00293   * Used in : - PTEID_Object::checkContextStillOk()
    00294   *********************************************************************************/
    00295 class PTEID_ExNoReader: public PTEID_Exception
    00296 {
    00297 public:
    00298         PTEIDSDK_API PTEID_ExNoReader();                          /**< Constructor */
    00299         PTEIDSDK_API virtual ~PTEID_ExNoReader();         /**< Destructor */
    00300 };
    00301
    00302 /******************************************************************************//**
    00303   * Exception class Not allow by user (error code = EIDMW_ERR_NOT_ALLOW_BY_USER)
    00304   *
    00305   *     Throw when the data could not be read from the card because the user do not allow
    00306   *********************************************************************************/
    00307 class PTEID_ExNotAllowByUser: public PTEID_Exception
    00308 {
    00309 public:
    00310         PTEIDSDK_API PTEID_ExNotAllowByUser();                            /**< Constructor */
    00311         PTEIDSDK_API virtual ~PTEID_ExNotAllowByUser();           /**< Destructor */
    00312 };
    00313
    00314 /******************************************************************************//**
    00315   * Exception class User must answer (error code = EIDMW_ERR_USER_MUST_ANSWER)
    00316   *
    00317   *     Throw when the user did not answer yet to allow or disallow reading the data from the card
    00318   *********************************************************************************/
    00319 class PTEID_ExUserMustAnswer: public PTEID_Exception
    00320 {
    00321 public:
    00322         PTEIDSDK_API PTEID_ExUserMustAnswer();                            /**< Constructor */
    00323         PTEIDSDK_API virtual ~PTEID_ExUserMustAnswer();           /**< Destructor */
    00324 };
    00325 }
    00326
    00327 #endif //__EIDLIB_EXCEPTION_H__