1/*
2 * Copyright (c) 2000-2001,2005-2007,2010-2012,2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * sslAlertMessage.h
26 */
27
28#ifndef _SSLALERTMESSAGE_H_
29#define _SSLALERTMESSAGE_H_ 1
30
31#ifndef _SECURE_TRANSPORT_H_
32#include "SecureTransport.h"
33#endif
34
35#include "sslPriv.h"
36#include "sslRecord.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42typedef enum
43{   SSL_AlertLevelWarning = 1,
44    SSL_AlertLevelFatal = 2
45} AlertLevel;
46
47typedef enum
48{   SSL_AlertCloseNotify = 0,
49    SSL_AlertUnexpectedMsg = 10,
50    SSL_AlertBadRecordMac = 20,
51	SSL_AlertDecryptionFail_RESERVED = 21,  /* TLS */
52	SSL_AlertRecordOverflow = 22,           /* TLS */
53    SSL_AlertDecompressFail = 30,
54    SSL_AlertHandshakeFail = 40,
55    SSL_AlertNoCert_RESERVED = 41,
56    SSL_AlertBadCert = 42,                  /* SSLv3 only */
57    SSL_AlertUnsupportedCert = 43,
58    SSL_AlertCertRevoked = 44,
59    SSL_AlertCertExpired = 45,
60    SSL_AlertCertUnknown = 46,
61    SSL_AlertIllegalParam = 47,
62	/* remainder are TLS addenda */
63	SSL_AlertUnknownCA = 48,
64	SSL_AlertAccessDenied = 49,
65	SSL_AlertDecodeError = 50,
66	SSL_AlertDecryptError = 51,
67	SSL_AlertExportRestriction_RESERVED = 60,
68	SSL_AlertProtocolVersion = 70,
69	SSL_AlertInsufficientSecurity = 71,
70	SSL_AlertInternalError = 80,
71	SSL_AlertUserCancelled = 90,
72	SSL_AlertNoRenegotiation = 100,
73	SSL_AlertUnsupportedExtension = 110     /* TLS 1.2 */
74} AlertDescription;
75
76OSStatus SSLProcessAlert(
77	SSLRecord rec,
78	SSLContext *ctx);
79OSStatus SSLSendAlert(
80	AlertLevel level,
81	AlertDescription desc,
82	SSLContext *ctx);
83OSStatus SSLFatalSessionAlert(
84	AlertDescription desc,
85	SSLContext *ctx);
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif /* _SSLALERTMESSAGE_H_ */
92