char * ccnxControlFacade_ToString(const CCNxTlvDictionary *contentDictionary) { char *string; char *jsonString = NULL; PARCJSON *json = ccnxControlFacade_GetJson(contentDictionary); if (json != NULL) { jsonString = parcJSON_ToString(json); } int failure = asprintf(&string, "CCNxControl { isCPI=%s, isNotification=%s, JSON=\"%s\"}", ccnxControlFacade_IsCPI(contentDictionary) ? "true" : "false", ccnxControlFacade_IsNotification(contentDictionary) ? "true" : "false", jsonString != NULL ? jsonString : "NULL"); if (jsonString) { parcMemory_Deallocate((void **) &jsonString); } assertTrue(failure > -1, "Error asprintf"); char *result = parcMemory_StringDuplicate(string, strlen(string)); free(string); return result; }
bool ccnxControl_IsACK(const CCNxControl *control) { if (cpi_GetMessageType(control) == CPI_ACK) { PARCJSON *json = ccnxControlFacade_GetJson(control); return cpiAcks_IsAck(json); } return false; }
/** * control message should be passed through */ LONGBOW_TEST_CASE(Dictionary, component_Codec_Tlv_Downcall_Read_Control) { TestData *data = longBowTestCase_GetClipBoardData(testCase); TransportMessage *tm = trafficTools_CreateTransportMessageWithDictionaryControl(data->mock->connection, CCNxTlvDictionary_SchemaVersion_V1); TransportMessage *test_tm = sendDown(data, tm); PARCJSON *json = ccnxControlFacade_GetJson(transportMessage_GetDictionary(test_tm)); assertNotNull(json, "Output of codec did not have a control message"); transportMessage_Destroy(&test_tm); }
PARCJSON * ccnxControl_GetJson(const CCNxControl *control) { return ccnxControlFacade_GetJson(control); }
uint64_t ccnxControl_GetAckOriginalSequenceNumber(const CCNxControl *control) { PARCJSON *json = ccnxControlFacade_GetJson(control); return cpiAcks_GetAckOriginalSequenceNumber(json); }