CASA/auth_token/casa_status.h
2005-12-14 17:18:24 +00:00

205 lines
7.5 KiB
C

/***********************************************************************
* File: casa_status.h
*
* Abstract: Defines the statuses used within CASA.
*
* Copyright (C) 2005 Novell, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
***********************************************************************/
#ifndef _CASA_STATUS_H_
#define _CASA_STATUS_H_
#if defined(__cplusplus) || defined(c_plusplus)
extern "C"
{
#endif
//===[ Header files specific to this module ]==============================
#include <micasa_types.h>
//===[ External data ]==============================
//===[ External prototypes ]==============================
//===[ Type definitions ]==============================
//
// CasaStatus type
//
//
// The layed out of status values is as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-+---------------------+-------------------------------+
// |Sev|r|r|r| Facility | Code |
// +---+-+-+-+---------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// r - is a reserved bit for internal use
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
typedef uint32_t CasaStatus;
//===[ Manifest constants ]==============================
//
// Define severity codes to be used with CasaStatusBuild macro
//
#define CASA_SEVERITY_SUCCESS 0x0
#define CASA_SEVERITY_INFORMATIONAL 0x1
#define CASA_SEVERITY_WARNING 0x2
#define CASA_SEVERITY_ERROR 0x3
//
// Define the facility codes
//
// Facility codes will start at 0x800 and then work backwards
// in an effort to avoid conflict with other system components.
//
#define CASA_FACILITY_AUTHTOKEN 0x7FF
#define CASA_FACILITY_KRB5TOKEN 0x7FE
//
// Codes above FACILITY_SPECIFIC are component specific status codes.
// Facility specific status codes are defined in the facilities' header file.
//
#define FACILITY_SPECIFIC 0x00001000
//
// Codes below FACILITY_SPECIFIC are common status codes shared by all components.
//
#define CASA_STATUS_SUCCESS ((CasaStatus)0x00000000) // Call completed successfully
#define CASA_STATUS_UNSUCCESSFUL ((CasaStatus)0x00000001) // Call completed unsuccessfully
#define CASA_STATUS_INVALID_HANDLE ((CasaStatus)0x00000002) // An invalid handle was specified
#define CASA_STATUS_INVALID_PARAMETER ((CasaStatus)0x00000003) // An invalid parameter to function was specified
#define CASA_STATUS_INSUFFICIENT_RESOURCES ((CasaStatus)0x00000004)
#define CASA_STATUS_ACCESS_DENIED ((CasaStatus)0x00000005) // Caller does not have required access rights for operation
#define CASA_STATUS_BUFFER_OVERFLOW ((CasaStatus)0x00000006) // The data was too large to fit into the specified buffer
#define CASA_STATUS_NO_DATA ((CasaStatus)0x00000007)
#define CASA_STATUS_NO_MORE_ENTRIES ((CasaStatus)0x00000008) // No more entries to enumerate
#define CASA_STATUS_TIMEOUT ((CasaStatus)0x00000009) // Timed out waiting on resource
#define CASA_STATUS_OBJECT_NOT_FOUND ((CasaStatus)0x0000000A)
#define CASA_STATUS_CANCELLED ((CasaStatus)0x0000000B) // Request cancelled
#define CASA_STATUS_NOT_IMPLEMENTED ((CasaStatus)0x0000000C)
#define CASA_STATUS_PENDING ((CasaStatus)0x0000000D) // The request is being processed
#define CASA_STATUS_INVALID_STATE ((CasaStatus)0x0000000E)
#define CASA_STATUS_INVALID_REQUEST ((CasaStatus)0x0000000F)
#define CASA_STATUS_ALREADY_REGISTERED ((CasaStatus)0x00000010)
#define CASA_STATUS_ABORTED ((CasaStatus)0x00000011)
#define CASA_STATUS_REQUEST_NOT_FOUND ((CasaStatus)0x00000012) // Unable to cancel request because it was not found
#define CASA_STATUS_OBJECT_ALREADY_EXISTS ((CasaStatus)0x00000013) // The object being created already exists.
#define CASA_STATUS_UNSUPPORTED_PROTOCOL ((CasaStatus)0x00000014) // The object is only accessable through a unsupported protocol.
#define CASA_STATUS_REJECTED ((CasaStatus)0x00000015)
#define CASA_STATUS_ACCESS_VIOLATION ((CasaStatus)0x00000016)
#define CASA_STATUS_NOT_SUPPORTED ((CasaStatus)0x00000017)
#define CASA_STATUS_NO_PROVIDERS ((CasaStatus)0x00000018) // No providers are available.
#define CASA_STATUS_CONFLICT ((CasaStatus)0x00000019)
#define CASA_STATUS_INSUFFICIENT_STORAGE ((CasaStatus)0x0000001A)
#define CASA_STATUS_AUTHENTICATION_FAILURE ((CasaStatus)0x0000001B)
#define CASA_STATUS_CONFIGURATION_ERROR ((CasaStatus)0x0000001C)
#define CASA_STATUS_LIBRARY_LOAD_FAILURE ((CasaStatus)0x0000001D)
//===[ Macro definitions ]==============================
//
// Macro for building status error codes
//
#define CasaStatusBuild(severity, facility, errorcode) \
((CasaStatus)(((severity) << 30) | ((facility) << 16) | (errorcode)))
//
// Macro for retrieving the facility
//
#define CasaStatusFacility(status) \
((CasaStatus)(((CasaStatus)(status) >> 16) & (CasaStatus)0x07FF))
//
// Macro for retrieving severity
//
#define CasaStatusSeverity(status) \
((CasaStatus)(((CasaStatus)(status)) >> 30))
//
// Macro for retrieving status code
//
#define CasaStatusCode(status) \
((CasaStatus)((CasaStatus)(status) & (CasaStatus)0x0000FFFF))
//
// Macro for checking status code for success
//
#define CASA_SUCCESS(status) \
((CasaStatus)(status) >> 30 != CASA_SEVERITY_ERROR)
//
// Macro for checking status code for information
//
#define CASA_INFORMATION(status) \
((CasaStatus)(status) >> 30 == CASA_SEVERITY_INFORMATIONAL)
//
// Macro for checking status code for warning
//
#define CASA_WARNING(status) \
((CasaStatus)(status) >> 30 == CASA_SEVERITY_WARNING)
//
// Macro for checking status code for error
//
#define CASA_ERROR(status) \
((CasaStatus)(status) >> 30 == CASA_SEVERITY_ERROR)
//===[ Function Prototypes ]==============================
//===[ Global Variables ]==============================
#endif // _CASA_STATUS_H_
//=========================================================================
//=========================================================================
// casa_status.h