示例#1
0
int main(int argc, const char *argv[])
{
    KonohaContext* kctx = CreateContext();
    int i;
    void *malloced[100];
    for (i = 0; i < 100; ++i) {
        malloced[i] = PLATAPI GCModule.Kmalloc(0, i, NULL);
    }
    for (i = 0; i < 100; ++i) {
        PLATAPI GCModule.Kfree(0, malloced[i], i);
    }
    for (i = 0; i < 100; ++i) {
        malloced[i] = PLATAPI GCModule.Kzmalloc(0, i, NULL);
        int j;
        char *p = (char *)malloced[i];
        for (j = 0; j < i; ++j) {
            assert(p[0] == 0);
        }
    }
    for (i = 0; i < 100; ++i) {
        PLATAPI GCModule.Kfree(0, malloced[i], i);
    }
    DeleteContext(kctx);
    return 0;
}
示例#2
0
int main(int argc, const char *argv[])
{
    KonohaContext* konoha = CreateContext();
    int i;
    for (i = 0; i < 100; ++i) {
        test_kString(konoha);
    }
    DeleteContext(konoha);
    return 0;
}
示例#3
0
文件: test_gc.c 项目: stadaki/konoha3
int main(int argc, const char *argv[])
{
	int ret = 0;
	KonohaContext* konoha = CreateContext();
	test_gc(konoha);
	DeleteContext(konoha);
	assert(__Free__ == __Init__);
	fprintf(stderr, "alloced_object_count = %d, freed_object_count=%d\n", __Init__, __Free__);
	test_bitops();
	return ret;
}
// ----------------------------------------------------------------------------
// CSipSecIpsecMechanism::ClearCache
// ----------------------------------------------------------------------------
//
void CSipSecIpsecMechanism::ClearCache(
    MSIPSecUser* aUser )
{
    CSipSecAgreeContext* c = FindContext( aUser );
    if ( c )
    {
        TRAPD( err, c->ClearL() );
        if ( err != KErrNone )
        {
            DeleteContext( c );
        }
    }
}
示例#5
0
SECURITY_STATUS SEC_ENTRY
DeleteSecurityContext(
    PCtxtHandle                 phContext           // Context to delete
    )
{
    if (DeleteContext(phContext->dwUpper))
    {
        return(SEC_E_OK);
    }
    else
    {
        return(SEC_E_INVALID_HANDLE);
    }
}
示例#6
0
/*--------------------------------------------------------------------------------*/
void ABlowfish::SetKey(const uint8_t *key, uint_t keyLen)
{
	if (key && keyLen) {
		// valid key -> create and initialise context
		BLOWFISH_CTX *ctx = (BLOWFISH_CTX *)GetContext();
		
		// zero context for safety
		memset(ctx, 0, sizeof(*ctx));

		// initialise Blowfish tables with key
		Blowfish_Init(ctx, key, keyLen);
	}
	// no key -> delete existing context
	else DeleteContext();
}
示例#7
0
ABlowfish::~ABlowfish()
{
	DeleteContext();
}
// ----------------------------------------------------------------------------
// CSipSecIpsecMechanism::ContextCleared
// ----------------------------------------------------------------------------
//
void CSipSecIpsecMechanism::ContextCleared(
    CSipSecAgreeContext* aContext )
{
    DeleteContext(aContext);
}
示例#9
0
TInt CIPv6Binder::Control(TUint aLevel, TUint aName, TDes8& /*aOption*/)
/**
 * The main function called by the TCP/IP protocol to control the interface.
 * Can perform a variety of general IP tasks (such as getting IP config)
 * and "3G" specific tasks (such as deleting the context).
 *
 * @param aLevel The level of the interface to control - always KSOLInterface
 * @param aName The command to perform
 * @param aOption Data to be input/output as a result of the command
 * @return Standard error codes
 */
	{
	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_CONTROL_1, "CIPv6Binder::Control [aLevel=%u, aName=%u]",aLevel, aName);

	if (aLevel == KSOLInterface)
		{
		switch (aName)
			{
		case KSoIfHardwareAddr:
			// unsupported because we don't have a h/w address
			break;

		// 3G-specific configuration commands are below this point.
		
#ifdef WCDMA_STUB
		case KRegisterEventHandler:
			// Raw IP NIF Events are not supported
		case KContextSetEvents:
			// Raw IP NIF Events are not supported
			break;

		case KContextCreate:
			// We don't support creating new secondary contexts.
			break;

		case KContextDelete:
			// Deletes the primary PDP context. This will shut down the Nif.
			return DeleteContext(aOption);

		case KContextActivate:
			// If the IPv6 interface is up, then the context will already have
			// been activated. So this command should fail with 
			// KErrAlreadyExists
			{
			TUint8* ptr = CONST_CAST(TUint8*, aOption.Ptr()); 
			TContextParameters* contextParams =
				REINTERPRET_CAST(TContextParameters*, ptr);

			if (contextParams->iContextInfo.iContextId != 
				STATIC_CAST(TInt8, GetFlow().GetBcaController()->Nsapi()))
				{
				contextParams->iReasonCode = KErrNotFound;
				}
			else
				{
				contextParams->iContextInfo.iStatus =
					GetFlow().GetContextStatus();
				contextParams->iReasonCode = KErrAlreadyExists;
				}
			return KErrNone;
			}

		case KNifSetDefaultQoS:
		case KContextQoSSet:
			// Setting the QoS is meaningless over GPRS, so we just return that
			// we don't support these operations.
			break;

		case KContextTFTModify:
			// As we only have one primary context, we don't support anything
			// to do with traffic flow templates, which are used by secondary
			// contexts.
			break;

		case KContextModifyActive:
			// This command is only valid aftermodifying TFT/QoS parameters. 
			// As we don't support any of these operations,
			// this command is never valid.
			break;
#endif

		default:
			break;
			}
		}
	return KErrNotSupported;
	}
示例#10
0
LinuxGLContext::~LinuxGLContext()
{
    DeleteContext();
}