2 Interface of IPsec printing debug information.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "IpSecImpl.h"
17 #include "IpSecDebug.h"
20 // The print title for IKEv1 variety phase.
22 CHAR8
*mStateStr
[] = {
26 "IKEv1_MAIN_ESTABLISHED",
29 "IKEv1_QUICK_ESTABLISHED"
32 // The print title for IKEv1 variety Exchagne.
34 CHAR8
*mExchangeStr
[] = {
35 "IKEv1 Main Exchange",
36 "IKEv1 Info Exchange",
37 "IKEv1 Quick Exchange",
38 "IKEv1 Unknown Exchange"
42 // The print title for IKEv1 variety Payload.
44 CHAR8
*mPayloadStr
[] = {
47 "IKEv1 Proposal Payload",
48 "IKEv1 Transform Payload",
51 "IKEv1 Certificate Payload",
52 "IKEv1 Certificate Request Payload",
54 "IKEv1 Signature Payload",
55 "IKEv1 Nonce Payload",
56 "IKEv1 Notify Payload",
57 "IKEv1 Delete Payload",
58 "IKEv1 Vendor Payload"
64 @param[in] Level Debug print error level. Pass to DEBUG().
65 @param[in] Ip Point to a specified IP address.
66 @param[in] IpVersion The IP Version.
72 IN EFI_IP_ADDRESS
*Ip
,
76 if (IpVersion
== IP_VERSION_6
) {
79 "%x%x:%x%x:%x%x:%x%x",
91 ":%x%x:%x%x:%x%x:%x%x\n",
115 Print IKEv1 Current states.
117 @param[in] Previous The Previous state of IKEv1.
118 @param[in] Current The current state of IKEv1.
127 if (Previous
== Current
) {
128 DEBUG ((DEBUG_INFO
, "\n****Current state is %a\n", mStateStr
[Previous
]));
130 DEBUG ((DEBUG_INFO
, "\n****Change state from %a to %a\n", mStateStr
[Previous
], mStateStr
[Current
]));
136 Print the buffer in form of Hex.
138 @param[in] Title The strings to be printed before the data of the buffer.
139 @param[in] Data Points to buffer to be printed.
140 @param[in] DataSize The size of the buffer to be printed.
152 UINTN BytesRemaining
;
156 BytesRemaining
= DataSize
;
158 DEBUG ((DEBUG_INFO
, "==%a %d bytes==\n", Title
, DataSize
));
160 while (BytesRemaining
> 0) {
162 BytesToPrint
= (BytesRemaining
> IPSEC_DEBUG_BYTE_PER_LINE
) ? IPSEC_DEBUG_BYTE_PER_LINE
: BytesRemaining
;
164 for (Index
= 0; Index
< BytesToPrint
; Index
++) {
165 DEBUG ((DEBUG_INFO
, " 0x%02x,", Data
[DataIndex
++]));
168 DEBUG ((DEBUG_INFO
, "\n"));
169 BytesRemaining
-= BytesToPrint
;