2 Copyright (c) 2014, McAfee, Inc.
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
9 Redistributions of source code must retain the above copyright notice, this list
10 of conditions and the following disclaimer.
12 Redistributions in binary form must reproduce the above copyright notice, this
13 list of conditions and the following disclaimer in the documentation and/or other
14 materials provided with the distribution.
16 Neither the name of McAfee, Inc. nor the names of its contributors may be used
17 to endorse or promote products derived from this software without specific prior
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 OF THE POSSIBILITY OF SUCH DAMAGE.
33 * \file IpcServerError.c
34 * \brief Ipc server-side error handling File
36 * This file contains the server-side exception handling, used by Security framework.
39 #include "IpcMacros.h"
40 #include "IpcServerError.h"
41 #include "TSCErrorCodes.h"
43 const char *GetErrorName(const int iErrCode)
47 case TSC_ERROR_CANCELLED:
48 return TSC_DBUS_INTERFACE ERR_NAME_CANCELLED;
49 case TSC_ERROR_DATA_ACCESS:
50 return TSC_DBUS_INTERFACE ERR_NAME_DATA_ACCESS;
51 case TSC_ERROR_INVALID_PARAM:
52 return TSC_DBUS_INTERFACE ERR_NAME_INVALID_PARAM;
53 case TSC_ERROR_INSUFFICIENT_RES:
54 return TSC_DBUS_INTERFACE ERR_NAME_INSUFFICIENT_RES;
55 case TSC_ERROR_INTERNAL:
56 return TSC_DBUS_INTERFACE ERR_NAME_INTERNAL;
57 case TSC_ERROR_INVALID_HANDLE:
58 return TSC_DBUS_INTERFACE ERR_NAME_INVALID_HANDLE;
59 case TSC_ERROR_NOT_IMPLEMENTED:
60 return TSC_DBUS_INTERFACE ERR_NAME_NOT_IMPLEMENTED;
63 /* default: TSC_ERROR_MODULE_GENERIC */
64 return TSC_DBUS_INTERFACE ERR_NAME_MODULE_GENERIC;
67 const char *GetErrorDescription(const int iErrCode)
71 case TSC_ERROR_CANCELLED:
72 return ERR_DESC_CANCELLED;
73 case TSC_ERROR_DATA_ACCESS:
74 return ERR_DESC_DATA_ACCESS;
75 case TSC_ERROR_INVALID_PARAM:
76 return ERR_DESC_INVALID_PARAM;
77 case TSC_ERROR_INSUFFICIENT_RES:
78 return ERR_DESC_INSUFFICIENT_RES;
79 case TSC_ERROR_INTERNAL:
80 return ERR_DESC_INTERNAL;
81 case TSC_ERROR_INVALID_HANDLE:
82 return ERR_DESC_INVALID_HANDLE;
83 case TSC_ERROR_NOT_IMPLEMENTED:
84 return ERR_DESC_NOT_IMPLEMENTED;
87 /* default: TSC_ERROR_MODULE_GENERIC */
88 return ERR_DESC_MODULE_GENERIC;