1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is PRIVATE to SSL.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 
9 #ifndef __tls13err_h_
10 #define __tls13err_h_
11 
12 /* Use this instead of FATAL_ERROR when an alert isn't possible. */
13 #define LOG_ERROR(ss, prError)                                                     \
14     do {                                                                           \
15         SSL_TRC(3, ("%d: TLS13[%d]: fatal error %d in %s (%s:%d)",                 \
16                     SSL_GETPID(), ss->fd, prError, __func__, __FILE__, __LINE__)); \
17         PORT_SetError(prError);                                                    \
18     } while (0)
19 
20 /* Log an error and generate an alert because something is irreparably wrong. */
21 #define FATAL_ERROR(ss, prError, desc)       \
22     do {                                     \
23         LOG_ERROR(ss, prError);              \
24         tls13_FatalError(ss, prError, desc); \
25     } while (0)
26 
27 void tls13_FatalError(sslSocket *ss, PRErrorCode prError, SSL3AlertDescription desc);
28 #endif
29