static CCNxTransportConfig * createParams(const char *keystore_name, const char *keystore_passwd) { assertNotNull(keystore_name, "Got null keystore name\n"); assertNotNull(keystore_passwd, "Got null keystore passwd\n"); CCNxStackConfig *stackConfig = apiConnector_ProtocolStackConfig( testingUpper_ProtocolStackConfig( vegasFlowController_ProtocolStackConfig( testingLower_ProtocolStackConfig( protocolStack_ComponentsConfigArgs(ccnxStackConfig_Create(), apiConnector_GetName(), testingUpper_GetName(), vegasFlowController_GetName(), testingLower_GetName(), NULL))))); CCNxConnectionConfig *connConfig = apiConnector_ConnectionConfig( testingUpper_ConnectionConfig( vegasFlowController_ConnectionConfig( tlvCodec_ConnectionConfig( testingLower_ConnectionConfig(ccnxConnectionConfig_Create()))))); publicKeySignerPkcs12Store_ConnectionConfig(connConfig, keystore_name, keystore_passwd); CCNxTransportConfig *result = ccnxTransportConfig_Create(stackConfig, connConfig); ccnxStackConfig_Release(&stackConfig); return result; }
/** * This composes a CCNxTransportConfig instance that describes a complete transport stack assembly. */ static const CCNxTransportConfig * _createTransportConfig(const CCNxPortalFactory *factory, _CCNxPortalType type, _CCNxPortalProtocol protocol) { if (type == ccnxPortalTypeChunked) { // Good. } else if (type == ccnxPortalTypeMessage) { // Good. } else { return NULL; } // TODO: This is in need of some narrative of what's going on here. CCNxConnectionConfig *connConfig = ccnxConnectionConfig_Create(); CCNxStackConfig *stackConfig = ccnxStackConfig_Create(); PARCArrayList *listOfComponentNames = parcArrayList_Create_Capacity(NULL, NULL, 8); parcArrayList_Add(listOfComponentNames, (char *) apiConnector_GetName()); apiConnector_ProtocolStackConfig(stackConfig); apiConnector_ConnectionConfig(connConfig); if (type == ccnxPortalTypeChunked) { parcArrayList_Add(listOfComponentNames, (char *) vegasFlowController_GetName()); vegasFlowController_ProtocolStackConfig(stackConfig); vegasFlowController_ConnectionConfig(connConfig); } switch (protocol) { case CCNxPortalProtocol_RTALoopback: _ccnxPortalProtocol_RTALoopback(connConfig, stackConfig, listOfComponentNames); break; case ccnxPortalProtocol_RTA: _ccnxPortalProtocol_RTAMetis(connConfig, stackConfig, listOfComponentNames); break; default: errno = EPROTOTYPE; assertTrue(0, "Unknown protocol type: %d", protocol); } protocolStack_ComponentsConfigArrayList(stackConfig, listOfComponentNames); parcArrayList_Destroy(&listOfComponentNames); const PARCIdentity *identity = ccnxPortalFactory_GetIdentity(factory); configPublicKeySigner_SetIdentity(connConfig, identity); CCNxTransportConfig *result = ccnxTransportConfig_Create(stackConfig, connConfig); ccnxStackConfig_Release(&stackConfig); return result; }