]> git.saurik.com Git - apple/security.git/blobdiff - utilities/src/SecCFError.h
Security-55471.tar.gz
[apple/security.git] / utilities / src / SecCFError.h
diff --git a/utilities/src/SecCFError.h b/utilities/src/SecCFError.h
new file mode 100644 (file)
index 0000000..3bfb676
--- /dev/null
@@ -0,0 +1,46 @@
+//
+//  SecCFError.h
+//  utilities
+//
+//  Created by Mitch Adler on 7/18/12.
+//  Copyright (c) 2012 Apple Inc. All rights reserved.
+//
+
+#ifndef _SECCFERROR_H_
+#define _SECCFERROR_H_
+
+#include <CoreFoundation/CoreFoundation.h>
+
+//
+// Leaf error creation from other systems
+//
+
+// kern_return_t errors
+#define kSecKernDomain  kCFErrorDomainMach
+bool SecKernError(kern_return_t result, CFErrorRef *error, CFStringRef format, ...);
+
+// Unix errno errors
+#define kSecErrnoDomain  kCFErrorDomainPOSIX
+bool SecCheckErrno(int result, CFErrorRef *error, CFStringRef format, ...);
+
+// OSStatus errors
+#define kSecErrorDomain  kCFErrorDomainOSStatus
+bool SecError(OSStatus status, CFErrorRef *error, CFStringRef format, ...);
+
+//
+// Create and chain
+//
+void SecCFCreateError(CFIndex errorCode, CFStringRef domain, CFStringRef descriptionString,
+                      CFErrorRef previousError, CFErrorRef *newError);
+
+void SecCFCreateErrorWithFormat(CFIndex errorCode, CFStringRef domain, CFErrorRef previousError, CFErrorRef *newError,
+                                CFDictionaryRef formatoptions, CFStringRef descriptionString, ...)
+                        CF_FORMAT_FUNCTION(6,7);
+
+
+void SecCFCreateErrorWithFormatAndArguments(CFIndex errorCode, CFStringRef domain,
+                                            CFErrorRef previousError, CFErrorRef *newError,
+                                            CFDictionaryRef formatoptions, CFStringRef descriptionString, va_list args)
+                                CF_FORMAT_FUNCTION(6, 0);
+
+#endif