Add API to set/get a LinphoneContent data with a string type.

This commit is contained in:
Ghislain MARY 2014-11-24 11:06:33 +01:00
parent 3cb94ab1e5
commit 17c5372cd9
2 changed files with 25 additions and 1 deletions

View file

@ -115,6 +115,15 @@ void linphone_content_set_buffer(LinphoneContent *content, const void *buffer, s
((char *)content->lcp.data)[size] = '\0';
}
char * linphone_content_get_string_buffer(const LinphoneContent *content) {
return (char *)content->lcp.data;
}
void linphone_content_set_string_buffer(LinphoneContent *content, const char *buffer) {
content->lcp.size = strlen(buffer);
content->lcp.data = belle_sip_strdup(buffer);
}
size_t linphone_content_get_size(const LinphoneContent *content) {
return content->lcp.size;
}

View file

@ -155,10 +155,25 @@ LINPHONE_PUBLIC void * linphone_content_get_buffer(const LinphoneContent *conten
/**
* Set the content data buffer, usually a string.
* @param[in] content LinphoneContent object.
* @param[in] data The content data buffer.
* @param[in] buffer The content data buffer.
* @param[in] size The size of the content data buffer.
*/
LINPHONE_PUBLIC void linphone_content_set_buffer(LinphoneContent *content, const void *buffer, size_t size);
/**
* Get the string content data buffer.
* @param[in] content LinphoneContent object
* @return The string content data buffer.
*/
LINPHONE_PUBLIC char * linphone_content_get_string_buffer(const LinphoneContent *content);
/**
* Set the string content data buffer.
* @param[in] content LinphoneContent object.
* @param[in] buffer The string content data buffer.
*/
LINPHONE_PUBLIC void linphone_content_set_string_buffer(LinphoneContent *content, const char *buffer);
/**
* Get the content data buffer size, excluding null character despite null character is always set for convenience.
* @param[in] content LinphoneContent object.