Lines Matching refs:attribute

16 #include "attribute.h"

195 IAM_STATIC ResultCode ParseAttributeSerializedMsgInner(Attribute *attribute, const Uint8Array msg,
215 ResultCode setAttrResult = SetAttributeUint8Array(attribute, type, readData);
222 IAM_STATIC ResultCode ParseAttributeSerializedMsg(Attribute *attribute, const Uint8Array msg)
227 ResultCode result = ParseAttributeSerializedMsgInner(attribute, msg, readBuffer);
265 AttributeImpl *attribute = Malloc(sizeof(AttributeImpl));
266 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, NULL);
267 (void)memset_s(attribute, sizeof(AttributeImpl), 0, sizeof(AttributeImpl));
269 return attribute;
276 Attribute *attribute = CreateEmptyAttribute();
277 if (attribute == NULL) {
282 ResultCode result = ParseAttributeSerializedMsg(attribute, msg);
285 FreeAttribute((Attribute **)&attribute);
289 return attribute;
298 const AttributeImpl *attribute = (const AttributeImpl *)attributePublic;
301 Uint8Array *array = attribute->values[i];
324 void FreeAttribute(Attribute **attribute)
326 IF_TRUE_LOGE_AND_RETURN(attribute == NULL);
327 IF_TRUE_LOGE_AND_RETURN(*attribute == NULL);
328 AttributeImpl *impl = (AttributeImpl *)*attribute;
333 IAM_FREE_AND_SET_NULL(*attribute);
336 ResultCode GetAttributeUint32(const Attribute *attribute, AttributeKey key, uint32_t *value)
338 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
343 ResultCode getAttrResult = GetAttributeUint8Array(attribute, key, &uint32Data);
351 ResultCode SetAttributeUint32(Attribute *attribute, AttributeKey key, const uint32_t value)
353 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
357 SetAttributeUint8Array(attribute, key, (Uint8Array) { (uint8_t *)&netOrderValue, sizeof(netOrderValue) });
363 ResultCode GetAttributeInt32(const Attribute *attribute, AttributeKey key, int32_t *retValue)
365 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
368 return GetAttributeUint32(attribute, key, (uint32_t *)retValue);
371 ResultCode SetAttributeInt32(Attribute *attribute, AttributeKey key, const int32_t value)
373 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
375 return SetAttributeUint32(attribute, key, (uint32_t)value);
378 ResultCode GetAttributeUint64(const Attribute *attribute, AttributeKey key, uint64_t *retValue)
380 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
385 ResultCode getAttrResult = GetAttributeUint8Array(attribute, key, &uint64Data);
393 ResultCode SetAttributeUint64(Attribute *attribute, AttributeKey key, const uint64_t value)
395 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
399 SetAttributeUint8Array(attribute, key, (Uint8Array){ (uint8_t *)&netOrderValue, sizeof(netOrderValue) });
411 const AttributeImpl *attribute = (const AttributeImpl *)attributePub;
417 if (attribute->values[attributeIndex] == NULL) {
422 if (attribute->values[attributeIndex]->data != NULL && attribute->values[attributeIndex]->len != 0) {
423 errno_t memcpyRet = memcpy_s(retData->data, retData->len, attribute->values[attributeIndex]->data,
424 attribute->values[attributeIndex]->len);
429 retData->len = attribute->values[attributeIndex]->len;
439 AttributeImpl *attribute = (AttributeImpl *)attributePub;
445 DestroyUint8Array(&attribute->values[attributeIndex]);
446 attribute->values[attributeIndex] = CreateUint8ArrayByData(data.data, data.len);
447 if (attribute->values[attributeIndex] == NULL) {
455 ResultCode GetAttributeUint64Array(const Attribute *attribute, AttributeKey key, Uint64Array *retData)
457 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
462 ResultCode getAttrResult = GetAttributeUint8Array(attribute, key, &uint64ArrayData);
474 ResultCode SetAttributeUint64Array(Attribute *attribute, AttributeKey key, const Uint64Array data)
476 IF_TRUE_LOGE_AND_RETURN_VAL(attribute == NULL, INVALID_PARAMETERS);
489 result = SetAttributeUint8Array(attribute, key,