KMSAgentDataUnitCache.cpp revision 4f14b0f29aa144cc03efdde5508ae126ae197acf
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * CDDL HEADER START
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * The contents of this file are subject to the terms of the
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * Common Development and Distribution License (the "License").
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * You may not use this file except in compliance with the License.
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * See the License for the specific language governing permissions
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * and limitations under the License.
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * When distributing Covered Code, include this CDDL HEADER in each
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * If applicable, add the following below this CDDL HEADER, with the
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * fields enclosed by brackets "[]" replaced with your own identifying
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * information: Portions Copyright [yyyy] [name of copyright owner]
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * CDDL HEADER END
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin const unsigned char* const i_pDataUnitID,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift const unsigned char* const i_pDataUnitKeyID ,
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin FATAL_ASSERT( (i_pDataUnitID && i_iDataUnitIDMaxLen == KMS_DATA_UNIT_ID_SIZE) ||
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin (i_pDataUnitKeyID && i_iDataUnitKeyIDMaxLen == KMS_KEY_ID_SIZE));
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin strlen( i_wsApplianceNetworkAddress ) < KMS_MAX_NETWORK_ADDRESS );
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift m_pCache = new DataUnitCacheEntry[m_iMaxSize];
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin // no error logged on out of memory
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin log_printf("CDataUnitCache::Insert new DataUnitCacheEntry alloc failure\n");
cf318da46ef082557ca9fb3fd19268c80e8dfc2csin return false;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift // the cache is full, so reuse an old slot
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift strncpy( m_pCache[m_iIndex].m_wsApplianceNetworkAddress,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift sizeof(m_pCache[m_iIndex].m_wsApplianceNetworkAddress) );
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift m_pCache[m_iIndex].m_wsApplianceNetworkAddress[sizeof(m_pCache[m_iIndex].m_wsApplianceNetworkAddress)-1] = '\0';
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift memset( m_pCache[m_iIndex].m_aDataUnitID,0,KMS_DATA_UNIT_ID_SIZE);
if ( i_pDataUnitKeyID )
Unlock();
const unsigned char* const i_pDataUnitID,
int i_iDataUnitIDMaxLen,
Lock();
for( i = 0; i < m_iSize; i++ )
Unlock();
Unlock();
const unsigned char* const i_pDataUnitKeyID,
Lock();
for( i = 0; i < m_iSize; i++ )
Unlock();
Unlock();