当前位置: 首页>>代码示例>>C++>>正文


C++ ccnxName_CreateFromURI函数代码示例

本文整理汇总了C++中ccnxName_CreateFromURI函数的典型用法代码示例。如果您正苦于以下问题:C++ ccnxName_CreateFromURI函数的具体用法?C++ ccnxName_CreateFromURI怎么用?C++ ccnxName_CreateFromURI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ccnxName_CreateFromURI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(Global, removeMatch)
{
    AthenaLRUContentStoreConfig config;
    config.capacityInMB = 10;
    AthenaContentStore *store = athenaContentStore_Create(&AthenaContentStore_LRUImplementation, &config);

    PARCClock *clock = parcClock_Wallclock();
    char *lci = "lci:/cakes/and/pies";

    CCNxName *origName = ccnxName_CreateFromURI(lci);
    CCNxContentObject *contentObject = ccnxContentObject_CreateWithDataPayload(origName, NULL);

    ccnxContentObject_SetExpiryTime(contentObject, parcClock_GetTime(clock) + 100);
    ccnxName_Release(&origName);

    athenaContentStore_PutContentObject(store, contentObject);
    ccnxContentObject_Release(&contentObject);

    CCNxName *testName = ccnxName_CreateFromURI(lci);
    bool status = athenaContentStore_RemoveMatch(store, testName, NULL, NULL);
    // TODO: match on other than name!
    assertTrue(status, "Expected to remove the contentobject we had");

    ccnxName_Release(&testName);
    parcClock_Release(&clock);
    athenaContentStore_Release(&store);
}
开发者ID:kevnfx,项目名称:Athena,代码行数:27,代码来源:test_athena_ContentStore.c

示例2: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(Local, putWithExpiryTime)
{
    AthenaLRUContentStore *impl = _createLRUContentStore();

    CCNxName *name1 = ccnxName_CreateFromURI("lci:/first/entry");
    CCNxContentObject *contentObject1 = ccnxContentObject_CreateWithDataPayload(name1, NULL);

    CCNxName *name2 = ccnxName_CreateFromURI("lci:/second/entry");
    CCNxContentObject *contentObject2 = ccnxContentObject_CreateWithDataPayload(name2, NULL);

    CCNxName *name3 = ccnxName_CreateFromURI("lci:/third/entry");
    CCNxContentObject *contentObject3 = ccnxContentObject_CreateWithDataPayload(name3, NULL);

    uint64_t now = parcClock_GetTime(impl->wallClock);

    ccnxContentObject_SetExpiryTime(contentObject1, now + 200);  // Expires AFTER object 2
    ccnxContentObject_SetExpiryTime(contentObject2, now + 100);
    // contentObject3 has no expiry time, so it expires last.

    _AthenaLRUContentStoreEntry *entry1 = _athenaLRUContentStoreEntry_Create(contentObject1);
    _AthenaLRUContentStoreEntry *entry2 = _athenaLRUContentStoreEntry_Create(contentObject2);
    _AthenaLRUContentStoreEntry *entry3 = _athenaLRUContentStoreEntry_Create(contentObject3);

    bool status = _athenaLRUContentStore_PutContentObject(impl, contentObject1);
    assertTrue(status, "Exepected to insert content");

    status = _athenaLRUContentStore_PutContentObject(impl, contentObject2);
    assertTrue(status, "Exepected to insert content");

    _AthenaLRUContentStoreEntry *oldestEntry = _getEarliestExpiryTime(impl);

    assertTrue(oldestEntry->contentObject == entry2->contentObject, "Expected entry 2 to be the earliest expiring entry");

    status = _athenaLRUContentStore_PutContentObject(impl, contentObject3);
    assertTrue(status, "Exepected to insert content");

    // The entry with no expiration time should not affect list ordering.
    oldestEntry = _getEarliestExpiryTime(impl);
    assertTrue(oldestEntry->contentObject == entry2->contentObject, "Expected entry 2 to be the earliest expiring entry");

    // Now remove the oldest one we added. The next oldest one should be contentObject1
    _athenaLRUContentStore_RemoveMatch(impl, name2, NULL, NULL);

    // The entry with no expiration time should not affect list ordering.
    oldestEntry = _getEarliestExpiryTime(impl);
    assertTrue(oldestEntry->contentObject == entry1->contentObject, "Expected entry 1 to be the earliest expiring entry");

    _athenaLRUContentStoreEntry_Release(&entry1);
    _athenaLRUContentStoreEntry_Release(&entry2);
    _athenaLRUContentStoreEntry_Release(&entry3);

    ccnxContentObject_Release(&contentObject1);
    ccnxContentObject_Release(&contentObject2);
    ccnxContentObject_Release(&contentObject3);
    ccnxName_Release(&name1);
    ccnxName_Release(&name2);
    ccnxName_Release(&name3);

    _athenaLRUContentStore_Release((AthenaContentStoreImplementation *) &impl);
}
开发者ID:chris-wood,项目名称:ghost,代码行数:60,代码来源:test_athena_LRUContentStore.c

示例3: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(Global, ccnxContentObject_Equals)
{
    CCNxName *nameA = ccnxName_CreateFromURI("lci:/foo/bar/A");
    PARCBuffer *payloadA = parcBuffer_Allocate(100);

    CCNxContentObject *objectA = ccnxContentObject_CreateWithDataPayload(nameA, payloadA);
    ccnxContentObject_AssertValid(objectA);

    assertTrue(ccnxContentObject_Equals(objectA, objectA), "Expected same instance to be equal");

    CCNxContentObject *objectA2 = ccnxContentObject_CreateWithDataPayload(nameA, payloadA);
    ccnxContentObject_AssertValid(objectA2);

    assertTrue(ccnxContentObject_Equals(objectA, objectA2), "Expected ContentObject with same payload and name to be equal");

    CCNxName *nameB = ccnxName_CreateFromURI("lci:/foo/bar/B");
    CCNxContentObject *objectB = ccnxContentObject_CreateWithDataPayload(nameB, payloadA);
    ccnxContentObject_AssertValid(objectB);

    assertFalse(ccnxContentObject_Equals(objectA, objectB), "Expected ContentObject with same payload and different name");

    ccnxName_Release(&nameA);
    ccnxName_Release(&nameB);
    parcBuffer_Release(&payloadA);

    ccnxContentObject_Release(&objectA);
    ccnxContentObject_Release(&objectA2);
    ccnxContentObject_Release(&objectB);
}
开发者ID:mword,项目名称:Libccnx-common,代码行数:29,代码来源:test_ccnx_ContentObject.c

示例4: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(Global, ccnxInterest_Equals)
{
    CCNxName *nameA = ccnxName_CreateFromURI("lci:/name");
    PARCBuffer *keyA = parcBuffer_Allocate(8);
    parcBuffer_PutUint64(keyA, 1234L);

    CCNxInterest *interestA = ccnxInterest_Create(nameA,
                                                  1000, /* lifetime */
                                                  keyA, /* KeyId */
                                                  NULL  /* ContentObjectHash */
                                                  );

    CCNxName *nameB = ccnxName_CreateFromURI("lci:/name");
    PARCBuffer *keyB = parcBuffer_Allocate(8);
    parcBuffer_PutUint64(keyB, 1234L);
    CCNxInterest *interestB = ccnxInterest_Create(nameB,
                                                  1000, /* lifetime */
                                                  keyB, /* KeyId */
                                                  NULL  /* ContentObjectHash */
                                                  );

    assertTrue(ccnxInterest_Equals(interestA, interestB), "Expected equivalent interests to be equal.");

    ccnxName_Release(&nameA);
    ccnxName_Release(&nameB);
    parcBuffer_Release(&keyA);
    parcBuffer_Release(&keyB);
    ccnxInterest_Release(&interestA);
    ccnxInterest_Release(&interestB);
}
开发者ID:mword,项目名称:Libccnx-common,代码行数:30,代码来源:test_ccnx_Interest.c

示例5: reader_writer

int
reader_writer(CCNxPortalFactory *factory, const char *uri)
{

    CCNxPortal *portal = ccnxPortalFactory_GetInstance(factory, ccnxPortalTypeDatagram, ccnxPortalProtocol_TLV, &ccnxPortalAttributes_Blocking);

    CCNxName *prefix = ccnxName_CreateFromURI(uri);
    CCNxName *bye = ccnxName_CreateFromURI("lci:/Hello/Goodbye%21");
    CCNxName *contentname = ccnxName_CreateFromURI("lci:/Hello/World");

    if (ccnxPortal_Listen(portal, prefix, 365 * 86400, CCNxStackTimeout_Never)) {
        CCNxMetaMessage *msg;

        while ((msg = ccnxPortal_Receive(portal, CCNxStackTimeout_Never)) != NULL) {

            if (ccnxMetaMessage_IsInterest(msg)) {
                CCNxInterest *interest = ccnxMetaMessage_GetInterest(msg);

                CCNxName *interestName = ccnxInterest_GetName(interest);

                if (ccnxName_Equals(interestName, contentname)) {
                    const PARCKeyId *publisherKeyId = ccnxPortal_GetKeyId(portal);

                    char buffer[128];
                    time_t theTime = time(0);
                    sprintf(buffer, "Hello World. The time is %s", ctime(&theTime));

                    PARCBuffer *payload = parcBuffer_CreateFromArray(buffer, 128);
                    parcBuffer_Flip(payload);

                    PARCBuffer *b = parcBuffer_Acquire(payload);
                    CCNxContentObject *uob = ccnxContentObject_CreateWithDataPayload(contentname, b);

                    // missing NULL check, case 1024

                    CCNxMetaMessage *message = ccnxMetaMessage_CreateFromContentObject(uob);
                    if (ccnxPortal_Send(portal, message, CCNxTransportStackTimeCCNxStackTimeout_Neverout_Never) == false) {
                        fprintf(stderr, "ccnx_write failed\n");
                    }
                    // ccnxMessage_Release(message);
                } else if (ccnxName_Equals(interestName, bye)) {
                    break;
                }
            } else {
                ccnxMetaMessage_Display(msg, 0);
            }
            ccnxMetaMessage_Release(&msg);
        }
    }

    ccnxName_Release(&prefix);
    ccnxName_Release(&bye);
    ccnxName_Release(&contentname);

    ccnxPortal_Release(&portal);

    return 0;
}
开发者ID:isolis,项目名称:Libccnx-portal,代码行数:58,代码来源:ccnx-portal-read.c

示例6: testValidationSetV1_KeyId_KeyLocator_KeyId_KeyName

void
testValidationSetV1_KeyId_KeyLocator_KeyId_KeyName(TestData *data,
                                                   bool (*set)(CCNxTlvDictionary *message, const PARCBuffer *keyid,
                                                               const CCNxKeyLocator *keyLocator),
                                                   bool (*test)(const CCNxTlvDictionary *message))
{
    CCNxName *name = ccnxName_CreateFromURI("lci:/parc/validation/test");
    CCNxTlvDictionary *packetV1 = ccnxContentObject_CreateWithImplAndPayload(&CCNxContentObjectFacadeV1_Implementation,
                                                                             name,
                                                                             CCNxPayloadType_DATA,
                                                                             NULL);
    bool success = set(packetV1, data->keyid, data->locatorByName);
    assertTrue(success, "Failed to set on V1");

    bool testResult = test(packetV1);
    assertTrue(testResult, "Test function failed on V1 packet");

    PARCBuffer *testKeyId = ccnxValidationFacadeV1_GetKeyId(packetV1);
    assertTrue(parcBuffer_Equals(testKeyId, data->keyid), "keyid not equal");

    // XXX: TODO: GetKeyName() returns a Link, so it should be GetLink().
    //            It also creates a new object (the CCNxLink), so... needs thinking about.
    //            See BugzId: 3322

    CCNxLink *testLink = ccnxValidationFacadeV1_GetKeyName(packetV1);
    assertTrue(ccnxName_Equals(ccnxLink_GetName(testLink), data->keyname), "Keynames not equal");
    ccnxLink_Release(&testLink);

    ccnxName_Release(&name);
    ccnxTlvDictionary_Release(&packetV1);
}
开发者ID:mword,项目名称:Libccnx-common,代码行数:31,代码来源:testrig_validation.c

示例7: testValidationSetV1_KeyId_KeyLocator_KeyId_Key

void
testValidationSetV1_KeyId_KeyLocator_KeyId_Key(TestData *data,
                                               bool (*set)(CCNxTlvDictionary *message, const PARCBuffer *keyid,
                                                           const CCNxKeyLocator *keyLocator),
                                               bool (*test)(const CCNxTlvDictionary *message))
{
    CCNxName *name = ccnxName_CreateFromURI("lci:/parc/validation/test");
    CCNxTlvDictionary *packetV1 = ccnxContentObject_CreateWithImplAndPayload(&CCNxContentObjectFacadeV1_Implementation,
                                                                             name,
                                                                             CCNxPayloadType_DATA,
                                                                             NULL);
    bool success = set(packetV1, data->keyid, data->locatorByKey);
    assertTrue(success, "Failed to set on V1");

    bool testResult = test(packetV1);
    assertTrue(testResult, "Test function failed on V1 packet");

    PARCBuffer *testKeyId = ccnxValidationFacadeV1_GetKeyId(packetV1);
    assertTrue(parcBuffer_Equals(testKeyId, data->keyid), "keyid not equal");

    PARCBuffer *testKey = ccnxValidationFacadeV1_GetPublicKey(packetV1);
    assertTrue(parcBuffer_Equals(testKey, data->key), "keys not equal");

    ccnxName_Release(&name);
    ccnxTlvDictionary_Release(&packetV1);
}
开发者ID:mword,项目名称:Libccnx-common,代码行数:26,代码来源:testrig_validation.c

示例8: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(Global, athenaTransportLinkAdapter_ListLinks)
{
    PARCURI *connectionURI;
    const char *result;
    AthenaTransportLinkAdapter *athenaTransportLinkAdapter = athenaTransportLinkAdapter_Create(_removeLink, NULL);
    assertNotNull(athenaTransportLinkAdapter, "athenaTransportLinkAdapter_Create returned NULL");

    _LoadModule(athenaTransportLinkAdapter, "TCP");

    connectionURI = parcURI_Parse("tcp://127.0.0.1:50200/listener/name=TCPListener");
    result = athenaTransportLinkAdapter_Open(athenaTransportLinkAdapter, connectionURI);
    assertTrue(result != NULL, "athenaTransportLinkAdapter_Open failed (%s)", strerror(errno));
    parcURI_Release(&connectionURI);

    connectionURI = parcURI_Parse("tcp://127.0.0.1:50200/name=TCP_0");
    result = athenaTransportLinkAdapter_Open(athenaTransportLinkAdapter, connectionURI);
    assertTrue(result != NULL, "athenaTransportLinkAdapter_Open failed (%s)", strerror(errno));
    parcURI_Release(&connectionURI);

    CCNxName *name = ccnxName_CreateFromURI(CCNxNameAthenaCommand_LinkList);
    CCNxInterest *ccnxMessage = ccnxInterest_CreateSimple(name);
    ccnxName_Release(&name);

    CCNxContentObject *contentObject = athenaTransportLinkAdapter_ProcessMessage(athenaTransportLinkAdapter, ccnxMessage);
    assertNotNull(contentObject, "athenaTransportLinkAdapter_ProcessMessage failed");
    ccnxInterest_Release(&ccnxMessage);
    ccnxContentObject_Release(&contentObject);

    int closeResult = athenaTransportLinkAdapter_CloseByName(athenaTransportLinkAdapter, "TCP_0");
    assertTrue(closeResult == 0, "athenaTransportLinkAdapter_CloseByName failed (%s)", strerror(errno));

    athenaTransportLinkAdapter_Destroy(&athenaTransportLinkAdapter);
}
开发者ID:chris-wood,项目名称:ghost,代码行数:33,代码来源:test_athena_TransportLinkAdapter.c

示例9: testData_Create

TestData *
testData_Create(void)
{
    char keyidString[] = "the keyid";
    char keyString[] = "Memory, all alone in the moonlight";
    char certString[] = "The quick brown fox";

    TestData *data = parcMemory_AllocateAndClear(sizeof(TestData));
    assertNotNull(data, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(TestData));

    data->keyid = bufferFromString(sizeof(keyidString), keyidString);
    data->key = bufferFromString(sizeof(keyString), keyString);
    data->cert = bufferFromString(sizeof(certString), certString);
    data->keyname = ccnxName_CreateFromURI("lci:/lazy/dog");

    PARCBuffer *bb_id = parcBuffer_Wrap("choo choo", 9, 0, 9);
    PARCKeyId *keyid = parcKeyId_Create(bb_id);
    parcBuffer_Release(&bb_id);

    PARCKey *key = parcKey_CreateFromDerEncodedPublicKey(keyid, PARCSigningAlgorithm_RSA, data->key);

    data->locatorByKey = ccnxKeyLocator_CreateFromKey(key);
    parcKey_Release(&key);
    parcKeyId_Release(&keyid);

    CCNxLink *link = ccnxLink_Create(data->keyname, NULL, NULL);
    data->locatorByName = ccnxKeyLocator_CreateFromKeyLink(link);
    ccnxLink_Release(&link);

    return data;
}
开发者ID:mword,项目名称:Libccnx-common,代码行数:31,代码来源:testrig_validation.c

示例10: _executeUserCommand

/**
 * Given a command (e.g "fetch") and an optional target name (e.g. "file.txt"), create an appropriate CCNxInterest
 * and write it to the Portal.
 *
 * @param command The command to be handled.
 * @param targetName The name of the target content, if any, that the command applies to.
 *
 * @return true If a CCNxInterest for the specified command and optional target was successfully issued and answered.
 */
static bool
_executeUserCommand(const char *command, const char *targetName)
{
    bool result = false;
    CCNxPortalFactory *factory = _setupConsumerPortalFactory();

    CCNxPortal *portal = ccnxPortalFactory_CreatePortal(factory, ccnxPortalRTA_Chunked);

    assertNotNull(portal, "Expected a non-null CCNxPortal pointer.");

    // Given the user's command and optional target, create an Interest.
    CCNxInterest *interest = _createInterest(command, targetName);

    // Send the Interest through the Portal, and wait for a response.
    CCNxMetaMessage *message = ccnxMetaMessage_CreateFromInterest(interest);
    if (ccnxPortal_Send(portal, message, CCNxStackTimeout_Never)) {
        CCNxName *domainPrefix = ccnxName_CreateFromURI(tutorialCommon_DomainPrefix);  // e.g. 'lci:/ccnx/tutorial'

        result = _receiveResponseToIssuedInterest(portal, domainPrefix);

        ccnxName_Release(&domainPrefix);
    }

    ccnxMetaMessage_Release(&message);
    ccnxInterest_Release(&interest);
    ccnxPortal_Release(&portal);
    ccnxPortalFactory_Release(&factory);

    return result;
}
开发者ID:isolis,项目名称:ccnx-tutorial,代码行数:39,代码来源:tutorial_Client.c

示例11: _createInterest

/**
 * Create and return a CCNxInterest whose Name contains our commend (e.g. "fetch" or "list"),
 * and, optionally, the name of a target object (e.g. "file.txt"). The newly created CCNxInterest
 * must eventually be released by calling ccnxInterest_Release().
 *
 * @param command The command to embed in the created CCNxInterest.
 * @param targetName The name of the content, if any, that the command applies to.
 *
 * @return A newly created CCNxInterest for the specified command and targetName.
 */
static CCNxInterest *
_createInterest(const char *command, const char *targetName)
{
    CCNxName *interestName = ccnxName_CreateFromURI(tutorialCommon_DomainPrefix); // Start with the prefix. We append to this.

    // Create a NameSegment for our command, which we will append after the prefix we just created.
    PARCBuffer *commandBuffer = parcBuffer_WrapCString((char *) command);
    CCNxNameSegment *commandSegment = ccnxNameSegment_CreateTypeValue(CCNxNameLabelType_NAME, commandBuffer);
    parcBuffer_Release(&commandBuffer);

    // Append the new command segment to the prefix
    ccnxName_Append(interestName, commandSegment);
    ccnxNameSegment_Release(&commandSegment);

    // If we have a target, then create another NameSegment for it and append that.
    if (targetName != NULL) {
        // Create a NameSegment for our target object
        PARCBuffer *targetBuf = parcBuffer_WrapCString((char *) targetName);
        CCNxNameSegment *targetSegment = ccnxNameSegment_CreateTypeValue(CCNxNameLabelType_NAME, targetBuf);
        parcBuffer_Release(&targetBuf);


        // Append it to the ccnxName.
        ccnxName_Append(interestName, targetSegment);
        ccnxNameSegment_Release(&targetSegment);
    }

    CCNxInterest *result = ccnxInterest_CreateSimple(interestName);
    ccnxName_Release(&interestName);

    return result;
}
开发者ID:isolis,项目名称:ccnx-tutorial,代码行数:42,代码来源:tutorial_Client.c

示例12: athena_Create

Athena *
athena_Create(size_t contentStoreSizeInMB)
{
    Athena *athena = parcObject_CreateAndClearInstance(Athena);

    athena->athenaName = ccnxName_CreateFromURI(CCNxNameAthena_Forwarder);
    assertNotNull(athena->athenaName, "Failed to create forwarder name (%s)", CCNxNameAthena_Forwarder);

    athena->athenaFIB = athenaFIB_Create();
    assertNotNull(athena->athenaFIB, "Failed to create FIB");

    athena->athenaPIT = athenaPIT_Create();
    assertNotNull(athena->athenaPIT, "Failed to create PIT");

    AthenaLRUContentStoreConfig storeConfig;
    storeConfig.capacityInMB = contentStoreSizeInMB;

    athena->athenaContentStore = athenaContentStore_Create(&AthenaContentStore_LRUImplementation, &storeConfig);
    assertNotNull(athena->athenaContentStore, "Failed to create Content Store");

    athena->athenaTransportLinkAdapter = athenaTransportLinkAdapter_Create(_removeLink, athena);
    assertNotNull(athena->athenaTransportLinkAdapter, "Failed to create Transport Link Adapter");

    athena->log = _athena_logger_create();
    athena->athenaState = Athena_Running;

    return athena;
}
开发者ID:chris-wood,项目名称:ghost,代码行数:28,代码来源:athena.c

示例13: _athenactl_RemoveLink

static int
_athenactl_RemoveLink(PARCIdentity *identity, int argc, char **argv)
{
    if (argc < 1) {
        printf("usage: remove link <linkName>\n");
        return 1;
    }

    CCNxName *name = ccnxName_CreateFromURI(CCNxNameAthenaCommand_LinkDisconnect);
    CCNxInterest *interest = ccnxInterest_CreateSimple(name);
    ccnxName_Release(&name);

    PARCBuffer *payload = parcBuffer_AllocateCString(argv[0]);
    ccnxInterest_SetPayload(interest, payload);
    parcBuffer_Release(&payload);

    const char *result = _athenactl_SendInterestControl(identity, interest);
    if (result) {
        printf("Link: %s\n", result);
        parcMemory_Deallocate(&result);
    }

    ccnxMetaMessage_Release(&interest);

    return 0;
}
开发者ID:chris-wood,项目名称:ghost,代码行数:26,代码来源:athenactl.c

示例14: _athenactl_Run

static int
_athenactl_Run(PARCIdentity *identity, int argc, char **argv)
{
    if (argc < 1) {
        printf("usage: spawn <port | link specification>\n");
        return 1;
    }

    char *linkSpecification = argv[0];
    char constructedLinkSpecification[MAXPATHLEN] = { 0 };

    // Short-cut, user can specify just a port and we will construct a default tcp listener specification
    if (atoi(argv[0]) != 0) {
        sprintf(constructedLinkSpecification, "tcp://localhost:%d/listener", atoi(argv[0]));
        linkSpecification = constructedLinkSpecification;
    }

    CCNxName *name = ccnxName_CreateFromURI(CCNxNameAthenaCommand_Run);
    CCNxInterest *interest = ccnxInterest_CreateSimple(name);
    ccnxName_Release(&name);

    PARCBuffer *payload = parcBuffer_AllocateCString(linkSpecification);
    ccnxInterest_SetPayload(interest, payload);
    parcBuffer_Release(&payload);

    const char *result = _athenactl_SendInterestControl(identity, interest);
    if (result) {
        printf("%s\n", result);
        parcMemory_Deallocate(&result);
    }

    ccnxMetaMessage_Release(&interest);

    return 0;
}
开发者ID:chris-wood,项目名称:ghost,代码行数:35,代码来源:athenactl.c

示例15: _athenactl_RemoveRoute

static int
_athenactl_RemoveRoute(PARCIdentity *identity, int argc, char **argv)
{
    if (argc < 2) {
        printf("usage: remove route <linkName> <prefix>\n");
        return 1;
    }

    CCNxName *name = ccnxName_CreateFromURI(CCNxNameAthenaCommand_FIBRemoveRoute);
    CCNxInterest *interest = ccnxInterest_CreateSimple(name);
    ccnxName_Release(&name);

    char *linkName = argv[0];
    char *prefix = argv[1];

    // passed in as <linkName> <prefix>, passed on as <prefix> <linkname>
    char routeArguments[MAXPATHLEN];
    sprintf(routeArguments, "%s %s", prefix, linkName);
    PARCBuffer *payload = parcBuffer_AllocateCString(routeArguments);
    ccnxInterest_SetPayload(interest, payload);
    parcBuffer_Release(&payload);

    const char *result = _athenactl_SendInterestControl(identity, interest);
    if (result) {
        printf("FIB: %s\n", result);
        parcMemory_Deallocate(&result);
    }

    ccnxMetaMessage_Release(&interest);

    return 0;
}
开发者ID:chris-wood,项目名称:ghost,代码行数:32,代码来源:athenactl.c


注:本文中的ccnxName_CreateFromURI函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。