1 /* $Copyright:
\r *
\r * Copyright 1998-2000 by the Massachusetts Institute of Technology.
\r *
\r * All rights reserved.
\r *
\r * Permission to use, copy, modify, and distribute this software and its
\r * documentation for any purpose and without fee is hereby granted,
\r * provided that the above copyright notice appear in all copies and that
\r * both that copyright notice and this permission notice appear in
\r * supporting documentation, and that the name of M.I.T. not be used in
\r * advertising or publicity pertaining to distribution of the software
\r * without specific, written prior permission. Furthermore if you modify
\r * this software you must label your software as modified software and not
\r * distribute it in such a fashion that it might be confused with the
\r * original MIT software. M.I.T. makes no representations about the
\r * suitability of this software for any purpose. It is provided "as is"
\r * without express or implied warranty.
\r *
\r * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
\r * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
\r * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
\r *
\r * Individual source code files are copyright MIT, Cygnus Support,
\r * OpenVision, Oracle, Sun Soft, FundsXpress, and others.
\r *
\r * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
\r * and Zephyr are trademarks of the Massachusetts Institute of Technology
\r * (MIT). No commercial use of these trademarks may be made without prior
\r * written permission of MIT.
\r *
\r * "Commercial use" means use of a name in a product or other for-profit
\r * manner. It does NOT prevent a commercial firm from referring to the MIT
\r * trademarks in order to convey information (although in doing so,
\r * recognition of their trademark status should be given).
\r * $
\r */
\r\r/* $Header: /afs/andrew/system/cvs/src/sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosSupport/ErrorLib.h,v 1.2 2001/12/04 02:05:56 rjs3 Exp $ */
\r\r/*
\r *
\r * errorlib.h -- Functions to handle socket/dns lib errors.
\r *
\r */
\r\r\r#ifndef __ERRORLIB__
\r#define __ERRORLIB__
\r\r#include <KerberosSupport/KerberosConditionalMacros.h>
\r\r#if TARGET_RT_MAC_CFM
\r #if TARGET_API_MAC_CARBON
\r #include <CoreServices.h>
\r #endif
\r\r #include <MacTypes.h>
\r #include <Files.h>
\r#else
\r #include <CoreServices/CoreServices.h>
\r#endif
\r\r#include <errno.h>
\r\r#if PRAGMA_ONCE
\r#pragma once
\r#endif
\r\r#ifdef __cplusplus
\rextern "C" {
\r#endif
\r\r#if PRAGMA_IMPORT
\r#pragma import on
\r#endif
\r\r#if PRAGMA_STRUCT_ALIGN
\r #pragma options align=mac68k
\r#elif PRAGMA_STRUCT_PACKPUSH
\r #pragma pack(push, 2)
\r#elif PRAGMA_STRUCT_PACK
\r #pragma pack(2)
\r#endif
\r\r\r/* ********************* */
\r/* The global error code */
\r/* ********************* */
\rextern OSStatus gMITLibError;
\r\r\r/* ****************************************************** */
\r/* length the buffer passed to GetErrorString() should be */
\r/* ****************************************************** */
\r#define kMaxErrorLength 512
\r\r\r/* ******************* */
\r/* type of error table */
\r/* ******************* */
\r#define kErrorTableResType 'ErrT'
\r\r\r/* *********************************************** */
\r/* Format of the error string for GetErrorString() */
\r/* *********************************************** */
\renum ErrorFormat
\r{
\r kErrorLongFormat,
\r kErrorShortFormat,
\r kErrorManager,
\r kErrorShortString,
\r kErrorLongString
\r};
\rtypedef enum ErrorFormat ErrorFormat;
\r\r/* ******************* */
\r/* Function prototypes */
\r/* ******************* */
\r\r#if !TARGET_RT_MAC_CFM
\r# pragma d0_pointers on
\r#else
\r# define ErrorLibraryIsPresent() ((Ptr) (RegisterErrorTable) != (Ptr) (kUnresolvedCFragSymbolAddress))
\r#endif
\r\rextern OSStatus GetMITLibError(void);
\rextern void SetMITLibError(OSStatus theError);
\rextern void ClearMITLibError(void);
\r\rextern OSStatus RegisterErrorTable(const FSSpec* inResFile, SInt16 inResID);
\r#if TARGET_API_MAC_CARBON
\rextern OSStatus RegisterErrorTableForBundle(CFStringRef inBundleID, SInt16 inResID);
\r#endif
\r\rextern OSStatus GetErrorLongFormat(OSStatus error, char *message, long messageLength);
\rextern OSStatus GetErrorShortFormat(OSStatus error, char *message, long messageLength);
\rextern OSStatus GetErrorManager(OSStatus error, char *message, long messageLength);
\rextern OSStatus GetErrorShortString(OSStatus error, char *message, long messageLength);
\rextern OSStatus GetErrorLongString(OSStatus error, char *message, long messageLength);
\r\rextern OSStatus GetErrorString(OSStatus error, char *message, long messageLength, ErrorFormat format);
\r\r#if !TARGET_RT_MAC_CFM
\r# pragma d0_pointers reset
\r#endif
\r\r#if PRAGMA_STRUCT_ALIGN
\r #pragma options align=reset
\r#elif PRAGMA_STRUCT_PACKPUSH
\r #pragma pack(pop)
\r#elif PRAGMA_STRUCT_PACK
\r #pragma pack()
\r#endif
\r\r#ifdef PRAGMA_IMPORT_OFF
\r#pragma import off
\r#elif PRAGMA_IMPORT
\r#pragma import reset
\r#endif
\r\r#ifdef __cplusplus
\r}
\r#endif
\r\r#endif /* __ERRORLIB__ */
\r