* PA-TNC message header
*/
chunk_t header;
+
+ /**
+ * Reference count
+ */
+ refcount_t ref;
};
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
return SUCCESS;
}
+METHOD(pa_tnc_attr_t, get_ref, pa_tnc_attr_t*,
+ private_ietf_attr_pa_tnc_error_t *this)
+{
+ ref_get(&this->ref);
+ return &this->public.pa_tnc_attribute;
+}
+
METHOD(pa_tnc_attr_t, destroy, void,
private_ietf_attr_pa_tnc_error_t *this)
{
- free(this->header.ptr);
- free(this);
+ if (ref_put(&this->ref))
+ {
+ free(this->header.ptr);
+ free(this);
+ }
}
METHOD(ietf_attr_pa_tnc_error_t, get_error_vendor_id, pen_t,
.set_noskip_flag = _set_noskip_flag,
.build = _build,
.process = _process,
+ .get_ref = _get_ref,
.destroy = _destroy,
},
.get_vendor_id = _get_error_vendor_id,
.error_vendor_id = vendor_id,
.error_code = error_code,
.header = chunk_clone(header),
+ .ref = 1,
);
return &this->public.pa_tnc_attribute;
.get_value = _get_value,
.build = _build,
.process = _process,
+ .get_ref = _get_ref,
.destroy = _destroy,
},
.get_vendor_id = _get_error_vendor_id,
.vendor_id = PEN_IETF,
.type = IETF_ATTR_PA_TNC_ERROR,
.value = chunk_clone(data),
+ .ref = 1,
);
return &this->public.pa_tnc_attribute;
* Command string
*/
char *command;
+
+ /**
+ * Reference count
+ */
+ refcount_t ref;
};
METHOD(pa_tnc_attr_t, get_vendor_id, pen_t,
return SUCCESS;
}
+METHOD(pa_tnc_attr_t, get_ref, pa_tnc_attr_t*,
+ private_ita_attr_command_t *this)
+{
+ ref_get(&this->ref);
+ return &this->public.pa_tnc_attribute;
+}
+
METHOD(pa_tnc_attr_t, destroy, void,
private_ita_attr_command_t *this)
{
- free(this->value.ptr);
- free(this->command);
- free(this);
+ if (ref_put(&this->ref))
+ {
+ free(this->value.ptr);
+ free(this->command);
+ free(this);
+ }
}
METHOD(ita_attr_command_t, get_command, char*,
.set_noskip_flag = _set_noskip_flag,
.build = _build,
.process = _process,
+ .get_ref = _get_ref,
.destroy = _destroy,
},
.get_command = _get_command,
.vendor_id = PEN_ITA,
.type = ITA_ATTR_COMMAND,
.command = strdup(command),
+ .ref = 1,
);
return &this->public.pa_tnc_attribute;
.get_value = _get_value,
.build = _build,
.process = _process,
+ .get_ref = _get_ref,
.destroy = _destroy,
},
.get_command = _get_command,
.vendor_id = PEN_ITA,
.type = ITA_ATTR_COMMAND,
.value = chunk_clone(data),
+ .ref = 1,
);
return &this->public.pa_tnc_attribute;
status_t (*process)(pa_tnc_attr_t *this);
/**
+ * Get a new reference to the PA-TNC attribute
+ *
+ * @return this, with an increased refcount
+ */
+ pa_tnc_attr_t* (*get_ref)(pa_tnc_attr_t *this);
+
+ /**
* Destroys a pa_tnc_attr_t object.
*/
void (*destroy)(pa_tnc_attr_t *this);