コード例 #1
0
ファイル: athena_InterestControl.c プロジェクト: PARC/Athena
static CCNxMetaMessage *
_ContentStore_Command(Athena *athena, CCNxInterest *interest)
{
    CCNxMetaMessage *responseMessage;
    responseMessage = athenaContentStore_ProcessMessage(athena->athenaContentStore, interest);
    if (responseMessage) {
        return responseMessage;
    }

    CCNxName *ccnxName = ccnxInterest_GetName(interest);
    if (ccnxName_GetSegmentCount(ccnxName) > AthenaCommandSegment) {
        CCNxNameSegment *nameSegment = ccnxName_GetSegment(ccnxName, AthenaCommandSegment);
        char *command = ccnxNameSegment_ToString(nameSegment);

        //char *arguments = _get_arguments(interest);

        //responseMessage = _create_response(athena, ccnxName, ...

        //parcMemory_Deallocate(&command);
        //if (arguments) {
        //    parcMemory_Deallocate(&arguments);
        //}

        parcMemory_Deallocate(&command);
    }
    return responseMessage;
}
コード例 #2
0
LONGBOW_TEST_CASE(EmptyImplementation, apiFunctions)
{
    AthenaContentStore *store = athenaContentStore_Create(&EmptyContentStoreImplementation, NULL);
    CCNxName *name = ccnxName_CreateFromURI("lci:/pie/is/always/good");
    CCNxInterest *interest = ccnxInterest_CreateSimple(name);

    athena_EncodeMessage(interest);

    assertNull(athenaContentStore_ProcessMessage(store, interest), "Expected a NULL response.");

    ccnxName_Release(&name);
    ccnxInterest_Release(&interest);
    athenaContentStore_Release(&store);
}
コード例 #3
0
LONGBOW_TEST_CASE(Global, processMessage)
{
    AthenaLRUContentStoreConfig config;
    config.capacityInMB = 10;
    AthenaContentStore *store = athenaContentStore_Create(&AthenaContentStore_LRUImplementation, &config);

    CCNxName *name = ccnxName_CreateFromURI(CCNxNameAthena_ContentStore "/stat/size");
    CCNxInterest *interest = ccnxInterest_CreateSimple(name);

    CCNxMetaMessage *message = ccnxMetaMessage_CreateFromInterest(interest);

    athena_EncodeMessage(message);

    CCNxMetaMessage *result = athenaContentStore_ProcessMessage(store, message);

    assertNotNull(result, "Expected a response from the store");

    ccnxMetaMessage_Release(&result);
    ccnxMetaMessage_Release(&message);
    ccnxInterest_Release(&interest);
    ccnxName_Release(&name);

    athenaContentStore_Release(&store);
}