1/* $Copyright: 2 * 3 * Copyright 1998-2000 by the Massachusetts Institute of Technology. 4 * 5 * All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and its 8 * documentation for any purpose and without fee is hereby granted, 9 * provided that the above copyright notice appear in all copies and that 10 * both that copyright notice and this permission notice appear in 11 * supporting documentation, and that the name of M.I.T. not be used in 12 * advertising or publicity pertaining to distribution of the software 13 * without specific, written prior permission. Furthermore if you modify 14 * this software you must label your software as modified software and not 15 * distribute it in such a fashion that it might be confused with the 16 * original MIT software. M.I.T. makes no representations about the 17 * suitability of this software for any purpose. It is provided "as is" 18 * without express or implied warranty. 19 * 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 * Individual source code files are copyright MIT, Cygnus Support, 25 * OpenVision, Oracle, Sun Soft, FundsXpress, and others. 26 * 27 * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, 28 * and Zephyr are trademarks of the Massachusetts Institute of Technology 29 * (MIT). No commercial use of these trademarks may be made without prior 30 * written permission of MIT. 31 * 32 * "Commercial use" means use of a name in a product or other for-profit 33 * manner. It does NOT prevent a commercial firm from referring to the MIT 34 * trademarks in order to convey information (although in doing so, 35 * recognition of their trademark status should be given). 36 * $ 37 */ 38 39/* $Header: /Volumes/backup/dsmigrate/Dumps/../CVS/passwordserver_sasl/cyrus_sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosSupport/ErrorLib.h,v 1.4 2005/01/10 19:10:47 snsimon Exp $ */ 40 41/* 42 * 43 * errorlib.h -- Functions to handle socket/dns lib errors. 44 * 45 */ 46 47 48#ifndef __ERRORLIB__ 49#define __ERRORLIB__ 50 51#include <KerberosSupport/KerberosConditionalMacros.h> 52 53#if TARGET_RT_MAC_CFM 54 #if TARGET_API_MAC_CARBON 55 #include <CoreServices.h> 56 #endif 57 58 #include <MacTypes.h> 59 #include <Files.h> 60#else 61 #include <CoreServices/CoreServices.h> 62#endif 63 64#include <errno.h> 65 66#if PRAGMA_ONCE 67#pragma once 68#endif 69 70#ifdef __cplusplus 71extern "C" { 72#endif 73 74#if PRAGMA_IMPORT 75#pragma import on 76#endif 77 78#if PRAGMA_STRUCT_ALIGN 79 #pragma options align=mac68k 80#elif PRAGMA_STRUCT_PACKPUSH 81 #pragma pack(push, 2) 82#elif PRAGMA_STRUCT_PACK 83 #pragma pack(2) 84#endif 85 86 87/* ********************* */ 88/* The global error code */ 89/* ********************* */ 90extern OSStatus gMITLibError; 91 92 93/* ****************************************************** */ 94/* length the buffer passed to GetErrorString() should be */ 95/* ****************************************************** */ 96#define kMaxErrorLength 512 97 98 99/* ******************* */ 100/* type of error table */ 101/* ******************* */ 102#define kErrorTableResType 'ErrT' 103 104 105/* *********************************************** */ 106/* Format of the error string for GetErrorString() */ 107/* *********************************************** */ 108enum ErrorFormat 109{ 110 kErrorLongFormat, 111 kErrorShortFormat, 112 kErrorManager, 113 kErrorShortString, 114 kErrorLongString 115}; 116typedef enum ErrorFormat ErrorFormat; 117 118/* ******************* */ 119/* Function prototypes */ 120/* ******************* */ 121 122#if !TARGET_RT_MAC_CFM 123# pragma d0_pointers on 124#else 125# define ErrorLibraryIsPresent() ((Ptr) (RegisterErrorTable) != (Ptr) (kUnresolvedCFragSymbolAddress)) 126#endif 127 128extern OSStatus GetMITLibError(void); 129extern void SetMITLibError(OSStatus theError); 130extern void ClearMITLibError(void); 131 132extern OSStatus RegisterErrorTable(const FSSpec* inResFile, SInt16 inResID); 133#if TARGET_API_MAC_CARBON 134extern OSStatus RegisterErrorTableForBundle(CFStringRef inBundleID, SInt16 inResID); 135#endif 136 137extern OSStatus GetErrorLongFormat(OSStatus error, char *message, long messageLength); 138extern OSStatus GetErrorShortFormat(OSStatus error, char *message, long messageLength); 139extern OSStatus GetErrorManager(OSStatus error, char *message, long messageLength); 140extern OSStatus GetErrorShortString(OSStatus error, char *message, long messageLength); 141extern OSStatus GetErrorLongString(OSStatus error, char *message, long messageLength); 142 143extern OSStatus GetErrorString(OSStatus error, char *message, long messageLength, ErrorFormat format); 144 145#if !TARGET_RT_MAC_CFM 146# pragma d0_pointers reset 147#endif 148 149#if PRAGMA_STRUCT_ALIGN 150 #pragma options align=reset 151#elif PRAGMA_STRUCT_PACKPUSH 152 #pragma pack(pop) 153#elif PRAGMA_STRUCT_PACK 154 #pragma pack() 155#endif 156 157#ifdef PRAGMA_IMPORT_OFF 158#pragma import off 159#elif PRAGMA_IMPORT 160#pragma import reset 161#endif 162 163#ifdef __cplusplus 164} 165#endif 166 167#endif /* __ERRORLIB__ */ 168