LONGBOW_TEST_CASE(Dictionary, component_Codec_Tlv_Upcall_Read_Control) { TestData *data = longBowTestCase_GetClipBoardData(testCase); PARCBuffer *wireFormat = parcBuffer_Wrap(v1_cpi_add_route_crc32c, sizeof(v1_cpi_add_route_crc32c), 0, sizeof(v1_cpi_add_route_crc32c)); CCNxTlvDictionary *dictionary = ccnxWireFormatMessage_FromControlPacketType(CCNxTlvDictionary_SchemaVersion_V1, wireFormat); parcBuffer_Release(&wireFormat); // We have not set the message type or schema TransportMessage *tm = transportMessage_CreateFromDictionary(dictionary); transportMessage_SetInfo(tm, data->mock->connection, NULL); ccnxTlvDictionary_Release(&dictionary); // ------ // Now do the actual test of sending the transport message up the stack TransportMessage *test_tm = sendUp(data, tm); // It should now be parsed into an control message CCNxTlvDictionary *testdict = transportMessage_GetDictionary(test_tm); assertNotNull(testdict, "Failed to get dictionary from the transport message"); assertTrue(ccnxTlvDictionary_IsControl(testdict), "Dictionary says it is not a Control"); assertTrue(ccnxTlvDictionary_GetSchemaVersion(testdict) == CCNxTlvDictionary_SchemaVersion_V1, "Wrong schema, got %d expected %d", ccnxTlvDictionary_GetSchemaVersion(testdict), CCNxTlvDictionary_SchemaVersion_V1); transportMessage_Destroy(&tm); }
LONGBOW_TEST_CASE(Global, ccnxWireFormatMessage_FromControlPacketType) { PARCBuffer *buffer = parcBuffer_Allocate(10); CCNxWireFormatMessage *message = ccnxWireFormatMessage_FromControlPacketType(CCNxTlvDictionary_SchemaVersion_V1, buffer); assertTrue(ccnxTlvDictionary_IsControl((CCNxTlvDictionary *) message), "Wrong message type"); ccnxWireFormatMessage_Release(&message); parcBuffer_Release(&buffer); }