Apache Portable Runtime
apu_errno.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APU_ERRNO_H
00018 #define APU_ERRNO_H
00019 
00020 /**
00021  * @file apu_errno.h
00022  * @brief APR-Util Error Codes
00023  */
00024 
00025 #include "apr.h"
00026 #include "apr_errno.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif /* __cplusplus */
00031 
00032 /**
00033  * @defgroup apu_errno Error Codes
00034  * @ingroup APR
00035  * @{
00036  */
00037 
00038 /**
00039  * @defgroup APR_Util_Error APR_Util Error Values
00040  * <PRE>
00041  * <b>APU ERROR VALUES</b>
00042  * APR_ENOKEY         The key provided was empty or NULL
00043  * APR_ENOIV          The initialisation vector provided was NULL
00044  * APR_EKEYTYPE       The key type was not recognised
00045  * APR_ENOSPACE       The buffer supplied was not big enough
00046  * APR_ECRYPT         An error occurred while encrypting or decrypting
00047  * APR_EPADDING       Padding was not supported
00048  * APR_EKEYLENGTH     The key length was incorrect
00049  * APR_ENOCIPHER      The cipher provided was not recognised
00050  * APR_ENODIGEST      The digest provided was not recognised
00051  * APR_ENOENGINE      The engine provided was not recognised
00052  * APR_EINITENGINE    The engine could not be initialised
00053  * APR_EREINIT        Underlying crypto has already been initialised
00054  * </PRE>
00055  *
00056  * <PRE>
00057  * <b>APR STATUS VALUES</b>
00058  * APR_INCHILD        Program is currently executing in the child
00059  * </PRE>
00060  * @{
00061  */
00062 /** @see APR_STATUS_IS_ENOKEY */
00063 #define APR_ENOKEY           (APR_UTIL_START_STATUS + 1)
00064 /** @see APR_STATUS_IS_ENOIV */
00065 #define APR_ENOIV            (APR_UTIL_START_STATUS + 2)
00066 /** @see APR_STATUS_IS_EKEYTYPE */
00067 #define APR_EKEYTYPE         (APR_UTIL_START_STATUS + 3)
00068 /** @see APR_STATUS_IS_ENOSPACE */
00069 #define APR_ENOSPACE         (APR_UTIL_START_STATUS + 4)
00070 /** @see APR_STATUS_IS_ECRYPT */
00071 #define APR_ECRYPT           (APR_UTIL_START_STATUS + 5)
00072 /** @see APR_STATUS_IS_EPADDING */
00073 #define APR_EPADDING         (APR_UTIL_START_STATUS + 6)
00074 /** @see APR_STATUS_IS_EKEYLENGTH */
00075 #define APR_EKEYLENGTH       (APR_UTIL_START_STATUS + 7)
00076 /** @see APR_STATUS_IS_ENOCIPHER */
00077 #define APR_ENOCIPHER        (APR_UTIL_START_STATUS + 8)
00078 /** @see APR_STATUS_IS_ENODIGEST */
00079 #define APR_ENODIGEST        (APR_UTIL_START_STATUS + 9)
00080 /** @see APR_STATUS_IS_ENOENGINE */
00081 #define APR_ENOENGINE        (APR_UTIL_START_STATUS + 10)
00082 /** @see APR_STATUS_IS_EINITENGINE */
00083 #define APR_EINITENGINE      (APR_UTIL_START_STATUS + 11)
00084 /** @see APR_STATUS_IS_EREINIT */
00085 #define APR_EREINIT          (APR_UTIL_START_STATUS + 12)
00086 /** @} */
00087 
00088 /**
00089  * @defgroup APU_STATUS_IS Status Value Tests
00090  * @warning For any particular error condition, more than one of these tests
00091  *      may match. This is because platform-specific error codes may not
00092  *      always match the semantics of the POSIX codes these tests (and the
00093  *      corresponding APR error codes) are named after. A notable example
00094  *      are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
00095  *      Win32 platforms. The programmer should always be aware of this and
00096  *      adjust the order of the tests accordingly.
00097  * @{
00098  */
00099 
00100 /** @} */
00101 
00102 /**
00103  * @addtogroup APR_Util_Error
00104  * @{
00105  */
00106 /**
00107  * The key was empty or not provided
00108  */
00109 #define APR_STATUS_IS_ENOKEY(s)        ((s) == APR_ENOKEY)
00110 /**
00111  * The initialisation vector was not provided
00112  */
00113 #define APR_STATUS_IS_ENOIV(s)        ((s) == APR_ENOIV)
00114 /**
00115  * The key type was not recognised
00116  */
00117 #define APR_STATUS_IS_EKEYTYPE(s)        ((s) == APR_EKEYTYPE)
00118 /**
00119  * The buffer provided was not big enough
00120  */
00121 #define APR_STATUS_IS_ENOSPACE(s)        ((s) == APR_ENOSPACE)
00122 /**
00123  * An error occurred while encrypting or decrypting
00124  */
00125 #define APR_STATUS_IS_ECRYPT(s)        ((s) == APR_ECRYPT)
00126 /**
00127  * An error occurred while padding
00128  */
00129 #define APR_STATUS_IS_EPADDING(s)        ((s) == APR_EPADDING)
00130 /**
00131  * An error occurred with the key length
00132  */
00133 #define APR_STATUS_IS_EKEYLENGTH(s)        ((s) == APR_EKEYLENGTH)
00134 /**
00135  * The cipher provided was not recognised
00136  */
00137 #define APR_STATUS_IS_ENOCIPHER(s)        ((s) == APR_ENOCIPHER)
00138 /**
00139  * The digest provided was not recognised
00140  */
00141 #define APR_STATUS_IS_ENODIGEST(s)        ((s) == APR_ENODIGEST)
00142 /**
00143  * The engine provided was not recognised
00144  */
00145 #define APR_STATUS_IS_ENOENGINE(s)        ((s) == APR_ENOENGINE)
00146 /**
00147  * The engine could not be initialised
00148  */
00149 #define APR_STATUS_IS_EINITENGINE(s)        ((s) == APR_EINITENGINE)
00150 /**
00151  * Crypto has already been initialised
00152  */
00153 #define APR_STATUS_IS_EREINIT(s)        ((s) == APR_EREINIT)
00154 /** @} */
00155 
00156 /**
00157  * This structure allows the underlying API error codes to be returned
00158  * along with plain text error messages that explain to us mere mortals
00159  * what really happened.
00160  */
00161 typedef struct apu_err_t {
00162     const char *reason;
00163     const char *msg;
00164     int rc;
00165 } apu_err_t;
00166 
00167 /** @} */
00168 
00169 #ifdef __cplusplus
00170 }
00171 #endif
00172 
00173 #endif  /* ! APU_ERRNO_H */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines