/** @file
The Interfaces of IPsec debug information printing.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "IpSecImpl.h"
#include "IpSecDebug.h"
//
// The print title for IKEv1 variety phase.
//
"IKEv1_MAIN_1",
"IKEv1_MAIN_2",
"IKEv1_MAIN_3",
"IKEv1_MAIN_ESTABLISHED",
"IKEv1_QUICK_1",
"IKEv1_QUICK_2",
"IKEv1_QUICK_ESTABLISHED"
};
//
// The print title for IKEv2 variety phase.
//
"IKEv2_STATE_INIT",
"IKEv2_STATE_AUTH",
"IKEv2_STATE_SA_ESTABLISH",
"IKEv2_STATE_CREATE_CHILD",
"IKEv2_STATE_SA_REKEYING",
"IKEv2_STATE_CHILD_SA_ESTABLISHED",
"IKEv2_STATE_SA_DELETING"
};
//
// The print title for IKEv1 variety Exchagne.
//
"IKEv1 Main Exchange",
"IKEv1 Info Exchange",
"IKEv1 Quick Exchange",
"IKEv2 Initial Exchange",
"IKEv2 Auth Exchange",
"IKEv2 Create Child Exchange",
"IKEv2 Info Exchange",
"IKE Unknow Exchange"
};
//
// The print title for IKEv1 variety Payload.
//
"IKEv1 None Payload",
"IKEv1 SA Payload",
"IKEv1 Proposal Payload",
"IKEv1 Transform Payload",
"IKEv1 KE Payload",
"IKEv1 ID Payload",
"IKEv1 Certificate Payload",
"IKEv1 Certificate Request Payload",
"IKEv1 Hash Payload",
"IKEv1 Signature Payload",
"IKEv1 Nonce Payload",
"IKEv1 Notify Payload",
"IKEv1 Delete Payload",
"IKEv1 Vendor Payload"
};
//
// The print title for IKEv2 variety Payload.
//
"IKEv2 SA Payload",
"IKEv2 Key Payload",
"IKEv2 Identity Initial Payload",
"IKEv2 Identity Respond Payload",
"IKEv2 Certificate Payload",
"IKEv2 Certificate Request Payload",
"IKEv2 Auth Payload",
"IKEv2 Nonce Payload",
"IKEv2 Notify Payload",
"IKEv2 Delet Payload",
"IKEv2 Vendor Payload",
"IKEv2 Traffic Selector Initiator Payload",
"IKEv2 Traffic Selector Respond Payload",
"IKEv2 Encrypt Payload",
"IKEv2 Configuration Payload",
"IKEv2 Extensible Authentication Payload"
};
/**
Print the IP address.
@param[in] Level Debug print error level. Pass to DEBUG().
@param[in] Ip Point to a specified IP address.
@param[in] IpVersion The IP Version.
**/
)
{
if (IpVersion == IP_VERSION_6) {
DEBUG (
(Level,
"%x%x:%x%x:%x%x:%x%x",
);
DEBUG (
(Level,
":%x%x:%x%x:%x%x:%x%x\n",
);
} else {
DEBUG (
(Level,
"%d.%d.%d.%d\n",
);
}
}
/**
Print IKE Current states.
@param[in] Previous The Previous state of IKE.
@param[in] Current The current state of IKE.
@param[in] IkeVersion The version of IKE.
**/
)
{
if (IkeVersion == 1) {
} else if (IkeVersion == 2) {
}
} else {
if (IkeVersion == 1) {
DEBUG ((DEBUG_INFO, "\n****Change state from %a to %a\n", mIkev1StateStr[Previous], mIkev1StateStr[Current]));
} else {
DEBUG ((DEBUG_INFO, "\n****Change state from %a to %a\n", mIkev2StateStr[Previous], mIkev2StateStr[Current]));
}
}
}
/**
Print the IKE Packet.
@param[in] Packet Point to IKE packet to be printed.
@param[in] Direction Point to the IKE packet is inbound or outbound.
@param[in] IpVersion Specified IP Version.
**/
)
{
InitCookie = (Direction == EfiIPsecOutBound) ? HTONLL (Packet->Header->InitiatorCookie) : Packet->Header->InitiatorCookie;
RespCookie = (Direction == EfiIPsecOutBound) ? HTONLL (Packet->Header->ResponderCookie) : Packet->Header->ResponderCookie;
TypeStr = mExchangeStr[0];
break;
case IKE_XCG_TYPE_INFO:
break;
case IKE_XCG_TYPE_QM:
break;
case IKE_XCG_TYPE_SA_INIT:
break;
case IKE_XCG_TYPE_AUTH:
break;
break;
case IKE_XCG_TYPE_INFO2:
break;
default:
break;
}
if (Direction == EfiIPsecOutBound) {
} else {
}
DEBUG (
" Version: 0x%x Flags:0x%x ExchangeType:0x%x\n",
);
DEBUG (
" MessageId:0x%x NextPayload:0x%x\n",
);
}
/**
Print the IKE Paylolad.
@param[in] IkePayload Point to payload to be printed.
@param[in] IkeVersion The specified version of IKE.
**/
)
{
if (IkeVersion == 1) {
} else {
//
// For IKEV2 the first Payload type is started from 33.
//
}
}
/**
Print the buffer in form of Hex.
@param[in] Title The strings to be printed before the data of the buffer.
@param[in] Data Points to buffer to be printed.
@param[in] DataSize The size of the buffer to be printed.
**/
)
{
DataIndex = 0;
while (BytesRemaining > 0) {
BytesToPrint = (BytesRemaining > IPSEC_DEBUG_BYTE_PER_LINE) ? IPSEC_DEBUG_BYTE_PER_LINE : BytesRemaining;
}
}
}