PARCLog * parcLog_Create(const char *hostName, const char *applicationName, const char *processId, PARCLogReporter *reporter) { if (applicationName == NULL) { applicationName = _nilvalue; } if (hostName == NULL) { hostName = _nilvalue; } if (processId == NULL) { processId = _nilvalue; } PARCLog *result = parcObject_CreateInstance(PARCLog); if (result == NULL) { trapOutOfMemory("Creating an instance of PARCLog."); } result->hostName = parcMemory_StringDuplicate(hostName, strlen(hostName)); result->applicationName = parcMemory_StringDuplicate(applicationName, strlen(applicationName)); result->processId = parcMemory_StringDuplicate(processId, strlen(processId)); result->messageId = 0; result->level = PARCLogLevel_Off; result->reporter = parcLogReporter_Acquire(reporter); return result; }
static CCNxTlvDictionary * _ccnxInterestFacadeV1_Create(const CCNxName *name, // required const uint32_t lifetimeMilliseconds, // may use DefaultLimetimeMilliseconds const PARCBuffer *keyId, // may be NULL const PARCBuffer *contentObjectHash, // may be NULL const uint32_t hopLimit) // may be DefaultHopLimit { assertNotNull(name, "Parameter name must be non-null"); CCNxTlvDictionary *dictionary = ccnxCodecSchemaV1TlvDictionary_CreateInterest(); if (dictionary) { ccnxTlvDictionary_PutName(dictionary, CCNxCodecSchemaV1TlvDictionary_MessageFastArray_NAME, name); if (lifetimeMilliseconds != CCNxInterestDefault_LifetimeMilliseconds) { _ccnxInterestFacadeV1_SetLifetime(dictionary, lifetimeMilliseconds); } if (keyId) { _ccnxInterestFacadeV1_SetKeyIdRestriction(dictionary, keyId); } if (contentObjectHash) { _ccnxInterestFacadeV1_SetContentObjectHashRestriction(dictionary, contentObjectHash); } if (hopLimit != CCNxInterestDefault_HopLimit) { _ccnxInterestFacadeV1_SetHopLimit(dictionary, hopLimit); } } else { trapOutOfMemory("Could not allocate an Interest"); } return dictionary; }
PARCLogEntry * parcLogEntry_Create(PARCLogLevel level, const char *hostName, const char *applicationName, const char *processName, const uint64_t messageId, const struct timeval timeStamp, PARCBuffer *payload) { PARCLogEntry *result = parcObject_CreateInstance(PARCLogEntry); if (result == NULL) { trapOutOfMemory("Creating an instance of PARCLogEntry."); } result->version = _parcLog_Version; result->timeStamp = timeStamp; result->hostName = parcMemory_StringDuplicate(hostName, strlen(hostName)); result->applicationName = parcMemory_StringDuplicate(applicationName, strlen(applicationName)); result->processName = parcMemory_StringDuplicate(processName, strlen(processName)); result->messageId = messageId; result->level = level; result->payload = parcBuffer_Acquire(payload); return result; }