static CCNxPortal * _ccnxPortalRTA_CreatePortal(const CCNxPortalFactory *factory, _CCNxPortalType type, _CCNxPortalProtocol protocol, const CCNxPortalAttributes *attributes) { CCNxPortal *result = NULL; const CCNxTransportConfig *configuration = _createTransportConfig(factory, type, protocol); if (ccnxTransportConfig_IsValid(configuration) == false) { return NULL; } RTATransport *rtaTransport = rtaTransport_Create(); if (rtaTransport != NULL) { int fileDescriptor = rtaTransport_Open(rtaTransport, (CCNxTransportConfig *) configuration); _CCNxPortalRTAContext *transportContext = _ccnxPortalRTAContext_Create(rtaTransport, configuration, fileDescriptor); if (transportContext != NULL) { CCNxPortalStack *implementation = ccnxPortalStack_Create(factory, attributes, _ccnxPortalRTA_Start, _ccnxPortalRTA_Stop, _ccnxPortalRTA_Receive, _ccnxPortalRTA_Send, _ccnxPortalRTA_Listen, _ccnxPortalRTA_Ignore, _ccnxPortalRTA_GetFileId, _ccnxPortalRTA_SetAttributes, _ccnxPortalRTA_GetAttributes, transportContext, (void (*)(void **))_ccnxPortalRTAContext_Release); result = ccnxPortal_Create(attributes, implementation); if (result != NULL) { if (_ccnxPortalRTA_IsConnected(result) == true) { _nonBlockingPortal(transportContext); } else { ccnxPortal_Release(&result); } } } } return result; }
LONGBOW_TEST_CASE(CreateRelease, CreateRelease) { CCNxPortalFactory *factory = (CCNxPortalFactory *) longBowTestCase_GetClipBoardData(testCase); CCNxPortalAttributes *attributes = NULL; CCNxPortalStack *actual = ccnxPortalStack_Create(factory, attributes, _mockStart, _mockStop, _mockRead, _mockSend, _mockListen, _mockIgnore, _mockGetFileId, _mockSetAttributes, _mockGetAttributes, parcMemory_Allocate(10), parcMemory_DeallocateImpl); parcObjectTesting_AssertAcquire(actual); ccnxPortalStack_Release(&actual); }