]> git.saurik.com Git - apple/security.git/blob - SecureTransport/privateInc/sslDebug.h
Security-163.tar.gz
[apple/security.git] / SecureTransport / privateInc / sslDebug.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 /*
20 File: sslDebug.h
21
22 Contains: Debugging macros.
23
24 Written by: Doug Mitchell
25
26 Copyright: (c) 1998, 1999 by Apple Computer, Inc., all rights reserved.
27 */
28
29 #ifndef _SSL_DEBUG_H_
30 #define _SSL_DEBUG_H_
31
32 #include "sslContext.h"
33 #include <Security/debugging.h>
34 #include <assert.h>
35
36 /* log changes in handshake state */
37 #define sslHdskStateDebug(args...) secdebug("sslHdskState", ## args)
38
39 /* log handshake and alert messages */
40 #define sslHdskMsgDebug(args...) secdebug("sslHdskMsg", ## args)
41
42 /* log negotiated handshake parameters */
43 #define sslLogNegotiateDebug(args...) secdebug("sslLogNegotiate", ## args)
44
45 /* log received protocol messsages */
46 #define sslLogRxProtocolDebug(msgType) secdebug("sslLogRxProtocol", \
47 "---received protoMsg %s", msgType)
48
49 /* log resumable session info */
50 #define sslLogResumSessDebug(args...) secdebug("sslResumSession", ## args)
51
52 /* log low-level session info in appleSession.cpp */
53 #define sslLogSessCacheDebug(args...) secdebug("sslSessionCache", ## args)
54
55 /* log record-level I/O (SSLRead, SSLWrite) */
56 #define sslLogRecordIo(args...) secdebug("sslRecordIo", ## args)
57
58 /* cert-related info */
59 #define sslCertDebug(args...) secdebug("sslCert", ## args)
60
61 /* Diffie-Hellman */
62 #define sslDhDebug(args...) secdebug("sslDh", ## args)
63
64 #ifdef NDEBUG
65
66 #define SSLChangeHdskState(ctx, newState) { ctx->state=newState; }
67 #define SSLLogHdskMsg(msg, sent)
68
69 /* all errors logged to stdout for DEBUG config only */
70 #define sslErrorLog(args...)
71
72 #else
73
74 #include "sslAlertMessage.h"
75
76 extern void SSLLogHdskMsg(SSLHandshakeType msg, char sent);
77 extern char *hdskStateToStr(SSLHandshakeState state);
78 extern void SSLChangeHdskState(SSLContext *ctx, SSLHandshakeState newState);
79
80 /* all errors logged to stdout for DEBUG config only */
81 #define sslErrorLog(args...) printf(args)
82
83 #endif /* NDEBUG */
84
85 #endif /* _SSL_DEBUG_H_ */